mode.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /** A mode is a specific mode in which the game can be.
  2. * for example, menu mode, play mode, main screen, edit mode, etc.
  3. * In every mode, inputs and drawing may work in a different way.
  4. */
  5. #ifndef MODE_H
  6. #define MODE_H
  7. #include "eruta.h"
  8. /** Planned modes. */
  9. enum ErutaModes_ {
  10. ERUTA_MODE_INTRO = 1,
  11. ERUTA_MODE_MAINMENU = 2,
  12. ERUTA_MODE_EXPLORE = 3,
  13. ERUTA_MODE_BATTLE = 4,
  14. ERUTA_MODE_DIALOG = 5,
  15. ERUTA_MODE_MENU = 6,
  16. ERUTA_MODE_LOAD = 7,
  17. ERUTA_MODE_SAVE = 8,
  18. ERUTA_MODE_NEW = 9,
  19. ERUTA_MODE_TEST = 10,
  20. ERUTA_MODE_MAX = 16,
  21. };
  22. /**
  23. * A Mode is a mode of the program in which the display and controls may
  24. * be different. Examples of this may be a menu mode, play mode,
  25. * edit mode, intro mode, etc.
  26. *
  27. */
  28. struct Mode_;
  29. typedef struct Mode_ Mode;
  30. /**
  31. * ModeActs contains the actions , that is the function poMode *ers of a mode.
  32. * These consist of start, enter, leave, done, event and paMode *
  33. */
  34. struct ModeActs_;
  35. typedef struct ModeActs_ ModeActs;
  36. typedef Mode * (ModeActEvent)(Mode * self, ALLEGRO_EVENT * event);
  37. typedef Mode * (ModeActPaint)(Mode * self, ALLEGRO_DISPLAY * display);
  38. typedef Mode * (ModeActMove)(Mode * self, Mode * other);
  39. typedef Mode * (ModeActSelf)(Mode * self);
  40. struct ModeActs_ {
  41. ModeActSelf * start;
  42. ModeActMove * enter;
  43. ModeActMove * leave;
  44. ModeActPaint * paint;
  45. ModeActEvent * event;
  46. ModeActSelf * stop;
  47. };
  48. #include "state.h"
  49. #include "react.h"
  50. Mode * mode_start (Mode * self );
  51. Mode * mode_enter (Mode * self , Mode * other );
  52. Mode * mode_leave (Mode * self , Mode * other );
  53. Mode * mode_stop (Mode * self );
  54. Mode * mode_paint (Mode * self , ALLEGRO_DISPLAY * display );
  55. Mode * mode_event (Mode * self , ALLEGRO_EVENT * event );
  56. Mode * mode_init (Mode * self , State * state , ModeActs * acts , int id );
  57. Mode * elsemode_start (Mode * self );
  58. Mode * elsemode_enter (Mode * self , Mode * other );
  59. Mode * elsemode_leave (Mode * self , Mode * other );
  60. Mode * elsemode_stop (Mode * self );
  61. Mode * elsemode_paint (Mode * self , ALLEGRO_DISPLAY * display );
  62. Mode * elsemode_event (Mode * self , ALLEGRO_EVENT * event );
  63. extern ModeActs elsemode_acts_;
  64. ModeActs * elsemode_getacts(void);
  65. React * mode_react (Mode * self );
  66. #endif