1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#ifndef __H_GAME__
#define __H_GAME__
#include <SDL2/SDL.h>
#include <stdbool.h>
#include "MousePointer.h"
#include "GameButton.h"
//#include "JSParser.h"
#include "game_utils.h"
/**
* This file, as the rest of the project is under MIT license.
* see http://opensource.org/licenses/MIT
*
* Author Gustav Hartvigsson <gustav.hartvigsson _at_ gmail.com> 2013
*/
#define J_SCALE_FACTOR 5000 //TODO: change tho momement to time-based
void quit (int rc);
typedef struct _Game Game;
struct _Game {
SDL_Event event;
SDL_Point mouse_delta;
bool mouse_pressed;
bool bg_colour_toggle;
int done;
SDL_Color background_colour;
SDL_Window * window;
SDL_Renderer * renderer;
SDL_GameController * game_controller;
MousePointer * mouse;
GameButton * button;
};
Game * game_new ();
void game_process_events (Game * self);
void game_main_loop (Game * self);
void game_free (Game * self);
void game_draw (Game * self);
#endif
|