/+junk/c_sdl_joypad_ducktape

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