transfered screenshots
This commit is contained in:
parent
5ee29fbe22
commit
5aae8f4931
52
Readme.md
52
Readme.md
@ -3,7 +3,12 @@
|
||||
|
||||
This is a bloat free minimal state immediate mode graphical user interface toolkit
|
||||
written in ANSI C. It was designed as a simple embeddable user interface for
|
||||
application and does not have any direct dependencies.
|
||||
application and does not have any direct dependencies. It does not have
|
||||
a default renderbackend, os window and input handling but instead provides a very modular
|
||||
library approach by providing a simple input state storage for input and draw
|
||||
commands describing primitive shapes as output. So instead of providing a
|
||||
layered library that tries to abstract over a number of platform and
|
||||
render backends it only focuses on the actual GUI.
|
||||
|
||||
## Features
|
||||
- Immediate mode graphical user interface toolkit
|
||||
@ -16,10 +21,29 @@ application and does not have any direct dependencies.
|
||||
- UTF-8 support
|
||||
- Optional vertex buffer output and font handling
|
||||
|
||||
The library is self-contained with four different files that only have to be
|
||||
copied and compiled into your application. Files gui.c and gui.h make up
|
||||
the core of the library, while stb_rect_pack.h and stb_truetype.h are
|
||||
for a optional font handling implementation and can be removed if not needed.
|
||||
- gui.c
|
||||
- gui.h
|
||||
- stb_rect_pack.h
|
||||
- stb_truetype.h
|
||||
There are no dependencies or particular building process required. You just have
|
||||
to compile the .c file and and #include gui.h into your project. To actually
|
||||
run you have to provide the input state, configuration style and memory
|
||||
for draw commands to the library. After the GUI was executed all draw commands
|
||||
have to be either executed or optionally converted into a vertex buffer to
|
||||
draw the GUI.
|
||||
|
||||
|
||||
## Gallery
|
||||
![gui demo](/screen/demo.png?raw=true)
|
||||
![gui explorer](/screen/explorer.png?raw=true)
|
||||
![gui nodedit](/screen/nodedit.png?raw=true)
|
||||
![gui
|
||||
demo](https://cloud.githubusercontent.com/assets/8057201/9937241/24f55e7e-5d60-11e5-9957-c010cf763f15.png)
|
||||
![gui
|
||||
explorer](http://cloud.githubusercontent.com/assets/8057201/9937240/24f509ce-5d60-11e5-894a-e7e9e228de30.png)
|
||||
![gui
|
||||
nodedit](https://cloud.githubusercontent.com/assets/8057201/9937243/24f6a5ea-5d60-11e5-81bc-21de3b6f4b1b.png)
|
||||
|
||||
## Example
|
||||
```c
|
||||
@ -32,9 +56,9 @@ gui_style_default(&style, GUI_DEFAULT_ALL, &font);
|
||||
struct gui_command_queue queue;
|
||||
gui_command_queue_init_fixed(&queue, malloc(MEMORY_SIZE), MEMORY_SIZE);
|
||||
|
||||
/* initialize panel */
|
||||
struct gui_window panel;
|
||||
gui_window_init(&panel, 50, 50, 220, 180,
|
||||
/* initialize window */
|
||||
struct gui_window window;
|
||||
gui_window_init(&window, 50, 50, 220, 180,
|
||||
GUI_PANEL_BORDER|GUI_PANEL_MOVEABLE|GUI_PANEL_SCALEABLE,
|
||||
&queue, &style, &input);
|
||||
|
||||
@ -52,7 +76,7 @@ while (1) {
|
||||
|
||||
/* GUI */
|
||||
struct gui_context context;
|
||||
gui_begin(&context, &panel);
|
||||
gui_begin(&context, &window);
|
||||
{
|
||||
const char *items[] = {"Fist", "Pistol", "Railgun", "BFG"};
|
||||
gui_header(&context, "Show", GUI_CLOSEABLE, 0, GUI_HEADER_LEFT);
|
||||
@ -66,7 +90,7 @@ while (1) {
|
||||
gui_label(&context, "Weapon:", GUI_TEXT_LEFT);
|
||||
gui_combo(&context, items, LEN(items), &item, 20, &active);
|
||||
}
|
||||
gui_end(&context, &panel);
|
||||
gui_end(&context, &window);
|
||||
|
||||
/* draw */
|
||||
const struct gui_command *cmd;
|
||||
@ -76,7 +100,8 @@ while (1) {
|
||||
gui_command_queue_clear(&queue);
|
||||
}
|
||||
```
|
||||
![gui screenshot](/screen/screen.png?raw=true)
|
||||
![gui
|
||||
screenshot](https://cloud.githubusercontent.com/assets/8057201/9937242/24f58b9c-5d60-11e5-94df-780232ca613e.png)
|
||||
|
||||
## IMGUIs
|
||||
Immediate mode in contrast to classical retained mode GUIs store as little state as possible
|
||||
@ -97,9 +122,11 @@ code driven style, centralized flow control, easy extensibility and
|
||||
understandability.
|
||||
|
||||
## FAQ
|
||||
#### Where is the demo/example code?
|
||||
#### Where is the demo/example code and documentation?
|
||||
The demo and example code can be found in the demo folder.
|
||||
There is demo code for Linux(X11) and nanovg.
|
||||
There is demo code for Linux(X11), nanovg and OpenGL with SDL.
|
||||
The documentation can be found in gui.h. I documented each submodule and
|
||||
function with description and parameter explanation.
|
||||
|
||||
#### Why did you use ANSI C and not C99 or C++?
|
||||
Personally I stay out of all "discussions" about C vs C++ since they are totally
|
||||
@ -121,6 +148,7 @@ platform. But if your development environment provides the header file you can d
|
||||
`GUI_USE_FIXED_SIZE_TYPES` to directly use the correct types.
|
||||
|
||||
## References
|
||||
- [stb_rect_pack.h and stb_truetype.h by Sean Barret (public domain)](https:://github.com/nothings/stb/)
|
||||
- [Tutorial from Jari Komppa about imgui libraries](http://www.johno.se/book/imgui.html)
|
||||
- [Johannes 'johno' Norneby's article](http://iki.fi/sol/imgui/)
|
||||
- [ImGui: The inspiration for this project from ocornut](https://github.com/ocornut/imgui)
|
||||
|
BIN
screen/demo.png
BIN
screen/demo.png
Binary file not shown.
Before Width: | Height: | Size: 62 KiB |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue
Block a user