Update Nuklear to 1.18

Fixes #907.
This commit is contained in:
Camilla Löwy 2016-11-27 13:29:07 +01:00
parent fd127d59fa
commit f44307da4e
4 changed files with 1033 additions and 603 deletions

1620
deps/nuklear.h vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
* Nuklear - v1.00 - public domain * Nuklear - v1.17 - public domain
* no warrenty implied; use at your own risk. * no warrenty implied; use at your own risk.
* authored from 2015-2016 by Micha Mettke * authored from 2015-2016 by Micha Mettke
*/ */
@ -219,7 +219,7 @@ nk_glfw3_clipbard_copy(nk_handle usr, const char *text, int len)
if (!len) return; if (!len) return;
str = (char*)malloc((size_t)len+1); str = (char*)malloc((size_t)len+1);
if (!str) return; if (!str) return;
NK_MEMCPY(str, text, (size_t)len); memcpy(str, text, (size_t)len);
str[len] = '\0'; str[len] = '\0';
glfwSetClipboardString(glfw.win, str); glfwSetClipboardString(glfw.win, str);
free(str); free(str);
@ -344,7 +344,7 @@ void nk_glfw3_shutdown(void)
nk_free(&glfw.ctx); nk_free(&glfw.ctx);
glDeleteTextures(1, &dev->font_tex); glDeleteTextures(1, &dev->font_tex);
nk_buffer_free(&dev->cmds); nk_buffer_free(&dev->cmds);
NK_MEMSET(&glfw, 0, sizeof(glfw)); memset(&glfw, 0, sizeof(glfw));
} }
#endif #endif

View File

@ -116,7 +116,6 @@ int main(int argc, char** argv)
while (!glfwWindowShouldClose(window)) while (!glfwWindowShouldClose(window))
{ {
int width, height; int width, height;
struct nk_panel layout;
struct nk_rect area; struct nk_rect area;
glfwGetWindowSize(window, &width, &height); glfwGetWindowSize(window, &width, &height);
@ -124,7 +123,7 @@ int main(int argc, char** argv)
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
nk_glfw3_new_frame(); nk_glfw3_new_frame();
if (nk_begin(nk, &layout, "", area, 0)) if (nk_begin(nk, "", area, 0))
{ {
const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor); const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
nk_window_set_bounds(nk, area); nk_window_set_bounds(nk, area);

View File

@ -128,14 +128,13 @@ int main(void)
while (!glfwWindowShouldClose(window)) while (!glfwWindowShouldClose(window))
{ {
int i, width, height; int i, width, height;
struct nk_panel layout;
glfwGetWindowSize(window, &width, &height); glfwGetWindowSize(window, &width, &height);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
nk_glfw3_new_frame(); nk_glfw3_new_frame();
if (nk_begin(nk, &layout, if (nk_begin(nk,
"Joysticks", "Joysticks",
nk_rect(0.f, 0.f, 0.f, 0.f), nk_rect(0.f, 0.f, 0.f, 0.f),
NK_WINDOW_MINIMIZABLE | NK_WINDOW_MINIMIZABLE |
@ -162,7 +161,7 @@ int main(void)
for (i = 0; i < joystick_count; i++) for (i = 0; i < joystick_count; i++)
{ {
if (nk_begin(nk, &layout, if (nk_begin(nk,
joystick_label(joysticks[i]), joystick_label(joysticks[i]),
nk_rect(i * 20.f, i * 20.f, 400.f, 400.f), nk_rect(i * 20.f, i * 20.f, 400.f, 400.f),
NK_WINDOW_BORDER | NK_WINDOW_BORDER |