added missing arguments to layout
This commit is contained in:
parent
3f6cd704ff
commit
eea9452cee
@ -35,7 +35,7 @@ Summary: It is only responsible for the actual user interface
|
||||
|
||||
## Example
|
||||
```c
|
||||
/* allocate memory to hold the draw calls output */
|
||||
/* allocate memory to hold the draw commands */
|
||||
gui_command_buffer buffer;
|
||||
void *memory = malloc(MEMORY_SIZE)
|
||||
gui_command_buffer_init_fixed(buffer, memory, MEMORY_SIZE);
|
||||
@ -327,7 +327,7 @@ gui_panel_init(&panel, 0, 0, 0, 0, 0, &config, &buffer);
|
||||
|
||||
struct gui_layout tiled;
|
||||
struct gui_layout_config ratio = {...};
|
||||
gui_layout_init(&tiled, &ratio);
|
||||
gui_layout_init(&tiled, &ratio, window_width, window_height);
|
||||
gui_layout_slot(&tiled, GUI_SLOT_LEFT, GUI_LAYOUT_VERTICAL, 1);
|
||||
|
||||
while (1) {
|
||||
|
@ -376,9 +376,8 @@ run_demo(struct demo_gui *gui, struct gui_input *input)
|
||||
{
|
||||
struct control_window *control = &gui->control;
|
||||
struct show_window *show = &gui->show;
|
||||
gui->running = update_control(control, &gui->stack, input, &gui->config);
|
||||
|
||||
/* Show window */
|
||||
gui->running = update_control(control, &gui->stack, input, &gui->config);
|
||||
show->hook.flags = control->show_flags;
|
||||
update_show(show, &gui->stack, input);
|
||||
if (show->hook.flags & GUI_PANEL_HIDDEN)
|
||||
|
14
gui.c
14
gui.c
@ -3019,7 +3019,8 @@ gui_stack_pop(struct gui_stack *stack, struct gui_panel*panel)
|
||||
* ===============================================================
|
||||
*/
|
||||
void
|
||||
gui_layout_init(struct gui_layout *layout, const struct gui_layout_config *config)
|
||||
gui_layout_init(struct gui_layout *layout, const struct gui_layout_config *config,
|
||||
gui_size width, gui_size height)
|
||||
{
|
||||
gui_float left, right;
|
||||
gui_float centerh, centerv;
|
||||
@ -3030,6 +3031,8 @@ gui_layout_init(struct gui_layout *layout, const struct gui_layout_config *confi
|
||||
if (!layout || !config) return;
|
||||
zero(layout, sizeof(*layout));
|
||||
layout->state = GUI_LAYOUT_ACTIVE;
|
||||
layout->width = width;
|
||||
layout->height = height;
|
||||
|
||||
left = SATURATE(config->left);
|
||||
right = SATURATE(config->right);
|
||||
@ -3051,6 +3054,15 @@ gui_layout_init(struct gui_layout *layout, const struct gui_layout_config *confi
|
||||
vec2_load(layout->slots[GUI_SLOT_RIGHT].offset, left + centerh, top);
|
||||
}
|
||||
|
||||
void
|
||||
gui_layout_set_size(struct gui_layout *layout, gui_size width, gui_size height)
|
||||
{
|
||||
ASSERT(layout);
|
||||
if (!layout) return;
|
||||
layout->width = width;
|
||||
layout->height = height;
|
||||
}
|
||||
|
||||
void
|
||||
gui_layout_slot(struct gui_layout *layout, enum gui_layout_slot_index slot,
|
||||
enum gui_layout_format format, gui_size count)
|
||||
|
6
gui.h
6
gui.h
@ -669,7 +669,7 @@ void gui_stack_pop(struct gui_stack*, struct gui_panel*);
|
||||
/*
|
||||
* ==============================================================
|
||||
*
|
||||
* Border Layout
|
||||
* Layout
|
||||
*
|
||||
* ===============================================================
|
||||
*/
|
||||
@ -716,7 +716,9 @@ struct gui_layout {
|
||||
struct gui_layout_slot slots[GUI_SLOT_MAX];
|
||||
};
|
||||
|
||||
void gui_layout_init(struct gui_layout*, const struct gui_layout_config*);
|
||||
void gui_layout_init(struct gui_layout*, const struct gui_layout_config*,
|
||||
gui_size width, gui_size height);
|
||||
void gui_layout_set_size(struct gui_layout*, gui_size width, gui_size height);
|
||||
void gui_layout_slot(struct gui_layout*, enum gui_layout_slot_index,
|
||||
enum gui_layout_format, gui_size panel_count);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user