fixed some demo isses

This commit is contained in:
vurtun 2015-05-17 20:19:24 +02:00
parent 4a2fab0024
commit 0f915e3f4a
5 changed files with 16 additions and 14 deletions

View File

@ -580,9 +580,9 @@ init_demo(struct demo_gui *gui, struct gui_font *font)
gui_default_config(config);
ratio.left = 0.10f;
ratio.right = 0.20f;
ratio.right = 0.40f;
ratio.centerv = 0.9f;
ratio.centerh = 0.7f;
ratio.centerh = 0.5f;
ratio.bottom = 0.05f;
ratio.top = 0.05f;
gui_layout_init(&gui->layout, &ratio);

View File

@ -602,7 +602,8 @@ main(int argc, char *argv[])
/* Draw */
glClearColor(0.4f, 0.4f, 0.4f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
draw(&gui.stack, width, height);
draw(&gui.background, width, height);
draw(&gui.floating, width, height);
SDL_GL_SwapWindow(win);
/* Timing */

View File

@ -448,6 +448,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR lpCmdLine, int shown)
surface_begin(xw.backbuffer);
surface_clear(xw.backbuffer, 255, 255, 255);
draw(xw.backbuffer, &gui.stack);
draw(xw.floating, &gui.stack);
surface_end(xw.backbuffer, xw.hdc);
/* Timing */

20
gui.c
View File

@ -1617,20 +1617,20 @@ gui_panel_hook_begin_tiled(struct gui_panel_layout *tile, struct gui_panel_hook
if (index >= layout->capacity[slot]) return gui_false;
panel = gui_hook_panel(hook);
panel->flags &= (gui_size)~GUI_PANEL_MINIMIZABLE;
panel->flags &= (gui_size)~GUI_PANEL_CLOSEABLE;
panel->flags &= (gui_size)~GUI_PANEL_MOVEABLE;
panel->flags &= (gui_size)~GUI_PANEL_SCALEABLE;
panel->flags &= (gui_flags)~GUI_PANEL_MINIMIZABLE;
panel->flags &= (gui_flags)~GUI_PANEL_CLOSEABLE;
panel->flags &= (gui_flags)~GUI_PANEL_MOVEABLE;
panel->flags &= (gui_flags)~GUI_PANEL_SCALEABLE;
bounds.x = layout->offset[slot].x * layout->width;
bounds.y = layout->offset[slot].y * layout->height;
bounds.w = layout->ratio[slot].x * layout->width;
bounds.h = layout->ratio[slot].y * layout->height;
bounds.x = layout->offset[slot].x * (gui_float)layout->width;
bounds.y = layout->offset[slot].y * (gui_float)layout->height;
bounds.w = layout->ratio[slot].x * (gui_float)layout->width;
bounds.h = layout->ratio[slot].y * (gui_float)layout->height;
panel->x = bounds.x;
panel->w = bounds.w;
panel->h = bounds.h / layout->capacity[slot];
panel->y = bounds.y + index * panel->h;
panel->h = bounds.h / (gui_float)layout->capacity[slot];
panel->y = bounds.y + (gui_float)index * panel->h;
gui_stack_push(&layout->stack, hook);
return gui_panel_begin(tile, panel, title, canvas, (layout->active) ? in : NULL);
}

2
gui.h
View File

@ -542,7 +542,7 @@ void gui_buffer_end(struct gui_command_list*, struct gui_command_buffer*,
#define gui_list_for_each(i, l) for (i = gui_list_begin(l); i != NULL; i = gui_list_next(l, i))
const struct gui_command* gui_list_begin(const struct gui_command_list*);
const struct gui_command* gui_list_next(const struct gui_command_list*,
const struct gui_command*);
const struct gui_command*);
/* Widgets */