Skip to content

Commit b52d08c

Browse files
Added Immediate-Mode-UI/Nuklear (close #235)
1 parent 7e689fa commit b52d08c

File tree

8 files changed

+34
-12
lines changed

8 files changed

+34
-12
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "ThirdParty/glfw"]
22
path = ThirdParty/glfw
33
url = https://github.com/DiligentGraphics/glfw.git
4+
[submodule "ThirdParty/Nuklear"]
5+
path = ThirdParty/Nuklear
6+
url = https://github.com/Immediate-Mode-UI/Nuklear

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ This sample demonstrates the integration of the engine with [dear imgui](https:/
406406

407407
![](Samples/NuklearDemo/Screenshot.png)
408408

409-
This sample demonstrates the integration of the engine with [nuklear](https://github.com/vurtun/nuklear) UI library.
409+
This sample demonstrates the integration of the engine with [nuklear](https://github.com/Immediate-Mode-UI/Nuklear) UI library.
410410

411411

412412
## [Hello AR](Android/HelloAR)
@@ -477,7 +477,7 @@ See [Apache 2.0 license](License.txt).
477477

478478
This project has some third-party dependencies, each of which may have independent licensing:
479479

480-
* [nuklear](https://github.com/vurtun/nuklear): A single-header ANSI C gui library ([MIT or Public domain license](https://github.com/DiligentGraphics/nuklear/blob/master/Readme.md)).
480+
* [nuklear](https://github.com/Immediate-Mode-UI/Nuklear): A single-header ANSI C gui library ([MIT or Public domain license](https://github.com/Immediate-Mode-UI/Nuklear/blob/master/LICENSE)).
481481
* [glfw](https://github.com/glfw/glfw): A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input ([zlib License](https://github.com/DiligentGraphics/glfw/blob/master/LICENSE.md)).
482482
* [ImGuizmo](https://github.com/CedricGuillemet/ImGuizmo): Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui ([MIT](https://github.com/CedricGuillemet/ImGuizmo/blob/master/LICENSE)).
483483

Samples/NuklearDemo/src/NkDiligent.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,7 +49,15 @@
4949
#define NK_INCLUDE_DEFAULT_FONT
5050

5151
#define NK_IMPLEMENTATION
52+
53+
#ifdef _MSC_VER
54+
# pragma warning(push)
55+
# pragma warning(disable : 4701) // potentially uninitialized local variable used
56+
#endif
5257
#include "nuklear.h"
58+
#ifdef _MSC_VER
59+
# pragma warning(pop)
60+
#endif
5361

5462
#include "NkDiligent.h"
5563

@@ -353,7 +361,7 @@ nk_diligent_render(struct nk_diligent_context* nk_dlg_ctx,
353361
config.circle_segment_count = 22;
354362
config.curve_segment_count = 22;
355363
config.arc_segment_count = 22;
356-
config.null = nk_dlg_ctx->null;
364+
config.tex_null = nk_dlg_ctx->null;
357365

358366
// setup buffers to load vertices and elements
359367
struct nk_buffer vbuf, ibuf;

Samples/NuklearDemo/src/NkInputWin32.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,7 +27,7 @@
2727

2828
#define NK_INCLUDE_FIXED_TYPES
2929
#define NK_INCLUDE_STANDARD_VARARGS
30-
#include "../../../ThirdParty/nuklear/nuklear.h"
30+
#include "../../../ThirdParty/Nuklear/nuklear.h"
3131

3232
#include "WinHPreface.h"
3333
#include <Windows.h>

Samples/NuklearDemo/src/NuklearDemo.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,23 @@
3131

3232
#define NK_INCLUDE_FIXED_TYPES
3333
#define NK_INCLUDE_STANDARD_VARARGS
34-
#include "../../../ThirdParty/nuklear/nuklear.h"
34+
#include "../../../ThirdParty/Nuklear/nuklear.h"
3535

3636
#include "NkDiligent.h"
3737

38-
#include "../../../ThirdParty/nuklear/demo/style.c"
39-
#include "../../../ThirdParty/nuklear/demo/overview.c"
38+
#include "../../../ThirdParty/Nuklear/demo/common/style.c"
4039

40+
#ifdef _MSC_VER
41+
# pragma warning(push)
42+
# pragma warning(disable : 4477) // overview.c(447,33): warning C4477: 'sprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t'
43+
#endif
44+
45+
static const struct nk_color nk_white = {255, 255, 255, 255};
46+
#include "../../../ThirdParty/Nuklear/demo/common/overview.c"
47+
48+
#ifdef _MSC_VER
49+
# pragma warning(pop)
50+
#endif
4151

4252
namespace Diligent
4353
{

Samples/NuklearDemo/src/NuklearDemoWin32.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,7 +29,7 @@
2929

3030
#define NK_INCLUDE_FIXED_TYPES
3131
#define NK_INCLUDE_STANDARD_VARARGS
32-
#include "../../../ThirdParty/nuklear/nuklear.h"
32+
#include "../../../ThirdParty/Nuklear/nuklear.h"
3333

3434
#include "WinHPreface.h"
3535
#include <Windows.h>

ThirdParty/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.10)
33
file(RELATIVE_PATH SAMPLES_DIR "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/..")
44

55
if (NOT DILIGENT_NUKLEAR_DIR)
6-
set(DILIGENT_NUKLEAR_DIR "${CMAKE_CURRENT_SOURCE_DIR}/nuklear" CACHE PATH "nuklear source directory")
6+
set(DILIGENT_NUKLEAR_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Nuklear" CACHE PATH "nuklear source directory")
77
endif()
88
if (NOT EXISTS "${DILIGENT_NUKLEAR_DIR}/nuklear.h")
99
message(FATAL_ERROR "${DILIGENT_NUKLEAR_DIR}/nuklear.h does not exist. This indicates that nuklear submodule is not checked out or DILIGENT_NUKLEAR_DIR variable contains invalid path.")

ThirdParty/Nuklear

Submodule Nuklear added at b0fbe40

0 commit comments

Comments
 (0)