예제 #1
0
  @Override
  public void onModeCreate(GL10 gl, int displayWidth, int displayHeight) {
    super.onModeCreate(gl, displayWidth, displayHeight);

    final int paddingX = (int) context.getResources().getDimension(R.dimen.buttonPaddingX);
    final int paddingY = (int) context.getResources().getDimension(R.dimen.buttonPaddingY);

    final int levelNameWidth = displayWidth * 2 / 3;
    final int levelNameHeight = 64;
    final int levelNameX = (displayWidth - levelNameWidth) / 2;
    final int levelNameY = displayHeight - paddingY;

    final int startButtonWidth = 210;
    final int startButtonHeight = 64;
    final int startButtonX = (displayWidth - startButtonWidth - paddingX);
    final int startButtonY = paddingY + startButtonHeight;

    String name = "Unknown";
    if (level != null && level.getName() != null) name = level.getName();

    levelName =
        new UIElementText(
            gameResources,
            context,
            gl,
            -1,
            name,
            levelNameX,
            levelNameY,
            levelNameWidth,
            levelNameHeight,
            BUTTON_TEXT_SIZE);
    importButton =
        new UIElementText(
            gameResources,
            context,
            gl,
            IMPORT_BUTTON,
            "Import Level",
            startButtonX,
            startButtonY,
            startButtonWidth,
            startButtonHeight,
            BUTTON_TEXT_SIZE);

    uiElements.add(levelName);
    uiElements.add(importButton);
  }
예제 #2
0
  @Override
  public void onModeCreate(GL10 gl, int displayWidth, int displayHeight) {
    super.onModeCreate(gl, displayWidth, displayHeight);

    createButtons(gl, displayWidth, displayHeight);
  }