PageRenderTime 26ms CodeModel.GetById 18ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/src/MenuCharacter.h

http://github.com/clintbellanger/flare
C++ Header | 135 lines | 100 code | 16 blank | 19 comment | 0 complexity | cc634269bb5c275be0303d6c0bd601e4 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 MenuCharacter
 20 */
 21
 22#ifndef MENU_CHARACTER_H
 23#define MENU_CHARACTER_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 "StatBlock.h"
 31#include "WidgetTooltip.h"
 32#include "InputState.h"
 33#include "WidgetButton.h"
 34#include "SharedResources.h"
 35#include "WidgetLabel.h"
 36#include <string>
 37#include <sstream>
 38
 39const int CSTAT_NAME = 0;
 40const int CSTAT_LEVEL = 1;
 41const int CSTAT_PHYSICAL = 2;
 42const int CSTAT_HP = 3;
 43const int CSTAT_HPREGEN = 4;
 44const int CSTAT_MENTAL = 5;
 45const int CSTAT_MP = 6;
 46const int CSTAT_MPREGEN = 7;
 47const int CSTAT_OFFENSE = 8;
 48const int CSTAT_ACCURACYV1 = 9;
 49const int CSTAT_ACCURACYV5 = 10;
 50const int CSTAT_DEFENSE = 11;
 51const int CSTAT_AVOIDANCEV1 = 12;
 52const int CSTAT_AVOIDANCEV5 = 13;
 53const int CSTAT_DMGMAIN = 14;
 54const int CSTAT_DMGRANGED = 15;
 55const int CSTAT_CRIT = 16;
 56const int CSTAT_ABSORB = 17;
 57const int CSTAT_FIRERESIST = 18;
 58const int CSTAT_ICERESIST = 19;
 59const int CSTAT_COUNT = 20;
 60
 61const int CPROF_P2 = 0;
 62const int CPROF_P3 = 1;
 63const int CPROF_P4 = 2;
 64const int CPROF_P5 = 3;
 65const int CPROF_M2 = 4;
 66const int CPROF_M3 = 5;
 67const int CPROF_M4 = 6;
 68const int CPROF_M5 = 7;
 69const int CPROF_O2 = 8;
 70const int CPROF_O3 = 9;
 71const int CPROF_O4 = 10;
 72const int CPROF_O5 = 11;
 73const int CPROF_D2 = 12;
 74const int CPROF_D3 = 13;
 75const int CPROF_D4 = 14;
 76const int CPROF_D5 = 15;
 77const int CPROF_COUNT = 16;
 78
 79struct CharStat {
 80	WidgetLabel *label;
 81	WidgetLabel *value;
 82	SDL_Rect hover;
 83	TooltipData tip;
 84	
 85	void setHover(int x, int y, int w, int h) {
 86		hover.x=x;
 87		hover.y=y;
 88		hover.w=w;
 89		hover.h=h;
 90	}
 91};
 92
 93struct CharProf {
 94	SDL_Rect hover;
 95	TooltipData tip;
 96	
 97	void setHover(int x, int y, int w, int h) {
 98		hover.x=x;
 99		hover.y=y;
100		hover.w=w;
101		hover.h=h;
102	}
103};
104
105class MenuCharacter {
106private:
107	StatBlock *stats;
108
109	SDL_Surface *background;
110	SDL_Surface *proficiency;
111	SDL_Surface *upgrade;
112	WidgetButton *closeButton;	
113	WidgetLabel *labelCharacter;
114	CharStat cstat[CSTAT_COUNT];
115	CharProf cprof[CPROF_COUNT];
116
117	void displayProficiencies(int value, int y);
118	void loadGraphics();
119	int bonusColor(int stat);
120	
121public:
122	MenuCharacter(StatBlock *stats);
123	~MenuCharacter();
124	void logic();
125	void render();
126	void refreshStats();
127	TooltipData checkTooltip();
128	bool checkUpgrade();
129
130	bool visible;
131    bool newPowerNotification;
132
133};
134
135#endif