/+junk/c_sdl_joypad_ducktape

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

« back to all changes in this revision

Viewing changes to GameButton.h

  • Committer: Gustav Hartvigsson
  • Date: 2013-09-29 21:11:58 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130929211158-9z71h0uymetjelsz
fixed the callback stuff..

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#ifndef __H_GAME_BUTTON__
3
3
#define __H_GAME_BUTTON__
4
4
 
5
 
/**
6
 
 * This file, as the rest of the project is under MIT license.
7
 
 * see http://opensource.org/licenses/MIT
8
 
 *
9
 
 * Author Gustav Hartvigsson <gustav.hartvigsson _at_ gmail.com> 2014
10
 
 */
11
 
 
12
5
#include <SDL2/SDL.h>
13
6
#include <stdbool.h>
14
7
 
15
8
#include "MousePointer.h"
16
9
 
17
 
typedef struct GameButton GameButton; // hack to make the callback work...
 
10
typedef struct _GameButton GameButton;
18
11
 
19
12
typedef void (* BtnCallback)(GameButton * self, void * data);
20
13
 
21
 
typedef struct GameButton {
 
14
struct _GameButton {
22
15
  SDL_Rect base; //this will behave like an SDL_Rect when cast to an SDL_Rect.
23
16
  bool fill;
24
17
  bool is_clicked;
25
18
  bool is_hover;
26
19
  bool is_stop_hover;
27
 
  
28
20
  SDL_Color colour;
29
 
  
30
21
  BtnCallback clicked;
31
22
  void * clicked_data;
32
 
  
33
23
  BtnCallback hover;
34
24
  void * hover_data;
35
 
  
36
25
  BtnCallback stop_hover;
37
26
  void * stop_hover_data;
38
 
} GameButton;
39
 
 
40
 
typedef void (* BtnCallback)(GameButton * self, void * data);
 
27
};
41
28
 
42
29
GameButton * game_button_new (int x, int y, int h, int w);
43
30