-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhealthbars.c
72 lines (47 loc) · 1.83 KB
/
healthbars.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <gtk/gtk.h>
#include "main.h"
#include "healthbars.h"
int dec_enemy_health(__attribute__ ((unused)) GtkButton *button, gpointer user_data)
{
Omni *data = user_data;
if(*(int*)data->widget_changes.enemy_health_bar->state > 0){
if(add_state(data, ENEMY_HEALTH_BAR)) return 1;
(*(int*)data->widget_changes.enemy_health_bar->state)--;
gtk_level_bar_set_value((GtkLevelBar*)data->gui_elems.enemy_health_bar,
*(int*)data->widget_changes.enemy_health_bar->state);
}
return 1;
}
int inc_enemy_health(__attribute__ ((unused)) GtkButton *button, gpointer user_data)
{
Omni *data = user_data;
if(*(int*)data->widget_changes.enemy_health_bar->state < 4){
if(add_state(data, ENEMY_HEALTH_BAR)) return 1;
(*(int*)data->widget_changes.enemy_health_bar->state)++;
gtk_level_bar_set_value((GtkLevelBar*)data->gui_elems.enemy_health_bar,
*(int*)data->widget_changes.enemy_health_bar->state);
}
return 1;
}
int dec_player_health(__attribute__ ((unused)) GtkButton *button, gpointer user_data)
{
Omni *data = user_data;
if(*(int*)data->widget_changes.player_health_bar->state > 0){
if(add_state(data, PLAYER_HEALTH_BAR)) return 1;
(*(int*)data->widget_changes.player_health_bar->state)--;
gtk_level_bar_set_value((GtkLevelBar*)data->gui_elems.player_health_bar,
*(int*)data->widget_changes.player_health_bar->state);
}
return 1;
}
int inc_player_health(__attribute__ ((unused)) GtkButton *button, gpointer user_data)
{
Omni *data = user_data;
if(*(int*)data->widget_changes.player_health_bar->state < 4){
if(add_state(data, PLAYER_HEALTH_BAR)) return 1;
(*(int*)data->widget_changes.player_health_bar->state)++;
gtk_level_bar_set_value((GtkLevelBar*)data->gui_elems.player_health_bar,
*(int*)data->widget_changes.player_health_bar->state);
}
return 1;
}