GoldFish Engine
Quite simple and lightweight game engine
Loading...
Searching...
No Matches
gf_gui.h File Reference

GUI. More...

#include <gf_pre.h>
#include <gf_macro.h>
#include <gf_type/gui.h>
#include <gf_type/draw.h>
#include <gf_type/core.h>

Go to the source code of this file.

Macros

#define GF_GUI_NORMAL   1
 Draw border normally.
 
#define GF_GUI_INVERT   -1
 Draw border inverted.
 
#define GF_GUI_FONT_SIZE   32
 Default GUI font size.
 

Functions

gf_gui_tgf_gui_create (gf_engine_t *engine, gf_draw_t *draw)
 Create GUI.
 
void gf_gui_destroy (gf_gui_t *gui)
 Destroy GUI.
 
void gf_gui_destroy_id (gf_gui_t *gui, gf_gui_id_t id)
 Destroy GUI component by ID.
 
gf_gui_id_t gf_gui_create_button (gf_gui_t *gui, double x, double y, double w, double h, const char *text)
 Create button component.
 
void gf_gui_render (gf_gui_t *gui)
 Render GUI.
 
gf_gui_component_tgf_gui_first_unused (gf_gui_t *gui, gf_gui_id_t *id)
 Get first unused component entry.
 
void gf_gui_draw_box (gf_gui_t *gui, int mul, double x, double y, double w, double h)
 Render box.
 
void gf_gui_set_callback (gf_gui_t *gui, gf_gui_id_t id, gf_gui_callback_t callback)
 Set callback.
 

Detailed Description

GUI.

Definition in file gf_gui.h.

Macro Definition Documentation

◆ GF_GUI_FONT_SIZE

#define GF_GUI_FONT_SIZE   32

Default GUI font size.

Definition at line 38 of file gf_gui.h.

◆ GF_GUI_INVERT

#define GF_GUI_INVERT   -1

Draw border inverted.

Definition at line 32 of file gf_gui.h.

◆ GF_GUI_NORMAL

#define GF_GUI_NORMAL   1

Draw border normally.

Definition at line 26 of file gf_gui.h.

Function Documentation

◆ gf_gui_create()

gf_gui_t * gf_gui_create ( gf_engine_t engine,
gf_draw_t draw 
)
extern

Create GUI.

Parameters
engineEngine instance
drawDrawing interface
Returns
GUI

Definition at line 26 of file gf_gui.c.

◆ gf_gui_create_button()

gf_gui_id_t gf_gui_create_button ( gf_gui_t gui,
double  x,
double  y,
double  w,
double  h,
const char *  text 
)
extern

Create button component.

Parameters
guiGUI
xX coord of button
yY coord of button
wWidth of button
hHeight of button
textButton text
Returns
Component ID

Definition at line 98 of file gf_gui.c.

◆ gf_gui_destroy()

void gf_gui_destroy ( gf_gui_t gui)
extern

Destroy GUI.

Parameters
guiGUI

Definition at line 43 of file gf_gui.c.

◆ gf_gui_destroy_id()

void gf_gui_destroy_id ( gf_gui_t gui,
gf_gui_id_t  id 
)
extern

Destroy GUI component by ID.

Parameters
guiGUI
idComponent ID

Definition at line 52 of file gf_gui.c.

◆ gf_gui_draw_box()

void gf_gui_draw_box ( gf_gui_t gui,
int  mul,
double  x,
double  y,
double  w,
double  h 
)
extern

Render box.

Parameters
guiGUI
mulGF_GUI_NORMAL or GF_GUI_INVERT
xX coord of box
yY coord of box
wWidth of box
hHeight of box

Definition at line 65 of file gf_gui.c.

◆ gf_gui_first_unused()

gf_gui_component_t * gf_gui_first_unused ( gf_gui_t gui,
gf_gui_id_t id 
)
extern

Get first unused component entry.

Parameters
guiGUI
idComponent ID to be returned
Returns
Pointer to component

Definition at line 87 of file gf_gui.c.

◆ gf_gui_render()

void gf_gui_render ( gf_gui_t gui)
extern

Render GUI.

Parameters
guiGUI

Definition at line 116 of file gf_gui.c.

◆ gf_gui_set_callback()

void gf_gui_set_callback ( gf_gui_t gui,
gf_gui_id_t  id,
gf_gui_callback_t  callback 
)
extern

Set callback.

Parameters
guiGUI
idComponent ID
callbackCallback

Definition at line 165 of file gf_gui.c.