nfprojects / nfengine

Game engine
GNU General Public License v2.0
55 stars 4 forks source link

ImGui window input issue #148

Closed Witek902 closed 6 years ago

Witek902 commented 8 years ago

Current implementation assumes following event progress in main loop:

Window::ProcessMessages (nfEngineDemo)
Process Demo Input (nfEngineDemo) 
Engine::Advance (nfCore)
View::DrawGUI (nfCore)

This needs to be modified, because ProcessMessages gathers and applies events before ImGUI has any chance to react. New workflow should go as follows:

  1. Window::ProcessMessages should only gather what happened inside Window.
  2. ImGUI should be updated according to these events.
  3. nfEngineDemo should process input only if ImGUI is not in the way (there is a flag inside ImGUI which can tell us about this).
  4. Engine::Advance, which will draw everything that is needed.

So, in pseudocode (names are subject to change):

Window::ProcessMessages (nfEngineDemo)
Engine::Advance (nfCore)
View::UpdateGUI (nfCore)
Process Demo Input (nfEngineDemo)
View::DrawGUI (nfCore)