From df19ee5e70548258c92995eccb5f814df67ea212 Mon Sep 17 00:00:00 2001 From: Shariq Shah Date: Thu, 25 Apr 2019 16:59:57 +1000 Subject: [PATCH] Added status bar --- src/game/editor.c | 23 +++++++++++++++++++++++ todo.txt | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/game/editor.c b/src/game/editor.c index bf5dbeb..4b999b7 100755 --- a/src/game/editor.c +++ b/src/game/editor.c @@ -348,6 +348,28 @@ void editor_update(struct Editor* editor, float dt) } nk_end(context); + /* Status Bar */ + if(nk_begin(context, "Status Bar", nk_recti(0, win_height - editor->top_panel_height, win_width, editor->top_panel_height), NK_WINDOW_NO_SCROLLBAR)) + { + nk_layout_row_begin(context, NK_DYNAMIC, editor->top_panel_height - 5, 5); + + nk_layout_row_push(context, 0.1f); + nk_labelf(context, NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE, "Cursor: %.1f %.1f %.1f", editor->tool_mesh_position.x, editor->tool_mesh_position.y, editor->tool_mesh_position.z); + + nk_layout_row_push(context, 0.1f); + nk_checkbox_label(context, "Snap to grid ", &editor->tool_snap_enabled); + + nk_layout_row_push(context, 0.1f); + nk_labelf(context, NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE, "Grid Scale: %.1f", editor->grid_scale); + + nk_layout_row_push(context, 0.1f); + nk_labelf(context, NK_TEXT_ALIGN_LEFT | NK_TEXT_ALIGN_MIDDLE, "Grid Length: %d", editor->grid_num_lines); + + nk_layout_row_push(context, 0.6f); + nk_spacing(context, 1); + } + 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); @@ -556,6 +578,7 @@ void editor_entity_select(struct Editor* editor, struct Entity* entity) { editor->selected_entity->editor_selected = false; editor->selected_entity = NULL; + vec3_fill(&editor->tool_mesh_position, 0.f, 0.f, 0.f); } else if(entity) // Select { diff --git a/todo.txt b/todo.txt index f3cae29..2ad387c 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,7 @@ Todo: + - Display editor camera information and speed adjustment in status bar or top bar + - Add pre-render/post-render steps to deal with render order issues and culling lights before rendering - Immediate mode render order, drawing axis and helpers on top of grid - - Display tool/cursor location in editor statusbar - Better, more accurate picking - Highlight if we are about to select an entity or perform the tool action like translate when mouse is hovered and an entity can be selected at that location - Display the projected position if we perform the action for example display what the new location would be right next to the tool mesh @@ -230,4 +231,5 @@ Done: * Vertical translation in translate mode * Axis selection/cycling * Axis switching and returning back to previously selected axis after releasing alt in translate mode + * Display tool/cursor location in editor statusbar