/+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 GameButton;
17
//typedef struct _GameButtonClass GameButtonClass; //TODO
7 by Gustav Hartvigsson
* Added licensing information to the files.
18
1 by Gustav Hartvigsson
Initial code.
19
typedef void (* BtnCallback)(GameButton * self, void * data);
20
21
struct _GameButton {
22
  SDL_Rect base; //this will behave like an SDL_Rect when cast to an SDL_Rect.
23
  bool fill;
24
  bool is_clicked;
25
  bool is_hover;
26
  bool is_stop_hover;
27
  
7 by Gustav Hartvigsson
* Added licensing information to the files.
28
  SDL_Color colour;
1 by Gustav Hartvigsson
Initial code.
29
  
7 by Gustav Hartvigsson
* Added licensing information to the files.
30
  BtnCallback clicked;
1 by Gustav Hartvigsson
Initial code.
31
  void * clicked_data;
32
  
7 by Gustav Hartvigsson
* Added licensing information to the files.
33
  BtnCallback hover;
1 by Gustav Hartvigsson
Initial code.
34
  void * hover_data;
35
  
7 by Gustav Hartvigsson
* Added licensing information to the files.
36
  BtnCallback stop_hover;
1 by Gustav Hartvigsson
Initial code.
37
  void * stop_hover_data;
38
};
39
40
GameButton * game_button_new (int x, int y, int h, int w);
41
42
bool game_button_check_clicked (GameButton * self, MousePointer * pointer);
43
44
bool game_button_check_hover (GameButton * self, MousePointer * pointer);
45
46
void game_button_set_callback (GameButton * self,
47
                               const char * name,
48
                               BtnCallback callback,
49
                               void * data);
50
51
void game_button_do_callback (GameButton * self,
52
                              const char * name);
53
54
void game_button_draw (GameButton * self, SDL_Renderer * renderer);
55
56
void game_button_set_fill (GameButton * self, bool fill);
57
58
void game_button_free (GameButton * self);
59
#endif
60