mirror of https://github.com/vurtun/nuklear.git
Update demos configurables and removed warnings
parent
07e422ecd1
commit
6bddc5c5f0
|
@ -32,17 +32,32 @@
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
#define UNUSED(a) (void)a
|
/*#define INCLUDE_STYLE */
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
/*#define INCLUDE_CALCULATOR */
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
/*#define INCLUDE_OVERVIEW */
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
/*#include "../style.c"*/
|
#ifdef INCLUDE_ALL
|
||||||
/*#include "../calculator.c"*/
|
#define INCLUDE_STYLE
|
||||||
/*#include "../overview.c"*/
|
#define INCLUDE_CALCULATOR
|
||||||
/*#include "../node_editor.c"*/
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -189,10 +204,12 @@ int main(void)
|
||||||
/*nk_style_set_font(ctx, &droid->handle)*/;}
|
/*nk_style_set_font(ctx, &droid->handle)*/;}
|
||||||
|
|
||||||
/* style.c */
|
/* style.c */
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
background = nk_rgb(28,48,62);
|
background = nk_rgb(28,48,62);
|
||||||
while (running)
|
while (running)
|
||||||
|
@ -244,9 +261,15 @@ int main(void)
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
{/* Draw */
|
{/* Draw */
|
||||||
|
|
|
@ -29,17 +29,32 @@
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
#define UNUSED(a) (void)a
|
/*#define INCLUDE_STYLE */
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
/*#define INCLUDE_CALCULATOR */
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
/*#define INCLUDE_OVERVIEW */
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
/*#include "../style.c"*/
|
#ifdef INCLUDE_ALL
|
||||||
/*#include "../calculator.c"*/
|
#define INCLUDE_STYLE
|
||||||
/*#include "../overview.c"*/
|
#define INCLUDE_CALCULATOR
|
||||||
/*#include "../node_editor.c"*/
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -194,10 +209,12 @@ int main(void)
|
||||||
/*nk_style_set_font(ctx, &droid->handle)*/;}
|
/*nk_style_set_font(ctx, &droid->handle)*/;}
|
||||||
|
|
||||||
/* style.c */
|
/* style.c */
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
background = nk_rgb(28,48,62);
|
background = nk_rgb(28,48,62);
|
||||||
while (running)
|
while (running)
|
||||||
|
@ -248,9 +265,15 @@ int main(void)
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -24,17 +24,32 @@
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
#define UNUSED(a) (void)a
|
/*#define INCLUDE_STYLE */
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
/*#define INCLUDE_CALCULATOR */
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
/*#define INCLUDE_OVERVIEW */
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
/*#include "../style.c"*/
|
#ifdef INCLUDE_ALL
|
||||||
/*#include "../calculator.c"*/
|
#define INCLUDE_STYLE
|
||||||
/*#include "../overview.c"*/
|
#define INCLUDE_CALCULATOR
|
||||||
/*#include "../node_editor.c"*/
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -94,10 +109,12 @@ int main(void)
|
||||||
ctx = nk_gdi_init(font, dc, WINDOW_WIDTH, WINDOW_HEIGHT);
|
ctx = nk_gdi_init(font, dc, WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||||
|
|
||||||
/* style.c */
|
/* style.c */
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
while (running)
|
while (running)
|
||||||
{
|
{
|
||||||
|
@ -144,9 +161,15 @@ int main(void)
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -23,18 +23,33 @@
|
||||||
* EXAMPLE
|
* EXAMPLE
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* These are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
#define UNUSED(a) (void)a
|
/*#define INCLUDE_STYLE */
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
/*#define INCLUDE_CALCULATOR */
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
/*#define INCLUDE_OVERVIEW */
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
/*#include "../style.c"*/
|
#ifdef INCLUDE_ALL
|
||||||
/*#include "../calculator.c"*/
|
#define INCLUDE_STYLE
|
||||||
/*#include "../overview.c"*/
|
#define INCLUDE_CALCULATOR
|
||||||
/*#include "../node_editor.c"*/
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -90,10 +105,12 @@ int main(void)
|
||||||
nk_gdip_set_font(font);
|
nk_gdip_set_font(font);
|
||||||
|
|
||||||
/* style.c */
|
/* style.c */
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
while (running)
|
while (running)
|
||||||
{
|
{
|
||||||
|
@ -139,9 +156,15 @@ int main(void)
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -27,23 +27,38 @@
|
||||||
#define WINDOW_WIDTH 1200
|
#define WINDOW_WIDTH 1200
|
||||||
#define WINDOW_HEIGHT 800
|
#define WINDOW_HEIGHT 800
|
||||||
|
|
||||||
#define UNUSED(a) (void)a
|
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
* EXAMPLE
|
* EXAMPLE
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
/*#include "../style.c"*/
|
/*#define INCLUDE_STYLE */
|
||||||
/*#include "../calculator.c"*/
|
/*#define INCLUDE_CALCULATOR */
|
||||||
/*#include "../overview.c"*/
|
/*#define INCLUDE_OVERVIEW */
|
||||||
/*#include "../node_editor.c"*/
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
|
#ifdef INCLUDE_ALL
|
||||||
|
#define INCLUDE_STYLE
|
||||||
|
#define INCLUDE_CALCULATOR
|
||||||
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -87,11 +102,12 @@ int main(void)
|
||||||
/*nk_style_load_all_cursors(ctx, atlas->cursors);*/
|
/*nk_style_load_all_cursors(ctx, atlas->cursors);*/
|
||||||
/*nk_style_set_font(ctx, &droid->handle);*/}
|
/*nk_style_set_font(ctx, &droid->handle);*/}
|
||||||
|
|
||||||
/* style.c */
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
background = nk_rgb(28,48,62);
|
background = nk_rgb(28,48,62);
|
||||||
while (!glfwWindowShouldClose(win))
|
while (!glfwWindowShouldClose(win))
|
||||||
|
@ -136,9 +152,15 @@ int main(void)
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -31,23 +31,38 @@
|
||||||
#define MAX_VERTEX_BUFFER 512 * 1024
|
#define MAX_VERTEX_BUFFER 512 * 1024
|
||||||
#define MAX_ELEMENT_BUFFER 128 * 1024
|
#define MAX_ELEMENT_BUFFER 128 * 1024
|
||||||
|
|
||||||
#define UNUSED(a) (void)a
|
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
* EXAMPLE
|
* EXAMPLE
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
/*#include "../style.c"*/
|
/*#define INCLUDE_STYLE */
|
||||||
/*#include "../calculator.c"*/
|
/*#define INCLUDE_CALCULATOR */
|
||||||
/*#include "../overview.c"*/
|
/*#define INCLUDE_OVERVIEW */
|
||||||
/*#include "../node_editor.c"*/
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
|
#ifdef INCLUDE_ALL
|
||||||
|
#define INCLUDE_STYLE
|
||||||
|
#define INCLUDE_CALCULATOR
|
||||||
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -104,11 +119,12 @@ int main(void)
|
||||||
/*nk_style_load_all_cursors(ctx, atlas->cursors);*/
|
/*nk_style_load_all_cursors(ctx, atlas->cursors);*/
|
||||||
/*nk_style_set_font(ctx, &droid->handle);*/}
|
/*nk_style_set_font(ctx, &droid->handle);*/}
|
||||||
|
|
||||||
/* style.c */
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
background = nk_rgb(28,48,62);
|
background = nk_rgb(28,48,62);
|
||||||
while (!glfwWindowShouldClose(win))
|
while (!glfwWindowShouldClose(win))
|
||||||
|
@ -153,9 +169,15 @@ int main(void)
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -104,7 +104,7 @@ node_editor_add(struct node_editor *editor, const char *name, struct nk_rect bou
|
||||||
{
|
{
|
||||||
static int IDs = 0;
|
static int IDs = 0;
|
||||||
struct node *node;
|
struct node *node;
|
||||||
assert((nk_size)editor->node_count < LEN(editor->node_buf));
|
NK_ASSERT((nk_size)editor->node_count < NK_LEN(editor->node_buf));
|
||||||
node = &editor->node_buf[editor->node_count++];
|
node = &editor->node_buf[editor->node_count++];
|
||||||
node->ID = IDs++;
|
node->ID = IDs++;
|
||||||
node->value = 0;
|
node->value = 0;
|
||||||
|
@ -122,7 +122,7 @@ node_editor_link(struct node_editor *editor, int in_id, int in_slot,
|
||||||
int out_id, int out_slot)
|
int out_id, int out_slot)
|
||||||
{
|
{
|
||||||
struct node_link *link;
|
struct node_link *link;
|
||||||
assert((nk_size)editor->link_count < LEN(editor->links));
|
NK_ASSERT((nk_size)editor->link_count < NK_LEN(editor->links));
|
||||||
link = &editor->links[editor->link_count++];
|
link = &editor->links[editor->link_count++];
|
||||||
link->input_id = in_id;
|
link->input_id = in_id;
|
||||||
link->input_slot = in_slot;
|
link->input_slot = in_slot;
|
||||||
|
@ -169,6 +169,7 @@ node_editor(struct nk_context *ctx)
|
||||||
{
|
{
|
||||||
struct node *it = nodedit->begin;
|
struct node *it = nodedit->begin;
|
||||||
struct nk_rect size = nk_layout_space_bounds(ctx);
|
struct nk_rect size = nk_layout_space_bounds(ctx);
|
||||||
|
struct nk_panel *node = 0;
|
||||||
|
|
||||||
if (nodedit->show_grid) {
|
if (nodedit->show_grid) {
|
||||||
/* display grid */
|
/* display grid */
|
||||||
|
@ -182,7 +183,6 @@ node_editor(struct nk_context *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* execute each node as a movable group */
|
/* execute each node as a movable group */
|
||||||
struct nk_panel *node;
|
|
||||||
while (it) {
|
while (it) {
|
||||||
/* calculate scrolled node window position and size */
|
/* calculate scrolled node window position and size */
|
||||||
nk_layout_space_push(ctx, nk_rect(it->bounds.x - nodedit->scrolling.x,
|
nk_layout_space_push(ctx, nk_rect(it->bounds.x - nodedit->scrolling.x,
|
||||||
|
|
|
@ -228,7 +228,7 @@ overview(struct nk_context *ctx)
|
||||||
|
|
||||||
nk_label(ctx, "Slider float", NK_TEXT_LEFT);
|
nk_label(ctx, "Slider float", NK_TEXT_LEFT);
|
||||||
nk_slider_float(ctx, 0, &float_slider, 5.0, 0.5f);
|
nk_slider_float(ctx, 0, &float_slider, 5.0, 0.5f);
|
||||||
nk_labelf(ctx, NK_TEXT_LEFT, "Progressbar" , prog_value);
|
nk_labelf(ctx, NK_TEXT_LEFT, "Progressbar: %zu" , prog_value);
|
||||||
nk_progress(ctx, &prog_value, 100, NK_MODIFIABLE);
|
nk_progress(ctx, &prog_value, 100, NK_MODIFIABLE);
|
||||||
|
|
||||||
nk_layout_row(ctx, NK_STATIC, 25, 2, ratio);
|
nk_layout_row(ctx, NK_STATIC, 25, 2, ratio);
|
||||||
|
@ -924,6 +924,7 @@ overview(struct nk_context *ctx)
|
||||||
{
|
{
|
||||||
nk_style_pop_vec2(ctx);
|
nk_style_pop_vec2(ctx);
|
||||||
switch (current_tab) {
|
switch (current_tab) {
|
||||||
|
default: break;
|
||||||
case CHART_LINE:
|
case CHART_LINE:
|
||||||
nk_layout_row_dynamic(ctx, 100, 1);
|
nk_layout_row_dynamic(ctx, 100, 1);
|
||||||
bounds = nk_widget_bounds(ctx);
|
bounds = nk_widget_bounds(ctx);
|
||||||
|
|
|
@ -28,23 +28,38 @@
|
||||||
#define WINDOW_WIDTH 1200
|
#define WINDOW_WIDTH 1200
|
||||||
#define WINDOW_HEIGHT 800
|
#define WINDOW_HEIGHT 800
|
||||||
|
|
||||||
#define UNUSED(a) (void)a
|
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
* EXAMPLE
|
* EXAMPLE
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
/*#include "../style.c"*/
|
/*#define INCLUDE_STYLE */
|
||||||
/*#include "../calculator.c"*/
|
/*#define INCLUDE_CALCULATOR */
|
||||||
/*#include "../overview.c"*/
|
/*#define INCLUDE_OVERVIEW */
|
||||||
/*#include "../node_editor.c"*/
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
|
#ifdef INCLUDE_ALL
|
||||||
|
#define INCLUDE_STYLE
|
||||||
|
#define INCLUDE_CALCULATOR
|
||||||
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -52,7 +67,7 @@
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
int
|
int
|
||||||
main(int argc, char* argv[])
|
main(void)
|
||||||
{
|
{
|
||||||
/* Platform */
|
/* Platform */
|
||||||
SDL_Window *win;
|
SDL_Window *win;
|
||||||
|
@ -94,11 +109,12 @@ main(int argc, char* argv[])
|
||||||
/*nk_style_load_all_cursors(ctx, atlas->cursors);*/
|
/*nk_style_load_all_cursors(ctx, atlas->cursors);*/
|
||||||
/*nk_style_set_font(ctx, &roboto->handle)*/;}
|
/*nk_style_set_font(ctx, &roboto->handle)*/;}
|
||||||
|
|
||||||
/* style.c */
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
background = nk_rgb(28,48,62);
|
background = nk_rgb(28,48,62);
|
||||||
while (running)
|
while (running)
|
||||||
|
@ -147,9 +163,15 @@ main(int argc, char* argv[])
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -26,36 +26,51 @@
|
||||||
#include "../../nuklear.h"
|
#include "../../nuklear.h"
|
||||||
#include "nuklear_sdl_gl3.h"
|
#include "nuklear_sdl_gl3.h"
|
||||||
|
|
||||||
#define WINDOW_WIDTH 800
|
#define WINDOW_WIDTH 1200
|
||||||
#define WINDOW_HEIGHT 600
|
#define WINDOW_HEIGHT 800
|
||||||
|
|
||||||
#define MAX_VERTEX_MEMORY 512 * 1024
|
#define MAX_VERTEX_MEMORY 512 * 1024
|
||||||
#define MAX_ELEMENT_MEMORY 128 * 1024
|
#define MAX_ELEMENT_MEMORY 128 * 1024
|
||||||
|
|
||||||
#define UNUSED(a) (void)a
|
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
* EXAMPLE
|
* EXAMPLE
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
/*#include "../style.c"*/
|
/*#define INCLUDE_STYLE */
|
||||||
/*#include "../calculator.c"*/
|
/*#define INCLUDE_CALCULATOR */
|
||||||
/*#include "../overview.c"*/
|
/*#define INCLUDE_OVERVIEW */
|
||||||
/*#include "../node_editor.c"*/
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
|
#ifdef INCLUDE_ALL
|
||||||
|
#define INCLUDE_STYLE
|
||||||
|
#define INCLUDE_CALCULATOR
|
||||||
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
* DEMO
|
* DEMO
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
int main(int argc, char* argv[])
|
int main(void)
|
||||||
{
|
{
|
||||||
/* Platform */
|
/* Platform */
|
||||||
SDL_Window *win;
|
SDL_Window *win;
|
||||||
|
@ -105,10 +120,12 @@ int main(int argc, char* argv[])
|
||||||
/*nk_style_set_font(ctx, &roboto->handle);*/}
|
/*nk_style_set_font(ctx, &roboto->handle);*/}
|
||||||
|
|
||||||
/* style.c */
|
/* style.c */
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
background = nk_rgb(28,48,62);
|
background = nk_rgb(28,48,62);
|
||||||
while (running)
|
while (running)
|
||||||
|
@ -142,9 +159,15 @@ int main(int argc, char* argv[])
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -28,23 +28,38 @@
|
||||||
#define WINDOW_WIDTH 1200
|
#define WINDOW_WIDTH 1200
|
||||||
#define WINDOW_HEIGHT 800
|
#define WINDOW_HEIGHT 800
|
||||||
|
|
||||||
#define UNUSED(a) (void)a
|
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
* EXAMPLE
|
* EXAMPLE
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
/*#include "../style.c"*/
|
/*#define INCLUDE_STYLE */
|
||||||
/*#include "../calculator.c"*/
|
/*#define INCLUDE_CALCULATOR */
|
||||||
/*#include "../overview.c"*/
|
/*#define INCLUDE_OVERVIEW */
|
||||||
/*#include "../node_editor.c"*/
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
|
#ifdef INCLUDE_ALL
|
||||||
|
#define INCLUDE_STYLE
|
||||||
|
#define INCLUDE_CALCULATOR
|
||||||
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -78,10 +93,12 @@ int main(void)
|
||||||
/*nk_style_set_font(ctx, &droid->handle);*/
|
/*nk_style_set_font(ctx, &droid->handle);*/
|
||||||
|
|
||||||
/* style.c */
|
/* style.c */
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
struct nk_color background;
|
struct nk_color background;
|
||||||
background = nk_rgb(28,48,62);
|
background = nk_rgb(28,48,62);
|
||||||
|
@ -135,9 +152,15 @@ int main(void)
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -30,23 +30,38 @@
|
||||||
#define MAX_VERTEX_BUFFER 512 * 1024
|
#define MAX_VERTEX_BUFFER 512 * 1024
|
||||||
#define MAX_ELEMENT_BUFFER 128 * 1024
|
#define MAX_ELEMENT_BUFFER 128 * 1024
|
||||||
|
|
||||||
#define UNUSED(a) (void)a
|
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
* EXAMPLE
|
* EXAMPLE
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
/*#include "../style.c"*/
|
/*#define INCLUDE_STYLE */
|
||||||
/*#include "../calculator.c"*/
|
/*#define INCLUDE_CALCULATOR */
|
||||||
/*#include "../overview.c"*/
|
/*#define INCLUDE_OVERVIEW */
|
||||||
/*#include "../node_editor.c"*/
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
|
#ifdef INCLUDE_ALL
|
||||||
|
#define INCLUDE_STYLE
|
||||||
|
#define INCLUDE_CALCULATOR
|
||||||
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -84,10 +99,12 @@ int main(void)
|
||||||
/*nk_style_set_font(ctx, &droid->handle);*/
|
/*nk_style_set_font(ctx, &droid->handle);*/
|
||||||
|
|
||||||
/* style.c */
|
/* style.c */
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
struct nk_color background;
|
struct nk_color background;
|
||||||
background = nk_rgb(28,48,62);
|
background = nk_rgb(28,48,62);
|
||||||
|
@ -142,9 +159,15 @@ int main(void)
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
enum theme {THEME_BLACK, THEME_WHITE, THEME_RED, THEME_BLUE, THEME_DARK};
|
enum theme {THEME_BLACK, THEME_WHITE, THEME_RED, THEME_BLUE, THEME_DARK};
|
||||||
|
|
||||||
void
|
static void
|
||||||
set_style(struct nk_context *ctx, enum theme theme)
|
set_style(struct nk_context *ctx, enum theme theme)
|
||||||
{
|
{
|
||||||
struct nk_color table[NK_COLOR_COUNT];
|
struct nk_color table[NK_COLOR_COUNT];
|
||||||
|
|
|
@ -23,11 +23,6 @@
|
||||||
#define WINDOW_WIDTH 800
|
#define WINDOW_WIDTH 800
|
||||||
#define WINDOW_HEIGHT 600
|
#define WINDOW_HEIGHT 600
|
||||||
|
|
||||||
#define UNUSED(a) (void)a
|
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
|
||||||
|
|
||||||
typedef struct XWindow XWindow;
|
typedef struct XWindow XWindow;
|
||||||
struct XWindow {
|
struct XWindow {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
|
@ -55,14 +50,6 @@ die(const char *fmt, ...)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void*
|
|
||||||
xcalloc(size_t siz, size_t n)
|
|
||||||
{
|
|
||||||
void *ptr = calloc(siz, n);
|
|
||||||
if (!ptr) die("Out of memory\n");
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static long
|
static long
|
||||||
timestamp(void)
|
timestamp(void)
|
||||||
{
|
{
|
||||||
|
@ -87,13 +74,33 @@ sleep_for(long t)
|
||||||
* EXAMPLE
|
* EXAMPLE
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* These are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
/*#include "../style.c"*/
|
/*#define INCLUDE_STYLE */
|
||||||
/*#include "../calculator.c"*/
|
/*#define INCLUDE_CALCULATOR */
|
||||||
/*#include "../overview.c"*/
|
/*#define INCLUDE_OVERVIEW */
|
||||||
/*#include "../node_editor.c"*/
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
|
#ifdef INCLUDE_ALL
|
||||||
|
#define INCLUDE_STYLE
|
||||||
|
#define INCLUDE_CALCULATOR
|
||||||
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -140,11 +147,12 @@ main(void)
|
||||||
xw.font = nk_xfont_create(xw.dpy, "fixed");
|
xw.font = nk_xfont_create(xw.dpy, "fixed");
|
||||||
ctx = nk_xlib_init(xw.font, xw.dpy, xw.screen, xw.win, xw.width, xw.height);
|
ctx = nk_xlib_init(xw.font, xw.dpy, xw.screen, xw.win, xw.width, xw.height);
|
||||||
|
|
||||||
/* style.c */
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
while (running)
|
while (running)
|
||||||
{
|
{
|
||||||
|
@ -182,9 +190,15 @@ main(void)
|
||||||
if (nk_window_is_hidden(ctx, "Demo")) break;
|
if (nk_window_is_hidden(ctx, "Demo")) break;
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -31,23 +31,38 @@
|
||||||
#define MAX_VERTEX_BUFFER 512 * 1024
|
#define MAX_VERTEX_BUFFER 512 * 1024
|
||||||
#define MAX_ELEMENT_BUFFER 128 * 1024
|
#define MAX_ELEMENT_BUFFER 128 * 1024
|
||||||
|
|
||||||
#define UNUSED(a) (void)a
|
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
* EXAMPLE
|
* EXAMPLE
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
/*#include "../style.c"*/
|
/*#define INCLUDE_STYLE */
|
||||||
/*#include "../calculator.c"*/
|
/*#define INCLUDE_CALCULATOR */
|
||||||
/*#include "../overview.c"*/
|
/*#define INCLUDE_OVERVIEW */
|
||||||
/*#include "../node_editor.c"*/
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
|
#ifdef INCLUDE_ALL
|
||||||
|
#define INCLUDE_STYLE
|
||||||
|
#define INCLUDE_CALCULATOR
|
||||||
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -67,7 +82,7 @@ struct XWindow {
|
||||||
};
|
};
|
||||||
static int gl_err = nk_false;
|
static int gl_err = nk_false;
|
||||||
static int gl_error_handler(Display *dpy, XErrorEvent *ev)
|
static int gl_error_handler(Display *dpy, XErrorEvent *ev)
|
||||||
{UNUSED((dpy, ev)); gl_err = nk_true; return 0;}
|
{NK_UNUSED(dpy); NK_UNUSED(ev); gl_err = nk_true; return 0;}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
die(const char *fmt, ...)
|
die(const char *fmt, ...)
|
||||||
|
@ -101,7 +116,7 @@ has_extension(const char *string, const char *ext)
|
||||||
return nk_false;
|
return nk_false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
/* Platform */
|
/* Platform */
|
||||||
int running = 1;
|
int running = 1;
|
||||||
|
@ -152,7 +167,7 @@ int main(int argc, char **argv)
|
||||||
glXGetFBConfigAttrib(win.dpy, fbc[i], GLX_SAMPLE_BUFFERS, &sample_buffer);
|
glXGetFBConfigAttrib(win.dpy, fbc[i], GLX_SAMPLE_BUFFERS, &sample_buffer);
|
||||||
glXGetFBConfigAttrib(win.dpy, fbc[i], GLX_SAMPLES, &samples);
|
glXGetFBConfigAttrib(win.dpy, fbc[i], GLX_SAMPLES, &samples);
|
||||||
if ((fb_best < 0) || (sample_buffer && samples > best_num_samples))
|
if ((fb_best < 0) || (sample_buffer && samples > best_num_samples))
|
||||||
fb_best = i; best_num_samples = samples;
|
fb_best = i, best_num_samples = samples;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
win.fbc = fbc[fb_best];
|
win.fbc = fbc[fb_best];
|
||||||
|
@ -236,11 +251,12 @@ int main(int argc, char **argv)
|
||||||
/*nk_style_load_all_cursors(ctx, atlas->cursors);*/
|
/*nk_style_load_all_cursors(ctx, atlas->cursors);*/
|
||||||
/*nk_style_set_font(ctx, &droid->handle);*/}
|
/*nk_style_set_font(ctx, &droid->handle);*/}
|
||||||
|
|
||||||
/* style.c */
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
background = nk_rgb(28,48,62);
|
background = nk_rgb(28,48,62);
|
||||||
while (running)
|
while (running)
|
||||||
|
@ -291,9 +307,15 @@ int main(int argc, char **argv)
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
|
@ -29,23 +29,38 @@
|
||||||
#define MAX_VERTEX_BUFFER 512 * 1024
|
#define MAX_VERTEX_BUFFER 512 * 1024
|
||||||
#define MAX_ELEMENT_BUFFER 128 * 1024
|
#define MAX_ELEMENT_BUFFER 128 * 1024
|
||||||
|
|
||||||
#define UNUSED(a) (void)a
|
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
|
||||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
* EXAMPLE
|
* EXAMPLE
|
||||||
*
|
*
|
||||||
* ===============================================================*/
|
* ===============================================================*/
|
||||||
/* This are some code examples to provide a small overview of what can be
|
/* This are some code examples to provide a small overview of what can be
|
||||||
* done with this library. To try out an example uncomment the include
|
* done with this library. To try out an example uncomment the defines */
|
||||||
* and the corresponding function. */
|
/*#define INCLUDE_ALL */
|
||||||
/*#include "../style.c"*/
|
/*#define INCLUDE_STYLE */
|
||||||
/*#include "../calculator.c"*/
|
/*#define INCLUDE_CALCULATOR */
|
||||||
/*#include "../overview.c"*/
|
/*#define INCLUDE_OVERVIEW */
|
||||||
/*#include "../node_editor.c"*/
|
/*#define INCLUDE_NODE_EDITOR */
|
||||||
|
|
||||||
|
#ifdef INCLUDE_ALL
|
||||||
|
#define INCLUDE_STYLE
|
||||||
|
#define INCLUDE_CALCULATOR
|
||||||
|
#define INCLUDE_OVERVIEW
|
||||||
|
#define INCLUDE_NODE_EDITOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_STYLE
|
||||||
|
#include "../style.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_CALCULATOR
|
||||||
|
#include "../calculator.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
#include "../overview.c"
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
#include "../node_editor.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ===============================================================
|
/* ===============================================================
|
||||||
*
|
*
|
||||||
|
@ -65,7 +80,7 @@ struct XWindow {
|
||||||
};
|
};
|
||||||
static int gl_err = nk_false;
|
static int gl_err = nk_false;
|
||||||
static int gl_error_handler(Display *dpy, XErrorEvent *ev)
|
static int gl_error_handler(Display *dpy, XErrorEvent *ev)
|
||||||
{UNUSED((dpy, ev)); gl_err = nk_true;return 0;}
|
{NK_UNUSED(dpy); NK_UNUSED(ev); gl_err = nk_true;return 0;}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
die(const char *fmt, ...)
|
die(const char *fmt, ...)
|
||||||
|
@ -99,7 +114,7 @@ has_extension(const char *string, const char *ext)
|
||||||
return nk_false;
|
return nk_false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(void)
|
||||||
{
|
{
|
||||||
/* Platform */
|
/* Platform */
|
||||||
int running = 1;
|
int running = 1;
|
||||||
|
@ -150,7 +165,7 @@ int main(int argc, char **argv)
|
||||||
glXGetFBConfigAttrib(win.dpy, fbc[i], GLX_SAMPLE_BUFFERS, &sample_buffer);
|
glXGetFBConfigAttrib(win.dpy, fbc[i], GLX_SAMPLE_BUFFERS, &sample_buffer);
|
||||||
glXGetFBConfigAttrib(win.dpy, fbc[i], GLX_SAMPLES, &samples);
|
glXGetFBConfigAttrib(win.dpy, fbc[i], GLX_SAMPLES, &samples);
|
||||||
if ((fb_best < 0) || (sample_buffer && samples > best_num_samples))
|
if ((fb_best < 0) || (sample_buffer && samples > best_num_samples))
|
||||||
fb_best = i; best_num_samples = samples;
|
fb_best = i, best_num_samples = samples;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
win.fbc = fbc[fb_best];
|
win.fbc = fbc[fb_best];
|
||||||
|
@ -233,11 +248,12 @@ int main(int argc, char **argv)
|
||||||
/*nk_style_load_all_cursors(ctx, atlas->cursors);*/
|
/*nk_style_load_all_cursors(ctx, atlas->cursors);*/
|
||||||
/*nk_style_set_font(ctx, &droid->handle);*/}
|
/*nk_style_set_font(ctx, &droid->handle);*/}
|
||||||
|
|
||||||
/* style.c */
|
#ifdef INCLUDE_STYLE
|
||||||
/*set_style(ctx, THEME_WHITE);*/
|
/*set_style(ctx, THEME_WHITE);*/
|
||||||
/*set_style(ctx, THEME_RED);*/
|
/*set_style(ctx, THEME_RED);*/
|
||||||
/*set_style(ctx, THEME_BLUE);*/
|
/*set_style(ctx, THEME_BLUE);*/
|
||||||
/*set_style(ctx, THEME_DARK);*/
|
/*set_style(ctx, THEME_DARK);*/
|
||||||
|
#endif
|
||||||
|
|
||||||
background = nk_rgb(28,48,62);
|
background = nk_rgb(28,48,62);
|
||||||
while (running)
|
while (running)
|
||||||
|
@ -288,9 +304,15 @@ int main(int argc, char **argv)
|
||||||
nk_end(ctx);
|
nk_end(ctx);
|
||||||
|
|
||||||
/* -------------- EXAMPLES ---------------- */
|
/* -------------- EXAMPLES ---------------- */
|
||||||
/*calculator(ctx);*/
|
#ifdef INCLUDE_CALCULATOR
|
||||||
/*overview(ctx);*/
|
calculator(ctx);
|
||||||
/*node_editor(ctx);*/
|
#endif
|
||||||
|
#ifdef INCLUDE_OVERVIEW
|
||||||
|
overview(ctx);
|
||||||
|
#endif
|
||||||
|
#ifdef INCLUDE_NODE_EDITOR
|
||||||
|
node_editor(ctx);
|
||||||
|
#endif
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
|
|
||||||
/* Draw */
|
/* Draw */
|
||||||
|
|
Loading…
Reference in New Issue