fixed win32 demo and some tings the msvc analyzer found + updated readme

This commit is contained in:
vurtun 2015-05-18 13:37:16 +02:00
parent 760c8d3736
commit f9319b0d0f
4 changed files with 12 additions and 17 deletions

View File

@ -232,7 +232,7 @@ struct gui_allocator {
``` ```
### Buffering ### Buffering
While a raw canvas provides the ability to draw without any problems, the pure While a raw canvas provides the ability to draw without problems, the pure
nature of callbacks is a loss of flow control. You have to immediately nature of callbacks is a loss of flow control. You have to immediately
draw a primitive to screen which forces your application to build around the draw a primitive to screen which forces your application to build around the
toolkit instead of controling it. An additional disadvantage of callbacks in this toolkit instead of controling it. An additional disadvantage of callbacks in this
@ -520,8 +520,8 @@ platform (Xlib, Win32) itself already provides a solution.
- [Tutorial from Jari Komppa about imgui libraries](http://www.johno.se/book/imgui.html) - [Tutorial from Jari Komppa about imgui libraries](http://www.johno.se/book/imgui.html)
- [Johannes 'johno' Norneby's article](http://iki.fi/sol/imgui/) - [Johannes 'johno' Norneby's article](http://iki.fi/sol/imgui/)
- [Casey Muratori's original introduction to imgui's](http:://mollyrocket.com/861?node=861) - [Casey Muratori's original introduction to imgui's](http:://mollyrocket.com/861?node=861)
- [Casey Muratori's imgui panel design(1/2)](http://mollyrocket.com/casey/stream_0019.html) - [Casey Muratori's imgui panel design (1/2)](http://mollyrocket.com/casey/stream_0019.html)
- [Casey Muratori's imgui panel design(2/2)](http://mollyrocket.com/casey/stream_0020.html) - [Casey Muratori's imgui panel design (2/2)](http://mollyrocket.com/casey/stream_0020.html)
- [Casey Muratori: Designing and Evaluation Reusable Components](http://mollyrocket.com/casey/stream_0028.html) - [Casey Muratori: Designing and Evaluation Reusable Components](http://mollyrocket.com/casey/stream_0028.html)
- [ImGui: The inspiration for this project](https://github.com/ocornut/imgui) - [ImGui: The inspiration for this project](https://github.com/ocornut/imgui)
- [Nvidia's imgui toolkit](https://code.google.com/p/nvidia-widgets/) - [Nvidia's imgui toolkit](https://code.google.com/p/nvidia-widgets/)

View File

@ -259,7 +259,7 @@ static void
style_tab(struct gui_panel_layout *panel, struct gui_config *config) style_tab(struct gui_panel_layout *panel, struct gui_config *config)
{ {
gui_int tx, ty; gui_int tx, ty;
gui_panel_row(panel, 30, 2);
gui_panel_label(panel, "scrollbar width:", GUI_TEXT_LEFT); gui_panel_label(panel, "scrollbar width:", GUI_TEXT_LEFT);
tx = gui_panel_spinner(panel, 0, (gui_int)config->scrollbar_width, 20, 1, NULL); tx = gui_panel_spinner(panel, 0, (gui_int)config->scrollbar_width, 20, 1, NULL);
config->scrollbar_width = (float)tx; config->scrollbar_width = (float)tx;
@ -346,7 +346,6 @@ color_tab(struct gui_panel_layout *panel, struct control_window *control, struct
} else { } else {
gui_panel_row(panel, 30, 2); gui_panel_row(panel, 30, 2);
for (i = 0; i < GUI_COLOR_COUNT; ++i) { for (i = 0; i < GUI_COLOR_COUNT; ++i) {
struct gui_panel_layout layout;
gui_panel_label(panel, labels[i], GUI_TEXT_LEFT); gui_panel_label(panel, labels[i], GUI_TEXT_LEFT);
if (gui_panel_button_color(panel, config->colors[i], GUI_BUTTON_DEFAULT)) { if (gui_panel_button_color(panel, config->colors[i], GUI_BUTTON_DEFAULT)) {
if (!control->picker_active) { if (!control->picker_active) {
@ -526,7 +525,6 @@ static void
update_settings(struct settings_window *win, struct gui_layout *layout, update_settings(struct settings_window *win, struct gui_layout *layout,
struct gui_input *in, struct gui_canvas *canvas) struct gui_input *in, struct gui_canvas *canvas)
{ {
gui_bool running;
struct gui_panel_layout panel; struct gui_panel_layout panel;
struct gui_panel_layout tab; struct gui_panel_layout tab;
gui_panel_hook_begin_tiled(&panel, &win->hook, layout, GUI_SLOT_RIGHT, 0, "Tool Settings", canvas, in); gui_panel_hook_begin_tiled(&panel, &win->hook, layout, GUI_SLOT_RIGHT, 0, "Tool Settings", canvas, in);
@ -568,10 +566,10 @@ init_demo(struct demo_gui *gui, struct gui_font *font)
gui_buffer_init_fixed(buffer, memory, GUI_BUFFER_CLIPPING); gui_buffer_init_fixed(buffer, memory, GUI_BUFFER_CLIPPING);
gui_default_config(config); gui_default_config(config);
ratio.left = 0.10f; ratio.left = 0.05f;
ratio.right = 0.40f; ratio.right = 0.35f;
ratio.centerv = 0.9f; ratio.centerv = 0.9f;
ratio.centerh = 0.5f; ratio.centerh = 0.6f;
ratio.bottom = 0.05f; ratio.bottom = 0.05f;
ratio.top = 0.05f; ratio.top = 0.05f;
gui_layout_init(&gui->layout, &ratio); gui_layout_init(&gui->layout, &ratio);

View File

@ -232,7 +232,6 @@ surface_draw_text(XSurface *surf, XFont *font, short x, short y, unsigned short
unsigned char bg_r, unsigned char bg_g, unsigned char bg_b, unsigned char bg_r, unsigned char bg_g, unsigned char bg_b,
unsigned char fg_r, unsigned char fg_g, unsigned char fg_b) unsigned char fg_r, unsigned char fg_g, unsigned char fg_b)
{ {
int tx, ty, th;
RECT format; RECT format;
UINT bg = RGB(bg_r, bg_g, bg_b); UINT bg = RGB(bg_r, bg_g, bg_b);
UINT fg = RGB(fg_r, fg_g, fg_b); UINT fg = RGB(fg_r, fg_g, fg_b);
@ -447,8 +446,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR lpCmdLine, int shown)
/* Draw */ /* Draw */
surface_begin(xw.backbuffer); surface_begin(xw.backbuffer);
surface_clear(xw.backbuffer, 255, 255, 255); surface_clear(xw.backbuffer, 255, 255, 255);
draw(xw.backbuffer, &gui.stack); draw(xw.backbuffer, &gui.background);
draw(xw.floating, &gui.stack); draw(xw.backbuffer, &gui.floating);
surface_end(xw.backbuffer, xw.hdc); surface_end(xw.backbuffer, xw.hdc);
/* Timing */ /* Timing */

8
gui.c
View File

@ -2707,14 +2707,14 @@ gui_panel_shelf_begin(struct gui_panel_layout *parent, struct gui_panel_layout *
button_y += config->item_padding.y; button_y += config->item_padding.y;
button_h -= config->item_padding.y; button_h -= config->item_padding.y;
button.background = config->colors[GUI_COLOR_SHELF]; button.background = config->colors[GUI_COLOR_SHELF];
button.content = config->colors[GUI_COLOR_TEXT]; button.content = config->colors[GUI_COLOR_SHELF_TEXT];
button.highlight = config->colors[GUI_COLOR_SHELF]; button.highlight = config->colors[GUI_COLOR_SHELF];
button.highlight_content = config->colors[GUI_COLOR_SHELF_TEXT]; button.highlight_content = config->colors[GUI_COLOR_SHELF_TEXT];
} else { } else {
button.background = config->colors[GUI_COLOR_SHELF_ACTIVE]; button.background = config->colors[GUI_COLOR_SHELF_ACTIVE];
button.content = config->colors[GUI_COLOR_TEXT]; button.content = config->colors[GUI_COLOR_SHELF_ACTIVE_TEXT];
button.highlight = config->colors[GUI_COLOR_SHELF_ACTIVE]; button.highlight = config->colors[GUI_COLOR_SHELF_ACTIVE];
button.highlight_content = config->colors[GUI_COLOR_SHELF_TEXT]; button.highlight_content = config->colors[GUI_COLOR_SHELF_ACTIVE_TEXT];
} }
if (gui_button_text(canvas, button_x, button_y, button_w, button_h, if (gui_button_text(canvas, button_x, button_y, button_w, button_h,
tabs[i], GUI_BUTTON_DEFAULT, &button, parent->input, &parent->font)) tabs[i], GUI_BUTTON_DEFAULT, &button, parent->input, &parent->font))
@ -2887,7 +2887,6 @@ gui_stack_pop(struct gui_panel_stack *stack, struct gui_panel_hook *panel)
void 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)
{ {
struct gui_layout_slot *slot;
ASSERT(layout); ASSERT(layout);
ASSERT(config); ASSERT(config);
if (!layout || !config) return; if (!layout || !config) return;
@ -2920,7 +2919,6 @@ gui_layout_begin(struct gui_layout *layout, gui_size width, gui_size height,
void void
gui_layout_end(struct gui_panel_stack *stack, struct gui_layout *layout) gui_layout_end(struct gui_panel_stack *stack, struct gui_layout *layout)
{ {
gui_size i;
ASSERT(stack); ASSERT(stack);
ASSERT(layout); ASSERT(layout);
if (!stack || !layout) return; if (!stack || !layout) return;