|
| 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: Context</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&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()"> </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&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&dn=expat.txt MIT */ |
| 74 | +$(document).ready(function(){initNavTree('Context.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 | + |
| 85 | +<!-- iframe showing the search results (closed by default) --> |
| 86 | +<div id="MSearchResultsWindow"> |
| 87 | +<div id="MSearchResults"> |
| 88 | +<div class="SRPage"> |
| 89 | +<div id="SRIndex"> |
| 90 | +<div id="SRResults"></div> |
| 91 | +<div class="SRStatus" id="Loading">Loading...</div> |
| 92 | +<div class="SRStatus" id="Searching">Searching...</div> |
| 93 | +<div class="SRStatus" id="NoMatches">No Matches</div> |
| 94 | +</div> |
| 95 | +</div> |
| 96 | +</div> |
| 97 | +</div> |
| 98 | + |
| 99 | +<div><div class="header"> |
| 100 | + <div class="headertitle"><div class="title">Context</div></div> |
| 101 | +</div><!--header--> |
| 102 | +<div class="contents"> |
| 103 | +<div class="textblock"><p>Contexts are the main entry point and the majestro of nuklear and contain all required state.</p> |
| 104 | +<p>They are used for window, memory, input, style, stack, commands and time management and need to be passed into all nuklear GUI specific functions.</p> |
| 105 | +<h1><a class="anchor" id="autotoc_md11"></a> |
| 106 | +Usage</h1> |
| 107 | +<p>To use a context it first has to be initialized which can be achieved by calling one of either <code>nk_init_default</code>, <code>nk_init_fixed</code>, <code>nk_init</code>, <code>nk_init_custom</code>. Each takes in a font handle and a specific way of handling memory. Memory control hereby ranges from standard library to just specifying a fixed sized block of memory which nuklear has to manage itself from.</p> |
| 108 | +<div class="fragment"><div class="line"><span class="keyword">struct </span><a class="code hl_struct" href="structnk__context.html">nk_context</a> ctx;</div> |
| 109 | +<div class="line">nk_init_xxx(&ctx, ...);</div> |
| 110 | +<div class="line"><span class="keywordflow">while</span> (1) {</div> |
| 111 | +<div class="line"> <span class="comment">// [...]</span></div> |
| 112 | +<div class="line"> <a class="code hl_function" href="nuklear_8h.html#ade3301f0a92370be1b4beac7eceac279">nk_clear</a>(&ctx);</div> |
| 113 | +<div class="line">}</div> |
| 114 | +<div class="line"><a class="code hl_function" href="nuklear_8h.html#a06772e194320fa99524681fd32df85e9">nk_free</a>(&ctx);</div> |
| 115 | +<div class="ttc" id="anuklear_8h_html_a06772e194320fa99524681fd32df85e9"><div class="ttname"><a href="nuklear_8h.html#a06772e194320fa99524681fd32df85e9">nk_free</a></div><div class="ttdeci">NK_API void nk_free(struct nk_context *)</div><div class="ttdoc">Frees all memory allocated by nuklear; Not needed if context was initialized with nk_init_fixed.</div><div class="ttdef"><b>Definition</b> <a href="nuklear__context_8c_source.html#l00088">nuklear_context.c:88</a></div></div> |
| 116 | +<div class="ttc" id="anuklear_8h_html_ade3301f0a92370be1b4beac7eceac279"><div class="ttname"><a href="nuklear_8h.html#ade3301f0a92370be1b4beac7eceac279">nk_clear</a></div><div class="ttdeci">NK_API void nk_clear(struct nk_context *)</div><div class="ttdoc">Resets the context state at the end of the frame.</div><div class="ttdef"><b>Definition</b> <a href="nuklear__context_8c_source.html#l00110">nuklear_context.c:110</a></div></div> |
| 117 | +<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#l05724">nuklear.h:5724</a></div></div> |
| 118 | +</div><!-- fragment --><h1><a class="anchor" id="autotoc_md12"></a> |
| 119 | +Reference</h1> |
| 120 | +<table class="markdownTable"> |
| 121 | +<tr class="markdownTableHead"> |
| 122 | +<th class="markdownTableHeadNone">Function </th><th class="markdownTableHeadNone">Description </th></tr> |
| 123 | +<tr class="markdownTableRowOdd"> |
| 124 | +<td class="markdownTableBodyNone">nk_init_default </td><td class="markdownTableBodyNone">Initializes context with standard library memory allocation (malloc,free) </td></tr> |
| 125 | +<tr class="markdownTableRowEven"> |
| 126 | +<td class="markdownTableBodyNone"><a class="el" href="nuklear_8h.html#a27a65e767320f4d72cee9c3175153b56">nk_init_fixed</a> </td><td class="markdownTableBodyNone">Initializes context from single fixed size memory block </td></tr> |
| 127 | +<tr class="markdownTableRowOdd"> |
| 128 | +<td class="markdownTableBodyNone"><a class="el" href="nuklear_8h.html#ab5c6cdd02a560dbcbdb5bd54ed753b2c">nk_init</a> </td><td class="markdownTableBodyNone">Initializes context with memory allocator callbacks for alloc and free </td></tr> |
| 129 | +<tr class="markdownTableRowEven"> |
| 130 | +<td class="markdownTableBodyNone"><a class="el" href="nuklear_8h.html#a4122ba85b642a16b61268932b1fed694">nk_init_custom</a> </td><td class="markdownTableBodyNone">Initializes context from two buffers. One for draw commands the other for window/panel/table allocations </td></tr> |
| 131 | +<tr class="markdownTableRowOdd"> |
| 132 | +<td class="markdownTableBodyNone"><a class="el" href="nuklear_8h.html#ade3301f0a92370be1b4beac7eceac279">nk_clear</a> </td><td class="markdownTableBodyNone">Called at the end of the frame to reset and prepare the context for the next frame </td></tr> |
| 133 | +<tr class="markdownTableRowEven"> |
| 134 | +<td class="markdownTableBodyNone"><a class="el" href="nuklear_8h.html#a06772e194320fa99524681fd32df85e9">nk_free</a> </td><td class="markdownTableBodyNone">Shutdown and free all memory allocated inside the context </td></tr> |
| 135 | +<tr class="markdownTableRowOdd"> |
| 136 | +<td class="markdownTableBodyNone">nk_set_user_data </td><td class="markdownTableBodyNone">Utility function to pass user data to draw command </td></tr> |
| 137 | +</table> |
| 138 | +</div></div><!-- contents --> |
| 139 | +</div><!-- PageDoc --> |
| 140 | +</div><!-- doc-content --> |
| 141 | +<!-- start footer part --> |
| 142 | +<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 143 | + <ul> |
| 144 | + <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> |
| 145 | + </ul> |
| 146 | +</div> |
| 147 | +</body> |
| 148 | +</html> |
0 commit comments