While there are any remaining events on the SDL event stack 1. Check if one of those events is a quit 2. Check if the GUI wants to use the keyboard and mouse 3. Handle keyboard events ourselves 4. Handle mouse events directly */
| 36 | 4. Handle mouse events directly |
| 37 | */ |
| 38 | void InputManager::processInput(bool &done, unsigned int deltaT){ |
| 39 | SDL_Event event; |
| 40 | |
| 41 | ImGuiIO& io = ImGui::GetIO(); |
| 42 | |
| 43 | while(SDL_PollEvent(&event)){ |
| 44 | //First check if user requests an exit |
| 45 | if(event.type == SDL_QUIT){ |
| 46 | done = true; |
| 47 | return; |
| 48 | } |
| 49 | //Next, check if imGUI wants to use the mouse or keyboard |
| 50 | else if(io.WantCaptureKeyboard || io.WantCaptureMouse ){ |
| 51 | //Stops all camera movement if you are interacting with the GUI |
| 52 | sceneCamera->activeMoveStates.clear(); |
| 53 | ImGui_ImplSDL2_ProcessEvent(&event); |
| 54 | } |
| 55 | //Handle any other relevant input data |
| 56 | //Keypresses, mouse etc |
| 57 | else{ |
| 58 | handleEvent(&event, done, deltaT); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | |
| 64 | //Maybe a candidate to break apart into smaller functions |
no test coverage detected