Changeset a0da009 in opengl-game


Ignore:
Timestamp:
Oct 1, 2019, 2:48:30 AM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
40995d3
Parents:
fa9fa1c
Message:

Add a window resize callback in gamegui and add an unknown event type for events that aren't currently handeld

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • game-gui-glfw.cpp

    rfa9fa1c ra0da009  
    6666   glfwSetMouseButtonCallback(window, glfw_mouse_button_callback);
    6767   glfwSetKeyCallback(window, glfw_key_callback);
     68   glfwSetWindowSizeCallback(window, glfw_window_size_callback);
    6869}
    6970
     
    151152   GameGui_GLFW::s_events.push(e);
    152153}
     154
     155void glfw_window_size_callback(GLFWwindow* window, int width, int height) {
     156   UIEvent e;
     157   e.type = UI_EVENT_WINDOWRESIZE;
     158
     159   GameGui_GLFW::s_events.push(e);
     160}
  • game-gui-glfw.hpp

    rfa9fa1c ra0da009  
    5050void glfw_mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
    5151void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
     52void glfw_window_size_callback(GLFWwindow* window, int width, int height);
    5253
    5354#endif // _GAME_GUI_GLFW_H
  • game-gui-sdl.cpp

    rfa9fa1c ra0da009  
    122122         case SDL_AUDIODEVICEREMOVED:
    123123         case SDL_TEXTEDITING: // TODO: Research this one later
    124             event = nullptr;
    125             return 0;
     124            event->type = UI_EVENT_UNKNOWN;
     125            event->unknown.eventType = e.type;
    126126            break;
    127127         default:
    128             cout << "Unknown event type: 0x" << hex << e.type << dec << endl;
    129             event = nullptr;
    130             return 0;
     128            event->type = UI_EVENT_UNKNOWN;
     129            event->unknown.eventType = 0;
    131130      }
    132131
  • game-gui.hpp

    rfa9fa1c ra0da009  
    44#include <string>
    55#include <vector>
    6 
    7 // TODO: Remove the line below once the couts in the game-gui-* files are moved
    8 #include <iostream>
    96
    107#ifdef GAMEGUI_INCLUDE_VULKAN
     
    2118   UI_EVENT_MOUSEBUTTONDOWN,
    2219   UI_EVENT_MOUSEBUTTONUP,
    23    UI_EVENT_MOUSEMOTION
     20   UI_EVENT_MOUSEMOTION,
     21   UI_EVENT_UNKNOWN
    2422};
    2523
     
    3533struct MouseEvent {
    3634   EventType type;
     35   /*
     36      int button;
     37      int action;
     38      int x;
     39      int y;
     40   */
     41};
     42
     43struct UnknownEvent {
     44   EventType type;
     45   unsigned int eventType;
    3746};
    3847
     
    4251   KeyEvent key;
    4352   MouseEvent mouse;
     53   UnknownEvent unknown;
    4454};
    45 
    46 /*
    47 struct MouseEvent {
    48    int button;
    49    int action;
    50    int x;
    51    int y;
    52 };
    53 */
    5455
    5556class GameGui {
  • opengl-game.cpp

    rfa9fa1c ra0da009  
    125125               }
    126126               break;
     127            case UI_EVENT_WINDOWRESIZE:
     128               cout << "Window resize event detected" << endl;
     129               break;
    127130            default:
    128131               cout << "Unhandled UI event: " << e.type << endl;
  • vulkan-game.cpp

    rfa9fa1c ra0da009  
    144144               break;
    145145            case UI_EVENT_MOUSEMOTION:
     146               break;
     147            case UI_EVENT_UNKNOWN:
     148               cout << "Unknown event type: 0x" << hex << e.unknown.eventType << dec << endl;
    146149               break;
    147150            default:
  • vulkan-ref.cpp

    rfa9fa1c ra0da009  
    326326/*** END OF REFACTORED CODE ***/
    327327
     328         // THIS SECTION IS WHERE TEXTURES ARE CREATED, MAYBE SPLIT IT OFF INTO A SEPARATE FUNCTION
     329         // MAY WANT TO CREATE A STRUCT TO HOLD SIMILAR VARIABLES< LIKE THOSE FOR A TEXTURE
     330
    328331         createImageResources("textures/texture.jpg", textureImage, textureImageMemory, textureImageView);
    329332         createImageResourcesFromSDLTexture(uiOverlay, sdlOverlayImage, sdlOverlayImageMemory, sdlOverlayImageView);
     
    339342         overlayImageInfo.imageView = sdlOverlayImageView;
    340343         overlayImageInfo.sampler = textureSampler;
     344
     345         // SHADER-SPECIFIC STUFF STARTS HERE
    341346
    342347         vector<Vertex> sceneVertices = {
Note: See TracChangeset for help on using the changeset viewer.