From cba6a7e24aa3c3947aa78ebe6de48f4638132d39 Mon Sep 17 00:00:00 2001 From: Shariq Shah Date: Sat, 20 Apr 2019 17:55:15 +1000 Subject: [PATCH] Changed potentially buggy usage of bools being implicitly converted to int* when used with nuklear --- src/game/editor.c | 7 +++---- todo.txt | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/game/editor.c b/src/game/editor.c index 02c5c1b..5a7cb77 100755 --- a/src/game/editor.c +++ b/src/game/editor.c @@ -277,7 +277,6 @@ void editor_update(struct Editor* editor, float dt) } nk_end(context); - if(editor->window_scene_heirarchy) editor_window_scene_heirarchy(context, editor, game_state); if(editor->window_debug_variables) editor_window_debug_variables(context, editor); if(editor->window_property_inspector) editor_window_property_inspector(context, editor, game_state); @@ -294,7 +293,7 @@ void editor_update(struct Editor* editor, float dt) static const char* draw_modes[] = { "Triangles", "Lines", "Points" }; nk_layout_row_dynamic(context, row_height, 2); nk_label(context, "Debug Draw", NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE); - nk_checkbox_label(context, "", &render_settings->debug_draw_enabled); + render_settings->debug_draw_enabled = nk_check_label(context, "", render_settings->debug_draw_enabled); nk_layout_row_dynamic(context, row_height, 2); nk_label(context, "Debug Draw Mode", NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE); @@ -795,13 +794,13 @@ void editor_window_property_inspector(struct nk_context* context, struct Editor* nk_layout_row_dynamic(context, row_height, 2); nk_label(context, "Orthographic", NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE); - bool ortho = nk_checkbox_label(context, "", &camera->ortho); + bool ortho = nk_check_label(context, "", camera->ortho); if(ortho != camera->ortho) { + camera->ortho = ortho; update = true; } - if(!camera->ortho) { nk_layout_row_dynamic(context, row_height, 1); diff --git a/todo.txt b/todo.txt index 3ecd98c..903737e 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,4 @@ Todo: - - Change all usages of bool types and nuklear causing buggy behaviour in editor code - Specific rendering mode for editor related rendering - Basic Editor gizmo for transformation i.e. translate/rotate/scale in world and local coordinates - Add warning to genie build script when running on windows and WindowsSdkVersion cannot be found. This happens when the script is not run from vcvarsall command prompt @@ -209,4 +208,5 @@ Done: * Implemented handling drawing other entity types that can be selected in the editor but are not static meshes * Implemented proper topbar * Changed config vars are used. + * Changed all usages of bool types and nuklear causing buggy behaviour in editor code by using int instead of bool or by using variants of the functions that do take int as parameter instead of int*