2011-06-22 20:12:22 +00:00
|
|
|
/* This is the heart of the application.
|
|
|
|
This contains the basic game looping code, sets up event handlers, etc.
|
|
|
|
|
|
|
|
All the hard work will eventually get farmed out to other objects, for now,
|
|
|
|
we're doing almost everything in here.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _GAME_CORE_H_
|
|
|
|
#define _GAME_CORE_H_
|
|
|
|
|
|
|
|
#include <SDL/SDL.h>
|
|
|
|
#include "mainevent.h"
|
2011-06-23 21:28:49 +00:00
|
|
|
#include "gamedata.h"
|
2011-06-23 19:10:40 +00:00
|
|
|
|
2011-06-22 20:12:22 +00:00
|
|
|
class GameCore : public MainEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GameCore();
|
|
|
|
int execute();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// event handlers
|
|
|
|
void on_exit();
|
2011-06-22 21:57:44 +00:00
|
|
|
void on_lbutton_down(int x, int y);
|
2011-06-23 19:10:40 +00:00
|
|
|
void on_rbutton_down(int mX, int mY);
|
2011-06-22 20:12:22 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool init();
|
|
|
|
|
|
|
|
void iterate(); // updates the game state
|
|
|
|
void render();
|
|
|
|
void cleanup();
|
|
|
|
|
|
|
|
bool is_running;
|
|
|
|
|
|
|
|
SDL_Surface* display;
|
2011-06-22 20:43:23 +00:00
|
|
|
|
|
|
|
// textures to draw
|
|
|
|
SDL_Surface* background;
|
2011-06-22 21:57:44 +00:00
|
|
|
|
|
|
|
// data
|
2011-06-23 21:28:49 +00:00
|
|
|
GameData data;
|
2011-06-23 02:32:33 +00:00
|
|
|
|
2011-06-23 16:36:40 +00:00
|
|
|
static int NODE_RADIUS;
|
|
|
|
static int MAX_MOVE_DISTANCE;
|
2011-06-22 20:12:22 +00:00
|
|
|
};
|
|
|
|
|
2011-06-23 19:10:40 +00:00
|
|
|
|
2011-06-22 20:12:22 +00:00
|
|
|
#endif
|