/src/MenuManager.h

http://github.com/clintbellanger/flare · C Header · 114 lines · 78 code · 17 blank · 19 comment · 0 complexity · ed6180dc34e3489f9ed4a099bd9bd4ac MD5 · raw file

  1. /*
  2. Copyright 2011 Clint Bellanger
  3. This file is part of FLARE.
  4. FLARE is free software: you can redistribute it and/or modify it under the terms
  5. of the GNU General Public License as published by the Free Software Foundation,
  6. either version 3 of the License, or (at your option) any later version.
  7. FLARE is distributed in the hope that it will be useful, but WITHOUT ANY
  8. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  9. PARTICULAR PURPOSE. See the GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License along with
  11. FLARE. If not, see http://www.gnu.org/licenses/
  12. */
  13. /**
  14. * class MenuManager
  15. */
  16. #ifndef MENU_MANAGER_H
  17. #define MENU_MANAGER_H
  18. #include <SDL.h>
  19. #include <SDL_image.h>
  20. #include <SDL_mixer.h>
  21. #include "Utils.h"
  22. #include "FontEngine.h"
  23. #include "InputState.h"
  24. #include "MenuInventory.h"
  25. #include "MenuPowers.h"
  26. #include "MenuCharacter.h"
  27. #include "MenuLog.h"
  28. #include "MenuHUDLog.h"
  29. #include "StatBlock.h"
  30. #include "MenuActionBar.h"
  31. #include "MenuHPMP.h"
  32. #include "WidgetTooltip.h"
  33. #include "ItemManager.h"
  34. #include "PowerManager.h"
  35. #include "MenuMiniMap.h"
  36. #include "MenuExperience.h"
  37. #include "MenuEnemy.h"
  38. #include "MenuVendor.h"
  39. #include "MenuTalker.h"
  40. #include "MenuExit.h"
  41. #include "CampaignManager.h"
  42. #include "SharedResources.h"
  43. const int DRAG_SRC_POWERS = 1;
  44. const int DRAG_SRC_INVENTORY = 2;
  45. const int DRAG_SRC_ACTIONBAR = 3;
  46. const int DRAG_SRC_VENDOR = 4;
  47. class MenuManager {
  48. private:
  49. SDL_Surface *icons;
  50. PowerManager *powers;
  51. StatBlock *stats;
  52. CampaignManager *camp;
  53. TooltipData tip_buf;
  54. bool key_lock;
  55. void loadSounds();
  56. void loadIcons();
  57. bool dragging;
  58. ItemStack drag_stack;
  59. int drag_power;
  60. int drag_src;
  61. bool done;
  62. public:
  63. MenuManager(PowerManager *powers, StatBlock *stats, CampaignManager *camp, ItemManager *items);
  64. ~MenuManager();
  65. void logic();
  66. void render();
  67. void renderIcon(int icon_id, int x, int y);
  68. void closeAll(bool play_sound);
  69. void closeLeft(bool play_sound);
  70. void closeRight(bool play_sound);
  71. ItemManager *items;
  72. MenuInventory *inv;
  73. MenuPowers *pow;
  74. MenuCharacter *chr;
  75. MenuLog *log;
  76. MenuHUDLog *hudlog;
  77. MenuActionBar *act;
  78. MenuHPMP *hpmp;
  79. WidgetTooltip *tip;
  80. MenuMiniMap *mini;
  81. MenuExperience *xp;
  82. MenuEnemy *enemy;
  83. MenuVendor *vendor;
  84. MenuTalker *talker;
  85. MenuExit *exit;
  86. bool pause;
  87. bool menus_open;
  88. ItemStack drop_stack;
  89. Mix_Chunk *sfx_open;
  90. Mix_Chunk *sfx_close;
  91. bool requestingExit() { return done; }
  92. };
  93. #endif