Advertisement
Charybdizs

Menu Pseudocode

Mar 12th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. public class StartMenu : Menu
  2. {
  3.  
  4. List of Buttons
  5.  
  6. Button StartButton = new Button(top center, 2 x 4, texture)
  7. Button OptionsButton = new Button(middle center, 2 x 4, texture)
  8. Button ExitButton = new Button(bottom center, 2 x 4, texture)
  9.  
  10. Update()
  11. {
  12.  
  13. foreach(Button in the list of buttons)
  14. {
  15.  
  16. Button.CheckifHighlighted()
  17. Button.CheckifSelected()
  18.  
  19. if(Button.Selected == true)
  20. {
  21.  
  22. switch(Button.Name)
  23.  
  24. case StartButton
  25. gamestate = loadlevel
  26. break;
  27.  
  28. case OptionsButton
  29. add options menu to top of list of menus
  30. break;
  31.  
  32. case ExitButton
  33. exit game
  34. break;
  35.  
  36. }
  37.  
  38. }
  39.  
  40. }
  41.  
  42. Draw()
  43. {
  44.  
  45. foreach(Button in the list of buttons)
  46. {
  47.  
  48. Button.DrawGraphics()
  49.  
  50. }
  51.  
  52. }
  53.  
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement