Skip to content

Commit 5dd782c

Browse files
authored
Merge pull request #748 from Immediate-Mode-UI/style-configurator-all-demos
add conditional style configurator to all demos
2 parents 2d3a10b + b5477a4 commit 5dd782c

File tree

29 files changed

+323
-12
lines changed

29 files changed

+323
-12
lines changed

demo/allegro5/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@
4242
/*#define INCLUDE_CALCULATOR */
4343
/*#define INCLUDE_CANVAS */
4444
#define INCLUDE_OVERVIEW
45+
/*#define INCLUDE_CONFIGURATOR */
4546
/*#define INCLUDE_NODE_EDITOR */
4647

4748
#ifdef INCLUDE_ALL
4849
#define INCLUDE_STYLE
4950
#define INCLUDE_CALCULATOR
5051
#define INCLUDE_CANVAS
5152
#define INCLUDE_OVERVIEW
53+
#define INCLUDE_CONFIGURATOR
5254
#define INCLUDE_NODE_EDITOR
5355
#endif
5456

@@ -64,6 +66,9 @@
6466
#ifdef INCLUDE_OVERVIEW
6567
#include "../../demo/common/overview.c"
6668
#endif
69+
#ifdef INCLUDE_CONFIGURATOR
70+
#include "../../demo/common/style_configurator.c"
71+
#endif
6772
#ifdef INCLUDE_NODE_EDITOR
6873
#include "../../demo/common/node_editor.c"
6974
#endif
@@ -81,6 +86,11 @@ int main(void)
8186
NkAllegro5Font *font;
8287
struct nk_context *ctx;
8388

89+
#ifdef INCLUDE_CONFIGURATOR
90+
static struct nk_color color_table[NK_COLOR_COUNT];
91+
memcpy(color_table, nk_default_color_style, sizeof(color_table));
92+
#endif
93+
8494
if (!al_init()) {
8595
fprintf(stdout, "failed to initialize allegro5!\n");
8696
exit(1);
@@ -168,6 +178,9 @@ int main(void)
168178
#ifdef INCLUDE_OVERVIEW
169179
overview(ctx);
170180
#endif
181+
#ifdef INCLUDE_CONFIGURATOR
182+
style_configurator(ctx, color_table);
183+
#endif
171184
#ifdef INCLUDE_NODE_EDITOR
172185
node_editor(ctx);
173186
#endif

demo/d3d11/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@
3838
/*#define INCLUDE_CALCULATOR */
3939
/*#define INCLUDE_CANVAS */
4040
#define INCLUDE_OVERVIEW
41+
/*#define INCLUDE_CONFIGURATOR */
4142
/*#define INCLUDE_NODE_EDITOR */
4243

4344
#ifdef INCLUDE_ALL
4445
#define INCLUDE_STYLE
4546
#define INCLUDE_CALCULATOR
4647
#define INCLUDE_CANVAS
4748
#define INCLUDE_OVERVIEW
49+
#define INCLUDE_CONFIGURATOR
4850
#define INCLUDE_NODE_EDITOR
4951
#endif
5052

@@ -60,6 +62,9 @@
6062
#ifdef INCLUDE_OVERVIEW
6163
#include "../../demo/common/overview.c"
6264
#endif
65+
#ifdef INCLUDE_CONFIGURATOR
66+
#include "../../demo/common/style_configurator.c"
67+
#endif
6368
#ifdef INCLUDE_NODE_EDITOR
6469
#include "../../demo/common/node_editor.c"
6570
#endif
@@ -149,6 +154,11 @@ int main(void)
149154
D3D_FEATURE_LEVEL feature_level;
150155
DXGI_SWAP_CHAIN_DESC swap_chain_desc;
151156

157+
#ifdef INCLUDE_CONFIGURATOR
158+
static struct nk_color color_table[NK_COLOR_COUNT];
159+
memcpy(color_table, nk_default_color_style, sizeof(color_table));
160+
#endif
161+
152162
/* Win32 */
153163
memset(&wc, 0, sizeof(wc));
154164
wc.style = CS_DBLCLKS;
@@ -267,6 +277,9 @@ int main(void)
267277
#ifdef INCLUDE_OVERVIEW
268278
overview(ctx);
269279
#endif
280+
#ifdef INCLUDE_CONFIGURATOR
281+
style_configurator(ctx, color_table);
282+
#endif
270283
#ifdef INCLUDE_NODE_EDITOR
271284
node_editor(ctx);
272285
#endif

demo/d3d12/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@
4141
/*#define INCLUDE_CALCULATOR */
4242
/*#define INCLUDE_CANVAS */
4343
#define INCLUDE_OVERVIEW
44+
/*#define INCLUDE_CONFIGURATOR */
4445
/*#define INCLUDE_NODE_EDITOR */
4546

4647
#ifdef INCLUDE_ALL
4748
#define INCLUDE_STYLE
4849
#define INCLUDE_CALCULATOR
4950
#define INCLUDE_CANVAS
5051
#define INCLUDE_OVERVIEW
52+
#define INCLUDE_CONFIGURATOR
5153
#define INCLUDE_NODE_EDITOR
5254
#endif
5355

@@ -63,6 +65,9 @@
6365
#ifdef INCLUDE_OVERVIEW
6466
#include "../../demo/common/overview.c"
6567
#endif
68+
#ifdef INCLUDE_CONFIGURATOR
69+
#include "../../demo/common/style_configurator.c"
70+
#endif
6671
#ifdef INCLUDE_NODE_EDITOR
6772
#include "../../demo/common/node_editor.c"
6873
#endif
@@ -207,6 +212,11 @@ int main(void)
207212
DXGI_SWAP_CHAIN_DESC1 swap_chain_desc;
208213
D3D12_DESCRIPTOR_HEAP_DESC rtv_desc_heap_desc;
209214

215+
#ifdef INCLUDE_CONFIGURATOR
216+
static struct nk_color color_table[NK_COLOR_COUNT];
217+
memcpy(color_table, nk_default_color_style, sizeof(color_table));
218+
#endif
219+
210220
/* Win32 */
211221
memset(&wc, 0, sizeof(wc));
212222
wc.style = CS_DBLCLKS;
@@ -359,6 +369,9 @@ int main(void)
359369
#ifdef INCLUDE_OVERVIEW
360370
overview(ctx);
361371
#endif
372+
#ifdef INCLUDE_CONFIGURATOR
373+
style_configurator(ctx, color_table);
374+
#endif
362375
#ifdef INCLUDE_NODE_EDITOR
363376
node_editor(ctx);
364377
#endif

demo/d3d9/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@
3535
/*#define INCLUDE_CALCULATOR */
3636
/*#define INCLUDE_CANVAS */
3737
#define INCLUDE_OVERVIEW
38+
/*#define INCLUDE_CONFIGURATOR */
3839
/*#define INCLUDE_NODE_EDITOR */
3940

4041
#ifdef INCLUDE_ALL
4142
#define INCLUDE_STYLE
4243
#define INCLUDE_CALCULATOR
4344
#define INCLUDE_CANVAS
4445
#define INCLUDE_OVERVIEW
46+
#define INCLUDE_CONFIGURATOR
4547
#define INCLUDE_NODE_EDITOR
4648
#endif
4749

@@ -57,6 +59,9 @@
5759
#ifdef INCLUDE_OVERVIEW
5860
#include "../../demo/common/overview.c"
5961
#endif
62+
#ifdef INCLUDE_CONFIGURATOR
63+
#include "../../demo/common/style_configurator.c"
64+
#endif
6065
#ifdef INCLUDE_NODE_EDITOR
6166
#include "../../demo/common/node_editor.c"
6267
#endif
@@ -179,6 +184,11 @@ int main(void)
179184
HWND wnd;
180185
int running = 1;
181186

187+
#ifdef INCLUDE_CONFIGURATOR
188+
static struct nk_color color_table[NK_COLOR_COUNT];
189+
memcpy(color_table, nk_default_color_style, sizeof(color_table));
190+
#endif
191+
182192
/* Win32 */
183193
memset(&wc, 0, sizeof(wc));
184194
wc.style = CS_DBLCLKS;
@@ -272,6 +282,9 @@ int main(void)
272282
#ifdef INCLUDE_OVERVIEW
273283
overview(ctx);
274284
#endif
285+
#ifdef INCLUDE_CONFIGURATOR
286+
style_configurator(ctx, color_table);
287+
#endif
275288
#ifdef INCLUDE_NODE_EDITOR
276289
node_editor(ctx);
277290
#endif

demo/gdi/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@
3030
/*#define INCLUDE_CALCULATOR */
3131
/*#define INCLUDE_CANVAS */
3232
#define INCLUDE_OVERVIEW
33+
/*#define INCLUDE_CONFIGURATOR */
3334
/*#define INCLUDE_NODE_EDITOR */
3435

3536
#ifdef INCLUDE_ALL
3637
#define INCLUDE_STYLE
3738
#define INCLUDE_CALCULATOR
3839
#define INCLUDE_CANVAS
3940
#define INCLUDE_OVERVIEW
41+
#define INCLUDE_CONFIGURATOR
4042
#define INCLUDE_NODE_EDITOR
4143
#endif
4244

@@ -52,6 +54,9 @@
5254
#ifdef INCLUDE_OVERVIEW
5355
#include "../../demo/common/overview.c"
5456
#endif
57+
#ifdef INCLUDE_CONFIGURATOR
58+
#include "../../demo/common/style_configurator.c"
59+
#endif
5560
#ifdef INCLUDE_NODE_EDITOR
5661
#include "../../demo/common/node_editor.c"
5762
#endif
@@ -92,6 +97,11 @@ int main(void)
9297
int running = 1;
9398
int needs_refresh = 1;
9499

100+
#ifdef INCLUDE_CONFIGURATOR
101+
static struct nk_color color_table[NK_COLOR_COUNT];
102+
memcpy(color_table, nk_default_color_style, sizeof(color_table));
103+
#endif
104+
95105
/* Win32 */
96106
memset(&wc, 0, sizeof(wc));
97107
wc.style = CS_DBLCLKS;
@@ -167,6 +177,9 @@ int main(void)
167177
#ifdef INCLUDE_OVERVIEW
168178
overview(ctx);
169179
#endif
180+
#ifdef INCLUDE_CONFIGURATOR
181+
style_configurator(ctx, color_table);
182+
#endif
170183
#ifdef INCLUDE_NODE_EDITOR
171184
node_editor(ctx);
172185
#endif

demo/gdip/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@
3030
/*#define INCLUDE_CALCULATOR */
3131
/*#define INCLUDE_CANVAS */
3232
#define INCLUDE_OVERVIEW
33+
/*#define INCLUDE_CONFIGURATOR */
3334
/*#define INCLUDE_NODE_EDITOR */
3435

3536
#ifdef INCLUDE_ALL
3637
#define INCLUDE_STYLE
3738
#define INCLUDE_CALCULATOR
3839
#define INCLUDE_CANVAS
3940
#define INCLUDE_OVERVIEW
41+
#define INCLUDE_CONFIGURATOR
4042
#define INCLUDE_NODE_EDITOR
4143
#endif
4244

@@ -52,6 +54,9 @@
5254
#ifdef INCLUDE_OVERVIEW
5355
#include "../../demo/common/overview.c"
5456
#endif
57+
#ifdef INCLUDE_CONFIGURATOR
58+
#include "../../demo/common/style_configurator.c"
59+
#endif
5560
#ifdef INCLUDE_NODE_EDITOR
5661
#include "../../demo/common/node_editor.c"
5762
#endif
@@ -87,6 +92,11 @@ int main(void)
8792
int running = 1;
8893
int needs_refresh = 1;
8994

95+
#ifdef INCLUDE_CONFIGURATOR
96+
static struct nk_color color_table[NK_COLOR_COUNT];
97+
memcpy(color_table, nk_default_color_style, sizeof(color_table));
98+
#endif
99+
90100
/* Win32 */
91101
memset(&wc, 0, sizeof(wc));
92102
wc.style = CS_DBLCLKS;
@@ -162,6 +172,9 @@ int main(void)
162172
#ifdef INCLUDE_OVERVIEW
163173
overview(ctx);
164174
#endif
175+
#ifdef INCLUDE_CONFIGURATOR
176+
style_configurator(ctx, color_table);
177+
#endif
165178
#ifdef INCLUDE_NODE_EDITOR
166179
node_editor(ctx);
167180
#endif

demo/glfw_opengl2/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
/* #define INCLUDE_CANVAS */
4444
/* #define INCLUDE_FILE_BROWSER */
4545
/* #define INCLUDE_OVERVIEW */
46+
/* #define INCLUDE_CONFIGURATOR */
4647
/* #define INCLUDE_NODE_EDITOR */
4748

4849
#ifdef INCLUDE_ALL
@@ -51,6 +52,7 @@
5152
#define INCLUDE_CANVAS
5253
#define INCLUDE_FILE_BROWSER
5354
#define INCLUDE_OVERVIEW
55+
#define INCLUDE_CONFIGURATOR
5456
#define INCLUDE_NODE_EDITOR
5557
#endif
5658

@@ -69,6 +71,9 @@
6971
#ifdef INCLUDE_OVERVIEW
7072
#include "../../demo/common/overview.c"
7173
#endif
74+
#ifdef INCLUDE_CONFIGURATOR
75+
#include "../../demo/common/style_configurator.c"
76+
#endif
7277
#ifdef INCLUDE_NODE_EDITOR
7378
#include "../../demo/common/node_editor.c"
7479
#endif
@@ -95,6 +100,11 @@ int main(void)
95100
struct media media;
96101
#endif
97102

103+
#ifdef INCLUDE_CONFIGURATOR
104+
static struct nk_color color_table[NK_COLOR_COUNT];
105+
memcpy(color_table, nk_default_color_style, sizeof(color_table));
106+
#endif
107+
98108
/* GLFW */
99109
glfwSetErrorCallback(error_callback);
100110
if (!glfwInit()) {
@@ -195,6 +205,9 @@ int main(void)
195205
#ifdef INCLUDE_OVERVIEW
196206
overview(ctx);
197207
#endif
208+
#ifdef INCLUDE_CONFIGURATOR
209+
style_configurator(ctx, color_table);
210+
#endif
198211
#ifdef INCLUDE_NODE_EDITOR
199212
node_editor(ctx);
200213
#endif

demo/glfw_opengl3/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@
4343
/*#define INCLUDE_CALCULATOR */
4444
/*#define INCLUDE_CANVAS */
4545
#define INCLUDE_OVERVIEW
46+
/*#define INCLUDE_CONFIGURATOR */
4647
/*#define INCLUDE_NODE_EDITOR */
4748

4849
#ifdef INCLUDE_ALL
4950
#define INCLUDE_STYLE
5051
#define INCLUDE_CALCULATOR
5152
#define INCLUDE_CANVAS
5253
#define INCLUDE_OVERVIEW
54+
#define INCLUDE_CONFIGURATOR
5355
#define INCLUDE_NODE_EDITOR
5456
#endif
5557

@@ -65,6 +67,9 @@
6567
#ifdef INCLUDE_OVERVIEW
6668
#include "../../demo/common/overview.c"
6769
#endif
70+
#ifdef INCLUDE_CONFIGURATOR
71+
#include "../../demo/common/style_configurator.c"
72+
#endif
6873
#ifdef INCLUDE_NODE_EDITOR
6974
#include "../../demo/common/node_editor.c"
7075
#endif
@@ -86,6 +91,11 @@ int main(void)
8691
struct nk_context *ctx;
8792
struct nk_colorf bg;
8893

94+
#ifdef INCLUDE_CONFIGURATOR
95+
static struct nk_color color_table[NK_COLOR_COUNT];
96+
memcpy(color_table, nk_default_color_style, sizeof(color_table));
97+
#endif
98+
8999
/* GLFW */
90100
glfwSetErrorCallback(error_callback);
91101
if (!glfwInit()) {
@@ -177,6 +187,9 @@ int main(void)
177187
#ifdef INCLUDE_OVERVIEW
178188
overview(ctx);
179189
#endif
190+
#ifdef INCLUDE_CONFIGURATOR
191+
style_configurator(ctx, color_table);
192+
#endif
180193
#ifdef INCLUDE_NODE_EDITOR
181194
node_editor(ctx);
182195
#endif

0 commit comments

Comments
 (0)