/+junk/c_sdl_joypad

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/c_sdl_joypad

« back to all changes in this revision

Viewing changes to Game.h

  • Committer: Gustav Hartvigsson
  • Date: 2013-09-27 18:52:09 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130927185209-x6tnykj2lfj0qxwt
Initial code.
This is just an experiment on different techniques that can be used.
It is pseudo object orientated. And has a few util functions to make life
easier.

All code is provided as is. Copy, Learn, Refactor, Have Fun!

TODO: make the MousePointer use an image and add an object drawing lists.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __H_GAME__
 
2
#define __H_GAME__
 
3
 
 
4
#include <SDL2/SDL.h>
 
5
#include <stdbool.h>
 
6
 
 
7
#include "MousePointer.h"
 
8
#include "GameButton.h"
 
9
 
 
10
 
 
11
#define J_SCALE_FACTOR 5000
 
12
 
 
13
 
 
14
 
 
15
void quit (int rc);
 
16
 
 
17
typedef struct _Game Game;
 
18
 
 
19
struct _Game {
 
20
  SDL_Event event;
 
21
  SDL_Point mouse_delta;
 
22
  bool mouse_pressed;
 
23
  bool bg_colour_toggle;
 
24
  int done;
 
25
  SDL_Color background_colour;
 
26
  SDL_Window * window;
 
27
  SDL_Renderer * renderer;
 
28
  SDL_GameController * game_controller;
 
29
  MousePointer * mouse;
 
30
  GameButton * button;
 
31
};
 
32
 
 
33
Game * game_new ();
 
34
void game_process_events (Game * self);
 
35
void game_main_loop (Game * self);
 
36
void game_free (Game * self);
 
37
void game_draw (Game * self);
 
38
 
 
39
#endif