Changeset d8cf709 in opengl-game for gui


Ignore:
Timestamp:
Feb 13, 2021, 11:41:39 PM (4 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
c6f0793
Parents:
8b823e7
Message:

Change UIEvent to also include the original event from the UI library the game gui is currently using, such as SDL or GLFW.

Location:
gui
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • gui/button.cpp

    r8b823e7 rd8cf709  
    8787}
    8888
    89 void Button::handleEvent(UIEvent& e) {
     89void Button::handleEvent(GameEvent& e) {
    9090   switch(e.type) {
    9191      case UI_EVENT_MOUSEMOTION:
  • gui/button.hpp

    r8b823e7 rd8cf709  
    2121   void init() override;
    2222   void render(int x, int y) override;
    23    void handleEvent(UIEvent& e) override;
     23   void handleEvent(GameEvent& e) override;
    2424
    2525private:
  • gui/game-screen.cpp

    r8b823e7 rd8cf709  
    4949}
    5050
    51 void GameScreen::handleEvent(UIEvent& e) {
     51void GameScreen::handleEvent(GameEvent& e) {
    5252   Screen::handleEvent(e);
    5353}
  • gui/game-screen.hpp

    r8b823e7 rd8cf709  
    1313      void createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage) override;
    1414
    15       void handleEvent(UIEvent& e) override;
     15      void handleEvent(GameEvent& e) override;
    1616};
    1717
  • gui/main-screen.cpp

    r8b823e7 rd8cf709  
    2121}
    2222
    23 void MainScreen::handleEvent(UIEvent& e) {
     23void MainScreen::handleEvent(GameEvent& e) {
    2424   Screen::handleEvent(e);
    2525}
  • gui/main-screen.hpp

    r8b823e7 rd8cf709  
    1313      void createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage) override;
    1414
    15       void handleEvent(UIEvent& e) override;
     15      void handleEvent(GameEvent& e) override;
    1616};
    1717
  • gui/panel.cpp

    r8b823e7 rd8cf709  
    7272}
    7373
    74 void Panel::handleEvent(UIEvent& e) {
     74void Panel::handleEvent(GameEvent& e) {
    7575   for (UIElement*& uiElement : this->uiElements) {
    7676      uiElement->handleEvent(e);
  • gui/panel.hpp

    r8b823e7 rd8cf709  
    1919
    2020   void render(int x, int y) override;
    21    void handleEvent(UIEvent& e) override;
     21   void handleEvent(GameEvent& e) override;
    2222
    2323private:
  • gui/screen.cpp

    r8b823e7 rd8cf709  
    2929}
    3030
    31 void Screen::handleEvent(UIEvent& e) {
     31void Screen::handleEvent(GameEvent& e) {
    3232   for (UIElement*& uiElement : this->uiElements) {
    3333      uiElement->handleEvent(e);
  • gui/screen.hpp

    r8b823e7 rd8cf709  
    1717class VulkanGame;
    1818
    19 template<class Type>
    20 struct ValueReference {
    21    
    22 };
    23 
    2419// TODO: Add a function to create an SDL_Color from a uint32_t
    2520
     
    3429   
    3530   virtual void renderUI();
    36    virtual void handleEvent(UIEvent& e);
     31   virtual void handleEvent(GameEvent& e);
    3732   void addUIElement(UIElement* element);
    3833
  • gui/ui-element.cpp

    r8b823e7 rd8cf709  
    2121}
    2222
    23 void UIElement::handleEvent(UIEvent& e) {
     23void UIElement::handleEvent(GameEvent& e) {
    2424}
  • gui/ui-element.hpp

    r8b823e7 rd8cf709  
    1818   virtual void init();
    1919   virtual void render(int x, int y) = 0;
    20    virtual void handleEvent(UIEvent& e);
     20   virtual void handleEvent(GameEvent& e);
    2121
    2222protected:
Note: See TracChangeset for help on using the changeset viewer.