updated Readme

This commit is contained in:
vurtun 2015-05-16 12:27:51 +02:00
parent b91cd2d840
commit 9cf59ad7a7

View File

@ -80,10 +80,9 @@ while (1) {
gui_buffer_end(&list, &buffer, &canvas, &status); gui_buffer_end(&list, &buffer, &canvas, &status);
/* draw */ /* draw */
const struct gui_command *cmd = gui_list_begin(&list); const struct gui_command *cmd;
while (cmd) { gui_list_for_each(cmd, list) {
/* execute command */ /* execute command */
cmd = gui_list_next(&list, cmd);
} }
} }
``` ```
@ -304,6 +303,10 @@ gui_float value = 5.0f
gui_size prog = 20; gui_size prog = 20;
while (1) { while (1) {
gui_input_begin(&input);
/* record input */
gui_input_end(&input);
value = gui_slider(&canvas, 50, 50, 100, 30, 0, value, 10, 1, &style, &input); value = gui_slider(&canvas, 50, 50, 100, 30, 0, value, 10, 1, &style, &input);
prog = gui_progress(&canvas, 50, 100, 100, 30, prog, 100, gui_false, &style, &input); prog = gui_progress(&canvas, 50, 100, 100, 30, prog, 100, gui_false, &style, &input);
} }
@ -326,7 +329,6 @@ sequence points have no effect in the current frame and are only visible in the
next frame. next frame.
```c ```c
struct gui_font font = {...}; struct gui_font font = {...};
struct gui_input input = {0}; struct gui_input input = {0};
struct gui_canvas canvas = {...}; struct gui_canvas canvas = {...};
@ -336,6 +338,10 @@ gui_default_config(&config);
gui_panel_init(&panel, 50, 50, 300, 200, 0, &config, &font); gui_panel_init(&panel, 50, 50, 300, 200, 0, &config, &font);
while (1) { while (1) {
gui_input_begin(&input);
/* record input */
gui_input_end(&input);
struct gui_panel_layout layout; struct gui_panel_layout layout;
gui_panel_begin(&layout, &panel, "Demo", &canvas, &input); gui_panel_begin(&layout, &panel, "Demo", &canvas, &input);
gui_panel_row(&layout, 30, 1); gui_panel_row(&layout, 30, 1);
@ -380,6 +386,10 @@ while (1) {
struct gui_panel_layout layout; struct gui_panel_layout layout;
struct gui_canvas canvas; struct gui_canvas canvas;
gui_input_begin(&input);
/* record input */
gui_input_end(&input);
gui_buffer_begin(&canvas, &buffer, window_width, window_height); gui_buffer_begin(&canvas, &buffer, window_width, window_height);
gui_panel_hook_begin(&layout, &win.hook, &stack, "Demo", &canvas, &input); gui_panel_hook_begin(&layout, &win.hook, &stack, "Demo", &canvas, &input);
gui_panel_row(&layout, 30, 1); gui_panel_row(&layout, 30, 1);
@ -389,14 +399,12 @@ while (1) {
gui_buffer_end(gui_hook_list(&win.hook), buffer, &status); gui_buffer_end(gui_hook_list(&win.hook), buffer, &status);
/* draw each panel */ /* draw each panel */
struct gui_panel_hook *iter = stack.begin; struct gui_panel_hook *iter;
while (iter) { gui_stack_for_each(iter, &stack) {
const struct gui_command *cmd = gui_list_begin(gui_hook_list(h)); const struct gui_command *cmd
while (cmd) { gui_list_for_each(cmd, gui_hook_list(h)) {
/* execute command */ /* execute command */
cmd = gui_list_next(gui_hook_output(iter), cmd);
} }
iter = iter->next;
} }
} }
``` ```