/+junk/c_sdl_joypad

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/c_sdl_joypad
1 by Gustav Hartvigsson
Initial code.
1
#ifndef __H_GAME_BUTTON__
2
#define __H_GAME_BUTTON__
3
4
/**
7 by Gustav Hartvigsson
* Added licensing information to the files.
5
 * This file, as the rest of the project is under MIT license.
6
 * see http://opensource.org/licenses/MIT
7
 *
8
 * Author Gustav Hartvigsson <gustav.hartvigsson _at_ gmail.com> 2014
8 by Gustav Hartvigsson
* added and changed little in the files Lincening information.
9
 */
7 by Gustav Hartvigsson
* Added licensing information to the files.
10
11
#include <SDL2/SDL.h>
1 by Gustav Hartvigsson
Initial code.
12
#include <stdbool.h>
13
14
#include "MousePointer.h"
15
16
typedef struct GameButton {
12 by Gustav Hartvigsson
* reorganising code to be remove extra typedefs.
17
  SDL_Rect base; //this will behave like an SDL_Rect when cast to an SDL_Rect.
1 by Gustav Hartvigsson
Initial code.
18
  bool fill;
19
  bool is_clicked;
20
  bool is_hover;
21
  bool is_stop_hover;
22
  
7 by Gustav Hartvigsson
* Added licensing information to the files.
23
  SDL_Color colour;
1 by Gustav Hartvigsson
Initial code.
24
  
7 by Gustav Hartvigsson
* Added licensing information to the files.
25
  BtnCallback clicked;
1 by Gustav Hartvigsson
Initial code.
26
  void * clicked_data;
27
  
7 by Gustav Hartvigsson
* Added licensing information to the files.
28
  BtnCallback hover;
1 by Gustav Hartvigsson
Initial code.
29
  void * hover_data;
30
  
7 by Gustav Hartvigsson
* Added licensing information to the files.
31
  BtnCallback stop_hover;
1 by Gustav Hartvigsson
Initial code.
32
  void * stop_hover_data;
33
} GameButtan;
12 by Gustav Hartvigsson
* reorganising code to be remove extra typedefs.
34
35
typedef void (* BtnCallback)(GameButton * self, void * data);
36
1 by Gustav Hartvigsson
Initial code.
37
GameButton * game_button_new (int x, int y, int h, int w);
38
39
bool game_button_check_clicked (GameButton * self, MousePointer * pointer);
40
41
bool game_button_check_hover (GameButton * self, MousePointer * pointer);
42
43
void game_button_set_callback (GameButton * self,
44
                               const char * name,
45
                               BtnCallback callback,
46
                               void * data);
47
48
void game_button_do_callback (GameButton * self,
49
                              const char * name);
50
51
void game_button_draw (GameButton * self, SDL_Renderer * renderer);
52
53
void game_button_set_fill (GameButton * self, bool fill);
54
55
void game_button_free (GameButton * self);
56
#endif
57