27#define ALLEGRO_UNSTABLE 1
43 while ((opt = getopt(argc, argv,
"V:")) != -1) {
46 if (!strcmp(
"LOG_NULL", optarg))
48 else if (!strcmp(
"LOG_NOTICE", optarg))
50 else if (!strcmp(
"LOG_INFO", optarg))
52 else if (!strcmp(
"LOG_ERR", optarg))
54 else if (!strcmp(
"LOG_DEBUG", optarg))
66static void expect_close(
const char* label,
float got,
float want,
float tol) {
70 n_log(
LOG_ERR,
"%s: got %.3f, expected %.3f", label, got, want);
82int main(
int argc,
char** argv) {
85 fprintf(stderr,
"Usage: %s [-V LOG_LEVEL]\n", argv[0]);
90 if (!al_init() || !al_init_font_addon()) {
94 ALLEGRO_FONT* font = al_create_builtin_font();
102 al_destroy_font(font);
130 al_destroy_font(font);
void process_args(int argc, char **argv)
static void expect_true(const char *label, int cond)
static void expect_close(const char *label, float got, float want, float tol)
void n_gui_set_display_size(N_GUI_CTX *ctx, float w, float h)
Set the display (viewport) size for global scrollbar computation.
float n_gui_splitpane_get_ratio(N_GUI_CTX *ctx, int widget_id)
get the current divider ratio of a split pane
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.
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_splitpane_set_ratio(N_GUI_CTX *ctx, int widget_id, float ratio)
set the divider ratio of a split pane (clamped to its min/max)
void n_gui_splitpane_set_limits(N_GUI_CTX *ctx, int widget_id, float min_ratio, float max_ratio)
set the minimum and maximum allowed divider ratio of a split pane
The top-level GUI context that holds all windows.
#define n_log(__LEVEL__,...)
Logging function wrapper to get line and func.
#define LOG_DEBUG
debug-level messages
#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_NULL
no log output
#define LOG_INFO
informational
Common headers and low-level functions & define.
GUI system: buttons, sliders, text areas, checkboxes, scrollbars, dropdown menus, windows.