Skip to content

Commit

Permalink
imgui now properly consumes it's input - fixed after reading issues o…
Browse files Browse the repository at this point in the history
  • Loading branch information
onqtam committed Aug 16, 2017
1 parent 8b80399 commit 34f0dc0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
8 changes: 5 additions & 3 deletions docs/todo.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

prefabs

- level
- save
- load
Expand All @@ -8,17 +10,17 @@
- controls for that
- remove mixins like "selected"
- start/stop updating entities
- make a second camera used for the editor mode and leave the ingame one as is
- picking
- entity explorer
- entity properties
- entity attributes
- undo/redo
mutating objects - serialization/deserialization only for the relevant mixins - currently done for all...
switch to checking against the types instead of indexes...
- copy/paste
- search objects by name (and change from treeview to list view - or try to stick to a treeview)
- search objects by name (and change from treeview to list view in results - or try to stick to a treeview)
- resource viewer - all resources with preview when appropriate and refcounts
- make gizmos draw last - on top of the objects in the scene (but with depth test enabled for themselves!)
- imgui should consume input originating on one of its windows
- object snapping (with the gizmos)
- spatial queries about objects
- objects inheriting transformations based on their hierarchical component
Expand Down
20 changes: 8 additions & 12 deletions src/core/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ HA_SUPPRESS_WARNINGS

#include <bgfx/c99/platform.h>

#include <imgui/imgui_internal.h>

#include <GLFW/glfw3.h>

#ifdef EMSCRIPTEN
Expand Down Expand Up @@ -417,12 +415,15 @@ int Application::run(int argc, char** argv) {
}

void Application::processEvents() {
// if imgui hasn't consumed the input
if(ImGui::GetCurrentContext()->FocusedWindow == NULL) {
for(size_t i = 0; i < m_inputs.size(); ++i)
for(auto& curr : m_inputEventListeners)
ImGuiIO& io = ImGui::GetIO();

for(size_t i = 0; i < m_inputs.size(); ++i)
for(auto& curr : m_inputEventListeners)
if((m_inputs[i].type == InputEvent::KEY && !io.WantCaptureKeyboard) ||
(m_inputs[i].type == InputEvent::MOTION && !io.WantCaptureMouse) ||
(m_inputs[i].type == InputEvent::BUTTON && !io.WantCaptureMouse) ||
(m_inputs[i].type == InputEvent::SCROLL && !io.WantCaptureMouse))
curr->process_event(m_inputs[i]);
}

m_inputs.clear();
}
Expand All @@ -447,11 +448,6 @@ void Application::update() {
// send input events to the rest of the app
processEvents();

// to help in input consuming by imgui
if(!ImGui::IsMouseHoveringAnyWindow()) {
ImGui::SetWindowFocus(nullptr);
}

// update game stuff
World::get().update();

Expand Down

0 comments on commit 34f0dc0

Please sign in to comment.