added another FAQ
This commit is contained in:
parent
fb473c1db8
commit
b41897352e
18
Readme.md
18
Readme.md
@ -30,7 +30,7 @@ streamlined user development speed in mind.
|
||||
+ Selector
|
||||
+ Linegraph
|
||||
+ Histogram
|
||||
+ Panels
|
||||
+ Panel
|
||||
+ Layouts(Tabs, Groups, Shelf)
|
||||
|
||||
## Limitations
|
||||
@ -149,7 +149,7 @@ time I will look into adding them. Except for comboboxes which are just
|
||||
really hard to implement, but for a smaller datasets there is the selector
|
||||
widget or you could combine a tab with a group and toggle buttons.
|
||||
|
||||
#### Where is the demo/example code
|
||||
#### Where is the demo/example code?
|
||||
The demo and example code can be found in the demo folder. For now there is
|
||||
only example code for Linux with X11 and Xlib but a Win32, OpenGL and Directx
|
||||
demo is in the working.
|
||||
@ -166,14 +166,14 @@ users possible which brings me to ANSI C as the most portable version.
|
||||
In addition not all C compiler like the MSVC
|
||||
compiler fully support C99, which finalized my decision to use ANSI C.
|
||||
|
||||
#### Why do you typedef your own types instead of using the standard types
|
||||
#### Why do you typedef your own types instead of using the standard types?
|
||||
This Project uses ANSI C which does not have the header file `<stdint.h>`
|
||||
and therefore does not provide the fixed sized types that I need. Therefore
|
||||
I defined my own types which need to be set to the correct size for each
|
||||
plaform. But if your development environment provides the header file you can define
|
||||
`GUI_USE_FIXED_SIZE_TYPES` to directly use the correct types.
|
||||
|
||||
#### Why is font/input/window management not provided
|
||||
#### Why is font/input/window management not provided?
|
||||
As for window and input management it is a ton of work to abstract over
|
||||
all possible platforms and there are already libraries like SDL or SFML or even
|
||||
the platform itself which provide you with the functionality.
|
||||
@ -190,6 +190,16 @@ question is not as easy. In the end the project does not have font handling
|
||||
since there are already a number of font handling libraries in existence or even the
|
||||
platform (Xlib, Win32) itself already provides a solution.
|
||||
|
||||
#### Why are my panels not overlapping properly while being moved?
|
||||
Since every panel is directly drawn to screen if you have not implement buffering
|
||||
there is no direct way for the toolkit to decide which panel has to be drawn at which
|
||||
time. But the functionality can be easily implemented by buffering each drawing
|
||||
call and managing a panel stack. The panel stack would keep the active panel
|
||||
(`GUI_PANEL_ACTIVE`) at the top of the stack and keep the rest of the panel in
|
||||
order and draw each panel from top to down. As for now the overlapping panels
|
||||
are not implemented but if I have some time and it is a requested feature
|
||||
I will implement a panel window manager.
|
||||
|
||||
## References
|
||||
- [Tutorial from Jari Komppa about imgui libraries](http://www.johno.se/book/imgui.html)
|
||||
- [Johannes 'johno' Norneby's article](http://iki.fi/sol/imgui/)
|
||||
|
21
gui.c
21
gui.c
@ -1551,9 +1551,9 @@ gui_panel_input(struct gui_panel *panel, gui_char *buffer, gui_size len,
|
||||
buffer, len, max, active, &field, panel->in);
|
||||
}
|
||||
|
||||
gui_bool
|
||||
gui_panel_spinner(struct gui_panel *panel, gui_int min, gui_int *value,
|
||||
gui_int max, gui_int step, gui_bool active)
|
||||
gui_int
|
||||
gui_panel_spinner(struct gui_panel *panel, gui_int min, gui_int value,
|
||||
gui_int max, gui_int step, gui_bool *active)
|
||||
{
|
||||
struct gui_rect bounds;
|
||||
const struct gui_config *config;
|
||||
@ -1581,9 +1581,9 @@ gui_panel_spinner(struct gui_panel *panel, gui_int min, gui_int *value,
|
||||
config = panel->config;
|
||||
canvas = panel->canvas;
|
||||
|
||||
*value = CLAMP(min, *value, max);
|
||||
len = itos(string, *value);
|
||||
is_active = active;
|
||||
value = CLAMP(min, value, max);
|
||||
len = itos(string, value);
|
||||
is_active = *active;
|
||||
old_len = len;
|
||||
|
||||
button.border = 1;
|
||||
@ -1604,8 +1604,8 @@ gui_panel_spinner(struct gui_panel *panel, gui_int min, gui_int *value,
|
||||
button_down_clicked = gui_button_triangle(canvas, button_x, button_y, button_w, button_h,
|
||||
&button, GUI_DOWN, GUI_BUTTON_DEFAULT, panel->in);
|
||||
if (button_up_clicked || button_down_clicked) {
|
||||
*value += (button_up_clicked) ? step : -step;
|
||||
*value = CLAMP(min, *value, max);
|
||||
value += (button_up_clicked) ? step : -step;
|
||||
value = CLAMP(min, value, max);
|
||||
}
|
||||
|
||||
field_x = bounds.x;
|
||||
@ -1622,8 +1622,9 @@ gui_panel_spinner(struct gui_panel *panel, gui_int min, gui_int *value,
|
||||
len = gui_input(canvas, field_x, field_y, field_w, field_h, (gui_char*)string,
|
||||
len, MAX_NUMBER_BUFFER, &is_active, &field, panel->in);
|
||||
if (old_len != len)
|
||||
strtoi(value, string, len);
|
||||
return is_active;
|
||||
strtoi(&value, string, len);
|
||||
*active = is_active;
|
||||
return value;
|
||||
}
|
||||
|
||||
gui_size
|
||||
|
4
gui.h
4
gui.h
@ -341,8 +341,8 @@ gui_size gui_panel_progress(struct gui_panel*, gui_size cur, gui_size max,
|
||||
gui_bool modifyable);
|
||||
gui_size gui_panel_input(struct gui_panel*, gui_char *buffer, gui_size len,
|
||||
gui_size max, gui_bool *active, enum gui_input_filter);
|
||||
gui_bool gui_panel_spinner(struct gui_panel*, gui_int min, gui_int *value,
|
||||
gui_int max, gui_int step, gui_bool active);
|
||||
gui_int gui_panel_spinner(struct gui_panel*, gui_int min, gui_int value,
|
||||
gui_int max, gui_int step, gui_bool *active);
|
||||
gui_size gui_panel_selector(struct gui_panel*, const char *items[],
|
||||
gui_size item_count, gui_size item_current);
|
||||
gui_int gui_panel_plot(struct gui_panel*, const gui_float *values, gui_size value_count);
|
||||
|
Loading…
Reference in New Issue
Block a user