예제 #1
0
  @Override
  public void render(MVP mvp) {
    final float contentSize = 0.9f;

    SimpleTexturedShader shader = injector.getInstance(SimpleTexturedShader.class);
    shader.activate();

    // Draw the background texture
    shader.setMVPMatrix(mvp.collapse());
    shader.setTexture(backgroundTexture);
    shader.draw();

    // If the click action has an icon
    if (action.hasIconTexture()) {
      drawIcon(mvp, shader);
    }

    drawActionName(mvp, contentSize);

    // If the action cannot be performed
    if (!action.isExecutable()) {
      // Draw the unavailable overlay
      shader.setMVPMatrix(mvp.collapse());
      shader.setTexture(unselectableTexture);
      shader.draw();
    }
  }
예제 #2
0
  public boolean handleClick() {
    if (action.isExecutable()) {
      action.execute();

      return true;
    } else {
      return false;
    }
  }