small update
This commit is contained in:
parent
19ce2c227c
commit
807c4b631f
10
Readme.md
10
Readme.md
@ -15,10 +15,17 @@ possible with fast streamlined development speed in mind.
|
|||||||
- No direct dependencies (not even libc!)
|
- No direct dependencies (not even libc!)
|
||||||
- Full memory management control
|
- Full memory management control
|
||||||
- Renderer and platform independent
|
- Renderer and platform independent
|
||||||
- Configurable
|
- Configurable style and colors
|
||||||
- UTF-8 support
|
- UTF-8 support
|
||||||
|
|
||||||
|
## Target Audience
|
||||||
|
- Graphical tools/editors
|
||||||
|
- Library testbed UI
|
||||||
|
- Game engine debugging UI
|
||||||
|
- Graphical overlays
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
- Is NOT a layered Framework it is a component
|
||||||
- Does NOT provide os window/input management
|
- Does NOT provide os window/input management
|
||||||
- Does NOT provide a renderer backend
|
- Does NOT provide a renderer backend
|
||||||
- Does NOT implement a font library
|
- Does NOT implement a font library
|
||||||
@ -27,7 +34,6 @@ Summary: It is only responsible for the actual user interface
|
|||||||
## Gallery
|
## Gallery
|
||||||
![gui screenshot](/screen/demo.png?raw=true)
|
![gui screenshot](/screen/demo.png?raw=true)
|
||||||
![gui screenshot](/screen/config.png?raw=true)
|
![gui screenshot](/screen/config.png?raw=true)
|
||||||
![gui screenshot](/screen/config2.png?raw=true)
|
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
```c
|
```c
|
||||||
|
12
gui.h
12
gui.h
@ -10,6 +10,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Constants */
|
||||||
#define GUI_UTF_SIZE 4
|
#define GUI_UTF_SIZE 4
|
||||||
#define GUI_INPUT_MAX 16
|
#define GUI_INPUT_MAX 16
|
||||||
#define GUI_UTF_INVALID 0xFFFD
|
#define GUI_UTF_INVALID 0xFFFD
|
||||||
@ -18,6 +19,7 @@ extern "C" {
|
|||||||
#define GUI_HOOK_ATTR(T, name) struct T name
|
#define GUI_HOOK_ATTR(T, name) struct T name
|
||||||
#define GUI_HOOK_OUT gui_command_list
|
#define GUI_HOOK_OUT gui_command_list
|
||||||
|
|
||||||
|
/* Types */
|
||||||
#ifdef GUI_USE_FIXED_TYPES
|
#ifdef GUI_USE_FIXED_TYPES
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
typedef int32_t gui_int;
|
typedef int32_t gui_int;
|
||||||
@ -49,6 +51,7 @@ typedef unsigned int gui_flag;
|
|||||||
typedef unsigned long gui_size;
|
typedef unsigned long gui_size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Utilities */
|
||||||
enum {gui_false, gui_true};
|
enum {gui_false, gui_true};
|
||||||
enum gui_heading {GUI_UP, GUI_RIGHT, GUI_DOWN, GUI_LEFT};
|
enum gui_heading {GUI_UP, GUI_RIGHT, GUI_DOWN, GUI_LEFT};
|
||||||
struct gui_color {gui_byte r,g,b,a;};
|
struct gui_color {gui_byte r,g,b,a;};
|
||||||
@ -57,6 +60,7 @@ struct gui_rect {gui_float x,y,w,h;};
|
|||||||
struct gui_key {gui_bool down, clicked;};
|
struct gui_key {gui_bool down, clicked;};
|
||||||
struct gui_font;
|
struct gui_font;
|
||||||
|
|
||||||
|
/* Callbacks */
|
||||||
typedef void* gui_image;
|
typedef void* gui_image;
|
||||||
typedef gui_char gui_glyph[GUI_UTF_SIZE];
|
typedef gui_char gui_glyph[GUI_UTF_SIZE];
|
||||||
typedef gui_bool(*gui_filter)(gui_long unicode);
|
typedef gui_bool(*gui_filter)(gui_long unicode);
|
||||||
@ -71,6 +75,8 @@ typedef void(*gui_draw_triangle)(void*, gui_float, gui_float, gui_float, gui_flo
|
|||||||
typedef void(*gui_draw_text)(void*, gui_float, gui_float, gui_float, gui_float,
|
typedef void(*gui_draw_text)(void*, gui_float, gui_float, gui_float, gui_float,
|
||||||
const gui_char*, gui_size, const struct gui_font*,
|
const gui_char*, gui_size, const struct gui_font*,
|
||||||
struct gui_color, struct gui_color);
|
struct gui_color, struct gui_color);
|
||||||
|
|
||||||
|
/* Input */
|
||||||
enum gui_keys {
|
enum gui_keys {
|
||||||
GUI_KEY_SHIFT,
|
GUI_KEY_SHIFT,
|
||||||
GUI_KEY_CTRL,
|
GUI_KEY_CTRL,
|
||||||
@ -94,6 +100,8 @@ struct gui_input {
|
|||||||
struct gui_vec2 mouse_clicked_pos;
|
struct gui_vec2 mouse_clicked_pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Widgets */
|
||||||
enum gui_text_align {
|
enum gui_text_align {
|
||||||
GUI_TEXT_LEFT,
|
GUI_TEXT_LEFT,
|
||||||
GUI_TEXT_CENTERED,
|
GUI_TEXT_CENTERED,
|
||||||
@ -207,6 +215,8 @@ struct gui_canvas {
|
|||||||
gui_draw_text draw_text;
|
gui_draw_text draw_text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Buffer */
|
||||||
struct gui_memory {
|
struct gui_memory {
|
||||||
void *memory;
|
void *memory;
|
||||||
gui_size size;
|
gui_size size;
|
||||||
@ -329,6 +339,8 @@ struct gui_command_list {
|
|||||||
gui_size count;
|
gui_size count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Panel */
|
||||||
enum gui_panel_colors {
|
enum gui_panel_colors {
|
||||||
GUI_COLOR_TEXT,
|
GUI_COLOR_TEXT,
|
||||||
GUI_COLOR_PANEL,
|
GUI_COLOR_PANEL,
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 7.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.6 KiB |
Loading…
Reference in New Issue
Block a user