38#define ALLEGRO_UNSTABLE 1
74 memset(&ev, 0,
sizeof(ev));
75 ev.type = (
unsigned int)
type;
86 ALLEGRO_MOUSE_CURSOR* custom = (ALLEGRO_MOUSE_CURSOR*)1;
89 if (!al_init() || !al_init_font_addon()) {
93 font = al_create_builtin_font();
101 al_destroy_font(
font);
119 mouse(
gui, ALLEGRO_EVENT_MOUSE_AXES, 600, 300);
124 mouse(
gui, ALLEGRO_EVENT_MOUSE_AXES, 200, 300);
126 mouse(
gui, ALLEGRO_EVENT_MOUSE_AXES, 600, 300);
130 mouse(
gui, ALLEGRO_EVENT_MOUSE_BUTTON_DOWN, 600, 300);
133 mouse(
gui, ALLEGRO_EVENT_MOUSE_BUTTON_UP, 600, 300);
134 mouse(
gui, ALLEGRO_EVENT_MOUSE_AXES, 601, 300);
138 mouse(
gui, ALLEGRO_EVENT_MOUSE_AXES, 600, 300);
143 al_destroy_font(
font);
static void expect_true(const char *label, int cond)
static void mouse(N_GUI_CTX *gui, int type, int x, int y)
Send one mouse event.
static void type(N_GUI_CTX *gui, const char *s)
Type a whole string into whatever has focus.
FONT * font
the default 8x8 font, valid after allegro_init()
void n_gui_set_display_size(N_GUI_CTX *ctx, float w, float h)
set the display (viewport) size so global scrollbars can be computed.
int n_gui_process_event(N_GUI_CTX *ctx, ALLEGRO_EVENT event)
Process an allegro event through the GUI system.
int n_gui_add_splitpane(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int orientation, float ratio, void(*on_change)(int, float, void *), void *user_data)
Add a split pane widget: a draggable divider between two regions.
#define N_GUI_WIN_FRAMELESS
frameless window: no title bar drawn, drag via window body unless N_GUI_WIN_FIXED_POSITION is also se...
int n_gui_add_window(N_GUI_CTX *ctx, const char *title, float x, float y, float w, float h)
Add a new pseudo-window to the context.
N_GUI_CTX * n_gui_new_ctx(ALLEGRO_FONT *default_font)
Create a new GUI context.
#define N_GUI_SPLIT_VERTICAL
split pane: vertical divider, regions are left and right
void n_gui_destroy_ctx(N_GUI_CTX **ctx)
Destroy a GUI context and all its windows/widgets.
void n_gui_open_window(N_GUI_CTX *ctx, int window_id)
Open (show) a window.
int n_gui_get_cursor(N_GUI_CTX *ctx, ALLEGRO_MOUSE_CURSOR **custom)
The cursor the GUI last applied to the display.
void n_gui_window_set_flags(N_GUI_CTX *ctx, int window_id, int flags)
Set feature flags on a window.
void n_gui_set_cursor(N_GUI_CTX *ctx, int system_shape, ALLEGRO_MOUSE_CURSOR *custom)
Say which mouse cursor the application wants.
The top-level GUI context that holds all windows.
#define n_log(__LEVEL__,...)
Logging function wrapper to get line and func.
#define LOG_ERR
error conditions
void set_log_level(const int log_level)
Set the global log level value ( static int LOG_LEVEL ).
#define LOG_NOTICE
normal but significant condition
#define LOG_INFO
informational
Common headers and low-level functions & define.
GUI system: buttons, sliders, text areas, checkboxes, scrollbars, dropdown menus, windows.