the display's own scrollbars: shown for windows that reach past the display, not for a rounding error of a layout computed in floats
the display's own scrollbars: shown for windows that reach past the display, not for a rounding error of a layout computed in floats
#define ALLEGRO_UNSTABLE 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
if (!ok) {
} else {
}
}
int opt = 0;
while ((opt = getopt(argc, argv, "V:")) != -1) {
if (opt == 'V') {
} else {
return -1;
}
}
return 0;
}
int old = al_get_new_bitmap_flags();
ALLEGRO_BITMAP* target = NULL;
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
target = al_create_bitmap(400, 300);
al_set_new_bitmap_flags(old);
if (!target) return;
al_set_target_bitmap(target);
al_clear_to_color(al_map_rgb(0, 0, 0));
al_set_target_bitmap(NULL);
al_destroy_bitmap(target);
}
ALLEGRO_EVENT ev;
memset(&ev, 0, sizeof(ev));
ev.type = ALLEGRO_EVENT_MOUSE_AXES;
ev.mouse.x = 200;
ev.mouse.y = 150;
ev.mouse.dz = dz;
}
int main(
int argc,
char** argv) {
fprintf(stderr, "Usage: %s [-V LOG_LEVEL]\n", argv[0]);
return 2;
}
if (!al_init() || !al_init_font_addon() || !al_init_primitives_addon()) {
return 1;
}
ALLEGRO_FONT*
font = al_create_builtin_font();
return 1;
}
gui->global_scroll_x = 5.0f;
gui->global_scroll_y = 5.0f;
expect_true(
"a rounding error past the edge shows no scrollbar, so the view is not scrolled",
gui->global_scroll_x == 0.0f &&
gui->global_scroll_y == 0.0f);
expect_true(
"and the wheel does not scroll it",
gui->global_scroll_y == 0.0f);
gui->global_scroll_x = 5.0f;
expect_true(
"a window really past the edge keeps its horizontal scroll",
gui->global_scroll_x == 5.0f);
expect_true(
"back inside, the view is not scrolled",
gui->global_scroll_x == 0.0f &&
gui->global_scroll_y == 0.0f);
fprintf(stderr,
"ex_gui_global_scroll: %d failure(s)\n",
failures);
return 1;
}
printf("ex_gui_global_scroll: ok\n");
return 0;
}
void process_args(int argc, char **argv)
static void expect_true(const char *label, int cond)
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.
void n_gui_window_set_rect(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h)
Move and resize a window at runtime, reflowing its widgets.
int n_gui_process_event(N_GUI_CTX *ctx, ALLEGRO_EVENT event)
Process an allegro event through the GUI system.
#define N_GUI_WIN_FRAMELESS
frameless window: no title bar drawn, drag via window body unless N_GUI_WIN_FIXED_POSITION is also se...
void n_gui_draw(N_GUI_CTX *ctx)
draw all visible GUI windows and widgets
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.
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.
void n_gui_window_set_flags(N_GUI_CTX *ctx, int window_id, int flags)
Set feature flags on a window.
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_INFO
informational
Common headers and low-level functions & define.
GUI system: buttons, sliders, text areas, checkboxes, scrollbars, dropdown menus, windows.