Changeset f6521fb in opengl-game for game-gui.hpp


Ignore:
Timestamp:
Sep 13, 2019, 1:30:24 AM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
c61323a
Parents:
203ab1b
Message:

Add processEvents() and pollEvent() to GameGui, implement them for GameGui_SDL, and add a union for different event types, similar to the SDL_Event union

File:
1 edited

Legend:

Unmodified
Added
Removed
  • game-gui.hpp

    r203ab1b rf6521fb  
    55#include <vector>
    66
     7// TODO: Remove the line below once the couts in the game-gui-* files are moved
     8#include <iostream>
     9
    710#ifdef GAMEGUI_INCLUDE_VULKAN
    811   #include <vulkan/vulkan.h>
    912#endif
    1013
    11 // TODO: Remove the line below once the couts in the game-gui-* files are moved
    12 #include <iostream>
     14using namespace std;
    1315
    14 using namespace std;
     16enum EventType {
     17   UI_EVENT_QUIT,
     18   UI_EVENT_WINDOW,
     19   UI_EVENT_KEY,
     20   UI_EVENT_MOUSEBUTTONDOWN,
     21   UI_EVENT_MOUSEBUTTONUP,
     22   UI_EVENT_MOUSEMOTION
     23};
     24
     25struct WindowEvent {
     26   EventType type;
     27};
     28
     29struct KeyEvent {
     30   EventType type;
     31   unsigned int keycode;
     32};
     33
     34struct MouseEvent {
     35   EventType type;
     36};
     37
     38union UIEvent {
     39   EventType type;
     40   WindowEvent window;
     41   KeyEvent key;
     42   MouseEvent mouse;
     43};
    1544
    1645/*
     
    3564      virtual void destroyWindow() = 0;
    3665
     66      virtual void processEvents() = 0;
     67      virtual int pollEvent(UIEvent* event) = 0;
     68
    3769      /*
    3870      virtual void processEvents() = 0;
Note: See TracChangeset for help on using the changeset viewer.