Changeset 6053b24 in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Feb 14, 2021, 6:53:53 PM (4 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
db1b548
Parents:
8d96e95
git-author:
Dmitry Portnoy <dportnoy@…> (02/14/21 18:53:48)
git-committer:
Dmitry Portnoy <dportnoy@…> (02/14/21 18:53:53)
Message:

Read events from GameGui in both VulkanGame and SDLGame and don't pass
events to the main application when IMGUI wants to capture them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    r8d96e95 r6053b24  
    781781   lastSpawn_asteroid = curTime;
    782782
     783   ImGuiIO& io = ImGui::GetIO();
     784
    783785   done = false;
    784786   while (!done) {
     
    802804      while (gui->pollEvent(&uiEvent)) {
    803805         GameEvent& e = uiEvent.event;
     806         SDL_Event sdlEvent = uiEvent.rawEvent.sdl;
     807
     808         ImGui_ImplSDL2_ProcessEvent(&sdlEvent);
     809         if (io.WantCaptureMouse &&
     810               (e.type == UI_EVENT_MOUSEBUTTONDOWN || e.type == UI_EVENT_MOUSEBUTTONUP || e.type == UI_EVENT_UNKNOWN)) {
     811            if (sdlEvent.type == SDL_MOUSEWHEEL || sdlEvent.type == SDL_MOUSEBUTTONDOWN || sdlEvent.type == SDL_MOUSEBUTTONUP) {
     812               continue;
     813            }
     814         }
     815         if (io.WantCaptureKeyboard &&
     816               (e.type == UI_EVENT_KEYDOWN || e.type == UI_EVENT_KEYUP)) {
     817            if (sdlEvent.type == SDL_KEYDOWN || sdlEvent.type == SDL_KEYUP) {
     818               continue;
     819            }
     820         }
     821         if (io.WantTextInput) {
     822            // show onscreen keyboard if on mobile
     823         }
    804824
    805825         switch(e.type) {
Note: See TracChangeset for help on using the changeset viewer.