Started documentation transition to markdeep

pull/600/head
vurtun 2018-01-07 17:18:02 +01:00
parent 9cb143e13f
commit dd5f3520a0
23 changed files with 1216 additions and 3064 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "docs/build/html"]
path = docs/build/html
url = https://github.com/nuklear-ui/nuklear-ui.github.io

24
doc/Makefile Normal file
View File

@ -0,0 +1,24 @@
# Install
BIN = doc
# Flags
CFLAGS += -std=c99 -pedantic -O2
SRC = stddoc.c
OBJ = $(SRC:.c=.o)
ifeq ($(OS),Windows_NT)
BIN := $(BIN).exe
LIBS =
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LIBS =
else
LIBS =
endif
endif
$(BIN):
rm -f $(BIN) $(OBJS)
$(CC) $(SRC) $(CFLAGS) -o $(BIN)

4
doc/build.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
cat ../nuklear.h|./doc > nuklear.html

508
doc/nuklear.html Normal file
View File

@ -0,0 +1,508 @@
<meta charset='utf-8' emacsmode='-*- markdown -*-'>
<link rel='stylesheet' href='https://casual-effects.com/markdeep/latest/apidoc.css?'>
# Nuklear
![](https://cloud.githubusercontent.com/assets/8057201/11761525/ae06f0ca-a0c6-11e5-819d-5610b25f6ef4.gif)
## Contents
1. About section
2. Highlights section
3. Features section
4. Usage section
1. Flags section
2. Constants section
3. Dependencies section
5. Example section
6. License section
7. Changelog section
8. Gallery section
9. Credits section
## About
This is a minimal state immediate mode graphical user interface toolkit
written in ANSI C and licensed under public domain. It was designed as a simple
embeddable user interface for application and does not have any dependencies,
a default renderbackend or OS window and input handling but instead provides a very modular
library approach by using simple input state 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 UI.
## Highlights
- Graphical user interface toolkit
- Single header library
- Written in C89 (a.k.a. ANSI C or ISO C90)
- Small codebase (~18kLOC)
- Focus on portability, efficiency and simplicity
- No dependencies (not even the standard library if not wanted)
- Fully skinnable and customizable
- Low memory footprint with total memory control if needed or wanted
- UTF-8 support
- No global or hidden state
- Customizable library modules (you can compile and use only what you need)
- Optional font baker and vertex buffer output
## Features
- Absolutely no platform dependent code
- Memory management control ranging from/to
- Ease of use by allocating everything from standard library
- Control every byte of memory inside the library
- Font handling control ranging from/to
- Use your own font implementation for everything
- Use this libraries internal font baking and handling API
- Drawing output control ranging from/to
- Simple shapes for more high level APIs which already have drawing capabilities
- Hardware accessible anti-aliased vertex buffer output
- Customizable colors and properties ranging from/to
- Simple changes to color by filling a simple color table
- Complete control with ability to use skinning to decorate widgets
- Bendable UI library with widget ranging from/to
- Basic widgets like buttons, checkboxes, slider, ...
- Advanced widget like abstract comboboxes, contextual menus,...
- Compile time configuration to only compile what you need
- Subset which can be used if you do not want to link or use the standard library
- Can be easily modified to only update on user input instead of frame updates
## Usage
This library is self contained in one single header file and can be used either
in header only mode or in implementation mode. The header only mode is used
by default when included and allows including this header in other headers
and does not contain the actual implementation. <br /><br />
The implementation mode requires to define the preprocessor macro
NK_IMPLEMENTATION in *one* .c/.cpp file before #includeing this file, e.g.:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~C
#define NK_IMPLEMENTATION
#include "nuklear.h"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Also optionally define the symbols listed in the section "OPTIONAL DEFINES"
below in header and implementation mode if you want to use additional functionality
or need more control over the library.
!!! WARNING
Every time nuklear is included define the same compiler flags. This very important not doing so could lead to compiler errors or even worse stack corruptions.
### Flags
Flag | Description
-----|-------------
NK_PRIVATE | If defined declares all functions as static, so they can only be accessed inside the file that contains the implementation
NK_INCLUDE_FIXED_TYPES | If defined it will include header `<stdint.h>` for fixed sized types otherwise nuklear tries to select the correct type. If that fails it will throw a compiler error and you have to select the correct types yourself.
NK_INCLUDE_DEFAULT_ALLOCATOR | if defined it will include header `<stdlib.h>` and provide additional functions to use this library without caring for memory allocation control and therefore ease memory management.
NK_INCLUDE_STANDARD_IO | if defined it will include header `<stdio.h>` and provide additional functions depending on file loading.
NK_INCLUDE_STANDARD_VARARGS | if defined it will include header <stdio.h> and provide additional functions depending on file loading.
NK_INCLUDE_VERTEX_BUFFER_OUTPUT | Defining this adds a vertex draw command list backend to this library, which allows you to convert queue commands into vertex draw commands. This is mainly if you need a hardware accessible format for OpenGL, DirectX, Vulkan, Metal,...
NK_INCLUDE_FONT_BAKING | Defining this adds `stb_truetype` and `stb_rect_pack` implementation to this library and provides font baking and rendering. If you already have font handling or do not want to use this font handler you don't have to define it.
NK_INCLUDE_DEFAULT_FONT | Defining this adds the default font: ProggyClean.ttf into this library which can be loaded into a font atlas and allows using this library without having a truetype font
NK_INCLUDE_COMMAND_USERDATA | Defining this adds a userdata pointer into each command. Can be useful for example if you want to provide custom shaders depending on the used widget. Can be combined with the style structures.
NK_BUTTON_TRIGGER_ON_RELEASE | Different platforms require button clicks occurring either on buttons being pressed (up to down) or released (down to up). By default this library will react on buttons being pressed, but if you define this it will only trigger if a button is released.
NK_ZERO_COMMAND_MEMORY | Defining this will zero out memory for each drawing command added to a drawing queue (inside nk_command_buffer_push). Zeroing command memory is very useful for fast checking (using memcmp) if command buffers are equal and avoid drawing frames when nothing on screen has changed since previous frame.
!!! WARNING
The following flags will pull in the standard C library:
- NK_INCLUDE_DEFAULT_ALLOCATOR
- NK_INCLUDE_STANDARD_IO
- NK_INCLUDE_STANDARD_VARARGS
!!! WARNING
The following flags if defined need to be defined for both header and implementation:
- NK_INCLUDE_FIXED_TYPES
- NK_INCLUDE_DEFAULT_ALLOCATOR
- NK_INCLUDE_STANDARD_VARARGS
- NK_INCLUDE_VERTEX_BUFFER_OUTPUT
- NK_INCLUDE_FONT_BAKING
- NK_INCLUDE_DEFAULT_FONT
- NK_INCLUDE_STANDARD_VARARGS
- NK_INCLUDE_COMMAND_USERDATA
### Constants
Define | Description
-----|-------------
NK_BUFFER_DEFAULT_INITIAL_SIZE | Initial buffer size allocated by all buffers while using the default allocator functions included by defining NK_INCLUDE_DEFAULT_ALLOCATOR. If you don't want to allocate the default 4k memory then redefine it.
NK_MAX_NUMBER_BUFFER | Maximum buffer size for the conversion buffer between float and string Under normal circumstances this should be more than sufficient.
NK_INPUT_MAX | Defines the max number of bytes which can be added as text input in one frame. Under normal circumstances this should be more than sufficient.
!!! WARNING
The following constants if defined need to be defined for both header and implementation:
- NK_MAX_NUMBER_BUFFER
- NK_BUFFER_DEFAULT_INITIAL_SIZE
- NK_INPUT_MAX
### Dependencies
Function | Description
-----|-------------
NK_ASSERT | If you don't define this, nuklear will use <assert.h> with assert().
NK_MEMSET | You can define this to 'memset' or your own memset implementation replacement. If not nuklear will use its own version.
NK_MEMCPY | You can define this to 'memcpy' or your own memcpy implementation replacement. If not nuklear will use its own version.
NK_SQRT | You can define this to 'sqrt' or your own sqrt implementation replacement. If not nuklear will use its own slow and not highly accurate version.
NK_SIN | You can define this to 'sinf' or your own sine implementation replacement. If not nuklear will use its own approximation implementation.
NK_COS | You can define this to 'cosf' or your own cosine implementation replacement. If not nuklear will use its own approximation implementation.
NK_STRTOD | You can define this to `strtod` or your own string to double conversion implementation replacement. If not defined nuklear will use its own imprecise and possibly unsafe version (does not handle nan or infinity!).
NK_DTOA | You can define this to `dtoa` or your own double to string conversion implementation replacement. If not defined nuklear will use its own imprecise and possibly unsafe version (does not handle nan or infinity!).
NK_VSNPRINTF | If you define `NK_INCLUDE_STANDARD_VARARGS` as well as `NK_INCLUDE_STANDARD_IO` and want to be safe define this to `vsnprintf` on compilers supporting later versions of C or C++. By default nuklear will check for your stdlib version in C as well as compiler version in C++. if `vsnprintf` is available it will define it to `vsnprintf` directly. If not defined and if you have older versions of C or C++ it will be defined to `vsprintf` which is unsafe.
!!! WARNING
The following dependencies will pull in the standard C library if not redefined:
- NK_ASSERT
!!! WARNING
The following dependencies if defined need to be defined for both header and implementation:
- NK_ASSERT
!!! WARNING
The following dependencies if defined need to be defined only for the implementation part:
- NK_MEMSET
- NK_MEMCPY
- NK_SQRT
- NK_SIN
- NK_COS
- NK_STRTOD
- NK_DTOA
- NK_VSNPRINTF
## Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
// init gui state
enum {EASY, HARD};
static int op = EASY;
static float value = 0.6f;
static int i = 20;
struct nk_context ctx;
nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);
if (nk_begin(&ctx, "Show", nk_rect(50, 50, 220, 220),
NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
// fixed widget pixel width
nk_layout_row_static(&ctx, 30, 80, 1);
if (nk_button_label(&ctx, "button")) {
// event handling
}
// fixed widget window ratio width
nk_layout_row_dynamic(&ctx, 30, 2);
if (nk_option_label(&ctx, "easy", op == EASY)) op = EASY;
if (nk_option_label(&ctx, "hard", op == HARD)) op = HARD;
// custom widget pixel width
nk_layout_row_begin(&ctx, NK_STATIC, 30, 2);
{
nk_layout_row_push(&ctx, 50);
nk_label(&ctx, "Volume:", NK_TEXT_LEFT);
nk_layout_row_push(&ctx, 110);
nk_slider_float(&ctx, 0, &value, 1.0f, 0.1f);
}
nk_layout_row_end(&ctx);
}
nk_end(&ctx);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
![](https://cloud.githubusercontent.com/assets/8057201/10187981/584ecd68-675c-11e5-897c-822ef534a876.png)
scores --------- */
-XXX.XXX- X...X - X...X -X....X - X....X"
X...XXXXXXXXXXXXX...X - "
Offset --*/
## License
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~none
------------------------------------------------------------------------------
This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License
Copyright (c) 2016-2018 Micha Mettke
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## Changelog
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~none
[date][x.yy.zz]-[description]
-[date]: date on which the change has been pushed
-[x.yy.zz]: Numerical version string representation. Each version number on the right
resets back to zero if version on the left is incremented.
- [x]: Major version with API and library breaking
- [yy]: Minor version with non-breaking API and library changes
- [zz]: Bug fix version with no direct changes to API
- 2017/01/05 (3.00.0) - BREAKING CHANGE: The previous color picker API was broken
because of conversions between float and byte color representation.
Color pickers now use floating point values to represent
HSV values. To get back the old behavior I added some additional
color conversion functions to cast between nk_color and
nk_colorf.
- 2017/12/23 (2.00.7) - Fixed small warning
- 2017/12/23 (2.00.7) - Fixed nk_edit_buffer behavior if activated to allow input
- 2017/12/23 (2.00.7) - Fixed modifyable progressbar dragging visuals and input behavior
- 2017/12/04 (2.00.6) - Added formated string tooltip widget
- 2017/11/18 (2.00.5) - Fixed window becoming hidden with flag NK_WINDOW_NO_INPUT
- 2017/11/15 (2.00.4) - Fixed font merging
- 2017/11/07 (2.00.3) - Fixed window size and position modifier functions
- 2017/09/14 (2.00.2) - Fixed nk_edit_buffer and nk_edit_focus behavior
- 2017/09/14 (2.00.1) - Fixed window closing behavior
- 2017/09/14 (2.00.0) - BREAKING CHANGE: Modifing window position and size funtions now
require the name of the window and must happen outside the window
building process (between function call nk_begin and nk_end).
- 2017/09/11 (1.40.9) - Fixed window background flag if background window is declared last
- 2017/08/27 (1.40.8) - Fixed `nk_item_is_any_active` for hidden windows
- 2017/08/27 (1.40.7) - Fixed window background flag
- 2017/07/07 (1.40.6) - Fixed missing clipping rect check for hovering/clicked
query for widgets
- 2017/07/07 (1.40.5) - Fixed drawing bug for vertex output for lines and stroked
and filled rectangles
- 2017/07/07 (1.40.4) - Fixed bug in nk_convert trying to add windows that are in
process of being destroyed.
- 2017/07/07 (1.40.3) - Fixed table internal bug caused by storing table size in
window instead of directly in table.
- 2017/06/30 (1.40.2) - Removed unneeded semicolon in C++ NK_ALIGNOF macro
- 2017/06/30 (1.40.1) - Fixed drawing lines smaller or equal zero
- 2017/06/08 (1.40.0) - Removed the breaking part of last commit. Auto layout now only
comes in effect if you pass in zero was row height argument
- 2017/06/08 (1.40.0) - BREAKING CHANGE: while not directly API breaking it will change
how layouting works. From now there will be an internal minimum
row height derived from font height. If you need a row smaller than
that you can directly set it by `nk_layout_set_min_row_height` and
reset the value back by calling `nk_layout_reset_min_row_height.
- 2017/06/08 (1.39.1) - Fixed property text edit handling bug caused by past `nk_widget` fix
- 2017/06/08 (1.39.0) - Added function to retrieve window space without calling a nk_layout_xxx function
- 2017/06/06 (1.38.5) - Fixed `nk_convert` return flag for command buffer
- 2017/05/23 (1.38.4) - Fixed activation behavior for widgets partially clipped
- 2017/05/10 (1.38.3) - Fixed wrong min window size mouse scaling over boundries
- 2017/05/09 (1.38.2) - Fixed vertical scrollbar drawing with not enough space
- 2017/05/09 (1.38.1) - Fixed scaler dragging behavior if window size hits minimum size
- 2017/05/06 (1.38.0) - Added platform double-click support
- 2017/04/20 (1.37.1) - Fixed key repeat found inside glfw demo backends
- 2017/04/20 (1.37.0) - Extended properties with selection and clipbard support
- 2017/04/20 (1.36.2) - Fixed #405 overlapping rows with zero padding and spacing
- 2017/04/09 (1.36.1) - Fixed #403 with another widget float error
- 2017/04/09 (1.36.0) - Added window `NK_WINDOW_NO_INPUT` and `NK_WINDOW_NOT_INTERACTIVE` flags
- 2017/04/09 (1.35.3) - Fixed buffer heap corruption
- 2017/03/25 (1.35.2) - Fixed popup overlapping for `NK_WINDOW_BACKGROUND` windows
- 2017/03/25 (1.35.1) - Fixed windows closing behavior
- 2017/03/18 (1.35.0) - Added horizontal scroll requested in #377
- 2017/03/18 (1.34.3) - Fixed long window header titles
- 2017/03/04 (1.34.2) - Fixed text edit filtering
- 2017/03/04 (1.34.1) - Fixed group closable flag
- 2017/02/25 (1.34.0) - Added custom draw command for better language binding support
- 2017/01/24 (1.33.0) - Added programatic way of remove edit focus
- 2017/01/24 (1.32.3) - Fixed wrong define for basic type definitions for windows
- 2017/01/21 (1.32.2) - Fixed input capture from hidden or closed windows
- 2017/01/21 (1.32.1) - Fixed slider behavior and drawing
- 2017/01/13 (1.32.0) - Added flag to put scaler into the bottom left corner
- 2017/01/13 (1.31.0) - Added additional row layouting method to combine both
dynamic and static widgets.
- 2016/12/31 (1.30.0) - Extended scrollbar offset from 16-bit to 32-bit
- 2016/12/31 (1.29.2)- Fixed closing window bug of minimized windows
- 2016/12/03 (1.29.1)- Fixed wrapped text with no seperator and C89 error
- 2016/12/03 (1.29.0) - Changed text wrapping to process words not characters
- 2016/11/22 (1.28.6)- Fixed window minimized closing bug
- 2016/11/19 (1.28.5)- Fixed abstract combo box closing behavior
- 2016/11/19 (1.28.4)- Fixed tooltip flickering
- 2016/11/19 (1.28.3)- Fixed memory leak caused by popup repeated closing
- 2016/11/18 (1.28.2)- Fixed memory leak caused by popup panel allocation
- 2016/11/10 (1.28.1)- Fixed some warnings and C++ error
- 2016/11/10 (1.28.0)- Added additional `nk_button` versions which allows to directly
pass in a style struct to change buttons visual.
- 2016/11/10 (1.27.0)- Added additional 'nk_tree' versions to support external state
storage. Just like last the `nk_group` commit the main
advantage is that you optionally can minimize nuklears runtime
memory consumption or handle hash collisions.
- 2016/11/09 (1.26.0)- Added additional `nk_group` version to support external scrollbar
offset storage. Main advantage is that you can externalize
the memory management for the offset. It could also be helpful
if you have a hash collision in `nk_group_begin` but really
want the name. In addition I added `nk_list_view` which allows
to draw big lists inside a group without actually having to
commit the whole list to nuklear (issue #269).
- 2016/10/30 (1.25.1)- Fixed clipping rectangle bug inside `nk_draw_list`
- 2016/10/29 (1.25.0)- Pulled `nk_panel` memory management into nuklear and out of
the hands of the user. From now on users don't have to care
about panels unless they care about some information. If you
still need the panel just call `nk_window_get_panel`.
- 2016/10/21 (1.24.0)- Changed widget border drawing to stroked rectangle from filled
rectangle for less overdraw and widget background transparency.
- 2016/10/18 (1.23.0)- Added `nk_edit_focus` for manually edit widget focus control
- 2016/09/29 (1.22.7)- Fixed deduction of basic type in non `<stdint.h>` compilation
- 2016/09/29 (1.22.6)- Fixed edit widget UTF-8 text cursor drawing bug
- 2016/09/28 (1.22.5)- Fixed edit widget UTF-8 text appending/inserting/removing
- 2016/09/28 (1.22.4)- Fixed drawing bug inside edit widgets which offset all text
text in every edit widget if one of them is scrolled.
- 2016/09/28 (1.22.3)- Fixed small bug in edit widgets if not active. The wrong
text length is passed. It should have been in bytes but
was passed as glyphes.
- 2016/09/20 (1.22.2)- Fixed color button size calculation
- 2016/09/20 (1.22.1)- Fixed some `nk_vsnprintf` behavior bugs and removed
`<stdio.h>` again from `NK_INCLUDE_STANDARD_VARARGS`.
- 2016/09/18 (1.22.0)- C89 does not support vsnprintf only C99 and newer as well
as C++11 and newer. In addition to use vsnprintf you have
to include <stdio.h>. So just defining `NK_INCLUDE_STD_VAR_ARGS`
is not enough. That behavior is now fixed. By default if
both varargs as well as stdio is selected I try to use
vsnprintf if not possible I will revert to vsprintf. If
varargs but not stdio was defined I will use my own function.
- 2016/09/15 (1.21.2)- Fixed panel `close` behavior for deeper panel levels
- 2016/09/15 (1.21.1)- Fixed C++ errors and wrong argument to `nk_panel_get_xxxx`
- 2016/09/13 (1.21.0) - !BREAKING! Fixed nonblocking popup behavior in menu, combo,
and contextual which prevented closing in y-direction if
popup did not reach max height.
In addition the height parameter was changed into vec2
for width and height to have more control over the popup size.
- 2016/09/13 (1.20.3) - Cleaned up and extended type selection
- 2016/09/13 (1.20.2)- Fixed slider behavior hopefully for the last time. This time
all calculation are correct so no more hackery.
- 2016/09/13 (1.20.1)- Internal change to divide window/panel flags into panel flags and types.
Suprisinly spend years in C and still happened to confuse types
with flags. Probably something to take note.
- 2016/09/08 (1.20.0)- Added additional helper function to make it easier to just
take the produced buffers from `nk_convert` and unplug the
iteration process from `nk_context`. So now you can
just use the vertex,element and command buffer + two pointer
inside the command buffer retrieved by calls `nk__draw_begin`
and `nk__draw_end` and macro `nk_draw_foreach_bounded`.
- 2016/09/08 (1.19.0)- Added additional asserts to make sure every `nk_xxx_begin` call
for windows, popups, combobox, menu and contextual is guarded by
`if` condition and does not produce false drawing output.
- 2016/09/08 (1.18.0)- Changed confusing name for `NK_SYMBOL_RECT_FILLED`, `NK_SYMBOL_RECT`
to hopefully easier to understand `NK_SYMBOL_RECT_FILLED` and
`NK_SYMBOL_RECT_OUTLINE`.
- 2016/09/08 (1.17.0)- Changed confusing name for `NK_SYMBOL_CIRLCE_FILLED`, `NK_SYMBOL_CIRCLE`
to hopefully easier to understand `NK_SYMBOL_CIRCLE_FILLED` and
`NK_SYMBOL_CIRCLE_OUTLINE`.
- 2016/09/08 (1.16.0)- Added additional checks to select correct types if `NK_INCLUDE_FIXED_TYPES`
is not defined by supporting the biggest compiler GCC, clang and MSVC.
- 2016/09/07 (1.15.3)- Fixed `NK_INCLUDE_COMMAND_USERDATA` define to not cause an error
- 2016/09/04 (1.15.2)- Fixed wrong combobox height calculation
- 2016/09/03 (1.15.1)- Fixed gaps inside combo boxes in OpenGL
- 2016/09/02 (1.15.0) - Changed nuklear to not have any default vertex layout and
instead made it user provided. The range of types to convert
to is quite limited at the moment, but I would be more than
happy to accept PRs to add additional.
- 2016/08/30 (1.14.2) - Removed unused variables
- 2016/08/30 (1.14.1) - Fixed C++ build errors
- 2016/08/30 (1.14.0) - Removed mouse dragging from SDL demo since it does not work correctly
- 2016/08/30 (1.13.4) - Tweaked some default styling variables
- 2016/08/30 (1.13.3) - Hopefully fixed drawing bug in slider, in general I would
refrain from using slider with a big number of steps.
- 2016/08/30 (1.13.2) - Fixed close and minimize button which would fire even if the
window was in Read Only Mode.
- 2016/08/30 (1.13.1) - Fixed popup panel padding handling which was previously just
a hack for combo box and menu.
- 2016/08/30 (1.13.0) - Removed `NK_WINDOW_DYNAMIC` flag from public API since
it is bugged and causes issues in window selection.
- 2016/08/30 (1.12.0) - Removed scaler size. The size of the scaler is now
determined by the scrollbar size
- 2016/08/30 (1.11.2) - Fixed some drawing bugs caused by changes from 1.11
- 2016/08/30 (1.11.1) - Fixed overlapping minimized window selection
- 2016/08/30 (1.11.0) - Removed some internal complexity and overly complex code
handling panel padding and panel border.
- 2016/08/29 (1.10.0) - Added additional height parameter to `nk_combobox_xxx`
- 2016/08/29 (1.10.0) - Fixed drawing bug in dynamic popups
- 2016/08/29 (1.10.0) - Added experimental mouse scrolling to popups, menus and comboboxes
- 2016/08/26 (1.10.0) - Added window name string prepresentation to account for
hash collisions. Currently limited to NK_WINDOW_MAX_NAME
which in term can be redefined if not big enough.
- 2016/08/26 (1.10.0) - Added stacks for temporary style/UI changes in code
- 2016/08/25 (1.10.0) - Changed `nk_input_is_key_pressed` and 'nk_input_is_key_released'
to account for key press and release happening in one frame.
- 2016/08/25 (1.10.0) - Added additional nk_edit flag to directly jump to the end on activate
- 2016/08/17 (1.09.6)- Removed invalid check for value zero in nk_propertyx
- 2016/08/16 (1.09.5)- Fixed ROM mode for deeper levels of popup windows parents.
- 2016/08/15 (1.09.4)- Editbox are now still active if enter was pressed with flag
`NK_EDIT_SIG_ENTER`. Main reasoning is to be able to keep
typing after commiting.
- 2016/08/15 (1.09.4)- Removed redundant code
- 2016/08/15 (1.09.4)- Fixed negative numbers in `nk_strtoi` and remove unused variable
- 2016/08/15 (1.09.3)- Fixed `NK_WINDOW_BACKGROUND` flag behavior to select a background
window only as selected by hovering and not by clicking.
- 2016/08/14 (1.09.2)- Fixed a bug in font atlas which caused wrong loading
of glyphes for font with multiple ranges.
- 2016/08/12 (1.09.1)- Added additional function to check if window is currently
hidden and therefore not visible.
- 2016/08/12 (1.09.1)- nk_window_is_closed now queries the correct flag `NK_WINDOW_CLOSED`
instead of the old flag `NK_WINDOW_HIDDEN`
- 2016/08/09 (1.09.0) - Added additional double version to nk_property and changed
the underlying implementation to not cast to float and instead
work directly on the given values.
- 2016/08/09 (1.08.0) - Added additional define to overwrite library internal
floating pointer number to string conversion for additional
precision.
- 2016/08/09 (1.08.0) - Added additional define to overwrite library internal
string to floating point number conversion for additional
precision.
- 2016/08/08 (1.07.2)- Fixed compiling error without define NK_INCLUDE_FIXED_TYPE
- 2016/08/08 (1.07.1)- Fixed possible floating point error inside `nk_widget` leading
to wrong wiget width calculation which results in widgets falsly
becomming tagged as not inside window and cannot be accessed.
- 2016/08/08 (1.07.0) - Nuklear now differentiates between hiding a window (NK_WINDOW_HIDDEN) and
closing a window (NK_WINDOW_CLOSED). A window can be hidden/shown
by using `nk_window_show` and closed by either clicking the close
icon in a window or by calling `nk_window_close`. Only closed
windows get removed at the end of the frame while hidden windows
remain.
- 2016/08/08 (1.06.0) - Added `nk_edit_string_zero_terminated` as a second option to
`nk_edit_string` which takes, edits and outputs a '\0' terminated string.
- 2016/08/08 (1.05.4)- Fixed scrollbar auto hiding behavior
- 2016/08/08 (1.05.3)- Fixed wrong panel padding selection in `nk_layout_widget_space`
- 2016/08/07 (1.05.2)- Fixed old bug in dynamic immediate mode layout API, calculating
wrong item spacing and panel width.
define NK_INCLUDE_STANDARD_VARARGS to allow more fine
grained controlled over library includes.
- 2016/08/06 (1.04.5)- Changed memset calls to NK_MEMSET
- 2016/08/04 (1.04.4)- Fixed fast window scaling behavior
- 2016/08/04 (1.04.3)- Fixed window scaling, movement bug which appears if you
move/scale a window and another window is behind it.
If you are fast enough then the window behind gets activated
and the operation is blocked. I now require activating
by hovering only if mouse is not pressed.
- 2016/08/04 (1.04.2)- Fixed changing fonts
- 2016/08/03 (1.04.1)- Fixed `NK_WINDOW_BACKGROUND` behavior
- 2016/08/03 (1.04.0) - Added color parameter to `nk_draw_image`
- 2016/08/03 (1.04.0) - Added additional window padding style attributes for
sub windows (combo, menu, ...)
- 2016/08/03 (1.04.0) - Added functions to show/hide software cursor
- 2016/08/03 (1.04.0) - Added `NK_WINDOW_BACKGROUND` flag to force a window
to be always in the background of the screen
- 2016/08/03 (1.03.2)- Removed invalid assert macro for NK_RGB color picker
- 2016/08/01 (1.03.1)- Added helper macros into header include guard
- 2016/07/29 (1.03.0) - Moved the window/table pool into the header part to
simplify memory management by removing the need to
allocate the pool.
- 2016/07/29 (1.02.0) - Added auto scrollbar hiding window flag which if enabled
will hide the window scrollbar after NK_SCROLLBAR_HIDING_TIMEOUT
seconds without window interaction. To make it work
you have to also set a delta time inside the `nk_context`.
- 2016/07/25 (1.01.1) - Fixed small panel and panel border drawing bugs
- 2016/07/15 (1.01.0) - Added software cursor to `nk_style` and `nk_context`
- 2016/07/15 (1.01.0) - Added const correctness to `nk_buffer_push' data argument
- 2016/07/15 (1.01.0) - Removed internal font baking API and simplified
font atlas memory management by converting pointer
arrays for fonts and font configurations to lists.
- 2016/07/15 (1.00.0) - Changed button API to use context dependend button
behavior instead of passing it for every function call.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## Gallery
![Figure [blue]: Feature overview with blue color styling](https://cloud.githubusercontent.com/assets/8057201/13538240/acd96876-e249-11e5-9547-5ac0b19667a0.png)
![Figure [red]: Feature overview with red color styling](https://cloud.githubusercontent.com/assets/8057201/13538243/b04acd4c-e249-11e5-8fd2-ad7744a5b446.png)
![Figure [widgets]: Widget overview](https://cloud.githubusercontent.com/assets/8057201/11282359/3325e3c6-8eff-11e5-86cb-cf02b0596087.png)
![Figure [blackwhite]: Black and white](https://cloud.githubusercontent.com/assets/8057201/11033668/59ab5d04-86e5-11e5-8091-c56f16411565.png)
![Figure [filexp]: File explorer](https://cloud.githubusercontent.com/assets/8057201/10718115/02a9ba08-7b6b-11e5-950f-adacdd637739.png)
![Figure [opengl]: OpenGL Editor](https://cloud.githubusercontent.com/assets/8057201/12779619/2a20d72c-ca69-11e5-95fe-4edecf820d5c.png)
![Figure [nodedit]: Node Editor](https://cloud.githubusercontent.com/assets/8057201/9976995/e81ac04a-5ef7-11e5-872b-acd54fbeee03.gif)
![Figure [skinning]: Using skinning in Nuklear](https://cloud.githubusercontent.com/assets/8057201/15991632/76494854-30b8-11e6-9555-a69840d0d50b.png)
![Figure [bf]: Heavy modified version](https://cloud.githubusercontent.com/assets/8057201/14902576/339926a8-0d9c-11e6-9fee-a8b73af04473.png)
## Credits
Developed by Micha Mettke and every direct or indirect github contributor. <br /><br />
Embeds [stb_texedit](https://github.com/nothings/stb/blob/master/stb_textedit.h), [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) and [stb_rectpack](https://github.com/nothings/stb/blob/master/stb_rect_pack.h) by Sean Barret (public domain) <br />
Uses [stddoc.c](https://github.com/r-lyeh/stddoc.c) from r-lyeh@github.com for documentation generation <br /><br />
Embeds ProggyClean.ttf font by Tristan Grimmer (MIT license). <br />
Big thank you to Omar Cornut (ocornut@github) for his [imgui library](https://github.com/ocornut/imgui) and
giving me the inspiration for this library, Casey Muratori for handmade hero
and his original immediate mode graphical user interface idea and Sean
Barret for his amazing single header libraries which restored my faith
in libraries and brought me to create some of my own.
<script>markdeepOptions={tocStyle:'medium'};</script>
<!-- Markdeep: --><script src='https://casual-effects.com/markdeep/latest/markdeep.min.js?'></script>

141
doc/stddoc.c Normal file
View File

@ -0,0 +1,141 @@
/// ## About
/// - _stddoc.c_ is a tiny documentation generator for 60 programming languages.
/// - This page sample was auto-generated from the code comments found in `stddoc.c` file.
///
/// ## How does it work?
/// - Markdeep code comments are extracted from stdin and printed into stdout as a HTML file.
///
/// ## Supported languages
/// - `/// Three slashes comment` [ActionScript, AngelScript, C (C99), C#, C++, ChaiScript, D,
/// GameMonkey, GML, Go, Java, JavaScript, JetScript, jtc, Jx9, Kotlin, Neko, Object Pascal (Delphi),
/// Objective-C, Pawn, PHP, QuakeC, Rust, SASS, Scala, Squirrel, Swift, Vala, Wren, Xojo].
/// - `--- Three dashes comment` [Ada, AppleScript, Eiffel, Euphoria, Haskell, Lua, Occam,
/// PL/SQL, PSL, SGML, SPARK, SQL, Terra, TSQL, VHDL].
/// - `### Three hashes comment` [AWK, Bash, Bourne shell, C shell, Cobra, Maple, Maple,
/// Perl, Perl6, PowerShell, Python, R, Ruby, Seed7, Tcl].
///
/// ## Usage
/// - `stddoc < source.code > documentation.html`
///
/// ## Changelog
/// 2018/01/07
/// : Initial version (_v1.0.0_)
///
/// ## License
/// - rlyeh, unlicensed (~public domain).
#include <stdio.h>
int main() {
printf("%s\n", "<meta charset='utf-8' emacsmode='-*- markdown -*-'>");
printf("%s\n", "<link rel='stylesheet' href='https://casual-effects.com/markdeep/latest/apidoc.css?'>");
for( int fsm_S = 0, fsm_D = 0, fsm_H = 0; !feof(stdin); ) {
int chr = getc(stdin);
if( fsm_S > 3 || fsm_D > 3 || fsm_H > 3 ) {
putc(chr, stdout);
if( chr != '\r' && chr != '\n' ) continue;
}
/**/ if( fsm_S <= 2 && chr == '/' && !fsm_D && !fsm_H ) fsm_S++;
else if( fsm_S == 3 && chr == ' ' && !fsm_D && !fsm_H ) fsm_S++;
else if( fsm_D <= 2 && chr == '-' && !fsm_S && !fsm_H ) fsm_D++;
else if( fsm_D == 3 && chr == ' ' && !fsm_S && !fsm_H ) fsm_D++;
else if( fsm_H <= 2 && chr == '#' && !fsm_S && !fsm_D ) fsm_H++;
else if( fsm_H == 3 && chr == ' ' && !fsm_S && !fsm_D ) fsm_H++;
else fsm_S = fsm_D = fsm_H = 0;
}
printf("%s\n", "<script>markdeepOptions={tocStyle:'medium'};</script>");
printf("%s\n", "<!-- Markdeep: --><script src='https://casual-effects.com/markdeep/latest/markdeep.min.js?'></script>");
}
///
/// ## **Example page!**
///
/// Imaginary documentation page. Here would be some introduction text.
///
/// The table of contents that Markdeep produces is stuffed on the right side,
/// if the browser window is wide enough. Otherwise it is hidden.
///
/// ### Basic Markdeep
///
/// Regular styling like **bold**, _italics_, ~~strikethrough~~, `inline code`, etc. Lists as:
///
/// * A
/// * Bullet
/// * List
///
/// And:
///
/// 1. A
/// 1. Numbered
/// 1. List!
///
/// Symbol substitutions: a 45-degree turn; som x -> y arrows; some whoa ==> fancy <==> arrows.
///
/// Is this a definition list?
/// : Looks like one to me
/// Is that right?
/// : Possibly!
///
/// And a code listing:
///
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// int main()
/// {
/// return 1;
/// }
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
///
///
/// ### Tables
///
/// Thing Name | Description |Notes
/// ------------------------|--------------------|-----
/// Yes | Yup! |
/// No | Nope :( |
/// FileNotFound | Doesn't find files | Pass `-sFIND_FILE=maybe` to maybe find them
///
///
/// ### Diagrams
///
/// ******************************************* Here's a text to the right of the diagram,
/// * +-----------------+ .-. * ain't that fancy. Pretty fancy indeed, I
/// * |\ | .-+ | * must say! Markdeep diagrams are generally
/// * | \ A-B *---+--> .--+ '--. * enclosed into a rectangle full made of `*`
/// * | \ | | Cloud! | * symbols; and are "drawn" using ASCII-art
/// * +---+-------------+ '-------------' * style, with `- | + / \ * o` etc.
/// ******************************************* Suh-weet!
///
/// Another random diagram, just because:
///
/// ********************
/// * +-+-+-+-*-o *
/// * / / ^ / *
/// * / v / / *
/// * +-+-+-+ *
/// ********************
///
/// ### Special notes
///
/// !!! Note
/// Hey I'm a note. Don't mind me, I'm just sitting here.
///
/// !!! WARNING
/// I'm a warning, perhaps. *Something might happen!*
///
/// !!! Error: Never Pass `nullptr` to a Shader
/// Invoking a shader with a null argument can seg fault.
/// This is a multi-line admonition.
///
/// Seriously, don't call shaders like that.
///
/// ### Embedding HTML
///
/// <pre>
/// This is an embedded html node by the way!
/// </pre>
///
/// ## Credits
/// - API doc style created by [Aras Pranckevičius](https://github.com/aras-p)
/// - Markdeep by [Morgan McGuire](https://casual-effects.com/markdeep/).

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +0,0 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = Nuklear
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

0
docs/build/.keep vendored
View File

1
docs/build/html vendored

@ -1 +0,0 @@
Subproject commit 170a3278dd646aa55df36b39b98b58db132f14e6

View File

@ -1,7 +0,0 @@
name: nuklear-docs
channels:
- conda-forge
dependencies:
- breathe

View File

@ -1,20 +0,0 @@
#!/bin/bash
# Safety first
set -euf -o pipefail
# Determine the docs root directory
DOCS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DOCS_DIR
# Run doxygen to generate xml output
doxygen
# Generate html output via sphinx
make html

View File

@ -1,15 +0,0 @@
#!/bin/bash
# Safety first
set -euf -o pipefail
# Determine the docs root directory
DOCS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DOCS_DIR/build/html
git commit -am '[auto] updating static documentation'
git push origin master

View File

@ -1,17 +0,0 @@
#!/bin/bash
# Dependencies required to generate documentation
if [[ "$(which pip)" == "" ]]; then
echo "Could not find pip, please python pip from your repos"
exit 1
fi
if [[ "$(which doxygen)" == "" ]]; then
echo "Could not find doxygen, please doxygen from your repos"
exit 1
fi
pip install sphinx
pip install breathe
pip install -e git+git://github.com/nuklear-ui/sphinx-to-github.git#egg=sphinx-to-github

View File

@ -1,9 +0,0 @@
API Index
===================================
.. toctree::
:maxdepth 3
reference

View File

@ -1,5 +0,0 @@
API Reference
=============================
.. doxygenindex:: Nuklear
:project: nuklear

View File

@ -1,179 +0,0 @@
# -*- coding: utf-8 -*-
#
# Nuklear documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 20 04:44:20 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
import subprocess, os
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinxtogithub',
'breathe']
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
if read_the_docs_build:
subprocess.call('cd ../; doxygen', shell=True)
breathe_projects = {
"nuklear":"../xml/",
}
breathe_domain_by_extension = {
"h" : "c",
}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Nuklear'
copyright = u'2017, Micha Mettke'
author = u'Micha Mettke'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'1.0.0'
# The full version, including alpha/beta/rc tags.
release = u'1.0.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'classic'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'Nukleardoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Nuklear.tex', u'Nuklear Documentation',
u'Micha Mettke', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'nuklear', u'Nuklear Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Nuklear', u'Nuklear Documentation',
author, 'Nuklear', 'One line description of project.',
'Miscellaneous'),
]

View File

@ -1,4 +0,0 @@
Nuklear Examples
===================================
A list of examples; brief descriptions of each.

View File

@ -1,6 +0,0 @@
Walk Throughs
==================================
Annotated indepth guides that take you through building a real example.
Covering various topics, from beginner to advance.

View File

@ -1,35 +0,0 @@
.. Nuklear documentation master file
Nuklear
===================================
This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain.
It was designed as a simple embeddable user interface for application and does not have any dependencies, a default renderbackend or OS window and input handling but instead provides a very modular library approach by using simple input state for input and draw commands describing primitive shapes as output.
Rather than provide a layered library that tries to abstract over a number of platform and render backends, Nuklear only focuses on the actual UI.
Overview
========================
.. toctree::
overview/architecture
overview/best_practices
overview/getting_started
Learn
========================
.. toctree::
guides/walk_throughs
guides/examples
API Documentation
========================
.. toctree::
:maxdepth 3
api/reference

View File

@ -1,4 +0,0 @@
Architecture Overview
===================================
UI Concepts, Backend Agnostic ...

View File

@ -1,4 +0,0 @@
Best Practices
======================
...

View File

@ -1,2 +0,0 @@
Getting Started
===================================

814
nuklear.h
View File

@ -1,278 +1,203 @@
/*
Nuklear - 3.00.0 - public domain
no warranty implied; use at your own risk.
authored from 2015-2017 by Micha Mettke
ABOUT:
This is a minimal state graphical user interface single header toolkit
written in ANSI C and licensed under public domain.
It was designed as a simple embeddable user interface for application and does
not have any dependencies, a default renderbackend or OS window and input handling
but instead provides a very modular library approach by using simple input state
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 UI.
VALUES:
- Graphical user interface toolkit
- Single header library
- Written in C89 (a.k.a. ANSI C or ISO C90)
- Small codebase (~18kLOC)
- Focus on portability, efficiency and simplicity
- No dependencies (not even the standard library if not wanted)
- Fully skinnable and customizable
- Low memory footprint with total memory control if needed or wanted
- UTF-8 support
- No global or hidden state
- Customizable library modules (you can compile and use only what you need)
- Optional font baker and vertex buffer output
USAGE:
This library is self contained in one single header file and can be used either
in header only mode or in implementation mode. The header only mode is used
by default when included and allows including this header in other headers
and does not contain the actual implementation.
The implementation mode requires to define the preprocessor macro
NK_IMPLEMENTATION in *one* .c/.cpp file before #includeing this file, e.g.:
#define NK_IMPLEMENTATION
#include "nuklear.h"
Also optionally define the symbols listed in the section "OPTIONAL DEFINES"
below in header and implementation mode if you want to use additional functionality
or need more control over the library.
IMPORTANT: Every time you include "nuklear.h" you have to define the same flags.
This is very important not doing it either leads to compiler errors
or even worse stack corruptions.
FEATURES:
- Absolutely no platform dependent code
- Memory management control ranging from/to
- Ease of use by allocating everything from standard library
- Control every byte of memory inside the library
- Font handling control ranging from/to
- Use your own font implementation for everything
- Use this libraries internal font baking and handling API
- Drawing output control ranging from/to
- Simple shapes for more high level APIs which already have drawing capabilities
- Hardware accessible anti-aliased vertex buffer output
- Customizable colors and properties ranging from/to
- Simple changes to color by filling a simple color table
- Complete control with ability to use skinning to decorate widgets
- Bendable UI library with widget ranging from/to
- Basic widgets like buttons, checkboxes, slider, ...
- Advanced widget like abstract comboboxes, contextual menus,...
- Compile time configuration to only compile what you need
- Subset which can be used if you do not want to link or use the standard library
- Can be easily modified to only update on user input instead of frame updates
OPTIONAL DEFINES:
NK_PRIVATE
If defined declares all functions as static, so they can only be accessed
inside the file that contains the implementation
NK_INCLUDE_FIXED_TYPES
If defined it will include header <stdint.h> for fixed sized types
otherwise nuklear tries to select the correct type. If that fails it will
throw a compiler error and you have to select the correct types yourself.
<!> If used needs to be defined for implementation and header <!>
NK_INCLUDE_DEFAULT_ALLOCATOR
if defined it will include header <stdlib.h> and provide additional functions
to use this library without caring for memory allocation control and therefore
ease memory management.
<!> Adds the standard library with malloc and free so don't define if you
don't want to link to the standard library <!>
<!> If used needs to be defined for implementation and header <!>
NK_INCLUDE_STANDARD_IO
if defined it will include header <stdio.h> and provide
additional functions depending on file loading.
<!> Adds the standard library with fopen, fclose,... so don't define this
if you don't want to link to the standard library <!>
<!> If used needs to be defined for implementation and header <!>
NK_INCLUDE_STANDARD_VARARGS
if defined it will include header <stdarg.h> and provide
additional functions depending on variable arguments
<!> Adds the standard library with va_list and so don't define this if
you don't want to link to the standard library<!>
<!> If used needs to be defined for implementation and header <!>
NK_INCLUDE_VERTEX_BUFFER_OUTPUT
Defining this adds a vertex draw command list backend to this
library, which allows you to convert queue commands into vertex draw commands.
This is mainly if you need a hardware accessible format for OpenGL, DirectX,
Vulkan, Metal,...
<!> If used needs to be defined for implementation and header <!>
NK_INCLUDE_FONT_BAKING
Defining this adds `stb_truetype` and `stb_rect_pack` implementation
to this library and provides font baking and rendering.
If you already have font handling or do not want to use this font handler
you don't have to define it.
<!> If used needs to be defined for implementation and header <!>
NK_INCLUDE_DEFAULT_FONT
Defining this adds the default font: ProggyClean.ttf into this library
which can be loaded into a font atlas and allows using this library without
having a truetype font
<!> Enabling this adds ~12kb to global stack memory <!>
<!> If used needs to be defined for implementation and header <!>
NK_INCLUDE_COMMAND_USERDATA
Defining this adds a userdata pointer into each command. Can be useful for
example if you want to provide custom shaders depending on the used widget.
Can be combined with the style structures.
<!> If used needs to be defined for implementation and header <!>
NK_BUTTON_TRIGGER_ON_RELEASE
Different platforms require button clicks occurring either on buttons being
pressed (up to down) or released (down to up).
By default this library will react on buttons being pressed, but if you
define this it will only trigger if a button is released.
<!> If used it is only required to be defined for the implementation part <!>
NK_ZERO_COMMAND_MEMORY
Defining this will zero out memory for each drawing command added to a
drawing queue (inside nk_command_buffer_push). Zeroing command memory
is very useful for fast checking (using memcmp) if command buffers are
equal and avoid drawing frames when nothing on screen has changed since
previous frame.
NK_ASSERT
If you don't define this, nuklear will use <assert.h> with assert().
<!> Adds the standard library so define to nothing of not wanted <!>
<!> If used needs to be defined for implementation and header <!>
NK_BUFFER_DEFAULT_INITIAL_SIZE
Initial buffer size allocated by all buffers while using the default allocator
functions included by defining NK_INCLUDE_DEFAULT_ALLOCATOR. If you don't
want to allocate the default 4k memory then redefine it.
<!> If used needs to be defined for implementation and header <!>
NK_MAX_NUMBER_BUFFER
Maximum buffer size for the conversion buffer between float and string
Under normal circumstances this should be more than sufficient.
<!> If used needs to be defined for implementation and header <!>
NK_INPUT_MAX
Defines the max number of bytes which can be added as text input in one frame.
Under normal circumstances this should be more than sufficient.
<!> If used it is only required to be defined for the implementation part <!>
NK_MEMSET
You can define this to 'memset' or your own memset implementation
replacement. If not nuklear will use its own version.
<!> If used it is only required to be defined for the implementation part <!>
NK_MEMCPY
You can define this to 'memcpy' or your own memcpy implementation
replacement. If not nuklear will use its own version.
<!> If used it is only required to be defined for the implementation part <!>
NK_SQRT
You can define this to 'sqrt' or your own sqrt implementation
replacement. If not nuklear will use its own slow and not highly
accurate version.
<!> If used it is only required to be defined for the implementation part <!>
NK_SIN
You can define this to 'sinf' or your own sine implementation
replacement. If not nuklear will use its own approximation implementation.
<!> If used it is only required to be defined for the implementation part <!>
NK_COS
You can define this to 'cosf' or your own cosine implementation
replacement. If not nuklear will use its own approximation implementation.
<!> If used it is only required to be defined for the implementation part <!>
NK_STRTOD
You can define this to `strtod` or your own string to double conversion
implementation replacement. If not defined nuklear will use its own
imprecise and possibly unsafe version (does not handle nan or infinity!).
<!> If used it is only required to be defined for the implementation part <!>
NK_DTOA
You can define this to `dtoa` or your own double to string conversion
implementation replacement. If not defined nuklear will use its own
imprecise and possibly unsafe version (does not handle nan or infinity!).
<!> If used it is only required to be defined for the implementation part <!>
NK_VSNPRINTF
If you define `NK_INCLUDE_STANDARD_VARARGS` as well as `NK_INCLUDE_STANDARD_IO`
and want to be safe define this to `vsnprintf` on compilers supporting
later versions of C or C++. By default nuklear will check for your stdlib version
in C as well as compiler version in C++. if `vsnprintf` is available
it will define it to `vsnprintf` directly. If not defined and if you have
older versions of C or C++ it will be defined to `vsprintf` which is unsafe.
<!> If used it is only required to be defined for the implementation part <!>
NK_BYTE
NK_INT16
NK_UINT16
NK_INT32
NK_UINT32
NK_SIZE_TYPE
NK_POINTER_TYPE
If you compile without NK_USE_FIXED_TYPE then a number of standard types
will be selected and compile time validated. If they are incorrect you can
define the correct types by overloading these type defines.
CREDITS:
Developed by Micha Mettke and every direct or indirect contributor.
Embeds stb_texedit, stb_truetype and stb_rectpack by Sean Barret (public domain)
Embeds ProggyClean.ttf font by Tristan Grimmer (MIT license).
Big thank you to Omar Cornut (ocornut@github) for his imgui library and
giving me the inspiration for this library, Casey Muratori for handmade hero
and his original immediate mode graphical user interface idea and Sean
Barret for his amazing single header libraries which restored my faith
in libraries and brought me to create some of my own.
LICENSE:
------------------------------------------------------------------------------
This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License
Copyright (c) 2017 Micha Mettke
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------
/*/// # Nuklear
/// ![](https://cloud.githubusercontent.com/assets/8057201/11761525/ae06f0ca-a0c6-11e5-819d-5610b25f6ef4.gif)
///
/// ## Contents
/// 1. About section
/// 2. Highlights section
/// 3. Features section
/// 4. Usage section
/// 1. Flags section
/// 2. Constants section
/// 3. Dependencies section
/// 5. Example section
/// 6. License section
/// 7. Changelog section
/// 8. Gallery section
/// 9. Credits section
///
/// ## About
/// This is a minimal state immediate mode graphical user interface toolkit
/// written in ANSI C and licensed under public domain. It was designed as a simple
/// embeddable user interface for application and does not have any dependencies,
/// a default renderbackend or OS window and input handling but instead provides a very modular
/// library approach by using simple input state 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 UI.
///
/// ## Highlights
/// - Graphical user interface toolkit
/// - Single header library
/// - Written in C89 (a.k.a. ANSI C or ISO C90)
/// - Small codebase (~18kLOC)
/// - Focus on portability, efficiency and simplicity
/// - No dependencies (not even the standard library if not wanted)
/// - Fully skinnable and customizable
/// - Low memory footprint with total memory control if needed or wanted
/// - UTF-8 support
/// - No global or hidden state
/// - Customizable library modules (you can compile and use only what you need)
/// - Optional font baker and vertex buffer output
///
/// ## Features
/// - Absolutely no platform dependent code
/// - Memory management control ranging from/to
/// - Ease of use by allocating everything from standard library
/// - Control every byte of memory inside the library
/// - Font handling control ranging from/to
/// - Use your own font implementation for everything
/// - Use this libraries internal font baking and handling API
/// - Drawing output control ranging from/to
/// - Simple shapes for more high level APIs which already have drawing capabilities
/// - Hardware accessible anti-aliased vertex buffer output
/// - Customizable colors and properties ranging from/to
/// - Simple changes to color by filling a simple color table
/// - Complete control with ability to use skinning to decorate widgets
/// - Bendable UI library with widget ranging from/to
/// - Basic widgets like buttons, checkboxes, slider, ...
/// - Advanced widget like abstract comboboxes, contextual menus,...
/// - Compile time configuration to only compile what you need
/// - Subset which can be used if you do not want to link or use the standard library
/// - Can be easily modified to only update on user input instead of frame updates
///
/// ## Usage
/// This library is self contained in one single header file and can be used either
/// in header only mode or in implementation mode. The header only mode is used
/// by default when included and allows including this header in other headers
/// and does not contain the actual implementation. <br /><br />
///
/// The implementation mode requires to define the preprocessor macro
/// NK_IMPLEMENTATION in *one* .c/.cpp file before #includeing this file, e.g.:
///
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~C
/// #define NK_IMPLEMENTATION
/// #include "nuklear.h"
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
///
/// Also optionally define the symbols listed in the section "OPTIONAL DEFINES"
/// below in header and implementation mode if you want to use additional functionality
/// or need more control over the library.
///
/// !!! WARNING
/// Every time nuklear is included define the same compiler flags. This very important not doing so could lead to compiler errors or even worse stack corruptions.
///
/// ### Flags
/// Flag | Description
/// -----|-------------
/// NK_PRIVATE | If defined declares all functions as static, so they can only be accessed inside the file that contains the implementation
/// NK_INCLUDE_FIXED_TYPES | If defined it will include header `<stdint.h>` for fixed sized types otherwise nuklear tries to select the correct type. If that fails it will throw a compiler error and you have to select the correct types yourself.
/// NK_INCLUDE_DEFAULT_ALLOCATOR | if defined it will include header `<stdlib.h>` and provide additional functions to use this library without caring for memory allocation control and therefore ease memory management.
/// NK_INCLUDE_STANDARD_IO | if defined it will include header `<stdio.h>` and provide additional functions depending on file loading.
/// NK_INCLUDE_STANDARD_VARARGS | if defined it will include header <stdio.h> and provide additional functions depending on file loading.
/// NK_INCLUDE_VERTEX_BUFFER_OUTPUT | Defining this adds a vertex draw command list backend to this library, which allows you to convert queue commands into vertex draw commands. This is mainly if you need a hardware accessible format for OpenGL, DirectX, Vulkan, Metal,...
/// NK_INCLUDE_FONT_BAKING | Defining this adds `stb_truetype` and `stb_rect_pack` implementation to this library and provides font baking and rendering. If you already have font handling or do not want to use this font handler you don't have to define it.
/// NK_INCLUDE_DEFAULT_FONT | Defining this adds the default font: ProggyClean.ttf into this library which can be loaded into a font atlas and allows using this library without having a truetype font
/// NK_INCLUDE_COMMAND_USERDATA | Defining this adds a userdata pointer into each command. Can be useful for example if you want to provide custom shaders depending on the used widget. Can be combined with the style structures.
/// NK_BUTTON_TRIGGER_ON_RELEASE | Different platforms require button clicks occurring either on buttons being pressed (up to down) or released (down to up). By default this library will react on buttons being pressed, but if you define this it will only trigger if a button is released.
/// NK_ZERO_COMMAND_MEMORY | Defining this will zero out memory for each drawing command added to a drawing queue (inside nk_command_buffer_push). Zeroing command memory is very useful for fast checking (using memcmp) if command buffers are equal and avoid drawing frames when nothing on screen has changed since previous frame.
///
/// !!! WARNING
/// The following flags will pull in the standard C library:
/// - NK_INCLUDE_DEFAULT_ALLOCATOR
/// - NK_INCLUDE_STANDARD_IO
/// - NK_INCLUDE_STANDARD_VARARGS
///
/// !!! WARNING
/// The following flags if defined need to be defined for both header and implementation:
/// - NK_INCLUDE_FIXED_TYPES
/// - NK_INCLUDE_DEFAULT_ALLOCATOR
/// - NK_INCLUDE_STANDARD_VARARGS
/// - NK_INCLUDE_VERTEX_BUFFER_OUTPUT
/// - NK_INCLUDE_FONT_BAKING
/// - NK_INCLUDE_DEFAULT_FONT
/// - NK_INCLUDE_STANDARD_VARARGS
/// - NK_INCLUDE_COMMAND_USERDATA
///
/// ### Constants
/// Define | Description
/// -----|-------------
/// NK_BUFFER_DEFAULT_INITIAL_SIZE | Initial buffer size allocated by all buffers while using the default allocator functions included by defining NK_INCLUDE_DEFAULT_ALLOCATOR. If you don't want to allocate the default 4k memory then redefine it.
/// NK_MAX_NUMBER_BUFFER | Maximum buffer size for the conversion buffer between float and string Under normal circumstances this should be more than sufficient.
/// NK_INPUT_MAX | Defines the max number of bytes which can be added as text input in one frame. Under normal circumstances this should be more than sufficient.
///
/// !!! WARNING
/// The following constants if defined need to be defined for both header and implementation:
/// - NK_MAX_NUMBER_BUFFER
/// - NK_BUFFER_DEFAULT_INITIAL_SIZE
/// - NK_INPUT_MAX
///
/// ### Dependencies
/// Function | Description
/// -----|-------------
/// NK_ASSERT | If you don't define this, nuklear will use <assert.h> with assert().
/// NK_MEMSET | You can define this to 'memset' or your own memset implementation replacement. If not nuklear will use its own version.
/// NK_MEMCPY | You can define this to 'memcpy' or your own memcpy implementation replacement. If not nuklear will use its own version.
/// NK_SQRT | You can define this to 'sqrt' or your own sqrt implementation replacement. If not nuklear will use its own slow and not highly accurate version.
/// NK_SIN | You can define this to 'sinf' or your own sine implementation replacement. If not nuklear will use its own approximation implementation.
/// NK_COS | You can define this to 'cosf' or your own cosine implementation replacement. If not nuklear will use its own approximation implementation.
/// NK_STRTOD | You can define this to `strtod` or your own string to double conversion implementation replacement. If not defined nuklear will use its own imprecise and possibly unsafe version (does not handle nan or infinity!).
/// NK_DTOA | You can define this to `dtoa` or your own double to string conversion implementation replacement. If not defined nuklear will use its own imprecise and possibly unsafe version (does not handle nan or infinity!).
/// NK_VSNPRINTF | If you define `NK_INCLUDE_STANDARD_VARARGS` as well as `NK_INCLUDE_STANDARD_IO` and want to be safe define this to `vsnprintf` on compilers supporting later versions of C or C++. By default nuklear will check for your stdlib version in C as well as compiler version in C++. if `vsnprintf` is available it will define it to `vsnprintf` directly. If not defined and if you have older versions of C or C++ it will be defined to `vsprintf` which is unsafe.
///
/// !!! WARNING
/// The following dependencies will pull in the standard C library if not redefined:
/// - NK_ASSERT
///
/// !!! WARNING
/// The following dependencies if defined need to be defined for both header and implementation:
/// - NK_ASSERT
///
/// !!! WARNING
/// The following dependencies if defined need to be defined only for the implementation part:
/// - NK_MEMSET
/// - NK_MEMCPY
/// - NK_SQRT
/// - NK_SIN
/// - NK_COS
/// - NK_STRTOD
/// - NK_DTOA
/// - NK_VSNPRINTF
///
/// ## Example
///
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
/// // init gui state
/// enum {EASY, HARD};
/// static int op = EASY;
/// static float value = 0.6f;
/// static int i = 20;
/// struct nk_context ctx;
///
/// nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);
/// if (nk_begin(&ctx, "Show", nk_rect(50, 50, 220, 220),
/// NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
/// // fixed widget pixel width
/// nk_layout_row_static(&ctx, 30, 80, 1);
/// if (nk_button_label(&ctx, "button")) {
/// // event handling
/// }
///
/// // fixed widget window ratio width
/// nk_layout_row_dynamic(&ctx, 30, 2);
/// if (nk_option_label(&ctx, "easy", op == EASY)) op = EASY;
/// if (nk_option_label(&ctx, "hard", op == HARD)) op = HARD;
///
/// // custom widget pixel width
/// nk_layout_row_begin(&ctx, NK_STATIC, 30, 2);
/// {
/// nk_layout_row_push(&ctx, 50);
/// nk_label(&ctx, "Volume:", NK_TEXT_LEFT);
/// nk_layout_row_push(&ctx, 110);
/// nk_slider_float(&ctx, 0, &value, 1.0f, 0.1f);
/// }
/// nk_layout_row_end(&ctx);
/// }
/// nk_end(&ctx);
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
///
/// ![](https://cloud.githubusercontent.com/assets/8057201/10187981/584ecd68-675c-11e5-897c-822ef534a876.png)
///
///
*/
#ifndef NK_NUKLEAR_H_
#define NK_NUKLEAR_H_
@ -23921,3 +23846,342 @@ nk_menu_end(struct nk_context *ctx)
{nk_contextual_end(ctx);}
#endif /* NK_IMPLEMENTATION */
/*
/// ## License
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~none
/// ------------------------------------------------------------------------------
/// This software is available under 2 licenses -- choose whichever you prefer.
/// ------------------------------------------------------------------------------
/// ALTERNATIVE A - MIT License
/// Copyright (c) 2016-2018 Micha Mettke
/// Permission is hereby granted, free of charge, to any person obtaining a copy of
/// this software and associated documentation files (the "Software"), to deal in
/// the Software without restriction, including without limitation the rights to
/// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
/// of the Software, and to permit persons to whom the Software is furnished to do
/// so, subject to the following conditions:
/// The above copyright notice and this permission notice shall be included in all
/// copies or substantial portions of the Software.
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
/// ------------------------------------------------------------------------------
/// ALTERNATIVE B - Public Domain (www.unlicense.org)
/// This is free and unencumbered software released into the public domain.
/// Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
/// software, either in source code form or as a compiled binary, for any purpose,
/// commercial or non-commercial, and by any means.
/// In jurisdictions that recognize copyright laws, the author or authors of this
/// software dedicate any and all copyright interest in the software to the public
/// domain. We make this dedication for the benefit of the public at large and to
/// the detriment of our heirs and successors. We intend this dedication to be an
/// overt act of relinquishment in perpetuity of all present and future rights to
/// this software under copyright law.
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
/// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
/// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/// ------------------------------------------------------------------------------
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// ## Changelog
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~none
/// [date][x.yy.zz]-[description]
/// -[date]: date on which the change has been pushed
/// -[x.yy.zz]: Numerical version string representation. Each version number on the right
/// resets back to zero if version on the left is incremented.
/// - [x]: Major version with API and library breaking
/// - [yy]: Minor version with non-breaking API and library changes
/// - [zz]: Bug fix version with no direct changes to API
///
/// - 2017/01/07 (3.00.1) - Started to change documentation style
/// - 2017/01/05 (3.00.0) - BREAKING CHANGE: The previous color picker API was broken
/// because of conversions between float and byte color representation.
/// Color pickers now use floating point values to represent
/// HSV values. To get back the old behavior I added some additional
/// color conversion functions to cast between nk_color and
/// nk_colorf.
/// - 2017/12/23 (2.00.7) - Fixed small warning
/// - 2017/12/23 (2.00.7) - Fixed nk_edit_buffer behavior if activated to allow input
/// - 2017/12/23 (2.00.7) - Fixed modifyable progressbar dragging visuals and input behavior
/// - 2017/12/04 (2.00.6) - Added formated string tooltip widget
/// - 2017/11/18 (2.00.5) - Fixed window becoming hidden with flag NK_WINDOW_NO_INPUT
/// - 2017/11/15 (2.00.4) - Fixed font merging
/// - 2017/11/07 (2.00.3) - Fixed window size and position modifier functions
/// - 2017/09/14 (2.00.2) - Fixed nk_edit_buffer and nk_edit_focus behavior
/// - 2017/09/14 (2.00.1) - Fixed window closing behavior
/// - 2017/09/14 (2.00.0) - BREAKING CHANGE: Modifing window position and size funtions now
/// require the name of the window and must happen outside the window
/// building process (between function call nk_begin and nk_end).
/// - 2017/09/11 (1.40.9) - Fixed window background flag if background window is declared last
/// - 2017/08/27 (1.40.8) - Fixed `nk_item_is_any_active` for hidden windows
/// - 2017/08/27 (1.40.7) - Fixed window background flag
/// - 2017/07/07 (1.40.6) - Fixed missing clipping rect check for hovering/clicked
/// query for widgets
/// - 2017/07/07 (1.40.5) - Fixed drawing bug for vertex output for lines and stroked
/// and filled rectangles
/// - 2017/07/07 (1.40.4) - Fixed bug in nk_convert trying to add windows that are in
/// process of being destroyed.
/// - 2017/07/07 (1.40.3) - Fixed table internal bug caused by storing table size in
/// window instead of directly in table.
/// - 2017/06/30 (1.40.2) - Removed unneeded semicolon in C++ NK_ALIGNOF macro
/// - 2017/06/30 (1.40.1) - Fixed drawing lines smaller or equal zero
/// - 2017/06/08 (1.40.0) - Removed the breaking part of last commit. Auto layout now only
/// comes in effect if you pass in zero was row height argument
/// - 2017/06/08 (1.40.0) - BREAKING CHANGE: while not directly API breaking it will change
/// how layouting works. From now there will be an internal minimum
/// row height derived from font height. If you need a row smaller than
/// that you can directly set it by `nk_layout_set_min_row_height` and
/// reset the value back by calling `nk_layout_reset_min_row_height.
/// - 2017/06/08 (1.39.1) - Fixed property text edit handling bug caused by past `nk_widget` fix
/// - 2017/06/08 (1.39.0) - Added function to retrieve window space without calling a nk_layout_xxx function
/// - 2017/06/06 (1.38.5) - Fixed `nk_convert` return flag for command buffer
/// - 2017/05/23 (1.38.4) - Fixed activation behavior for widgets partially clipped
/// - 2017/05/10 (1.38.3) - Fixed wrong min window size mouse scaling over boundries
/// - 2017/05/09 (1.38.2) - Fixed vertical scrollbar drawing with not enough space
/// - 2017/05/09 (1.38.1) - Fixed scaler dragging behavior if window size hits minimum size
/// - 2017/05/06 (1.38.0) - Added platform double-click support
/// - 2017/04/20 (1.37.1) - Fixed key repeat found inside glfw demo backends
/// - 2017/04/20 (1.37.0) - Extended properties with selection and clipbard support
/// - 2017/04/20 (1.36.2) - Fixed #405 overlapping rows with zero padding and spacing
/// - 2017/04/09 (1.36.1) - Fixed #403 with another widget float error
/// - 2017/04/09 (1.36.0) - Added window `NK_WINDOW_NO_INPUT` and `NK_WINDOW_NOT_INTERACTIVE` flags
/// - 2017/04/09 (1.35.3) - Fixed buffer heap corruption
/// - 2017/03/25 (1.35.2) - Fixed popup overlapping for `NK_WINDOW_BACKGROUND` windows
/// - 2017/03/25 (1.35.1) - Fixed windows closing behavior
/// - 2017/03/18 (1.35.0) - Added horizontal scroll requested in #377
/// - 2017/03/18 (1.34.3) - Fixed long window header titles
/// - 2017/03/04 (1.34.2) - Fixed text edit filtering
/// - 2017/03/04 (1.34.1) - Fixed group closable flag
/// - 2017/02/25 (1.34.0) - Added custom draw command for better language binding support
/// - 2017/01/24 (1.33.0) - Added programatic way of remove edit focus
/// - 2017/01/24 (1.32.3) - Fixed wrong define for basic type definitions for windows
/// - 2017/01/21 (1.32.2) - Fixed input capture from hidden or closed windows
/// - 2017/01/21 (1.32.1) - Fixed slider behavior and drawing
/// - 2017/01/13 (1.32.0) - Added flag to put scaler into the bottom left corner
/// - 2017/01/13 (1.31.0) - Added additional row layouting method to combine both
/// dynamic and static widgets.
/// - 2016/12/31 (1.30.0) - Extended scrollbar offset from 16-bit to 32-bit
/// - 2016/12/31 (1.29.2)- Fixed closing window bug of minimized windows
/// - 2016/12/03 (1.29.1)- Fixed wrapped text with no seperator and C89 error
/// - 2016/12/03 (1.29.0) - Changed text wrapping to process words not characters
/// - 2016/11/22 (1.28.6)- Fixed window minimized closing bug
/// - 2016/11/19 (1.28.5)- Fixed abstract combo box closing behavior
/// - 2016/11/19 (1.28.4)- Fixed tooltip flickering
/// - 2016/11/19 (1.28.3)- Fixed memory leak caused by popup repeated closing
/// - 2016/11/18 (1.28.2)- Fixed memory leak caused by popup panel allocation
/// - 2016/11/10 (1.28.1)- Fixed some warnings and C++ error
/// - 2016/11/10 (1.28.0)- Added additional `nk_button` versions which allows to directly
/// pass in a style struct to change buttons visual.
/// - 2016/11/10 (1.27.0)- Added additional 'nk_tree' versions to support external state
/// storage. Just like last the `nk_group` commit the main
/// advantage is that you optionally can minimize nuklears runtime
/// memory consumption or handle hash collisions.
/// - 2016/11/09 (1.26.0)- Added additional `nk_group` version to support external scrollbar
/// offset storage. Main advantage is that you can externalize
/// the memory management for the offset. It could also be helpful
/// if you have a hash collision in `nk_group_begin` but really
/// want the name. In addition I added `nk_list_view` which allows
/// to draw big lists inside a group without actually having to
/// commit the whole list to nuklear (issue #269).
/// - 2016/10/30 (1.25.1)- Fixed clipping rectangle bug inside `nk_draw_list`
/// - 2016/10/29 (1.25.0)- Pulled `nk_panel` memory management into nuklear and out of
/// the hands of the user. From now on users don't have to care
/// about panels unless they care about some information. If you
/// still need the panel just call `nk_window_get_panel`.
/// - 2016/10/21 (1.24.0)- Changed widget border drawing to stroked rectangle from filled
/// rectangle for less overdraw and widget background transparency.
/// - 2016/10/18 (1.23.0)- Added `nk_edit_focus` for manually edit widget focus control
/// - 2016/09/29 (1.22.7)- Fixed deduction of basic type in non `<stdint.h>` compilation
/// - 2016/09/29 (1.22.6)- Fixed edit widget UTF-8 text cursor drawing bug
/// - 2016/09/28 (1.22.5)- Fixed edit widget UTF-8 text appending/inserting/removing
/// - 2016/09/28 (1.22.4)- Fixed drawing bug inside edit widgets which offset all text
/// text in every edit widget if one of them is scrolled.
/// - 2016/09/28 (1.22.3)- Fixed small bug in edit widgets if not active. The wrong
/// text length is passed. It should have been in bytes but
/// was passed as glyphes.
/// - 2016/09/20 (1.22.2)- Fixed color button size calculation
/// - 2016/09/20 (1.22.1)- Fixed some `nk_vsnprintf` behavior bugs and removed
/// `<stdio.h>` again from `NK_INCLUDE_STANDARD_VARARGS`.
/// - 2016/09/18 (1.22.0)- C89 does not support vsnprintf only C99 and newer as well
/// as C++11 and newer. In addition to use vsnprintf you have
/// to include <stdio.h>. So just defining `NK_INCLUDE_STD_VAR_ARGS`
/// is not enough. That behavior is now fixed. By default if
/// both varargs as well as stdio is selected I try to use
/// vsnprintf if not possible I will revert to vsprintf. If
/// varargs but not stdio was defined I will use my own function.
/// - 2016/09/15 (1.21.2)- Fixed panel `close` behavior for deeper panel levels
/// - 2016/09/15 (1.21.1)- Fixed C++ errors and wrong argument to `nk_panel_get_xxxx`
/// - 2016/09/13 (1.21.0) - !BREAKING! Fixed nonblocking popup behavior in menu, combo,
/// and contextual which prevented closing in y-direction if
/// popup did not reach max height.
/// In addition the height parameter was changed into vec2
/// for width and height to have more control over the popup size.
/// - 2016/09/13 (1.20.3) - Cleaned up and extended type selection
/// - 2016/09/13 (1.20.2)- Fixed slider behavior hopefully for the last time. This time
/// all calculation are correct so no more hackery.
/// - 2016/09/13 (1.20.1)- Internal change to divide window/panel flags into panel flags and types.
/// Suprisinly spend years in C and still happened to confuse types
/// with flags. Probably something to take note.
/// - 2016/09/08 (1.20.0)- Added additional helper function to make it easier to just
/// take the produced buffers from `nk_convert` and unplug the
/// iteration process from `nk_context`. So now you can
/// just use the vertex,element and command buffer + two pointer
/// inside the command buffer retrieved by calls `nk__draw_begin`
/// and `nk__draw_end` and macro `nk_draw_foreach_bounded`.
/// - 2016/09/08 (1.19.0)- Added additional asserts to make sure every `nk_xxx_begin` call
/// for windows, popups, combobox, menu and contextual is guarded by
/// `if` condition and does not produce false drawing output.
/// - 2016/09/08 (1.18.0)- Changed confusing name for `NK_SYMBOL_RECT_FILLED`, `NK_SYMBOL_RECT`
/// to hopefully easier to understand `NK_SYMBOL_RECT_FILLED` and
/// `NK_SYMBOL_RECT_OUTLINE`.
/// - 2016/09/08 (1.17.0)- Changed confusing name for `NK_SYMBOL_CIRLCE_FILLED`, `NK_SYMBOL_CIRCLE`
/// to hopefully easier to understand `NK_SYMBOL_CIRCLE_FILLED` and
/// `NK_SYMBOL_CIRCLE_OUTLINE`.
/// - 2016/09/08 (1.16.0)- Added additional checks to select correct types if `NK_INCLUDE_FIXED_TYPES`
/// is not defined by supporting the biggest compiler GCC, clang and MSVC.
/// - 2016/09/07 (1.15.3)- Fixed `NK_INCLUDE_COMMAND_USERDATA` define to not cause an error
/// - 2016/09/04 (1.15.2)- Fixed wrong combobox height calculation
/// - 2016/09/03 (1.15.1)- Fixed gaps inside combo boxes in OpenGL
/// - 2016/09/02 (1.15.0) - Changed nuklear to not have any default vertex layout and
/// instead made it user provided. The range of types to convert
/// to is quite limited at the moment, but I would be more than
/// happy to accept PRs to add additional.
/// - 2016/08/30 (1.14.2) - Removed unused variables
/// - 2016/08/30 (1.14.1) - Fixed C++ build errors
/// - 2016/08/30 (1.14.0) - Removed mouse dragging from SDL demo since it does not work correctly
/// - 2016/08/30 (1.13.4) - Tweaked some default styling variables
/// - 2016/08/30 (1.13.3) - Hopefully fixed drawing bug in slider, in general I would
/// refrain from using slider with a big number of steps.
/// - 2016/08/30 (1.13.2) - Fixed close and minimize button which would fire even if the
/// window was in Read Only Mode.
/// - 2016/08/30 (1.13.1) - Fixed popup panel padding handling which was previously just
/// a hack for combo box and menu.
/// - 2016/08/30 (1.13.0) - Removed `NK_WINDOW_DYNAMIC` flag from public API since
/// it is bugged and causes issues in window selection.
/// - 2016/08/30 (1.12.0) - Removed scaler size. The size of the scaler is now
/// determined by the scrollbar size
/// - 2016/08/30 (1.11.2) - Fixed some drawing bugs caused by changes from 1.11
/// - 2016/08/30 (1.11.1) - Fixed overlapping minimized window selection
/// - 2016/08/30 (1.11.0) - Removed some internal complexity and overly complex code
/// handling panel padding and panel border.
/// - 2016/08/29 (1.10.0) - Added additional height parameter to `nk_combobox_xxx`
/// - 2016/08/29 (1.10.0) - Fixed drawing bug in dynamic popups
/// - 2016/08/29 (1.10.0) - Added experimental mouse scrolling to popups, menus and comboboxes
/// - 2016/08/26 (1.10.0) - Added window name string prepresentation to account for
/// hash collisions. Currently limited to NK_WINDOW_MAX_NAME
/// which in term can be redefined if not big enough.
/// - 2016/08/26 (1.10.0) - Added stacks for temporary style/UI changes in code
/// - 2016/08/25 (1.10.0) - Changed `nk_input_is_key_pressed` and 'nk_input_is_key_released'
/// to account for key press and release happening in one frame.
/// - 2016/08/25 (1.10.0) - Added additional nk_edit flag to directly jump to the end on activate
/// - 2016/08/17 (1.09.6)- Removed invalid check for value zero in nk_propertyx
/// - 2016/08/16 (1.09.5)- Fixed ROM mode for deeper levels of popup windows parents.
/// - 2016/08/15 (1.09.4)- Editbox are now still active if enter was pressed with flag
/// `NK_EDIT_SIG_ENTER`. Main reasoning is to be able to keep
/// typing after commiting.
/// - 2016/08/15 (1.09.4)- Removed redundant code
/// - 2016/08/15 (1.09.4)- Fixed negative numbers in `nk_strtoi` and remove unused variable
/// - 2016/08/15 (1.09.3)- Fixed `NK_WINDOW_BACKGROUND` flag behavior to select a background
/// window only as selected by hovering and not by clicking.
/// - 2016/08/14 (1.09.2)- Fixed a bug in font atlas which caused wrong loading
/// of glyphes for font with multiple ranges.
/// - 2016/08/12 (1.09.1)- Added additional function to check if window is currently
/// hidden and therefore not visible.
/// - 2016/08/12 (1.09.1)- nk_window_is_closed now queries the correct flag `NK_WINDOW_CLOSED`
/// instead of the old flag `NK_WINDOW_HIDDEN`
/// - 2016/08/09 (1.09.0) - Added additional double version to nk_property and changed
/// the underlying implementation to not cast to float and instead
/// work directly on the given values.
/// - 2016/08/09 (1.08.0) - Added additional define to overwrite library internal
/// floating pointer number to string conversion for additional
/// precision.
/// - 2016/08/09 (1.08.0) - Added additional define to overwrite library internal
/// string to floating point number conversion for additional
/// precision.
/// - 2016/08/08 (1.07.2)- Fixed compiling error without define NK_INCLUDE_FIXED_TYPE
/// - 2016/08/08 (1.07.1)- Fixed possible floating point error inside `nk_widget` leading
/// to wrong wiget width calculation which results in widgets falsly
/// becomming tagged as not inside window and cannot be accessed.
/// - 2016/08/08 (1.07.0) - Nuklear now differentiates between hiding a window (NK_WINDOW_HIDDEN) and
/// closing a window (NK_WINDOW_CLOSED). A window can be hidden/shown
/// by using `nk_window_show` and closed by either clicking the close
/// icon in a window or by calling `nk_window_close`. Only closed
/// windows get removed at the end of the frame while hidden windows
/// remain.
/// - 2016/08/08 (1.06.0) - Added `nk_edit_string_zero_terminated` as a second option to
/// `nk_edit_string` which takes, edits and outputs a '\0' terminated string.
/// - 2016/08/08 (1.05.4)- Fixed scrollbar auto hiding behavior
/// - 2016/08/08 (1.05.3)- Fixed wrong panel padding selection in `nk_layout_widget_space`
/// - 2016/08/07 (1.05.2)- Fixed old bug in dynamic immediate mode layout API, calculating
/// wrong item spacing and panel width.
///- 2016/08/07 (1.05.1)- Hopefully finally fixed combobox popup drawing bug
///- 2016/08/07 (1.05.0) - Split varargs away from NK_INCLUDE_STANDARD_IO into own
/// define NK_INCLUDE_STANDARD_VARARGS to allow more fine
/// grained controlled over library includes.
/// - 2016/08/06 (1.04.5)- Changed memset calls to NK_MEMSET
/// - 2016/08/04 (1.04.4)- Fixed fast window scaling behavior
/// - 2016/08/04 (1.04.3)- Fixed window scaling, movement bug which appears if you
/// move/scale a window and another window is behind it.
/// If you are fast enough then the window behind gets activated
/// and the operation is blocked. I now require activating
/// by hovering only if mouse is not pressed.
/// - 2016/08/04 (1.04.2)- Fixed changing fonts
/// - 2016/08/03 (1.04.1)- Fixed `NK_WINDOW_BACKGROUND` behavior
/// - 2016/08/03 (1.04.0) - Added color parameter to `nk_draw_image`
/// - 2016/08/03 (1.04.0) - Added additional window padding style attributes for
/// sub windows (combo, menu, ...)
/// - 2016/08/03 (1.04.0) - Added functions to show/hide software cursor
/// - 2016/08/03 (1.04.0) - Added `NK_WINDOW_BACKGROUND` flag to force a window
/// to be always in the background of the screen
/// - 2016/08/03 (1.03.2)- Removed invalid assert macro for NK_RGB color picker
/// - 2016/08/01 (1.03.1)- Added helper macros into header include guard
/// - 2016/07/29 (1.03.0) - Moved the window/table pool into the header part to
/// simplify memory management by removing the need to
/// allocate the pool.
/// - 2016/07/29 (1.02.0) - Added auto scrollbar hiding window flag which if enabled
/// will hide the window scrollbar after NK_SCROLLBAR_HIDING_TIMEOUT
/// seconds without window interaction. To make it work
/// you have to also set a delta time inside the `nk_context`.
/// - 2016/07/25 (1.01.1) - Fixed small panel and panel border drawing bugs
/// - 2016/07/15 (1.01.0) - Added software cursor to `nk_style` and `nk_context`
/// - 2016/07/15 (1.01.0) - Added const correctness to `nk_buffer_push' data argument
/// - 2016/07/15 (1.01.0) - Removed internal font baking API and simplified
/// font atlas memory management by converting pointer
/// arrays for fonts and font configurations to lists.
/// - 2016/07/15 (1.00.0) - Changed button API to use context dependend button
/// behavior instead of passing it for every function call.
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
///
/// ## Gallery
/// ![Figure [blue]: Feature overview with blue color styling](https://cloud.githubusercontent.com/assets/8057201/13538240/acd96876-e249-11e5-9547-5ac0b19667a0.png)
/// ![Figure [red]: Feature overview with red color styling](https://cloud.githubusercontent.com/assets/8057201/13538243/b04acd4c-e249-11e5-8fd2-ad7744a5b446.png)
/// ![Figure [widgets]: Widget overview](https://cloud.githubusercontent.com/assets/8057201/11282359/3325e3c6-8eff-11e5-86cb-cf02b0596087.png)
/// ![Figure [blackwhite]: Black and white](https://cloud.githubusercontent.com/assets/8057201/11033668/59ab5d04-86e5-11e5-8091-c56f16411565.png)
/// ![Figure [filexp]: File explorer](https://cloud.githubusercontent.com/assets/8057201/10718115/02a9ba08-7b6b-11e5-950f-adacdd637739.png)
/// ![Figure [opengl]: OpenGL Editor](https://cloud.githubusercontent.com/assets/8057201/12779619/2a20d72c-ca69-11e5-95fe-4edecf820d5c.png)
/// ![Figure [nodedit]: Node Editor](https://cloud.githubusercontent.com/assets/8057201/9976995/e81ac04a-5ef7-11e5-872b-acd54fbeee03.gif)
/// ![Figure [skinning]: Using skinning in Nuklear](https://cloud.githubusercontent.com/assets/8057201/15991632/76494854-30b8-11e6-9555-a69840d0d50b.png)
/// ![Figure [bf]: Heavy modified version](https://cloud.githubusercontent.com/assets/8057201/14902576/339926a8-0d9c-11e6-9fee-a8b73af04473.png)
///
/// ## Credits
/// Developed by Micha Mettke and every direct or indirect github contributor. <br /><br />
///
/// Embeds [stb_texedit](https://github.com/nothings/stb/blob/master/stb_textedit.h), [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) and [stb_rectpack](https://github.com/nothings/stb/blob/master/stb_rect_pack.h) by Sean Barret (public domain) <br />
/// Uses [stddoc.c](https://github.com/r-lyeh/stddoc.c) from r-lyeh@github.com for documentation generation <br /><br />
/// Embeds ProggyClean.ttf font by Tristan Grimmer (MIT license). <br />
///
/// Big thank you to Omar Cornut (ocornut@github) for his [imgui library](https://github.com/ocornut/imgui) and
/// giving me the inspiration for this library, Casey Muratori for handmade hero
/// and his original immediate mode graphical user interface idea and Sean
/// Barret for his amazing single header libraries which restored my faith
/// in libraries and brought me to create some of my own.
///
*/