PageRenderTime 22ms CodeModel.GetById 11ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

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