Browse Source

Pulled panel memory managment into nuklear

I simplified a lot of API calls by pulling panel memory management
inside the library. All API calls which previously required a panel
as parameter are now handling their panel themself.
vurtun 9 years ago
parent
commit
bd3fd8300f

+ 4 - 0
CHANGELOG.md

@@ -1,4 +1,8 @@
 # Changelog
+- 2016/10/29 (1.170)- 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.160)- Changed widget border drawing to stroked rectangle from filled
                         rectangle for less overdraw and widget background transparency.
 - 2016/10/18 (1.160)- Added `nk_edit_focus` for manually edit widget focus control

+ 1 - 2
Readme.md

@@ -58,8 +58,7 @@ int op = EASY;
 float value = 0.6f;
 int i =  20;
 
-struct nk_panel layout;
-if (nk_begin(&ctx, &layout, "Show", nk_rect(50, 50, 220, 220),
+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);

+ 5 - 7
demo/d3d11/main.c

@@ -1,4 +1,4 @@
-/* nuklear - v1.09 - public domain */
+/* nuklear - v1.17 - public domain */
 #define COBJMACROS
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
@@ -209,8 +209,7 @@ int main(void)
         nk_input_end(ctx);
 
         /* GUI */
-        {struct nk_panel layout;
-        if (nk_begin(ctx, &layout, "Demo", nk_rect(50, 50, 230, 250),
+        if (nk_begin(ctx, "Demo", nk_rect(50, 50, 230, 250),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
             NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
         {
@@ -227,11 +226,10 @@ int main(void)
             nk_layout_row_dynamic(ctx, 22, 1);
             nk_property_int(ctx, "Compression:", 0, &property, 100, 10, 1);
 
-            {struct nk_panel combo;
             nk_layout_row_dynamic(ctx, 20, 1);
             nk_label(ctx, "background:", NK_TEXT_LEFT);
             nk_layout_row_dynamic(ctx, 25, 1);
-            if (nk_combo_begin_color(ctx, &combo, background, nk_vec2(nk_widget_width(ctx),400))) {
+            if (nk_combo_begin_color(ctx, background, nk_vec2(nk_widget_width(ctx),400))) {
                 nk_layout_row_dynamic(ctx, 120, 1);
                 background = nk_color_picker(ctx, background, NK_RGBA);
                 nk_layout_row_dynamic(ctx, 25, 1);
@@ -240,9 +238,9 @@ int main(void)
                 background.b = (nk_byte)nk_propertyi(ctx, "#B:", 0, background.b, 255, 1,1);
                 background.a = (nk_byte)nk_propertyi(ctx, "#A:", 0, background.a, 255, 1,1);
                 nk_combo_end(ctx);
-            }}
+            }
         }
-        nk_end(ctx);}
+        nk_end(ctx);
         if (nk_window_is_closed(ctx, "Demo")) break;
 
         /* -------------- EXAMPLES ---------------- */

+ 1 - 1
demo/d3d11/nuklear_d3d11.h

@@ -1,5 +1,5 @@
 /*
- * Nuklear - v1.00 - public domain
+ * Nuklear - v1.17 - public domain
  * no warrenty implied; use at your own risk.
  * authored from 2015-2016 by Micha Mettke
  */

+ 3 - 4
demo/gdi/main.c

@@ -1,4 +1,4 @@
-/* nuklear - v1.09 - public domain */
+/* nuklear - v1.17 - public domain */
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <stdio.h>
@@ -123,8 +123,7 @@ int main(void)
         nk_input_end(ctx);
 
         /* GUI */
-        {struct nk_panel layout;
-        if (nk_begin(ctx, &layout, "Demo", nk_rect(50, 50, 200, 200),
+        if (nk_begin(ctx, "Demo", nk_rect(50, 50, 200, 200),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
             NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
         {
@@ -141,7 +140,7 @@ int main(void)
             nk_layout_row_dynamic(ctx, 22, 1);
             nk_property_int(ctx, "Compression:", 0, &property, 100, 10, 1);
         }
-        nk_end(ctx);}
+        nk_end(ctx);
         if (nk_window_is_closed(ctx, "Demo")) break;
 
         /* -------------- EXAMPLES ---------------- */

+ 1 - 1
demo/gdi/nuklear_gdi.h

@@ -1,5 +1,5 @@
 /*
- * Nuklear - v1.00 - public domain
+ * Nuklear - v1.17 - public domain
  * no warrenty implied; use at your own risk.
  * authored from 2015-2016 by Micha Mettke
  */

+ 3 - 4
demo/gdip/main.c

@@ -1,4 +1,4 @@
-/* nuklear - v1.09 - public domain */
+/* nuklear - v1.17 - public domain */
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <stdio.h>
@@ -118,8 +118,7 @@ int main(void)
         nk_input_end(ctx);
 
         /* GUI */
-        {struct nk_panel layout;
-        if (nk_begin(ctx, &layout, "Demo", nk_rect(50, 50, 200, 200),
+        if (nk_begin(ctx, "Demo", nk_rect(50, 50, 200, 200),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
             NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
         {
@@ -136,7 +135,7 @@ int main(void)
             nk_layout_row_dynamic(ctx, 22, 1);
             nk_property_int(ctx, "Compression:", 0, &property, 100, 10, 1);
         }
-        nk_end(ctx);}
+        nk_end(ctx);
         if (nk_window_is_closed(ctx, "Demo")) break;
 
         /* -------------- EXAMPLES ---------------- */

+ 1 - 1
demo/gdip/nuklear_gdip.h

@@ -1,5 +1,5 @@
 /*
- * Nuklear - v1.00 - public domain
+ * Nuklear - v1.17 - public domain
  * no warrenty implied; use at your own risk.
  * authored from 2015-2016 by Micha Mettke
  */

+ 5 - 7
demo/glfw_opengl2/main.c

@@ -1,4 +1,4 @@
-/* nuklear - v1.09 - public domain */
+/* nuklear - v1.17 - public domain */
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -104,8 +104,7 @@ int main(void)
         nk_glfw3_new_frame();
 
         /* GUI */
-        {struct nk_panel layout;
-        if (nk_begin(ctx, &layout, "Demo", nk_rect(50, 50, 230, 250),
+        if (nk_begin(ctx, "Demo", nk_rect(50, 50, 230, 250),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
             NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
         {
@@ -123,11 +122,10 @@ int main(void)
             nk_layout_row_dynamic(ctx, 25, 1);
             nk_property_int(ctx, "Compression:", 0, &property, 100, 10, 1);
 
-            {struct nk_panel combo;
             nk_layout_row_dynamic(ctx, 20, 1);
             nk_label(ctx, "background:", NK_TEXT_LEFT);
             nk_layout_row_dynamic(ctx, 25, 1);
-            if (nk_combo_begin_color(ctx, &combo, background, nk_vec2(nk_widget_width(ctx),400))) {
+            if (nk_combo_begin_color(ctx, background, nk_vec2(nk_widget_width(ctx),400))) {
                 nk_layout_row_dynamic(ctx, 120, 1);
                 background = nk_color_picker(ctx, background, NK_RGBA);
                 nk_layout_row_dynamic(ctx, 25, 1);
@@ -136,9 +134,9 @@ int main(void)
                 background.b = (nk_byte)nk_propertyi(ctx, "#B:", 0, background.b, 255, 1,1);
                 background.a = (nk_byte)nk_propertyi(ctx, "#A:", 0, background.a, 255, 1,1);
                 nk_combo_end(ctx);
-            }}
+            }
         }
-        nk_end(ctx);}
+        nk_end(ctx);
 
         /* -------------- EXAMPLES ---------------- */
         /*calculator(ctx);*/

+ 1 - 1
demo/glfw_opengl2/nuklear_glfw_gl2.h

@@ -1,5 +1,5 @@
 /*
- * Nuklear - v1.00 - public domain
+ * Nuklear - v1.17 - public domain
  * no warrenty implied; use at your own risk.
  * authored from 2015-2016 by Micha Mettke
  */

+ 5 - 7
demo/glfw_opengl3/main.c

@@ -1,4 +1,4 @@
-/* nuklear - v1.09 - public domain */
+/* nuklear - v1.17 - public domain */
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -118,8 +118,7 @@ int main(void)
         nk_glfw3_new_frame();
 
         /* GUI */
-        {struct nk_panel layout;
-        if (nk_begin(ctx, &layout, "Demo", nk_rect(50, 50, 230, 250),
+        if (nk_begin(ctx, "Demo", nk_rect(50, 50, 230, 250),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
             NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
         {
@@ -137,11 +136,10 @@ int main(void)
             nk_layout_row_dynamic(ctx, 25, 1);
             nk_property_int(ctx, "Compression:", 0, &property, 100, 10, 1);
 
-            {struct nk_panel combo;
             nk_layout_row_dynamic(ctx, 20, 1);
             nk_label(ctx, "background:", NK_TEXT_LEFT);
             nk_layout_row_dynamic(ctx, 25, 1);
-            if (nk_combo_begin_color(ctx, &combo, background, nk_vec2(nk_widget_width(ctx),400))) {
+            if (nk_combo_begin_color(ctx, background, nk_vec2(nk_widget_width(ctx),400))) {
                 nk_layout_row_dynamic(ctx, 120, 1);
                 background = nk_color_picker(ctx, background, NK_RGBA);
                 nk_layout_row_dynamic(ctx, 25, 1);
@@ -150,9 +148,9 @@ int main(void)
                 background.b = (nk_byte)nk_propertyi(ctx, "#B:", 0, background.b, 255, 1,1);
                 background.a = (nk_byte)nk_propertyi(ctx, "#A:", 0, background.a, 255, 1,1);
                 nk_combo_end(ctx);
-            }}
+            }
         }
-        nk_end(ctx);}
+        nk_end(ctx);
 
         /* -------------- EXAMPLES ---------------- */
         /*calculator(ctx);*/

+ 1 - 1
demo/glfw_opengl3/nuklear_glfw_gl3.h

@@ -1,5 +1,5 @@
 /*
- * Nuklear - v1.00 - public domain
+ * Nuklear - v1.17 - public domain
  * no warrenty implied; use at your own risk.
  * authored from 2015-2016 by Micha Mettke
  */

+ 17 - 16
demo/node_editor.c

@@ -152,7 +152,6 @@ node_editor(struct nk_context *ctx)
     const struct nk_input *in = &ctx->input;
     struct nk_command_buffer *canvas;
     struct node *updated = 0;
-    struct nk_panel layout;
     struct node_editor *nodedit = &nodeEditor;
 
     if (!nodeEditor.initialized) {
@@ -160,7 +159,7 @@ node_editor(struct nk_context *ctx)
         nodeEditor.initialized = 1;
     }
 
-    if (nk_begin(ctx, &layout, "NodeEdit", nk_rect(0, 0, 800, 600),
+    if (nk_begin(ctx, "NodeEdit", nk_rect(0, 0, 800, 600),
         NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE))
     {
         /* allocate complete window space */
@@ -168,7 +167,6 @@ node_editor(struct nk_context *ctx)
         total_space = nk_window_get_content_region(ctx);
         nk_layout_space_begin(ctx, NK_STATIC, total_space.h, nodedit->node_count);
         {
-            struct nk_panel node, menu;
             struct node *it = nodedit->begin;
             struct nk_rect size = nk_layout_space_bounds(ctx);
 
@@ -190,12 +188,13 @@ node_editor(struct nk_context *ctx)
                     it->bounds.y - nodedit->scrolling.y, it->bounds.w, it->bounds.h));
 
                 /* execute node window */
-                if (nk_group_begin(ctx, &node, it->name, NK_WINDOW_MOVABLE|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER|NK_WINDOW_TITLE))
+                if (nk_group_begin(ctx, it->name, NK_WINDOW_MOVABLE|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER|NK_WINDOW_TITLE))
                 {
                     /* always have last selected node on top */
-                    if (nk_input_mouse_clicked(in, NK_BUTTON_LEFT, node.bounds) &&
+                    struct nk_panel *node = nk_window_get_panel(ctx);
+                    if (nk_input_mouse_clicked(in, NK_BUTTON_LEFT, node->bounds) &&
                         (!(it->prev && nk_input_mouse_clicked(in, NK_BUTTON_LEFT,
-                        nk_layout_space_rect_to_screen(ctx, node.bounds)))) &&
+                        nk_layout_space_rect_to_screen(ctx, node->bounds)))) &&
                         nodedit->end != it)
                     {
                         updated = it;
@@ -215,17 +214,18 @@ node_editor(struct nk_context *ctx)
                     /* node connector and linking */
                     float space;
                     struct nk_rect bounds;
-                    bounds = nk_layout_space_rect_to_local(ctx, node.bounds);
+                    struct nk_panel *node = nk_window_get_panel(ctx);
+                    bounds = nk_layout_space_rect_to_local(ctx, node->bounds);
                     bounds.x += nodedit->scrolling.x;
                     bounds.y += nodedit->scrolling.y;
                     it->bounds = bounds;
 
                     /* output connector */
-                    space = node.bounds.h / (float)((it->output_count) + 1);
+                    space = node->bounds.h / (float)((it->output_count) + 1);
                     for (n = 0; n < it->output_count; ++n) {
                         struct nk_rect circle;
-                        circle.x = node.bounds.x + node.bounds.w-4;
-                        circle.y = node.bounds.y + space * (float)(n+1);
+                        circle.x = node->bounds.x + node->bounds.w-4;
+                        circle.y = node->bounds.y + space * (float)(n+1);
                         circle.w = 8; circle.h = 8;
                         nk_fill_circle(canvas, circle, nk_rgb(100, 100, 100));
 
@@ -248,11 +248,11 @@ node_editor(struct nk_context *ctx)
                     }
 
                     /* input connector */
-                    space = node.bounds.h / (float)((it->input_count) + 1);
+                    space = node->bounds.h / (float)((it->input_count) + 1);
                     for (n = 0; n < it->input_count; ++n) {
                         struct nk_rect circle;
-                        circle.x = node.bounds.x-4;
-                        circle.y = node.bounds.y + space * (float)(n+1);
+                        circle.x = node->bounds.x-4;
+                        circle.y = node->bounds.y + space * (float)(n+1);
                         circle.w = 8; circle.h = 8;
                         nk_fill_circle(canvas, circle, nk_rgb(100, 100, 100));
                         if (nk_input_is_mouse_released(in, NK_BUTTON_LEFT) &&
@@ -276,11 +276,12 @@ node_editor(struct nk_context *ctx)
 
             /* draw each link */
             for (n = 0; n < nodedit->link_count; ++n) {
+                struct nk_panel *node = nk_window_get_panel(ctx);
                 struct node_link *link = &nodedit->links[n];
                 struct node *ni = node_editor_find(nodedit, link->input_id);
                 struct node *no = node_editor_find(nodedit, link->output_id);
-                float spacei = node.bounds.h / (float)((ni->output_count) + 1);
-                float spaceo = node.bounds.h / (float)((no->input_count) + 1);
+                float spacei = node->bounds.h / (float)((ni->output_count) + 1);
+                float spaceo = node->bounds.h / (float)((no->input_count) + 1);
                 struct nk_vec2 l0 = nk_layout_space_to_screen(ctx,
                     nk_vec2(ni->bounds.x + ni->bounds.w, 3.0f + ni->bounds.y + spacei * (float)(link->input_slot+1)));
                 struct nk_vec2 l1 = nk_layout_space_to_screen(ctx,
@@ -316,7 +317,7 @@ node_editor(struct nk_context *ctx)
             }
 
             /* contextual menu */
-            if (nk_contextual_begin(ctx, &menu, 0, nk_vec2(100, 220), nk_window_get_bounds(ctx))) {
+            if (nk_contextual_begin(ctx, 0, nk_vec2(100, 220), nk_window_get_bounds(ctx))) {
                 const char *grid_option[] = {"Show Grid", "Hide Grid"};
                 nk_layout_row_dynamic(ctx, 25, 1);
                 if (nk_contextual_item_label(ctx, "New", NK_TEXT_CENTERED))

+ 30 - 42
demo/overview.c

@@ -2,8 +2,6 @@
 static int
 overview(struct nk_context *ctx)
 {
-    struct nk_panel menu;
-
     /* window flags */
     static int show_menu = nk_true;
     static int titlebar = nk_true;
@@ -17,7 +15,6 @@ overview(struct nk_context *ctx)
     /* popups */
     static enum nk_style_header_align header_align = NK_HEADER_RIGHT;
     static int show_app_about = nk_false;
-    struct nk_panel layout;
 
     /* window flags */
     window_flags = 0;
@@ -28,7 +25,7 @@ overview(struct nk_context *ctx)
     if (no_scrollbar) window_flags |= NK_WINDOW_NO_SCROLLBAR;
     if (minimizable) window_flags |= NK_WINDOW_MINIMIZABLE;
 
-    if (nk_begin(ctx, &layout, "Overview", nk_rect(10, 10, 400, 600), window_flags))
+    if (nk_begin(ctx, "Overview", nk_rect(10, 10, 400, 600), window_flags))
     {
         if (show_menu)
         {
@@ -41,7 +38,7 @@ overview(struct nk_context *ctx)
             nk_menubar_begin(ctx);
             nk_layout_row_begin(ctx, NK_STATIC, 25, 2);
             nk_layout_row_push(ctx, 45);
-            if (nk_menu_begin_label(ctx, &menu, "MENU", NK_TEXT_LEFT, nk_vec2(120, 200)))
+            if (nk_menu_begin_label(ctx, "MENU", NK_TEXT_LEFT, nk_vec2(120, 200)))
             {
                 static size_t prog = 40;
                 static int slider = 10;
@@ -66,9 +63,8 @@ overview(struct nk_context *ctx)
         if (show_app_about)
         {
             /* about popup */
-            struct nk_panel popup;
             static struct nk_rect s = {20, 100, 300, 190};
-            if (nk_popup_begin(ctx, &popup, NK_POPUP_STATIC, "About", NK_WINDOW_CLOSABLE, s))
+            if (nk_popup_begin(ctx, NK_POPUP_STATIC, "About", NK_WINDOW_CLOSABLE, s))
             {
                 nk_layout_row_dynamic(ctx, 20, 1);
                 nk_label(ctx, "Nuklear", NK_TEXT_LEFT);
@@ -272,14 +268,13 @@ overview(struct nk_context *ctx)
 
                 char buffer[64];
                 size_t sum = 0;
-                struct nk_panel combo;
 
                 /* default combobox */
                 nk_layout_row_static(ctx, 25, 200, 1);
                 current_weapon = nk_combo(ctx, weapons, LEN(weapons), current_weapon, 25, nk_vec2(200,200));
 
                 /* slider color combobox */
-                if (nk_combo_begin_color(ctx, &combo, combo_color, nk_vec2(200,200))) {
+                if (nk_combo_begin_color(ctx, combo_color, nk_vec2(200,200))) {
                     float ratios[] = {0.15f, 0.85f};
                     nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratios);
                     nk_label(ctx, "R:", NK_TEXT_LEFT);
@@ -294,7 +289,7 @@ overview(struct nk_context *ctx)
                 }
 
                 /* complex color combobox */
-                if (nk_combo_begin_color(ctx, &combo, combo_color2, nk_vec2(200,400))) {
+                if (nk_combo_begin_color(ctx, combo_color2, nk_vec2(200,400))) {
                     enum color_mode {COL_RGB, COL_HSV};
                     static int col_mode = COL_RGB;
                     #ifndef DEMO_DO_NOT_USE_COLOR_PICKER
@@ -327,7 +322,7 @@ overview(struct nk_context *ctx)
                 /* progressbar combobox */
                 sum = prog_a + prog_b + prog_c + prog_d;
                 sprintf(buffer, "%lu", sum);
-                if (nk_combo_begin_label(ctx, &combo, buffer, nk_vec2(200,200))) {
+                if (nk_combo_begin_label(ctx, buffer, nk_vec2(200,200))) {
                     nk_layout_row_dynamic(ctx, 30, 1);
                     nk_progress(ctx, &prog_a, 100, NK_MODIFIABLE);
                     nk_progress(ctx, &prog_b, 100, NK_MODIFIABLE);
@@ -339,7 +334,7 @@ overview(struct nk_context *ctx)
                 /* checkbox combobox */
                 sum = (size_t)(check_values[0] + check_values[1] + check_values[2] + check_values[3] + check_values[4]);
                 sprintf(buffer, "%lu", sum);
-                if (nk_combo_begin_label(ctx, &combo, buffer, nk_vec2(200,200))) {
+                if (nk_combo_begin_label(ctx, buffer, nk_vec2(200,200))) {
                     nk_layout_row_dynamic(ctx, 30, 1);
                     nk_checkbox_label(ctx, weapons[0], &check_values[0]);
                     nk_checkbox_label(ctx, weapons[1], &check_values[1]);
@@ -350,7 +345,7 @@ overview(struct nk_context *ctx)
 
                 /* complex text combobox */
                 sprintf(buffer, "%.2f, %.2f, %.2f", position[0], position[1],position[2]);
-                if (nk_combo_begin_label(ctx, &combo, buffer, nk_vec2(200,200))) {
+                if (nk_combo_begin_label(ctx, buffer, nk_vec2(200,200))) {
                     nk_layout_row_dynamic(ctx, 25, 1);
                     nk_property_float(ctx, "#X:", -1024.0f, &position[0], 1024.0f, 1,0.5f);
                     nk_property_float(ctx, "#Y:", -1024.0f, &position[1], 1024.0f, 1,0.5f);
@@ -360,7 +355,7 @@ overview(struct nk_context *ctx)
 
                 /* chart combobox */
                 sprintf(buffer, "%.1f", chart_selection);
-                if (nk_combo_begin_label(ctx, &combo, buffer, nk_vec2(200,250))) {
+                if (nk_combo_begin_label(ctx, buffer, nk_vec2(200,250))) {
                     size_t i = 0;
                     static const float values[]={26.0f,13.0f,30.0f,15.0f,25.0f,10.0f,20.0f,40.0f, 12.0f, 8.0f, 22.0f, 28.0f, 5.0f};
                     nk_layout_row_dynamic(ctx, 150, 1);
@@ -393,7 +388,7 @@ overview(struct nk_context *ctx)
 
                     /* time combobox */
                     sprintf(buffer, "%02d:%02d:%02d", sel_time.tm_hour, sel_time.tm_min, sel_time.tm_sec);
-                    if (nk_combo_begin_label(ctx, &combo, buffer, nk_vec2(200,250))) {
+                    if (nk_combo_begin_label(ctx, buffer, nk_vec2(200,250))) {
                         time_selected = 1;
                         nk_layout_row_dynamic(ctx, 25, 1);
                         sel_time.tm_sec = nk_propertyi(ctx, "#S:", 0, sel_time.tm_sec, 60, 1, 1);
@@ -404,7 +399,7 @@ overview(struct nk_context *ctx)
 
                     /* date combobox */
                     sprintf(buffer, "%02d-%02d-%02d", sel_date.tm_mday, sel_date.tm_mon+1, sel_date.tm_year+1900);
-                    if (nk_combo_begin_label(ctx, &combo, buffer, nk_vec2(350,400)))
+                    if (nk_combo_begin_label(ctx, buffer, nk_vec2(350,400)))
                     {
                         int i = 0;
                         const char *month[] = {"January", "February", "March", "Apil", "May", "June", "July", "August", "September", "Ocotober", "November", "December"};
@@ -647,7 +642,7 @@ overview(struct nk_context *ctx)
             bounds = nk_widget_bounds(ctx);
             nk_label(ctx, "Right click me for menu", NK_TEXT_LEFT);
 
-            if (nk_contextual_begin(ctx, &menu, 0, nk_vec2(100, 300), bounds)) {
+            if (nk_contextual_begin(ctx, 0, nk_vec2(100, 300), bounds)) {
                 static size_t prog = 40;
                 static int slider = 10;
 
@@ -673,7 +668,7 @@ overview(struct nk_context *ctx)
             nk_button_color(ctx, color);
             nk_layout_row_end(ctx);
 
-            if (nk_contextual_begin(ctx, &menu, 0, nk_vec2(350, 60), bounds)) {
+            if (nk_contextual_begin(ctx, 0, nk_vec2(350, 60), bounds)) {
                 nk_layout_row_dynamic(ctx, 30, 4);
                 color.r = (nk_byte)nk_propertyi(ctx, "#r", 0, color.r, 255, 1, 1);
                 color.g = (nk_byte)nk_propertyi(ctx, "#g", 0, color.g, 255, 1, 1);
@@ -694,7 +689,7 @@ overview(struct nk_context *ctx)
             if (popup_active)
             {
                 static struct nk_rect s = {20, 100, 220, 90};
-                if (nk_popup_begin(ctx, &menu, NK_POPUP_STATIC, "Error", 0, s))
+                if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Error", 0, s))
                 {
                     nk_layout_row_dynamic(ctx, 25, 1);
                     nk_label(ctx, "A terrible error as occured", NK_TEXT_LEFT);
@@ -800,7 +795,6 @@ overview(struct nk_context *ctx)
                 static int group_no_scrollbar = nk_false;
                 static int group_width = 320;
                 static int group_height = 200;
-                struct nk_panel tab;
 
                 nk_flags group_flags = 0;
                 if (group_border) group_flags |= NK_WINDOW_BORDER;
@@ -822,7 +816,7 @@ overview(struct nk_context *ctx)
                 nk_layout_row_end(ctx);
 
                 nk_layout_row_static(ctx, (float)group_height, group_width, 2);
-                if (nk_group_begin(ctx, &tab, "Group", group_flags)) {
+                if (nk_group_begin(ctx, "Group", group_flags)) {
                     int i = 0;
                     static int selected[16];
                     nk_layout_row_static(ctx, 18, 100, 1);
@@ -836,13 +830,11 @@ overview(struct nk_context *ctx)
             if (nk_tree_push(ctx, NK_TREE_NODE, "Notebook", NK_MINIMIZED))
             {
                 static int current_tab = 0;
-                struct nk_panel group;
                 struct nk_vec2 item_padding;
                 struct nk_rect bounds;
                 float step = (2*3.141592654f) / 32;
                 enum chart_type {CHART_LINE, CHART_HISTO, CHART_MIXED};
                 const char *names[] = {"Lines", "Columns", "Mixed"};
-                float rounding;
                 float id = 0;
                 int i;
 
@@ -868,7 +860,7 @@ overview(struct nk_context *ctx)
 
                 /* Body */
                 nk_layout_row_dynamic(ctx, 140, 1);
-                if (nk_group_begin(ctx, &group, "Notebook", NK_WINDOW_BORDER))
+                if (nk_group_begin(ctx, "Notebook", NK_WINDOW_BORDER))
                 {
                     nk_style_pop_vec2(ctx);
                     switch (current_tab) {
@@ -919,9 +911,8 @@ overview(struct nk_context *ctx)
 
             if (nk_tree_push(ctx, NK_TREE_NODE, "Simple", NK_MINIMIZED))
             {
-                struct nk_panel tab;
                 nk_layout_row_dynamic(ctx, 300, 2);
-                if (nk_group_begin(ctx, &tab, "Group_Without_Border", 0)) {
+                if (nk_group_begin(ctx, "Group_Without_Border", 0)) {
                     int i = 0;
                     char buffer[64];
                     nk_layout_row_static(ctx, 18, 150, 1);
@@ -931,7 +922,7 @@ overview(struct nk_context *ctx)
                     }
                     nk_group_end(ctx);
                 }
-                if (nk_group_begin(ctx, &tab, "Group_With_Border", NK_WINDOW_BORDER)) {
+                if (nk_group_begin(ctx, "Group_With_Border", NK_WINDOW_BORDER)) {
                     int i = 0;
                     char buffer[64];
                     nk_layout_row_dynamic(ctx, 25, 2);
@@ -947,10 +938,9 @@ overview(struct nk_context *ctx)
             if (nk_tree_push(ctx, NK_TREE_NODE, "Complex", NK_MINIMIZED))
             {
                 int i;
-                struct nk_panel tab;
                 nk_layout_space_begin(ctx, NK_STATIC, 500, 64);
                 nk_layout_space_push(ctx, nk_rect(0,0,150,500));
-                if (nk_group_begin(ctx, &tab, "Group_left", NK_WINDOW_BORDER)) {
+                if (nk_group_begin(ctx, "Group_left", NK_WINDOW_BORDER)) {
                     static int selected[32];
                     nk_layout_row_static(ctx, 18, 100, 1);
                     for (i = 0; i < 32; ++i)
@@ -959,7 +949,7 @@ overview(struct nk_context *ctx)
                 }
 
                 nk_layout_space_push(ctx, nk_rect(160,0,150,240));
-                if (nk_group_begin(ctx, &tab, "Group_top", NK_WINDOW_BORDER)) {
+                if (nk_group_begin(ctx, "Group_top", NK_WINDOW_BORDER)) {
                     nk_layout_row_dynamic(ctx, 25, 1);
                     nk_button_label(ctx, "#FFAA");
                     nk_button_label(ctx, "#FFBB");
@@ -971,7 +961,7 @@ overview(struct nk_context *ctx)
                 }
 
                 nk_layout_space_push(ctx, nk_rect(160,250,150,250));
-                if (nk_group_begin(ctx, &tab, "Group_buttom", NK_WINDOW_BORDER)) {
+                if (nk_group_begin(ctx, "Group_buttom", NK_WINDOW_BORDER)) {
                     nk_layout_row_dynamic(ctx, 25, 1);
                     nk_button_label(ctx, "#FFAA");
                     nk_button_label(ctx, "#FFBB");
@@ -983,7 +973,7 @@ overview(struct nk_context *ctx)
                 }
 
                 nk_layout_space_push(ctx, nk_rect(320,0,150,150));
-                if (nk_group_begin(ctx, &tab, "Group_right_top", NK_WINDOW_BORDER)) {
+                if (nk_group_begin(ctx, "Group_right_top", NK_WINDOW_BORDER)) {
                     static int selected[4];
                     nk_layout_row_static(ctx, 18, 100, 1);
                     for (i = 0; i < 4; ++i)
@@ -992,7 +982,7 @@ overview(struct nk_context *ctx)
                 }
 
                 nk_layout_space_push(ctx, nk_rect(320,160,150,150));
-                if (nk_group_begin(ctx, &tab, "Group_right_center", NK_WINDOW_BORDER)) {
+                if (nk_group_begin(ctx, "Group_right_center", NK_WINDOW_BORDER)) {
                     static int selected[4];
                     nk_layout_row_static(ctx, 18, 100, 1);
                     for (i = 0; i < 4; ++i)
@@ -1001,7 +991,7 @@ overview(struct nk_context *ctx)
                 }
 
                 nk_layout_space_push(ctx, nk_rect(320,320,150,150));
-                if (nk_group_begin(ctx, &tab, "Group_right_bottom", NK_WINDOW_BORDER)) {
+                if (nk_group_begin(ctx, "Group_right_bottom", NK_WINDOW_BORDER)) {
                     static int selected[4];
                     nk_layout_row_static(ctx, 18, 100, 1);
                     for (i = 0; i < 4; ++i)
@@ -1023,7 +1013,6 @@ overview(struct nk_context *ctx)
                 {
                     static float a = 100, b = 100, c = 100;
                     struct nk_rect bounds;
-                    struct nk_panel sub;
 
                     float row_layout[5];
                     row_layout[0] = a;
@@ -1047,7 +1036,7 @@ overview(struct nk_context *ctx)
                     nk_layout_row(ctx, NK_STATIC, 200, 5, row_layout);
 
                     /* left space */
-                    if (nk_group_begin(ctx, &sub, "left", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR)) {
+                    if (nk_group_begin(ctx, "left", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR)) {
                         nk_layout_row_dynamic(ctx, 25, 1);
                         nk_button_label(ctx, "#FFAA");
                         nk_button_label(ctx, "#FFBB");
@@ -1070,7 +1059,7 @@ overview(struct nk_context *ctx)
                     }
 
                     /* middle space */
-                    if (nk_group_begin(ctx, &sub, "center", NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR)) {
+                    if (nk_group_begin(ctx, "center", NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR)) {
                         nk_layout_row_dynamic(ctx, 25, 1);
                         nk_button_label(ctx, "#FFAA");
                         nk_button_label(ctx, "#FFBB");
@@ -1093,7 +1082,7 @@ overview(struct nk_context *ctx)
                     }
 
                     /* right space */
-                    if (nk_group_begin(ctx, &sub, "right", NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR)) {
+                    if (nk_group_begin(ctx, "right", NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR)) {
                         nk_layout_row_dynamic(ctx, 25, 1);
                         nk_button_label(ctx, "#FFAA");
                         nk_button_label(ctx, "#FFBB");
@@ -1110,7 +1099,6 @@ overview(struct nk_context *ctx)
                 if (nk_tree_push(ctx, NK_TREE_NODE, "Horizontal", NK_MINIMIZED))
                 {
                     static float a = 100, b = 100, c = 100;
-                    struct nk_panel sub;
                     struct nk_rect bounds;
 
                     /* header */
@@ -1126,7 +1114,7 @@ overview(struct nk_context *ctx)
 
                     /* top space */
                     nk_layout_row_dynamic(ctx, a, 1);
-                    if (nk_group_begin(ctx, &sub, "top", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER)) {
+                    if (nk_group_begin(ctx, "top", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER)) {
                         nk_layout_row_dynamic(ctx, 25, 3);
                         nk_button_label(ctx, "#FFAA");
                         nk_button_label(ctx, "#FFBB");
@@ -1151,7 +1139,7 @@ overview(struct nk_context *ctx)
 
                     /* middle space */
                     nk_layout_row_dynamic(ctx, b, 1);
-                    if (nk_group_begin(ctx, &sub, "middle", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER)) {
+                    if (nk_group_begin(ctx, "middle", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER)) {
                         nk_layout_row_dynamic(ctx, 25, 3);
                         nk_button_label(ctx, "#FFAA");
                         nk_button_label(ctx, "#FFBB");
@@ -1177,7 +1165,7 @@ overview(struct nk_context *ctx)
 
                     /* bottom space */
                     nk_layout_row_dynamic(ctx, c, 1);
-                    if (nk_group_begin(ctx, &sub, "bottom", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER)) {
+                    if (nk_group_begin(ctx, "bottom", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER)) {
                         nk_layout_row_dynamic(ctx, 25, 3);
                         nk_button_label(ctx, "#FFAA");
                         nk_button_label(ctx, "#FFBB");

+ 5 - 7
demo/sdl_opengl2/main.c

@@ -1,4 +1,4 @@
-/* nuklear - v1.09 - public domain */
+/* nuklear - v1.17 - public domain */
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -116,8 +116,7 @@ main(int argc, char* argv[])
         nk_input_end(ctx);
 
         /* GUI */
-        {struct nk_panel layout;
-        if (nk_begin(ctx, &layout, "Demo", nk_rect(50, 50, 210, 250),
+        if (nk_begin(ctx, "Demo", nk_rect(50, 50, 210, 250),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
             NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
         {
@@ -134,11 +133,10 @@ main(int argc, char* argv[])
             nk_layout_row_dynamic(ctx, 25, 1);
             nk_property_int(ctx, "Compression:", 0, &property, 100, 10, 1);
 
-            {struct nk_panel combo;
             nk_layout_row_dynamic(ctx, 20, 1);
             nk_label(ctx, "background:", NK_TEXT_LEFT);
             nk_layout_row_dynamic(ctx, 25, 1);
-            if (nk_combo_begin_color(ctx, &combo, background, nk_vec2(nk_widget_width(ctx),400))) {
+            if (nk_combo_begin_color(ctx, background, nk_vec2(nk_widget_width(ctx),400))) {
                 nk_layout_row_dynamic(ctx, 120, 1);
                 background = nk_color_picker(ctx, background, NK_RGBA);
                 nk_layout_row_dynamic(ctx, 25, 1);
@@ -147,9 +145,9 @@ main(int argc, char* argv[])
                 background.b = (nk_byte)nk_propertyi(ctx, "#B:", 0, background.b, 255, 1,1);
                 background.a = (nk_byte)nk_propertyi(ctx, "#A:", 0, background.a, 255, 1,1);
                 nk_combo_end(ctx);
-            }}
+            }
         }
-        nk_end(ctx);}
+        nk_end(ctx);
 
         /* -------------- EXAMPLES ---------------- */
         /*calculator(ctx);*/

+ 1 - 1
demo/sdl_opengl2/nuklear_sdl_gl2.h

@@ -1,5 +1,5 @@
 /*
- * Nuklear - v1.00 - public domain
+ * Nuklear - v1.17 - public domain
  * no warrenty implied; use at your own risk.
  * authored from 2015-2016 by Micha Mettke
  */

+ 27 - 23
demo/sdl_opengl3/main.c

@@ -1,4 +1,4 @@
-/* nuklear - v1.09 - public domain */
+/* nuklear - v1.17 - public domain */
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -26,8 +26,8 @@
 #include "../../nuklear.h"
 #include "nuklear_sdl_gl3.h"
 
-#define WINDOW_WIDTH 1200
-#define WINDOW_HEIGHT 800
+#define WINDOW_WIDTH 800
+#define WINDOW_HEIGHT 600
 
 #define MAX_VERTEX_MEMORY 512 * 1024
 #define MAX_ELEMENT_MEMORY 128 * 1024
@@ -123,16 +123,35 @@ main(int argc, char* argv[])
         }
         nk_input_end(ctx);
 
+
         /* GUI */
-        {struct nk_panel layout;
-        if (nk_begin(ctx, &layout, "Demo", nk_rect(200, 200, 210, 250),
+        if (nk_begin(ctx, "Demo", nk_rect(50, 50, 200, 200),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
-            NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
+            NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
         {
+            nk_menubar_begin(ctx);
+            nk_layout_row_begin(ctx, NK_STATIC, 25, 2);
+            nk_layout_row_push(ctx, 45);
+            if (nk_menu_begin_label(ctx, "FILE", NK_TEXT_LEFT, nk_vec2(120, 200))) {
+                nk_layout_row_dynamic(ctx, 30, 1);
+                nk_menu_item_label(ctx, "OPEN", NK_TEXT_LEFT);
+                nk_menu_item_label(ctx, "CLOSE", NK_TEXT_LEFT);
+                nk_menu_end(ctx);
+            }
+            nk_layout_row_push(ctx, 45);
+            if (nk_menu_begin_label(ctx, "EDIT", NK_TEXT_LEFT, nk_vec2(120, 200))) {
+                nk_layout_row_dynamic(ctx, 30, 1);
+                nk_menu_item_label(ctx, "COPY", NK_TEXT_LEFT);
+                nk_menu_item_label(ctx, "CUT", NK_TEXT_LEFT);
+                nk_menu_item_label(ctx, "PASTE", NK_TEXT_LEFT);
+                nk_menu_end(ctx);
+            }
+            nk_layout_row_end(ctx);
+            nk_menubar_end(ctx);
+
             enum {EASY, HARD};
             static int op = EASY;
             static int property = 20;
-
             nk_layout_row_static(ctx, 30, 80, 1);
             if (nk_button_label(ctx, "button"))
                 fprintf(stdout, "button pressed\n");
@@ -141,23 +160,8 @@ main(int argc, char* argv[])
             if (nk_option_label(ctx, "hard", op == HARD)) op = HARD;
             nk_layout_row_dynamic(ctx, 25, 1);
             nk_property_int(ctx, "Compression:", 0, &property, 100, 10, 1);
-
-            {struct nk_panel combo;
-            nk_layout_row_dynamic(ctx, 20, 1);
-            nk_label(ctx, "background:", NK_TEXT_LEFT);
-            nk_layout_row_dynamic(ctx, 25, 1);
-            if (nk_combo_begin_color(ctx, &combo, background, nk_vec2(nk_widget_width(ctx),400))) {
-                nk_layout_row_dynamic(ctx, 120, 1);
-                background = nk_color_picker(ctx, background, NK_RGBA);
-                nk_layout_row_dynamic(ctx, 25, 1);
-                background.r = (nk_byte)nk_propertyi(ctx, "#R:", 0, background.r, 255, 1,1);
-                background.g = (nk_byte)nk_propertyi(ctx, "#G:", 0, background.g, 255, 1,1);
-                background.b = (nk_byte)nk_propertyi(ctx, "#B:", 0, background.b, 255, 1,1);
-                background.a = (nk_byte)nk_propertyi(ctx, "#A:", 0, background.a, 255, 1,1);
-                nk_combo_end(ctx);
-            }}
         }
-        nk_end(ctx);}
+        nk_end(ctx);
 
         /* -------------- EXAMPLES ---------------- */
         /*calculator(ctx);*/

+ 5 - 7
demo/sdl_opengl3/nuklear_sdl_gl3.h

@@ -1,5 +1,5 @@
 /*
- * Nuklear - v1.00 - public domain
+ * Nuklear - v1.17 - public domain
  * no warrenty implied; use at your own risk.
  * authored from 2015-2016 by Micha Mettke
  */
@@ -230,7 +230,7 @@ nk_sdl_render(enum nk_anti_aliasing AA, int max_vertex_buffer, int max_element_b
         glBufferData(GL_ARRAY_BUFFER, max_vertex_buffer, NULL, GL_STREAM_DRAW);
         glBufferData(GL_ELEMENT_ARRAY_BUFFER, max_element_buffer, NULL, GL_STREAM_DRAW);
 
-        /* load draw vertices & elements directly into vertex + element buffer */
+        /* load vertices/elements directly into vertex/element buffer */
         vertices = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
         elements = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
         {
@@ -256,8 +256,8 @@ nk_sdl_render(enum nk_anti_aliasing AA, int max_vertex_buffer, int max_element_b
 
             /* setup buffers to load vertices and elements */
             {struct nk_buffer vbuf, ebuf;
-            nk_buffer_init_fixed(&vbuf, vertices, (size_t)max_vertex_buffer);
-            nk_buffer_init_fixed(&ebuf, elements, (size_t)max_element_buffer);
+            nk_buffer_init_fixed(&vbuf, vertices, (nk_size)max_vertex_buffer);
+            nk_buffer_init_fixed(&ebuf, elements, (nk_size)max_element_buffer);
             nk_convert(&sdl.ctx, &dev->cmds, &vbuf, &ebuf, &config);}
         }
         glUnmapBuffer(GL_ARRAY_BUFFER);
@@ -267,12 +267,10 @@ nk_sdl_render(enum nk_anti_aliasing AA, int max_vertex_buffer, int max_element_b
         nk_draw_foreach(cmd, &sdl.ctx, &dev->cmds) {
             if (!cmd->elem_count) continue;
             glBindTexture(GL_TEXTURE_2D, (GLuint)cmd->texture.id);
-            glScissor(
-                (GLint)(cmd->clip_rect.x * scale.x),
+            glScissor((GLint)(cmd->clip_rect.x * scale.x),
                 (GLint)((height - (GLint)(cmd->clip_rect.y + cmd->clip_rect.h)) * scale.y),
                 (GLint)(cmd->clip_rect.w * scale.x),
                 (GLint)(cmd->clip_rect.h * scale.y));
-
             glDrawElements(GL_TRIANGLES, (GLsizei)cmd->elem_count, GL_UNSIGNED_SHORT, offset);
             offset += cmd->elem_count;
         }

+ 7 - 8
demo/x11/main.c

@@ -1,4 +1,4 @@
-/* nuklear - v1.09 - public domain */
+/* nuklear - v1.17 - public domain */
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -91,8 +91,8 @@ sleep_for(long t)
  * and the corresponding function. */
 /*#include "../style.c"*/
 /*#include "../calculator.c"*/
-/*#include "../overview.c"*/
-/*#include "../node_editor.c"*/
+#include "../overview.c"
+#include "../node_editor.c"
 
 /* ===============================================================
  *
@@ -155,8 +155,7 @@ main(void)
         nk_input_end(ctx);
 
         /* GUI */
-        {struct nk_panel layout;
-        if (nk_begin(ctx, &layout, "Demo", nk_rect(50, 50, 200, 200),
+        if (nk_begin(ctx, "Demo", nk_rect(50, 50, 200, 200),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
             NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
         {
@@ -173,13 +172,13 @@ main(void)
             nk_layout_row_dynamic(ctx, 25, 1);
             nk_property_int(ctx, "Compression:", 0, &property, 100, 10, 1);
         }
-        nk_end(ctx);}
+        nk_end(ctx);
         if (nk_window_is_closed(ctx, "Demo")) break;
 
         /* -------------- EXAMPLES ---------------- */
         /*calculator(ctx);*/
-        /*overview(ctx);*/
-        /*node_editor(ctx);*/
+        overview(ctx);
+        node_editor(ctx);
         /* ----------------------------------------- */
 
         /* Draw */

+ 1 - 1
demo/x11/nuklear_xlib.h

@@ -1,5 +1,5 @@
 /*
- * Nuklear - v1.00 - public domain
+ * Nuklear - v1.17 - public domain
  * no warrenty implied; use at your own risk.
  * authored from 2015-2016 by Micha Mettke
  */

+ 5 - 7
demo/x11_opengl2/main.c

@@ -1,4 +1,4 @@
-/* nuklear - v1.09 - public domain */
+/* nuklear - v1.17 - public domain */
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -252,8 +252,7 @@ int main(int argc, char **argv)
         nk_input_end(ctx);
 
         /* GUI */
-        {struct nk_panel layout;
-        if (nk_begin(ctx, &layout, "Demo", nk_rect(50, 50, 200, 200),
+        if (nk_begin(ctx, "Demo", nk_rect(50, 50, 200, 200),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
             NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
         {
@@ -270,11 +269,10 @@ int main(int argc, char **argv)
             nk_layout_row_dynamic(ctx, 25, 1);
             nk_property_int(ctx, "Compression:", 0, &property, 100, 10, 1);
 
-            {struct nk_panel combo;
             nk_layout_row_dynamic(ctx, 20, 1);
             nk_label(ctx, "background:", NK_TEXT_LEFT);
             nk_layout_row_dynamic(ctx, 25, 1);
-            if (nk_combo_begin_color(ctx, &combo, background, nk_vec2(nk_widget_width(ctx),400))) {
+            if (nk_combo_begin_color(ctx, background, nk_vec2(nk_widget_width(ctx),400))) {
                 nk_layout_row_dynamic(ctx, 120, 1);
                 background = nk_color_picker(ctx, background, NK_RGBA);
                 nk_layout_row_dynamic(ctx, 25, 1);
@@ -283,9 +281,9 @@ int main(int argc, char **argv)
                 background.b = (nk_byte)nk_propertyi(ctx, "#B:", 0, background.b, 255, 1,1);
                 background.a = (nk_byte)nk_propertyi(ctx, "#A:", 0, background.a, 255, 1,1);
                 nk_combo_end(ctx);
-            }}
+            }
         }
-        nk_end(ctx);}
+        nk_end(ctx);
         if (nk_window_is_closed(ctx, "Demo")) break;
 
         /* -------------- EXAMPLES ---------------- */

+ 1 - 1
demo/x11_opengl2/nuklear_xlib_gl2.h

@@ -1,5 +1,5 @@
 /*
- * Nuklear - v1.00 - public domain
+ * Nuklear - v1.17 - public domain
  * no warrenty implied; use at your own risk.
  * authored from 2015-2016 by Micha Mettke
  */

+ 5 - 7
demo/x11_opengl3/main.c

@@ -1,4 +1,4 @@
-/* nuklear - v1.09 - public domain */
+/* nuklear - v1.17 - public domain */
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -249,8 +249,7 @@ int main(int argc, char **argv)
         nk_input_end(ctx);
 
         /* GUI */
-        {struct nk_panel layout;
-        if (nk_begin(ctx, &layout, "Demo", nk_rect(50, 50, 200, 200),
+        if (nk_begin(ctx, "Demo", nk_rect(50, 50, 200, 200),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|
             NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
         {
@@ -267,11 +266,10 @@ int main(int argc, char **argv)
             nk_layout_row_dynamic(ctx, 25, 1);
             nk_property_int(ctx, "Compression:", 0, &property, 100, 10, 1);
 
-            {struct nk_panel combo;
             nk_layout_row_dynamic(ctx, 20, 1);
             nk_label(ctx, "background:", NK_TEXT_LEFT);
             nk_layout_row_dynamic(ctx, 25, 1);
-            if (nk_combo_begin_color(ctx, &combo, background, nk_vec2(nk_widget_width(ctx),400))) {
+            if (nk_combo_begin_color(ctx, background, nk_vec2(nk_widget_width(ctx),400))) {
                 nk_layout_row_dynamic(ctx, 120, 1);
                 background = nk_color_picker(ctx, background, NK_RGBA);
                 nk_layout_row_dynamic(ctx, 25, 1);
@@ -280,9 +278,9 @@ int main(int argc, char **argv)
                 background.b = (nk_byte)nk_propertyi(ctx, "#B:", 0, background.b, 255, 1,1);
                 background.a = (nk_byte)nk_propertyi(ctx, "#A:", 0, background.a, 255, 1,1);
                 nk_combo_end(ctx);
-            }}
+            }
         }
-        nk_end(ctx);}
+        nk_end(ctx);
         if (nk_window_is_closed(ctx, "Demo")) break;
 
         /* -------------- EXAMPLES ---------------- */

+ 1 - 1
demo/x11_opengl3/nuklear_xlib_gl3.h

@@ -1,5 +1,5 @@
 /*
- * Nuklear - v1.00 - public domain
+ * Nuklear - v1.17 - public domain
  * no warrenty implied; use at your own risk.
  * authored from 2015-2016 by Micha Mettke
  */

+ 1 - 2
example/canvas.c

@@ -348,7 +348,6 @@ pump_input(struct nk_context *ctx, GLFWwindow *win)
 }
 
 struct nk_canvas {
-    struct nk_panel layout;
     struct nk_command_buffer *painter;
     struct nk_vec2 item_spacing;
     struct nk_vec2 panel_padding;
@@ -371,7 +370,7 @@ canvas_begin(struct nk_context *ctx, struct nk_canvas *canvas, nk_flags flags,
 
     /* create/update window and set position + size */
     flags = flags & ~NK_WINDOW_DYNAMIC;
-    nk_begin(ctx, &canvas->layout, "Window", nk_rect(x, y, width, height), NK_WINDOW_NO_SCROLLBAR|flags);
+    nk_begin(ctx, "Window", nk_rect(x, y, width, height), NK_WINDOW_NO_SCROLLBAR|flags);
     nk_window_set_bounds(ctx, nk_rect(x, y, width, height));
 
     /* allocate the complete window space for drawing */

+ 11 - 18
example/extended.c

@@ -80,7 +80,6 @@ ui_piemenu(struct nk_context *ctx, struct nk_vec2 pos, float radius,
 {
     int ret = -1;
     struct nk_rect total_space;
-    struct nk_panel popup;
     struct nk_rect bounds;
     int active_item = 0;
 
@@ -94,7 +93,7 @@ ui_piemenu(struct nk_context *ctx, struct nk_vec2 pos, float radius,
     ctx->style.window.spacing = nk_vec2(0,0);
     ctx->style.window.padding = nk_vec2(0,0);
 
-    if (nk_popup_begin(ctx, &popup,  NK_POPUP_STATIC, "piemenu", NK_WINDOW_NO_SCROLLBAR,
+    if (nk_popup_begin(ctx, NK_POPUP_STATIC, "piemenu", NK_WINDOW_NO_SCROLLBAR,
         nk_rect(pos.x - total_space.x - radius, pos.y - radius - total_space.y,
         2*radius,2*radius)))
     {
@@ -187,12 +186,10 @@ grid_demo(struct nk_context *ctx, struct media *media)
     static const char *items[] = {"Item 0","item 1","item 2"};
     static int selected_item = 0;
     static int check = 1;
-    struct nk_panel layout;
 
     int i;
-    struct nk_panel combo;
     nk_style_set_font(ctx, &media->font_20->handle);
-    if (nk_begin(ctx, &layout, "Grid Demo", nk_rect(600, 350, 275, 250),
+    if (nk_begin(ctx, "Grid Demo", nk_rect(600, 350, 275, 250),
         NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|
         NK_WINDOW_NO_SCROLLBAR))
     {
@@ -207,7 +204,7 @@ grid_demo(struct nk_context *ctx, struct media *media)
         nk_label(ctx, "Checkbox:", NK_TEXT_RIGHT);
         nk_checkbox_label(ctx, "Check me", &check);
         nk_label(ctx, "Combobox:", NK_TEXT_RIGHT);
-        if (nk_combo_begin_label(ctx, &combo, items[selected_item], nk_vec2(nk_widget_width(ctx), 200))) {
+        if (nk_combo_begin_label(ctx, items[selected_item], nk_vec2(nk_widget_width(ctx), 200))) {
             nk_layout_row_dynamic(ctx, 25, 1);
             for (i = 0; i < 3; ++i)
                 if (nk_combo_item_label(ctx, items[i], NK_TEXT_LEFT))
@@ -253,15 +250,13 @@ ui_widget_centered(struct nk_context *ctx, struct media *media, float height)
 static void
 button_demo(struct nk_context *ctx, struct media *media)
 {
-    struct nk_panel layout;
-    struct nk_panel menu;
     static int option = 1;
     static int toggle0 = 1;
     static int toggle1 = 0;
     static int toggle2 = 1;
 
     nk_style_set_font(ctx, &media->font_20->handle);
-    nk_begin(ctx, &layout, "Button Demo", nk_rect(50,50,255,610),
+    nk_begin(ctx, "Button Demo", nk_rect(50,50,255,610),
         NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_TITLE);
 
     /*------------------------------------------------
@@ -271,7 +266,7 @@ button_demo(struct nk_context *ctx, struct media *media)
     {
         /* toolbar */
         nk_layout_row_static(ctx, 40, 40, 4);
-        if (nk_menu_begin_image(ctx, &menu, "Music", media->play, nk_vec2(110,120)))
+        if (nk_menu_begin_image(ctx, "Music", media->play, nk_vec2(110,120)))
         {
             /* settings */
             nk_layout_row_dynamic(ctx, 25, 1);
@@ -341,7 +336,7 @@ button_demo(struct nk_context *ctx, struct media *media)
      *                  CONTEXTUAL
      *------------------------------------------------*/
     nk_style_set_font(ctx, &media->font_18->handle);
-    if (nk_contextual_begin(ctx, &menu, NK_WINDOW_NO_SCROLLBAR, nk_vec2(150, 300), nk_window_get_bounds(ctx))) {
+    if (nk_contextual_begin(ctx, NK_WINDOW_NO_SCROLLBAR, nk_vec2(150, 300), nk_window_get_bounds(ctx))) {
         nk_layout_row_dynamic(ctx, 30, 1);
         if (nk_contextual_item_image_label(ctx, media->copy, "Clone", NK_TEXT_RIGHT))
             fprintf(stdout, "pressed clone!\n");
@@ -377,10 +372,8 @@ basic_demo(struct nk_context *ctx, struct media *media)
     static struct nk_vec2 piemenu_pos;
 
     int i = 0;
-    struct nk_panel layout;
-    struct nk_panel combo;
     nk_style_set_font(ctx, &media->font_20->handle);
-    nk_begin(ctx, &layout, "Basic Demo", nk_rect(320, 50, 275, 610),
+    nk_begin(ctx, "Basic Demo", nk_rect(320, 50, 275, 610),
         NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_TITLE);
 
     /*------------------------------------------------
@@ -403,7 +396,7 @@ basic_demo(struct nk_context *ctx, struct media *media)
      *------------------------------------------------*/
     if (image_active) {
         struct nk_panel popup;
-        if (nk_popup_begin(ctx, &popup, NK_POPUP_STATIC, "Image Popup", 0, nk_rect(265, 0, 320, 220))) {
+        if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Image Popup", 0, nk_rect(265, 0, 320, 220))) {
             nk_layout_row_static(ctx, 82, 82, 3);
             for (i = 0; i < 9; ++i) {
                 if (nk_button_image(ctx, media->images[i])) {
@@ -420,7 +413,7 @@ basic_demo(struct nk_context *ctx, struct media *media)
      *------------------------------------------------*/
     ui_header(ctx, media, "Combo box");
     ui_widget(ctx, media, 40);
-    if (nk_combo_begin_label(ctx, &combo, items[selected_item], nk_vec2(nk_widget_width(ctx), 200))) {
+    if (nk_combo_begin_label(ctx, items[selected_item], nk_vec2(nk_widget_width(ctx), 200))) {
         nk_layout_row_dynamic(ctx, 35, 1);
         for (i = 0; i < 3; ++i)
             if (nk_combo_item_label(ctx, items[i], NK_TEXT_LEFT))
@@ -429,7 +422,7 @@ basic_demo(struct nk_context *ctx, struct media *media)
     }
 
     ui_widget(ctx, media, 40);
-    if (nk_combo_begin_image_label(ctx, &combo, items[selected_icon], media->images[selected_icon], nk_vec2(nk_widget_width(ctx), 200))) {
+    if (nk_combo_begin_image_label(ctx, items[selected_icon], media->images[selected_icon], nk_vec2(nk_widget_width(ctx), 200))) {
         nk_layout_row_dynamic(ctx, 35, 1);
         for (i = 0; i < 3; ++i)
             if (nk_combo_item_image_label(ctx, media->images[i], items[i], NK_TEXT_RIGHT))
@@ -457,7 +450,7 @@ basic_demo(struct nk_context *ctx, struct media *media)
      *                  PIEMENU
      *------------------------------------------------*/
     if (nk_input_is_mouse_click_down_in_rect(&ctx->input, NK_BUTTON_RIGHT,
-        layout.bounds,nk_true)){
+        nk_window_get_bounds(ctx),nk_true)){
         piemenu_pos = ctx->input.mouse.pos;
         piemenu_active = 1;
     }

+ 3 - 4
example/file_browser.c

@@ -397,11 +397,10 @@ static int
 file_browser_run(struct file_browser *browser, struct nk_context *ctx)
 {
     int ret = 0;
-    struct nk_panel layout;
     struct media *media = browser->media;
     struct nk_rect total_space;
 
-    if (nk_begin(ctx, &layout, "File Browser", nk_rect(50, 50, 800, 600),
+    if (nk_begin(ctx, "File Browser", nk_rect(50, 50, 800, 600),
         NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_MOVABLE))
     {
         struct nk_panel sub;
@@ -434,7 +433,7 @@ file_browser_run(struct file_browser *browser, struct nk_context *ctx)
         /* window layout */
         total_space = nk_window_get_content_region(ctx);
         nk_layout_row(ctx, NK_DYNAMIC, total_space.h, 2, ratio);
-        nk_group_begin(ctx, &sub, "Special", NK_WINDOW_NO_SCROLLBAR);
+        nk_group_begin(ctx, "Special", NK_WINDOW_NO_SCROLLBAR);
         {
             struct nk_image home = media->icons.home;
             struct nk_image desktop = media->icons.desktop;
@@ -451,7 +450,7 @@ file_browser_run(struct file_browser *browser, struct nk_context *ctx)
         }
 
         /* output directory content window */
-        nk_group_begin(ctx, &sub, "Content", 0);
+        nk_group_begin(ctx, "Content", 0);
         {
             int index = -1;
             size_t i = 0, j = 0, k = 0;

+ 2 - 2
example/skinning.c

@@ -735,7 +735,7 @@ int main(int argc, char *argv[])
 
         /* GUI */
         {struct nk_panel layout, tab;
-        if (nk_begin(&ctx, &layout, "Demo", nk_rect(50, 50, 300, 400),
+        if (nk_begin(&ctx, "Demo", nk_rect(50, 50, 300, 400),
             NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_TITLE))
         {
             int i;
@@ -785,7 +785,7 @@ int main(int argc, char *argv[])
             nk_chart_end(&ctx);
 
             nk_layout_row_dynamic(&ctx, 250, 1);
-            if (nk_group_begin(&ctx, &tab, "Standard", NK_WINDOW_BORDER|NK_WINDOW_BORDER))
+            if (nk_group_begin(&ctx, "Standard", NK_WINDOW_BORDER|NK_WINDOW_BORDER))
             {
                 if (nk_tree_push(&ctx, NK_TREE_NODE, "Window", NK_MAXIMIZED)) {
                     static int selected[8];

File diff suppressed because it is too large
+ 332 - 300
nuklear.h


Some files were not shown because too many files changed in this diff