forked from avose/ChromoCraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui_game_event.h
61 lines (51 loc) · 1.59 KB
/
gui_game_event.h
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
#ifndef GUI_GAME_EVENT_H
#define GUI_GAME_EVENT_H
#include "vector.h"
#include "types.h"
#include "gem.h"
#include "enemy.h"
#include "tower.h"
// Game event types
#define GUI_GAME_EVENT_NONE 0
#define GUI_GAME_EVENT_FIRE 1
#define GUI_GAME_EVENT_KILL 2
#define GUI_GAME_EVENT_HIT 3
// Event queue node/queue
typedef struct str_gui_eventq_node_t {
struct str_gui_eventq_node_t *last;
struct str_gui_eventq_node_t *next;
u32b_t type; // Type of event (can use to pull out of union below)
u32b_t flags; // Event flags (unique use for each event type)
u64b_t time; // Time (in game ticks) this event occurred
union {
// Struct for a fire event
struct {
vector3_t tower;
vector3_t color;
vector3_t enemy;
double health;
} fire;
// Struct for a enemy kill event
struct {
vector3_t enemy; // Position
} kill;
// Struct for a enemy hit player event
struct {
vector3_t enemy; // Position
vector3_t color; // Color
} hit;
};
} gui_eventq_node_t, gui_eventq_t;
////////////////////////////////////////////////////////////
// Interface
////////////////////////////////////////////////////////////
#ifndef GUI_GAME_EVENT_C
// Consumers
extern gui_eventq_t* gui_game_event_get (gui_eventq_t *node);
extern void gui_game_event_remove(gui_eventq_t *node);
// Producers
extern void gui_game_event_kill(u64b_t time, enemy_t *enemy);
extern void gui_game_event_fire(u64b_t time, tower_t *tower, enemy_t *enemy, double dmg);
extern void gui_game_event_hit (u64b_t time, enemy_t *enemy);
#endif
#endif