50 lines
853 B
C++
50 lines
853 B
C++
/* 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"
|
|
#include "graph.h"
|
|
|
|
class GameCore : public MainEvent
|
|
{
|
|
public:
|
|
GameCore();
|
|
int execute();
|
|
|
|
protected:
|
|
// event handlers
|
|
void on_exit();
|
|
void on_lbutton_down(int x, int y);
|
|
|
|
private:
|
|
bool init();
|
|
|
|
void iterate(); // updates the game state
|
|
void render();
|
|
void cleanup();
|
|
|
|
bool is_running;
|
|
|
|
SDL_Surface* display;
|
|
|
|
// textures to draw
|
|
SDL_Surface* background;
|
|
SDL_Surface* node;
|
|
|
|
// data
|
|
Graph graph;
|
|
|
|
// constants
|
|
static int NODE_SIZE;
|
|
};
|
|
|
|
#endif
|