Changeset 0e09340 in opengl-game


Ignore:
Timestamp:
Sep 27, 2019, 8:21:48 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
fa9fa1c
Parents:
6fc24c7
Message:

In vulkangame, detect when the framebuffer is resized

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • game-gui-sdl.cpp

    r6fc24c7 r0e09340  
    9393            break;
    9494         case SDL_WINDOWEVENT:
    95             event->type = UI_EVENT_WINDOW;
     95            if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED ||
     96               e.window.event == SDL_WINDOWEVENT_MINIMIZED ||
     97               e.window.event == SDL_WINDOWEVENT_MAXIMIZED) {
     98               event->type = UI_EVENT_WINDOWRESIZE;
     99            } else {
     100               event->type = UI_EVENT_WINDOW;
     101            }
    96102            break;
    97103         case SDL_KEYUP:
  • game-gui.hpp

    r6fc24c7 r0e09340  
    1717   UI_EVENT_QUIT,
    1818   UI_EVENT_WINDOW,
     19   UI_EVENT_WINDOWRESIZE,
    1920   UI_EVENT_KEY,
    2021   UI_EVENT_MOUSEBUTTONDOWN,
  • upgrade-TODO.txt

    r6fc24c7 r0e09340  
    1818
    1919- Add CrashLogger functionality
     20
     21
     22opengl-game TODO
     23--------------
     24
     25- Make sure new-game.cpp is updated with the TODO lines
     26- Implament the window resize callback and related functionality in opengl-game / game-gui-glfw
  • vulkan-game.cpp

    r6fc24c7 r0e09340  
    124124               cout << "Window event detected" << endl;
    125125               // Currently unused
     126               break;
     127            case UI_EVENT_WINDOWRESIZE:
     128               cout << "Window resize event detected" << endl;
     129               framebufferResized = true;
    126130               break;
    127131            case UI_EVENT_KEY:
  • vulkan-game.hpp

    r6fc24c7 r0e09340  
    4040      VkRenderPass renderPass;
    4141
     42      bool framebufferResized = false;
     43
    4244      bool initWindow(int width, int height, unsigned char guiFlags);
    4345      void initVulkan();
  • vulkan-ref.cpp

    r6fc24c7 r0e09340  
    227227      size_t currentFrame = 0;
    228228
     229/*** START OF REFACTORED CODE ***/
    229230      bool framebufferResized = false;
    230231
    231 /*** START OF REFACTORED CODE ***/
    232232      bool initWindow() {
    233233         if (gui->init() == RTWO_ERROR) {
     
    16971697                  quit = true;
    16981698               }
    1699 /*** END OF REFACTORED CODE ***/
    17001699               if (e.type == SDL_WINDOWEVENT) {
    17011700                  if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED ||
     
    17041703                  }
    17051704               }
    1706 /*** START OF REFACTORED CODE ***/
    17071705            }
    17081706
Note: See TracChangeset for help on using the changeset viewer.