MainMenu.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package pathgame.gameplay.menu;
  2. import me.hammerle.snuviengine.api.Engine;
  3. /**
  4. * A container for holding all options of the MainMenu
  5. *
  6. * @author julia
  7. */
  8. public class MainMenu extends BaseMenu
  9. {
  10. private final MenuButton[] options;
  11. /**
  12. * Contructor generating and initializing the MainMenu
  13. *
  14. * @param id the id of the MainMenu
  15. * @param optionsId the id to the OptionMenu
  16. * @param characterId the id to the CharacterMenu
  17. */
  18. public MainMenu(int id, int optionsId, int characterId)
  19. {
  20. super(id);
  21. options = new MenuButton[]
  22. {
  23. new MenuButton("Start", (gamestate) ->
  24. {
  25. setReturnId(characterId);
  26. }),
  27. new MenuButton("Options", (gamestate) ->
  28. {
  29. setReturnId(optionsId);
  30. }),
  31. new MenuButton("Exit", (gamestate) ->
  32. {
  33. Engine.stop();
  34. })
  35. };
  36. }
  37. /**
  38. * Returns the options of the MainMenu
  39. *
  40. * @return the options of the MainMenu
  41. */
  42. @Override
  43. public MenuButton[] getOptions()
  44. {
  45. return options;
  46. }
  47. }