index.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=11"/>
  6. <meta name="generator" content="Doxygen 1.9.8"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>Nuklear: Nuklear</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="resize.js"></script>
  14. <script type="text/javascript" src="navtreedata.js"></script>
  15. <script type="text/javascript" src="navtree.js"></script>
  16. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  17. <script type="text/javascript" src="search/searchdata.js"></script>
  18. <script type="text/javascript" src="search/search.js"></script>
  19. <script type="text/javascript">
  20. /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  21. $(document).ready(function() { init_search(); });
  22. /* @license-end */
  23. </script>
  24. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  25. <link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
  26. </head>
  27. <body>
  28. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  29. <div id="titlearea">
  30. <table cellspacing="0" cellpadding="0">
  31. <tbody>
  32. <tr id="projectrow">
  33. <td id="projectalign">
  34. <div id="projectname">Nuklear
  35. </div>
  36. <div id="projectbrief">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 render backend or OS window/input handling but instead provides a highly modular, library-based approach, with 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 focuses only on the actual UI.</div>
  37. </td>
  38. <td> <div id="MSearchBox" class="MSearchBoxInactive">
  39. <span class="left">
  40. <span id="MSearchSelect" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()">&#160;</span>
  41. <input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
  42. onfocus="searchBox.OnSearchFieldFocus(true)"
  43. onblur="searchBox.OnSearchFieldFocus(false)"
  44. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  45. </span><span class="right">
  46. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
  47. </span>
  48. </div>
  49. </td>
  50. </tr>
  51. </tbody>
  52. </table>
  53. </div>
  54. <!-- end header part -->
  55. <!-- Generated by Doxygen 1.9.8 -->
  56. <script type="text/javascript">
  57. /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  58. var searchBox = new SearchBox("searchBox", "search/",'.html');
  59. /* @license-end */
  60. </script>
  61. </div><!-- top -->
  62. <div id="side-nav" class="ui-resizable side-nav-resizable">
  63. <div id="nav-tree">
  64. <div id="nav-tree-contents">
  65. <div id="nav-sync" class="sync"></div>
  66. </div>
  67. </div>
  68. <div id="splitbar" style="-moz-user-select:none;"
  69. class="ui-resizable-handle">
  70. </div>
  71. </div>
  72. <script type="text/javascript">
  73. /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
  74. $(document).ready(function(){initNavTree('index.html',''); initResizable(); });
  75. /* @license-end */
  76. </script>
  77. <div id="doc-content">
  78. <!-- window showing the filter options -->
  79. <div id="MSearchSelectWindow"
  80. onmouseover="return searchBox.OnSearchSelectShow()"
  81. onmouseout="return searchBox.OnSearchSelectHide()"
  82. onkeydown="return searchBox.OnSearchSelectKey(event)">
  83. </div>
  84. <!-- iframe showing the search results (closed by default) -->
  85. <div id="MSearchResultsWindow">
  86. <div id="MSearchResults">
  87. <div class="SRPage">
  88. <div id="SRIndex">
  89. <div id="SRResults"></div>
  90. <div class="SRStatus" id="Loading">Loading...</div>
  91. <div class="SRStatus" id="Searching">Searching...</div>
  92. <div class="SRStatus" id="NoMatches">No Matches</div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <div><div class="header">
  98. <div class="headertitle"><div class="title">Nuklear </div></div>
  99. </div><!--header-->
  100. <div class="contents">
  101. <div class="textblock"><p><a class="anchor" id="md_src_2HEADER"></a><img src="https://cloud.githubusercontent.com/assets/8057201/11761525/ae06f0ca-a0c6-11e5-819d-5610b25f6ef4.gif" alt="" class="inline"/></p>
  102. <h1><a class="anchor" id="autotoc_md1"></a>
  103. Contents</h1>
  104. <ol type="1">
  105. <li>About section</li>
  106. <li>Highlights section</li>
  107. <li>Features section</li>
  108. <li>Usage section<ol type="a">
  109. <li>Flags section</li>
  110. <li>Constants section</li>
  111. <li>Dependencies section</li>
  112. </ol>
  113. </li>
  114. <li>Example section</li>
  115. <li>API section<ol type="a">
  116. <li>Context section</li>
  117. <li>Input section</li>
  118. <li>Drawing section</li>
  119. <li>Window section</li>
  120. <li>Layouting section</li>
  121. <li>Groups section</li>
  122. <li>Tree section</li>
  123. <li>Properties section</li>
  124. </ol>
  125. </li>
  126. <li>License section</li>
  127. <li>Changelog section</li>
  128. <li>Gallery section</li>
  129. <li>Credits section</li>
  130. </ol>
  131. <h1><a class="anchor" id="autotoc_md2"></a>
  132. About</h1>
  133. <p>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.</p>
  134. <h1><a class="anchor" id="autotoc_md3"></a>
  135. Highlights</h1>
  136. <ul>
  137. <li>Graphical user interface toolkit</li>
  138. <li>Single header library</li>
  139. <li>Written in C89 (a.k.a. ANSI C or ISO C90)</li>
  140. <li>Small codebase (~18kLOC)</li>
  141. <li>Focus on portability, efficiency and simplicity</li>
  142. <li>No dependencies (not even the standard library if not wanted)</li>
  143. <li>Fully skinnable and customizable</li>
  144. <li>Low memory footprint with total memory control if needed or wanted</li>
  145. <li>UTF-8 support</li>
  146. <li>No global or hidden state</li>
  147. <li>Customizable library modules (you can compile and use only what you need)</li>
  148. <li>Optional font baker and vertex buffer output</li>
  149. <li><a href="https://github.com/Immediate-Mode-UI/Nuklear/">Code available on github</a></li>
  150. </ul>
  151. <h1><a class="anchor" id="autotoc_md4"></a>
  152. Features</h1>
  153. <ul>
  154. <li>Absolutely no platform dependent code</li>
  155. <li>Memory management control ranging from/to<ul>
  156. <li>Ease of use by allocating everything from standard library</li>
  157. <li>Control every byte of memory inside the library</li>
  158. </ul>
  159. </li>
  160. <li>Font handling control ranging from/to<ul>
  161. <li>Use your own font implementation for everything</li>
  162. <li>Use this libraries internal font baking and handling API</li>
  163. </ul>
  164. </li>
  165. <li>Drawing output control ranging from/to<ul>
  166. <li>Simple shapes for more high level APIs which already have drawing capabilities</li>
  167. <li>Hardware accessible anti-aliased vertex buffer output</li>
  168. </ul>
  169. </li>
  170. <li>Customizable colors and properties ranging from/to<ul>
  171. <li>Simple changes to color by filling a simple color table</li>
  172. <li>Complete control with ability to use skinning to decorate widgets</li>
  173. </ul>
  174. </li>
  175. <li>Bendable UI library with widget ranging from/to<ul>
  176. <li>Basic widgets like buttons, checkboxes, slider, ...</li>
  177. <li>Advanced widget like abstract comboboxes, contextual menus,...</li>
  178. </ul>
  179. </li>
  180. <li>Compile time configuration to only compile what you need<ul>
  181. <li>Subset which can be used if you do not want to link or use the standard library</li>
  182. </ul>
  183. </li>
  184. <li>Can be easily modified to only update on user input instead of frame updates</li>
  185. </ul>
  186. <h1><a class="anchor" id="autotoc_md5"></a>
  187. Usage</h1>
  188. <p>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 />
  189. <br />
  190. </p>
  191. <p>The implementation mode requires to define the preprocessor macro NK_IMPLEMENTATION in <em>one</em> .c/.cpp file before #including this file, e.g.:</p>
  192. <div class="fragment"><div class="line"><span class="preprocessor">#define NK_IMPLEMENTATION</span></div>
  193. <div class="line"><span class="preprocessor">#include &quot;<a class="code" href="nuklear_8h.html">nuklear.h</a>&quot;</span></div>
  194. <div class="ttc" id="anuklear_8h_html"><div class="ttname"><a href="nuklear_8h.html">nuklear.h</a></div><div class="ttdoc">main API and documentation file</div></div>
  195. </div><!-- fragment --><p>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.</p>
  196. <p>!!! 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.</p>
  197. <h2><a class="anchor" id="autotoc_md6"></a>
  198. Flags</h2>
  199. <table class="markdownTable">
  200. <tr class="markdownTableHead">
  201. <th class="markdownTableHeadNone">Flag </th><th class="markdownTableHeadNone">Description </th></tr>
  202. <tr class="markdownTableRowOdd">
  203. <td class="markdownTableBodyNone">NK_PRIVATE </td><td class="markdownTableBodyNone">If defined declares all functions as static, so they can only be accessed inside the file that contains the implementation </td></tr>
  204. <tr class="markdownTableRowEven">
  205. <td class="markdownTableBodyNone">NK_INCLUDE_FIXED_TYPES </td><td class="markdownTableBodyNone">If defined it will include header <code>&lt;stdint.h&gt;</code> 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. </td></tr>
  206. <tr class="markdownTableRowOdd">
  207. <td class="markdownTableBodyNone">NK_INCLUDE_DEFAULT_ALLOCATOR </td><td class="markdownTableBodyNone">If defined it will include header <code>&lt;stdlib.h&gt;</code> and provide additional functions to use this library without caring for memory allocation control and therefore ease memory management. </td></tr>
  208. <tr class="markdownTableRowEven">
  209. <td class="markdownTableBodyNone">NK_INCLUDE_STANDARD_IO </td><td class="markdownTableBodyNone">If defined it will include header <code>&lt;stdio.h&gt;</code> and provide additional functions depending on file loading. </td></tr>
  210. <tr class="markdownTableRowOdd">
  211. <td class="markdownTableBodyNone">NK_INCLUDE_STANDARD_VARARGS </td><td class="markdownTableBodyNone">If defined it will include header &lt;stdarg.h&gt; and provide additional functions depending on file loading. </td></tr>
  212. <tr class="markdownTableRowEven">
  213. <td class="markdownTableBodyNone">NK_INCLUDE_STANDARD_BOOL </td><td class="markdownTableBodyNone">If defined it will include header <code>&lt;stdbool.h&gt;</code> for nk_bool otherwise nuklear defines nk_bool as int. </td></tr>
  214. <tr class="markdownTableRowOdd">
  215. <td class="markdownTableBodyNone">NK_INCLUDE_VERTEX_BUFFER_OUTPUT </td><td class="markdownTableBodyNone">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,... </td></tr>
  216. <tr class="markdownTableRowEven">
  217. <td class="markdownTableBodyNone">NK_INCLUDE_FONT_BAKING </td><td class="markdownTableBodyNone">Defining this adds <code>stb_truetype</code> and <code>stb_rect_pack</code> 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. </td></tr>
  218. <tr class="markdownTableRowOdd">
  219. <td class="markdownTableBodyNone">NK_INCLUDE_DEFAULT_FONT </td><td class="markdownTableBodyNone">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 </td></tr>
  220. <tr class="markdownTableRowEven">
  221. <td class="markdownTableBodyNone">NK_INCLUDE_COMMAND_USERDATA </td><td class="markdownTableBodyNone">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. </td></tr>
  222. <tr class="markdownTableRowOdd">
  223. <td class="markdownTableBodyNone">NK_BUTTON_TRIGGER_ON_RELEASE </td><td class="markdownTableBodyNone">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. </td></tr>
  224. <tr class="markdownTableRowEven">
  225. <td class="markdownTableBodyNone">NK_ZERO_COMMAND_MEMORY </td><td class="markdownTableBodyNone">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. </td></tr>
  226. <tr class="markdownTableRowOdd">
  227. <td class="markdownTableBodyNone">NK_UINT_DRAW_INDEX </td><td class="markdownTableBodyNone">Defining this will set the size of vertex index elements when using NK_VERTEX_BUFFER_OUTPUT to 32bit instead of the default of 16bit </td></tr>
  228. <tr class="markdownTableRowEven">
  229. <td class="markdownTableBodyNone">NK_KEYSTATE_BASED_INPUT </td><td class="markdownTableBodyNone">Define this if your backend uses key state for each frame rather than key press/release events </td></tr>
  230. <tr class="markdownTableRowOdd">
  231. <td class="markdownTableBodyNone">NK_IS_WORD_BOUNDARY(c) </td><td class="markdownTableBodyNone">Define this to a function macro that takes a single nk_rune (nk_uint) and returns true if it's a word separator. If not defined, uses the default definition (see nk_is_word_boundary()) </td></tr>
  232. </table>
  233. <p>!!! WARNING The following flags will pull in the standard C library:</p><ul>
  234. <li>NK_INCLUDE_DEFAULT_ALLOCATOR</li>
  235. <li>NK_INCLUDE_STANDARD_IO</li>
  236. <li>NK_INCLUDE_STANDARD_VARARGS</li>
  237. </ul>
  238. <p>!!! WARNING The following flags if defined need to be defined for both header and implementation:</p><ul>
  239. <li>NK_INCLUDE_FIXED_TYPES</li>
  240. <li>NK_INCLUDE_DEFAULT_ALLOCATOR</li>
  241. <li>NK_INCLUDE_STANDARD_VARARGS</li>
  242. <li>NK_INCLUDE_STANDARD_BOOL</li>
  243. <li>NK_INCLUDE_VERTEX_BUFFER_OUTPUT</li>
  244. <li>NK_INCLUDE_FONT_BAKING</li>
  245. <li>NK_INCLUDE_DEFAULT_FONT</li>
  246. <li>NK_INCLUDE_STANDARD_VARARGS</li>
  247. <li>NK_INCLUDE_COMMAND_USERDATA</li>
  248. <li>NK_UINT_DRAW_INDEX</li>
  249. </ul>
  250. <h2><a class="anchor" id="autotoc_md7"></a>
  251. Constants</h2>
  252. <table class="markdownTable">
  253. <tr class="markdownTableHead">
  254. <th class="markdownTableHeadNone">Define </th><th class="markdownTableHeadNone">Description </th></tr>
  255. <tr class="markdownTableRowOdd">
  256. <td class="markdownTableBodyNone">NK_BUFFER_DEFAULT_INITIAL_SIZE </td><td class="markdownTableBodyNone">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. </td></tr>
  257. <tr class="markdownTableRowEven">
  258. <td class="markdownTableBodyNone">NK_MAX_NUMBER_BUFFER </td><td class="markdownTableBodyNone">Maximum buffer size for the conversion buffer between float and string Under normal circumstances this should be more than sufficient. </td></tr>
  259. <tr class="markdownTableRowOdd">
  260. <td class="markdownTableBodyNone">NK_INPUT_MAX </td><td class="markdownTableBodyNone">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. </td></tr>
  261. </table>
  262. <p>!!! WARNING The following constants if defined need to be defined for both header and implementation:</p><ul>
  263. <li>NK_MAX_NUMBER_BUFFER</li>
  264. <li>NK_BUFFER_DEFAULT_INITIAL_SIZE</li>
  265. <li>NK_INPUT_MAX</li>
  266. </ul>
  267. <h2><a class="anchor" id="autotoc_md8"></a>
  268. Dependencies</h2>
  269. <table class="markdownTable">
  270. <tr class="markdownTableHead">
  271. <th class="markdownTableHeadNone">Function </th><th class="markdownTableHeadNone">Description </th></tr>
  272. <tr class="markdownTableRowOdd">
  273. <td class="markdownTableBodyNone">NK_ASSERT </td><td class="markdownTableBodyNone">If you don't define this, nuklear will use &lt;assert.h&gt; with assert(). </td></tr>
  274. <tr class="markdownTableRowEven">
  275. <td class="markdownTableBodyNone">NK_MEMSET </td><td class="markdownTableBodyNone">You can define this to 'memset' or your own memset implementation replacement. If not nuklear will use its own version. </td></tr>
  276. <tr class="markdownTableRowOdd">
  277. <td class="markdownTableBodyNone">NK_MEMCPY </td><td class="markdownTableBodyNone">You can define this to 'memcpy' or your own memcpy implementation replacement. If not nuklear will use its own version. </td></tr>
  278. <tr class="markdownTableRowEven">
  279. <td class="markdownTableBodyNone">NK_INV_SQRT </td><td class="markdownTableBodyNone">You can define this to your own inverse sqrt implementation replacement. If not nuklear will use its own slow and not highly accurate version. </td></tr>
  280. <tr class="markdownTableRowOdd">
  281. <td class="markdownTableBodyNone">NK_SIN </td><td class="markdownTableBodyNone">You can define this to 'sinf' or your own sine implementation replacement. If not nuklear will use its own approximation implementation. </td></tr>
  282. <tr class="markdownTableRowEven">
  283. <td class="markdownTableBodyNone">NK_COS </td><td class="markdownTableBodyNone">You can define this to 'cosf' or your own cosine implementation replacement. If not nuklear will use its own approximation implementation. </td></tr>
  284. <tr class="markdownTableRowOdd">
  285. <td class="markdownTableBodyNone">NK_STRTOD </td><td class="markdownTableBodyNone">You can define this to <code>strtod</code> 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!). </td></tr>
  286. <tr class="markdownTableRowEven">
  287. <td class="markdownTableBodyNone">NK_DTOA </td><td class="markdownTableBodyNone">You can define this to <code>dtoa</code> 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!). </td></tr>
  288. <tr class="markdownTableRowOdd">
  289. <td class="markdownTableBodyNone">NK_VSNPRINTF </td><td class="markdownTableBodyNone">If you define <code>NK_INCLUDE_STANDARD_VARARGS</code> as well as <code>NK_INCLUDE_STANDARD_IO</code> and want to be safe define this to <code>vsnprintf</code> 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 <code>vsnprintf</code> is available it will define it to <code>vsnprintf</code> directly. If not defined and if you have older versions of C or C++ it will be defined to <code>vsprintf</code> which is unsafe. </td></tr>
  290. </table>
  291. <p>!!! WARNING The following dependencies will pull in the standard C library if not redefined:</p><ul>
  292. <li>NK_ASSERT</li>
  293. </ul>
  294. <p>!!! WARNING The following dependencies if defined need to be defined for both header and implementation:</p><ul>
  295. <li>NK_ASSERT</li>
  296. </ul>
  297. <p>!!! WARNING The following dependencies if defined need to be defined only for the implementation part:</p><ul>
  298. <li>NK_MEMSET</li>
  299. <li>NK_MEMCPY</li>
  300. <li>NK_SQRT</li>
  301. <li>NK_SIN</li>
  302. <li>NK_COS</li>
  303. <li>NK_STRTOD</li>
  304. <li>NK_DTOA</li>
  305. <li>NK_VSNPRINTF</li>
  306. </ul>
  307. <h1><a class="anchor" id="autotoc_md9"></a>
  308. Example</h1>
  309. <div class="fragment"><div class="line"><span class="comment">// init gui state</span></div>
  310. <div class="line"><span class="keyword">enum</span> {EASY, HARD};</div>
  311. <div class="line"><span class="keyword">static</span> <span class="keywordtype">int</span> op = EASY;</div>
  312. <div class="line"><span class="keyword">static</span> <span class="keywordtype">float</span> value = 0.6f;</div>
  313. <div class="line"><span class="keyword">static</span> <span class="keywordtype">int</span> i = 20;</div>
  314. <div class="line"><span class="keyword">struct </span><a class="code hl_struct" href="structnk__context.html">nk_context</a> ctx;</div>
  315. <div class="line"> </div>
  316. <div class="line"><a class="code hl_function" href="nuklear_8h.html#a27a65e767320f4d72cee9c3175153b56">nk_init_fixed</a>(&amp;ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &amp;font);</div>
  317. <div class="line"><span class="keywordflow">if</span> (<a class="code hl_function" href="nuklear_8h.html#aafe58ef289cad9c8cd7f5419fabe7cdd">nk_begin</a>(&amp;ctx, <span class="stringliteral">&quot;Show&quot;</span>, <a class="code hl_struct" href="structnk__rect.html">nk_rect</a>(50, 50, 220, 220),</div>
  318. <div class="line"> NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {</div>
  319. <div class="line"> <span class="comment">// fixed widget pixel width</span></div>
  320. <div class="line"> <a class="code hl_function" href="nuklear_8h.html#af8176018717fa81e62969ca5830414e3">nk_layout_row_static</a>(&amp;ctx, 30, 80, 1);</div>
  321. <div class="line"> <span class="keywordflow">if</span> (nk_button_label(&amp;ctx, <span class="stringliteral">&quot;button&quot;</span>)) {</div>
  322. <div class="line"> <span class="comment">// event handling</span></div>
  323. <div class="line"> }</div>
  324. <div class="line"> </div>
  325. <div class="line"> <span class="comment">// fixed widget window ratio width</span></div>
  326. <div class="line"> <a class="code hl_function" href="nuklear_8h.html#a76e65dc775c0bd5efaa3c8f38f96823f">nk_layout_row_dynamic</a>(&amp;ctx, 30, 2);</div>
  327. <div class="line"> <span class="keywordflow">if</span> (nk_option_label(&amp;ctx, <span class="stringliteral">&quot;easy&quot;</span>, op == EASY)) op = EASY;</div>
  328. <div class="line"> <span class="keywordflow">if</span> (nk_option_label(&amp;ctx, <span class="stringliteral">&quot;hard&quot;</span>, op == HARD)) op = HARD;</div>
  329. <div class="line"> </div>
  330. <div class="line"> <span class="comment">// custom widget pixel width</span></div>
  331. <div class="line"> <a class="code hl_function" href="nuklear_8h.html#aa6fa7480529cb74d07dd28c9c26d6549">nk_layout_row_begin</a>(&amp;ctx, NK_STATIC, 30, 2);</div>
  332. <div class="line"> {</div>
  333. <div class="line"> <a class="code hl_function" href="nuklear_8h.html#ab6fb149f7829d6c5f7361c93f26066aa">nk_layout_row_push</a>(&amp;ctx, 50);</div>
  334. <div class="line"> nk_label(&amp;ctx, <span class="stringliteral">&quot;Volume:&quot;</span>, NK_TEXT_LEFT);</div>
  335. <div class="line"> <a class="code hl_function" href="nuklear_8h.html#ab6fb149f7829d6c5f7361c93f26066aa">nk_layout_row_push</a>(&amp;ctx, 110);</div>
  336. <div class="line"> nk_slider_float(&amp;ctx, 0, &amp;value, 1.0f, 0.1f);</div>
  337. <div class="line"> }</div>
  338. <div class="line"> <a class="code hl_function" href="nuklear_8h.html#a14c7337d52877793ae04968e75f2c21f">nk_layout_row_end</a>(&amp;ctx);</div>
  339. <div class="line">}</div>
  340. <div class="line"><a class="code hl_function" href="nuklear_8h.html#ae0ade48c4c8df72456b9d97ab3d195e3">nk_end</a>(&amp;ctx);</div>
  341. <div class="ttc" id="anuklear_8h_html_a14c7337d52877793ae04968e75f2c21f"><div class="ttname"><a href="nuklear_8h.html#a14c7337d52877793ae04968e75f2c21f">nk_layout_row_end</a></div><div class="ttdeci">NK_API void nk_layout_row_end(struct nk_context *)</div><div class="ttdoc">Finished previously started row.</div><div class="ttdef"><b>Definition</b> <a href="nuklear__layout_8c_source.html#l00209">nuklear_layout.c:209</a></div></div>
  342. <div class="ttc" id="anuklear_8h_html_a27a65e767320f4d72cee9c3175153b56"><div class="ttname"><a href="nuklear_8h.html#a27a65e767320f4d72cee9c3175153b56">nk_init_fixed</a></div><div class="ttdeci">NK_API nk_bool nk_init_fixed(struct nk_context *, void *memory, nk_size size, const struct nk_user_font *)</div><div class="ttdef"><b>Definition</b> <a href="nuklear__context_8c_source.html#l00034">nuklear_context.c:34</a></div></div>
  343. <div class="ttc" id="anuklear_8h_html_a76e65dc775c0bd5efaa3c8f38f96823f"><div class="ttname"><a href="nuklear_8h.html#a76e65dc775c0bd5efaa3c8f38f96823f">nk_layout_row_dynamic</a></div><div class="ttdeci">NK_API void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols)</div><div class="ttdoc">Sets current row layout to share horizontal space between @cols number of widgets evenly.</div><div class="ttdef"><b>Definition</b> <a href="nuklear__layout_8c_source.html#l00147">nuklear_layout.c:147</a></div></div>
  344. <div class="ttc" id="anuklear_8h_html_aa6fa7480529cb74d07dd28c9c26d6549"><div class="ttname"><a href="nuklear_8h.html#aa6fa7480529cb74d07dd28c9c26d6549">nk_layout_row_begin</a></div><div class="ttdeci">NK_API void nk_layout_row_begin(struct nk_context *ctx, enum nk_layout_format fmt, float row_height, int cols)</div><div class="ttdoc">Starts a new dynamic or fixed row with given height and columns.</div><div class="ttdef"><b>Definition</b> <a href="nuklear__layout_8c_source.html#l00157">nuklear_layout.c:157</a></div></div>
  345. <div class="ttc" id="anuklear_8h_html_aafe58ef289cad9c8cd7f5419fabe7cdd"><div class="ttname"><a href="nuklear_8h.html#aafe58ef289cad9c8cd7f5419fabe7cdd">nk_begin</a></div><div class="ttdeci">NK_API nk_bool nk_begin(struct nk_context *ctx, const char *title, struct nk_rect bounds, nk_flags flags)</div><div class="ttdef"><b>Definition</b> <a href="nuklear__window_8c_source.html#l00136">nuklear_window.c:136</a></div></div>
  346. <div class="ttc" id="anuklear_8h_html_ab6fb149f7829d6c5f7361c93f26066aa"><div class="ttname"><a href="nuklear_8h.html#ab6fb149f7829d6c5f7361c93f26066aa">nk_layout_row_push</a></div><div class="ttdeci">NK_API void nk_layout_row_push(struct nk_context *, float value)</div><div class="ttdoc">\breif Specifies either window ratio or width of a single column</div><div class="ttdef"><b>Definition</b> <a href="nuklear__layout_8c_source.html#l00183">nuklear_layout.c:183</a></div></div>
  347. <div class="ttc" id="anuklear_8h_html_ae0ade48c4c8df72456b9d97ab3d195e3"><div class="ttname"><a href="nuklear_8h.html#ae0ade48c4c8df72456b9d97ab3d195e3">nk_end</a></div><div class="ttdeci">NK_API void nk_end(struct nk_context *ctx)</div><div class="ttdef"><b>Definition</b> <a href="nuklear__window_8c_source.html#l00297">nuklear_window.c:297</a></div></div>
  348. <div class="ttc" id="anuklear_8h_html_af8176018717fa81e62969ca5830414e3"><div class="ttname"><a href="nuklear_8h.html#af8176018717fa81e62969ca5830414e3">nk_layout_row_static</a></div><div class="ttdeci">NK_API void nk_layout_row_static(struct nk_context *ctx, float height, int item_width, int cols)</div><div class="ttdoc">Sets current row layout to fill @cols number of widgets in row with same @item_width horizontal size.</div><div class="ttdef"><b>Definition</b> <a href="nuklear__layout_8c_source.html#l00152">nuklear_layout.c:152</a></div></div>
  349. <div class="ttc" id="astructnk__context_html"><div class="ttname"><a href="structnk__context.html">nk_context</a></div><div class="ttdef"><b>Definition</b> <a href="nuklear_8h_source.html#l05705">nuklear.h:5705</a></div></div>
  350. <div class="ttc" id="astructnk__rect_html"><div class="ttname"><a href="structnk__rect.html">nk_rect</a></div><div class="ttdef"><b>Definition</b> <a href="nuklear_8h_source.html#l00265">nuklear.h:265</a></div></div>
  351. </div><!-- fragment --><p><img src="https://cloud.githubusercontent.com/assets/8057201/10187981/584ecd68-675c-11e5-897c-822ef534a876.png" alt="" class="inline"/></p>
  352. <h1><a class="anchor" id="autotoc_md10"></a>
  353. API</h1>
  354. </div></div><!-- PageDoc -->
  355. </div><!-- contents -->
  356. </div><!-- doc-content -->
  357. <!-- start footer part -->
  358. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  359. <ul>
  360. <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
  361. </ul>
  362. </div>
  363. </body>
  364. </html>