private void createMenuChildScene() {
    submenuChildScene = new MenuScene(camera);
    submenuChildScene.setPosition(WIDTH, HEIGHT);

    final IMenuItem optionsMenuItem =
        new ScaleMenuItemDecorator(
            new SpriteMenuItem(MENU_OPTIONS, resourcesManager.submenu_item1_region, vbom), 1.2f, 1);
    // final IMenuItem quitMenuItem = new ScaleMenuItemDecorator(new
    // SpriteMenuItem(MENU_QUIT,resourcesManager.quit_region,vbom),1.2f,1);

    submenuChildScene.addMenuItem(optionsMenuItem);

    submenuChildScene.buildAnimations(); // must setposition after it unless it has no effect
    submenuChildScene.setBackgroundEnabled(false);

    //		playMenuItem.setPosition(playMenuItem.getX()-20, playMenuItem.getY() - 150);
    //		optionsMenuItem.setPosition(optionsMenuItem.getX()-20, optionsMenuItem.getY() - 110);

    optionsMenuItem.setPosition(
        (WIDTH / 2 - optionsMenuItem.getWidth() / 2) - 50,
        (HEIGHT / 2 - optionsMenuItem.getHeight() / 2) - 50);

    submenuChildScene.setOnMenuItemClickListener(this);

    setChildScene(submenuChildScene);
  }
Пример #2
0
 protected float getFromY(final MenuScene pMenuScene, final IMenuItem pMenuItem, final float pY) {
   switch (this.mDirection) {
     case DOWN_LEFT:
     case DOWN:
     case DOWN_RIGHT:
       return pMenuScene.getHeight() + (pMenuItem.getHeight() * 0.5f);
     case LEFT:
     case RIGHT:
       return pY;
     case UP_LEFT:
     case UP:
     case UP_RIGHT:
       return -(pMenuItem.getHeight() * 0.5f);
     default:
       throw new IllegalArgumentException();
   }
 }