@Override
  public void draw(SpriteBatch batch, float parentAlpha) {
    Drawable background;
    if (list != null && list.getParent() != null && style.backgroundOpen != null)
      background = style.backgroundOpen;
    else if (clickListener.isOver() && style.backgroundOver != null)
      background = style.backgroundOver;
    else background = style.background;
    final BitmapFont font = style.font;
    final Color fontColor = style.fontColor;

    Color color = getColor();
    float x = getX();
    float y = getY();
    float width = getWidth();
    float height = getHeight();

    batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
    background.draw(batch, x, y, width, height);
    if (items.length > 0) {
      float availableWidth = width - background.getLeftWidth() - background.getRightWidth();
      int numGlyphs =
          font.computeVisibleGlyphs(
              items[selectedIndex], 0, items[selectedIndex].length(), availableWidth);
      bounds.set(font.getBounds(items[selectedIndex]));
      height -= background.getBottomHeight() + background.getTopHeight();
      float textY = (int) (height / 2 + background.getBottomHeight() + bounds.height / 2);
      font.setColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a * parentAlpha);
      font.draw(
          batch, items[selectedIndex], x + background.getLeftWidth(), y + textY, 0, numGlyphs);
    }

    // calculate screen coords where list should be displayed
    getStage().toScreenCoordinates(screenCoords.set(x, y), batch.getTransformMatrix());
  }
		@Override
		public void clicked(InputEvent event, float x, float y) {
			super.clicked(event, x, y);
			try {
				game.showSimulationModeScreen(gameController);
			} catch (IllegalBoardException e) {
				Dialog dialog = new NotificationDialog(
						_("invalid_board_dialog"));
				dialog.show(stage);
			}
		}
 @Override
 public void clicked(InputEvent event, float x, float y) {
   super.clicked(event, x, y);
   Overlap2DFacade facade = Overlap2DFacade.getInstance();
   ResolutionEntryVO resolutionEntryVO = new ResolutionEntryVO();
   resolutionEntryVO.name = nameVisTextField.getText();
   resolutionEntryVO.width = Integer.parseInt(widthVisTextField.getText());
   resolutionEntryVO.height = Integer.parseInt(heightVisTextField.getText());
   resolutionEntryVO.base = buttonGroup.getCheckedIndex();
   facade.sendNotification(CREATE_BTN_CLICKED, resolutionEntryVO);
 }
Beispiel #4
0
 public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
   if (selectionStart == cursor) hasSelection = false;
   super.touchUp(event, x, y, pointer, button);
 }
Beispiel #5
0
 public void touchDragged(InputEvent event, float x, float y, int pointer) {
   super.touchDragged(event, x, y, pointer);
   setCursorPosition(x, y);
 }
Beispiel #6
0
 @Override
 public void clicked(InputEvent event, float x, float y) {
   super.clicked(event, x, y);
   $soundClick();
 }