treewars/game.h

65 lines
1.2 KiB
C
Raw Normal View History

/* This is the heart of the application - the main game state where we are
actually playing.
This contains the basic game logic.
*/
#ifndef _GAME_H_
#define _GAME_H_
#include "gamedata.h"
#include "gamestate.h"
#include "menubutton.h"
#include <stack>
#include <SDL_ttf.h>
using std::stack;
class Game : public GameState
{
public:
Game(stack<GameState*>* state_stack, SDL_Surface* display);
~Game();
bool init();
protected:
void render();
void iterate() {}
// event handlers
void on_lbutton_down(int x, int y);
void on_rbutton_down(int mX, int mY);
2011-06-24 13:48:59 +00:00
void on_key_down(SDLKey sym, SDLMod mod, Uint16 unicode);
void on_mouse_move(int mX, int mY, int relX, int relY, bool left,
bool right, bool middle);
2011-06-24 13:48:59 +00:00
private:
void draw_stats(Vertex* v);
void draw_button(MenuButton* button);
// data
GameData data;
// the x,y position of the mouse cursor
int cursor_x;
int cursor_y;
// surfaces containing textures to draw
SDL_Surface* background;
TTF_Font* font;
// menu buttons
MenuButton move_button;
MenuButton build_button;
MenuButton attack_button;
static int NODE_RADIUS;
#ifdef DEBUG
void print_debug_info();
#endif
};
#endif