Skip to content

Commit

Permalink
add conditional style configurator to all demos
Browse files Browse the repository at this point in the history
  • Loading branch information
riri committed Nov 26, 2024
1 parent 31c5807 commit b5477a4
Show file tree
Hide file tree
Showing 29 changed files with 323 additions and 12 deletions.
13 changes: 13 additions & 0 deletions demo/allegro5/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
/*#define INCLUDE_CALCULATOR */
/*#define INCLUDE_CANVAS */
#define INCLUDE_OVERVIEW
/*#define INCLUDE_CONFIGURATOR */
/*#define INCLUDE_NODE_EDITOR */

#ifdef INCLUDE_ALL
#define INCLUDE_STYLE
#define INCLUDE_CALCULATOR
#define INCLUDE_CANVAS
#define INCLUDE_OVERVIEW
#define INCLUDE_CONFIGURATOR
#define INCLUDE_NODE_EDITOR
#endif

Expand All @@ -64,6 +66,9 @@
#ifdef INCLUDE_OVERVIEW
#include "../../demo/common/overview.c"
#endif
#ifdef INCLUDE_CONFIGURATOR
#include "../../demo/common/style_configurator.c"
#endif
#ifdef INCLUDE_NODE_EDITOR
#include "../../demo/common/node_editor.c"
#endif
Expand All @@ -81,6 +86,11 @@ int main(void)
NkAllegro5Font *font;
struct nk_context *ctx;

#ifdef INCLUDE_CONFIGURATOR
static struct nk_color color_table[NK_COLOR_COUNT];
memcpy(color_table, nk_default_color_style, sizeof(color_table));
#endif

