Class BasicMenuItem



  • public class BasicMenuItem
    extends java.lang.Object
    A menu item is an object wich can be placed on a menu.
    • Constructor Summary

      Constructors 
      Constructor Description
      BasicMenuItem​(int index, java.lang.String label)
      Create a new menu Item which does something specific like exiting or showing the option screen.
      BasicMenuItem​(int index, java.lang.String label, java.lang.Class<? extends Controller> gameController, java.lang.Class<? extends GameView> gameView)
      Create a new menu Item which can launch a game.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void action​()  
      java.lang.Class<? extends Controller> getGameController​()  
      java.lang.Class<? extends GameView> getGameView​()  
      static int getHighlight​()  
      boolean isClicked​()
      Check if the mouse clicked the menuItem.
      void render​(com.badlogic.gdx.graphics.g2d.BitmapFont font, com.badlogic.gdx.graphics.g2d.SpriteBatch batch, com.badlogic.gdx.graphics.glutils.ShapeRenderer sr)
      Renders the menu item.
      static void setHighlight​(int highlight)  
      static void setSound​(com.badlogic.gdx.audio.Sound sound)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BasicMenuItem

        public BasicMenuItem​(int index,
                             java.lang.String label,
                             java.lang.Class<? extends Controller> gameController,
                             java.lang.Class<? extends GameView> gameView)
        Create a new menu Item which can launch a game.
        Parameters:
        index - the index of the button
        label - the string displayed by the button. If "exit" or "options" they change their behaviour.
        gameController - Your game controller class for this menu item
        gameView - Your game view class for this menu item
      • BasicMenuItem

        public BasicMenuItem​(int index,
                             java.lang.String label)
        Create a new menu Item which does something specific like exiting or showing the option screen.
        Parameters:
        index - the index of the button
        label - the string displayed by the button. If "exit" or "options" they cahnge they behaviour.
    • Method Detail

      • render

        public void render​(com.badlogic.gdx.graphics.g2d.BitmapFont font,
                           com.badlogic.gdx.graphics.g2d.SpriteBatch batch,
                           com.badlogic.gdx.graphics.glutils.ShapeRenderer sr)
        Renders the menu item.
        Parameters:
        font -
        batch -
        sr -
      • isClicked

        public boolean isClicked​()
        Check if the mouse clicked the menuItem.
        Returns:
      • getGameController

        public java.lang.Class<? extends Controller> getGameController​()
        Returns:
      • getGameView

        public java.lang.Class<? extends GameView> getGameView​()
        Returns:
      • action

        public void action​()
      • setSound

        public static void setSound​(com.badlogic.gdx.audio.Sound sound)
        Parameters:
        sound -
      • getHighlight

        public static int getHighlight​()
        Returns:
      • setHighlight

        public static void setHighlight​(int highlight)
        Parameters:
        highlight -