bzr branch
http://gegoxaren.bato24.eu/bzr/%2Bjunk/c_sdl_joypad_ducktape
21
by Gustav Hatvigsson
* added Modeline to (almost) all files. |
1 |
/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil
|
2 |
* vi: set shiftwidth=2 tabstop=2 expandtab:
|
|
3 |
* :indentSize=2:tabSize=2:noTabs=true:
|
|
4 |
*/
|
|
5 |
||
1
by Gustav Hartvigsson
Initial code. |
6 |
#ifndef __H_GAME__
|
7 |
#define __H_GAME__
|
|
8 |
||
32
by Gustav Hartvigsson
* Removed code that is not needed |
9 |
|
10 |
#include "defs.h" |
|
1
by Gustav Hartvigsson
Initial code. |
11 |
#include <SDL2/SDL.h> |
12 |
#include <stdbool.h> |
|
13 |
||
32
by Gustav Hartvigsson
* Removed code that is not needed |
14 |
BEGIN_DECLS
|
15 |
||
1
by Gustav Hartvigsson
Initial code. |
16 |
#include "MousePointer.h" |
17 |
#include "GameButton.h" |
|
7
by Gustav Hartvigsson
* Added licensing information to the files. |
18 |
//#include "JSParser.h"
|
19 |
#include "game_utils.h" |
|
20 |
||
17
by Gustav Hartvigsson
* fixed a few Doxygen problems. |
21 |
/*
|
7
by Gustav Hartvigsson
* Added licensing information to the files. |
22 |
* This file, as the rest of the project is under MIT license.
|
23 |
* see http://opensource.org/licenses/MIT
|
|
24 |
*
|
|
8
by Gustav Hartvigsson
* added and changed little in the files Lincening information. |
25 |
* Author Gustav Hartvigsson <gustav.hartvigsson _at_ gmail.com> 2014
|
7
by Gustav Hartvigsson
* Added licensing information to the files. |
26 |
*/
|
27 |
||
32
by Gustav Hartvigsson
* Removed code that is not needed |
28 |
#define J_SCALE_FACTOR 5000 //TODO: change the movement to time-based |
29 |
||
30 |
/** @file
|
|
31 |
* A Game represents the game itself. This is going to be re-implementation in
|
|
32 |
* the future.
|
|
33 |
*/
|
|
34 |
||
35 |
/**
|
|
36 |
* Quits the program in an unsafe way.
|
|
37 |
*/
|
|
1
by Gustav Hartvigsson
Initial code. |
38 |
void quit (int rc); |
39 |
||
12
by Gustav Hartvigsson
* reorganising code to be remove extra typedefs. |
40 |
typedef struct Game { |
1
by Gustav Hartvigsson
Initial code. |
41 |
SDL_Event event; |
42 |
SDL_Point mouse_delta; |
|
43 |
bool mouse_pressed; |
|
25
by Gustav Hartvigsson
* Switched variable names to something more consistant |
44 |
bool bg_color_toggle; |
1
by Gustav Hartvigsson
Initial code. |
45 |
int done; |
25
by Gustav Hartvigsson
* Switched variable names to something more consistant |
46 |
SDL_Color background_color; |
1
by Gustav Hartvigsson
Initial code. |
47 |
SDL_Window * window; |
48 |
SDL_Renderer * renderer; |
|
49 |
SDL_GameController * game_controller; |
|
50 |
MousePointer * mouse; |
|
51 |
GameButton * button; |
|
12
by Gustav Hartvigsson
* reorganising code to be remove extra typedefs. |
52 |
} Game; |
1
by Gustav Hartvigsson
Initial code. |
53 |
|
32
by Gustav Hartvigsson
* Removed code that is not needed |
54 |
/**
|
55 |
* Creates a new Game.
|
|
56 |
*/
|
|
1
by Gustav Hartvigsson
Initial code. |
57 |
Game * game_new (); |
32
by Gustav Hartvigsson
* Removed code that is not needed |
58 |
|
59 |
/**
|
|
60 |
* The function that possesses the events of the game.
|
|
61 |
* Should generally not be called from outside the Game.
|
|
62 |
*/
|
|
1
by Gustav Hartvigsson
Initial code. |
63 |
void game_process_events (Game * self); |
32
by Gustav Hartvigsson
* Removed code that is not needed |
64 |
|
65 |
/**
|
|
66 |
* The function that has to be run for the game to run. executes the main loop
|
|
67 |
* of the game.
|
|
68 |
*/
|
|
1
by Gustav Hartvigsson
Initial code. |
69 |
void game_main_loop (Game * self); |
32
by Gustav Hartvigsson
* Removed code that is not needed |
70 |
/**
|
71 |
* Frees the Game and the resources associated with it.
|
|
72 |
*/
|
|
1
by Gustav Hartvigsson
Initial code. |
73 |
void game_free (Game * self); |
32
by Gustav Hartvigsson
* Removed code that is not needed |
74 |
|
75 |
/**
|
|
76 |
* a function that internally is called to draw all the objects on the screen.
|
|
77 |
*/
|
|
1
by Gustav Hartvigsson
Initial code. |
78 |
void game_draw (Game * self); |
79 |
||
32
by Gustav Hartvigsson
* Removed code that is not needed |
80 |
END_DECLS
|
81 |
||
1
by Gustav Hartvigsson
Initial code. |
82 |
#endif
|