GoldFish Engine
Quite simple and lightweight game engine
Loading...
Searching...
No Matches
gui.h
Go to the documentation of this file.
1
7#ifndef __GF_TYPE_GUI_H__
8#define __GF_TYPE_GUI_H__
9
10#include <gf_pre.h>
11#include <gf_macro.h>
12
17typedef int gf_gui_id_t;
18
24 GF_GUI_PRESS = 0
25};
26
27#ifdef GF_EXPOSE_GUI
28typedef struct gf_gui_button_t gf_gui_button_t;
29
30typedef struct gf_gui_t gf_gui_t;
32typedef union gf_gui_union_t gf_gui_union_t;
33
34/* External library */
35
36/* Engine */
37#include <gf_type/draw.h>
38#include <gf_type/core.h>
39
40/* Standard */
41
42typedef void (*gf_gui_callback_t)(gf_engine_t* engine, gf_draw_t* draw, gf_gui_id_t id, int type);
43
48#define GF_GUI_MAX_COMPONENTS 64
49
55 GF_GUI_UNUSED = -1,
56 GF_GUI_BUTTON
57};
58
67GF_DECLARE_TYPE(gui_button, { char* text; });
68
80
111GF_DECLARE_TYPE(gui_component, {
112 int type;
113 double x;
114 double y;
115 double width;
116 double height;
117 int pressed;
118 gf_gui_callback_t callback;
120});
121
139GF_DECLARE_TYPE(gui, {
140 gf_engine_t* engine;
141 gf_draw_t* draw;
142 gf_gui_id_t pressed;
144});
145#else
146typedef void* gf_gui_callback_t;
147
148typedef void gf_gui_button_t;
149
150typedef void gf_gui_t;
151typedef void gf_gui_component_t;
152typedef void gf_gui_union_t;
153#endif
154
155#endif
Type definitions related to core.
Type definitions related to drawing interface.
#define GF_DECLARE_TYPE(n, b)
Macro to define engine type shorter.
Definition gf_macro.h:172
Required headers before anything.
int gf_gui_id_t
Component ID.
Definition gui.h:17
GF_GUI_COMPONENT_TYPES
GUI component types.
Definition gui.h:54
#define GF_GUI_MAX_COMPONENTS
Max components engine GUI can handle.
Definition gui.h:48
GF_GUI_EVENTS
GUI events.
Definition gui.h:23
Drawing interface.
Definition draw.h:108
Engine instance.
Definition core.h:46
Button component.
Definition gui.h:67
char * text
Button text.
Definition gui.h:67
Component.
Definition gui.h:120
GUI.
Definition gui.h:144
Component union.
Definition gui.h:77
gf_gui_button_t button
Button component.
Definition gui.h:78