if (!al_init()) {
fprintf(stdout, "failed to initialize allegro5!\n");
exit(1);
Expand Down Expand Up @@ -168,6 +178,9 @@ int main(void)
#ifdef INCLUDE_OVERVIEW
overview(ctx);
#endif
#ifdef INCLUDE_CONFIGURATOR
style_configurator(ctx, color_table);
#endif
#ifdef INCLUDE_NODE_EDITOR
node_editor(ctx);
#endif
Expand Down
13 changes: 13 additions & 0 deletions demo/d3d11/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@
/*#define INCLUDE_CALCULATOR */
/*#define INCLUDE_CANVAS */
#define INCLUDE_OVERVIEW
/*#define INCLUDE_CONFIGURATOR */
/*#define INCLUDE_NODE_EDITOR */

#ifdef INCLUDE_ALL
#define INCLUDE_STYLE
#define INCLUDE_CALCULATOR
#define INCLUDE_CANVAS
#define INCLUDE_OVERVIEW
#define INCLUDE_CONFIGURATOR
#define INCLUDE_NODE_EDITOR
#endif

Expand All @@ -60,6 +62,9 @@
#ifdef INCLUDE_OVERVIEW
#include "../../demo/common/overview.c"
#endif
#ifdef INCLUDE_CONFIGURATOR
#include "../../demo/common/style_configurator.c"
#endif
#ifdef INCLUDE_NODE_EDITOR
#include "../../demo/common/node_editor.c"
#endif
Expand Down Expand Up @@ -149,6 +154,11 @@ int main(void)
D3D_FEATURE_LEVEL feature_level;
DXGI_SWAP_CHAIN_DESC swap_chain_desc;

#ifdef INCLUDE_CONFIGURATOR
static struct nk_color color_table[NK_COLOR_COUNT];
memcpy(color_table, nk_default_color_style, sizeof(color_table));
#endif

/* Win32 */
memset(&wc, 0, sizeof(wc));
wc.style = CS_DBLCLKS;
Expand Down Expand Up @@ -267,6 +277,9 @@ int main(void)
#ifdef INCLUDE_OVERVIEW
overview(ctx);
#endif
#ifdef INCLUDE_CONFIGURATOR
style_configurator(ctx, color_table);
#endif
#ifdef INCLUDE_NODE_EDITOR
node_editor(ctx);
#endif
Expand Down
13 changes: 13 additions & 0 deletions demo/d3d12/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@
/*#define INCLUDE_CALCULATOR */
/*#define INCLUDE_CANVAS */
#define INCLUDE_OVERVIEW
/*#define INCLUDE_CONFIGURATOR */
/*#define INCLUDE_NODE_EDITOR */

#ifdef INCLUDE_ALL
#define INCLUDE_STYLE
#define INCLUDE_CALCULATOR
#define INCLUDE_CANVAS
#define INCLUDE_OVERVIEW
#define INCLUDE_CONFIGURATOR
#define INCLUDE_NODE_EDITOR
#endif

Expand All @@ -63,6 +65,9 @@
#ifdef INCLUDE_OVERVIEW
#include "../../demo/common/overview.c"
#endif
#ifdef INCLUDE_CONFIGURATOR
#include "../../demo/common/style_configurator.c"
#endif
#ifdef INCLUDE_NODE_EDITOR
#include "../../demo/common/node_editor.c"
#endif
Expand Down Expand Up @@ -207,6 +212,11 @@ int main(void)
DXGI_SWAP_CHAIN_DESC1 swap_chain_desc;
D3D12_DESCRIPTOR_HEAP_DESC rtv_desc_heap_desc;

#ifdef INCLUDE_CONFIGURATOR
static struct nk_color color_table[NK_COLOR_COUNT];
memcpy(color_table, nk_default_color_style, sizeof(color_table));
#endif

/* Win32 */
memset(&wc, 0, sizeof(wc));
wc.style = CS_DBLCLKS;
Expand Down Expand Up @@ -359,6 +369,9 @@ int main(void)
#ifdef INCLUDE_OVERVIEW
overview(ctx);
#endif
#ifdef INCLUDE_CONFIGURATOR
style_configurator(ctx, color_table);
#endif
#ifdef INCLUDE_NODE_EDITOR
node_editor(ctx);
#endif
Expand Down
13 changes: 13 additions & 0 deletions demo/d3d9/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@
/*#define INCLUDE_CALCULATOR */
/*#define INCLUDE_CANVAS */
#define INCLUDE_OVERVIEW
/*#define INCLUDE_CONFIGURATOR */
/*#define INCLUDE_NODE_EDITOR */

#ifdef INCLUDE_ALL
#define INCLUDE_STYLE
#define INCLUDE_CALCULATOR
#define INCLUDE_CANVAS
#define INCLUDE_OVERVIEW
#define INCLUDE_CONFIGURATOR
#define INCLUDE_NODE_EDITOR
#endif

Expand All @@ -57,6 +59,9 @@
#ifdef INCLUDE_OVERVIEW
#include "../../demo/common/overview.c"
#endif
#ifdef INCLUDE_CONFIGURATOR
#include "../../demo/common/style_configurator.c"
#endif
#ifdef INCLUDE_NODE_EDITOR
#include "../../demo/common/node_editor.c"
#endif
Expand Down Expand Up @@ -179,6 +184,11 @@ int main(void)
HWND wnd;
int running = 1;

#ifdef INCLUDE_CONFIGURATOR
static struct nk_color color_table[NK_COLOR_COUNT];
memcpy(color_table, nk_default_color_style, sizeof(color_table));
#endif

/* Win32 */
memset(&wc, 0, sizeof(wc));
wc.style = CS_DBLCLKS;
Expand Down Expand Up @@ -272,6 +282,9 @@ int main(void)
#ifdef INCLUDE_OVERVIEW
overview(ctx);
#endif
#ifdef INCLUDE_CONFIGURATOR
style_configurator(ctx, color_table);
#endif
#ifdef INCLUDE_NODE_EDITOR
node_editor(ctx);
#endif
Expand Down
13 changes: 13 additions & 0 deletions demo/gdi/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
/*#define INCLUDE_CALCULATOR */
/*#define INCLUDE_CANVAS */
#define INCLUDE_OVERVIEW
/*#define INCLUDE_CONFIGURATOR */
/*#define INCLUDE_NODE_EDITOR */

#ifdef INCLUDE_ALL
#define INCLUDE_STYLE
#define INCLUDE_CALCULATOR
#define INCLUDE_CANVAS
#define INCLUDE_OVERVIEW
#define INCLUDE_CONFIGURATOR
#define INCLUDE_NODE_EDITOR
#endif

Expand All @@ -52,6 +54,9 @@
#ifdef INCLUDE_OVERVIEW
#include "../../demo/common/overview.c"
#endif
#ifdef INCLUDE_CONFIGURATOR
#include "../../demo/common/style_configurator.c"
#endif
#ifdef INCLUDE_NODE_EDITOR
#include "../../demo/common/node_editor.c"
#endif
Expand Down Expand Up @@ -92,6 +97,11 @@ int main(void)
int running = 1;
int needs_refresh = 1;

#ifdef INCLUDE_CONFIGURATOR
static struct nk_color color_table[NK_COLOR_COUNT];
memcpy(color_table, nk_default_color_style, sizeof(color_table));
#endif

/* Win32 */
memset(&wc, 0, sizeof(wc));
wc.style = CS_DBLCLKS;
Expand Down Expand Up @@ -167,6 +177,9 @@ int main(void)
#ifdef INCLUDE_OVERVIEW
overview(ctx);
#endif
#ifdef INCLUDE_CONFIGURATOR
style_configurator(ctx, color_table);
#endif
#ifdef INCLUDE_NODE_EDITOR
node_editor(ctx);
#endif
Expand Down
13 changes: 13 additions & 0 deletions demo/gdip/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
/*#define INCLUDE_CALCULATOR */
/*#define INCLUDE_CANVAS */
#define INCLUDE_OVERVIEW
/*#define INCLUDE_CONFIGURATOR */
/*#define INCLUDE_NODE_EDITOR */

#ifdef INCLUDE_ALL
#define INCLUDE_STYLE
#define INCLUDE_CALCULATOR
#define INCLUDE_CANVAS
#define INCLUDE_OVERVIEW
#define INCLUDE_CONFIGURATOR
#define INCLUDE_NODE_EDITOR
#endif

Expand All @@ -52,6 +54,9 @@
#ifdef INCLUDE_OVERVIEW
#include "../../demo/common/overview.c"
#endif
#ifdef INCLUDE_CONFIGURATOR
#include "../../demo/common/style_configurator.c"
#endif
#ifdef INCLUDE_NODE_EDITOR
#include "../../demo/common/node_editor.c"
#endif
Expand Down Expand Up @@ -87,6 +92,11 @@ int main(void)
int running = 1;
int needs_refresh = 1;

#ifdef INCLUDE_CONFIGURATOR
static struct nk_color color_table[NK_COLOR_COUNT];
memcpy(color_table, nk_default_color_style, sizeof(color_table));
#endif

/* Win32 */
memset(&wc, 0, sizeof(wc));
wc.style = CS_DBLCLKS;
Expand Down Expand Up @@ -162,6 +172,9 @@ int main(void)
#ifdef INCLUDE_OVERVIEW
overview(ctx);
#endif
#ifdef INCLUDE_CONFIGURATOR
style_configurator(ctx, color_table);
#endif
#ifdef INCLUDE_NODE_EDITOR
node_editor(ctx);
#endif
Expand Down
13 changes: 13 additions & 0 deletions demo/glfw_opengl2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
/* #define INCLUDE_CANVAS */
/* #define INCLUDE_FILE_BROWSER */
/* #define INCLUDE_OVERVIEW */
/* #define INCLUDE_CONFIGURATOR */
/* #define INCLUDE_NODE_EDITOR */

#ifdef INCLUDE_ALL
Expand All @@ -51,6 +52,7 @@
#define INCLUDE_CANVAS
#define INCLUDE_FILE_BROWSER
#define INCLUDE_OVERVIEW
#define INCLUDE_CONFIGURATOR
#define INCLUDE_NODE_EDITOR
#endif

Expand All @@ -69,6 +71,9 @@
#ifdef INCLUDE_OVERVIEW
#include "../../demo/common/overview.c"
#endif
#ifdef INCLUDE_CONFIGURATOR
#include "../../demo/common/style_configurator.c"
#endif
#ifdef INCLUDE_NODE_EDITOR
#include "../../demo/common/node_editor.c"
#endif
Expand All @@ -95,6 +100,11 @@ int main(void)
struct media media;
#endif

#ifdef INCLUDE_CONFIGURATOR
static struct nk_color color_table[NK_COLOR_COUNT];
memcpy(color_table, nk_default_color_style, sizeof(color_table));
#endif

/* GLFW */
glfwSetErrorCallback(error_callback);
if (!glfwInit()) {
Expand Down Expand Up @@ -195,6 +205,9 @@ int main(void)
#ifdef INCLUDE_OVERVIEW
overview(ctx);
#endif
#ifdef INCLUDE_CONFIGURATOR
style_configurator(ctx, color_table);
#endif
#ifdef INCLUDE_NODE_EDITOR
node_editor(ctx);
#endif
Expand Down
13 changes: 13 additions & 0 deletions demo/glfw_opengl3/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@
/*#define INCLUDE_CALCULATOR */
/*#define INCLUDE_CANVAS */
#define INCLUDE_OVERVIEW
/*#define INCLUDE_CONFIGURATOR */
/*#define INCLUDE_NODE_EDITOR */

#ifdef INCLUDE_ALL
#define INCLUDE_STYLE
#define INCLUDE_CALCULATOR
#define INCLUDE_CANVAS
#define INCLUDE_OVERVIEW
#define INCLUDE_CONFIGURATOR
#define INCLUDE_NODE_EDITOR
#endif

Expand All @@ -65,6 +67,9 @@
#ifdef INCLUDE_OVERVIEW
#include "../../demo/common/overview.c"
#endif
#ifdef INCLUDE_CONFIGURATOR
#include "../../demo/common/style_configurator.c"
#endif
#ifdef INCLUDE_NODE_EDITOR
#include "../../demo/common/node_editor.c"
#endif
Expand All @@ -86,6 +91,11 @@ int main(void)
struct nk_context *ctx;
struct nk_colorf bg;

#ifdef INCLUDE_CONFIGURATOR
static struct nk_color color_table[NK_COLOR_COUNT];
memcpy(color_table, nk_default_color_style, sizeof(color_table));
#endif

/* GLFW */
glfwSetErrorCallback(error_callback);
if (!glfwInit()) {
Expand Down Expand Up @@ -177,6 +187,9 @@ int main(void)
#ifdef INCLUDE_OVERVIEW
overview(ctx);
#endif
#ifdef INCLUDE_CONFIGURATOR
style_configurator(ctx, color_table);
#endif
#ifdef INCLUDE_NODE_EDITOR
node_editor(ctx);
#endif
Expand Down
Loading

0 comments on commit b5477a4

Please sign in to comment.