/+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
#include <SDL2/SDL.h>
5
#include <stdbool.h>
6
7
#include "MousePointer.h"
8
9
typedef struct _GameButton GameButton;
10
11
typedef void (* BtnCallback)(GameButton * self, void * data);
12
13
struct _GameButton {
14
  SDL_Rect base; //this will behave like an SDL_Rect when cast to an SDL_Rect.
15
  bool fill;
16
  bool is_clicked;
17
  bool is_hover;
18
  bool is_stop_hover;
19
  SDL_Color colour;
20
  BtnCallback clicked;
21
  void * clicked_data;
22
  BtnCallback hover;
23
  void * hover_data;
24
  BtnCallback stop_hover;
25
  void * stop_hover_data;
26
};
27
28
GameButton * game_button_new (int x, int y, int h, int w);
29
30
bool game_button_check_clicked (GameButton * self, MousePointer * pointer);
31
32
bool game_button_check_hover (GameButton * self, MousePointer * pointer);
33
34
void game_button_set_callback (GameButton * self,
35
                               const char * name,
36
                               BtnCallback callback,
37
                               void * data);
38
39
void game_button_do_callback (GameButton * self,
40
                              const char * name);
41
42
void game_button_draw (GameButton * self, SDL_Renderer * renderer);
43
44
void game_button_set_fill (GameButton * self, bool fill);
45
46
void game_button_free (GameButton * self);
47
#endif
48