MCPcopy Create free account
hub / github.com/Angelo1211/HybridRenderingEngine / processInput

Method processInput

src/inputManager.cpp:38–61  ·  view source on GitHub ↗

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 */

Source from the content-addressed store, hash-verified

364. Handle mouse events directly
37*/
38void 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

Callers 1

runMethod · 0.80

Calls 2

clearMethod · 0.45

Tested by

no test coverage detected