Atrinik Client  4.0
button.h
Go to the documentation of this file.
1 /*************************************************************************
2  * Atrinik, a Multiplayer Online Role Playing Game *
3  * *
4  * Copyright (C) 2009-2014 Alex Tokar and Atrinik Development Team *
5  * *
6  * Fork from Crossfire (Multiplayer game for X-windows). *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
21  * *
22  * The author can be reached at admin@atrinik.org *
23  ************************************************************************/
24 
30 #ifndef BUTTON_H
31 #define BUTTON_H
32 
34 #define BUTTON_MOUSE_OVER(button, mx, my, texture) ((mx) - (button)->px >= (button)->x && (mx) - (button)->px < (button)->x + (texture)->w && (my) - (button)->py >= (button)->y && (my) - (button)->py < (button)->y + (texture)->h)
35 
38 #define BUTTON_CHECK_TOOLTIP(button) \
39  ((button)->mouse_over && !(button)->pressed)
40 
42 typedef struct button_struct {
46  SDL_Surface *surface;
47 
49  int x;
50 
52  int y;
53 
54  int px;
55 
56  int py;
57 
62 
68 
74 
77 
79  uint64_t flags;
80 
84  uint8_t center;
85 
87  const char *color;
88 
90  const char *color_shadow;
91 
93  const char *color_over;
94 
96  const char *color_over_shadow;
97 
100 
105  int pressed;
106 
109 
111  int disabled;
112 
114  uint32_t pressed_ticks;
115 
117  uint32_t hover_ticks;
118 
121 
127  void (*repeat_func)(struct button_struct *button);
128 
132  uint8_t redraw;
133 } button_struct;
134 
135 #endif
font_struct * font
Definition: button.h:76
uint32_t hover_ticks
Definition: button.h:117
uint8_t redraw
Definition: button.h:132
const char * color_shadow
Definition: button.h:90
void(* repeat_func)(struct button_struct *button)
Definition: button.h:127
struct button_struct button_struct
texture_struct * texture_over
Definition: button.h:67
const char * color_over_shadow
Definition: button.h:96
uint32_t pressed_repeat_ticks
Definition: button.h:120
texture_struct * texture
Definition: button.h:61
uint32_t pressed_ticks
Definition: button.h:114
SDL_Surface * surface
Definition: button.h:46
uint8_t center
Definition: button.h:84
int disabled
Definition: button.h:111
texture_struct * texture_pressed
Definition: button.h:73
const char * color_over
Definition: button.h:93
uint64_t flags
Definition: button.h:79
int mouse_over
Definition: button.h:99
int pressed_forced
Definition: button.h:108
const char * color
Definition: button.h:87