Aether3D Game Engine
Window.hpp
1 #ifndef WINDOW_H
2 #define WINDOW_H
3 
4 namespace ae3d
5 {
7  enum class WindowEventType
8  {
9  None = 0,
10  Close,
11  KeyDown,
12  KeyUp,
13  Mouse1Down,
14  Mouse1Up,
15  Mouse2Down,
16  Mouse2Up,
17  MouseMiddleDown,
18  MouseMiddleUp,
19  MouseWheelScrollDown,
20  MouseWheelScrollUp,
21  MouseMove,
22  GamePadButtonA,
23  GamePadButtonB,
24  GamePadButtonX,
25  GamePadButtonY,
26  GamePadButtonDPadUp,
27  GamePadButtonDPadDown,
28  GamePadButtonDPadLeft,
29  GamePadButtonDPadRight,
30  GamePadButtonStart,
31  GamePadButtonBack,
32  GamePadButtonLeftShoulder,
33  GamePadButtonRightShoulder,
34  GamePadLeftThumbState,
35  GamePadRightThumbState,
36  };
37 
39  enum class KeyCode
40  {
41  A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
42  Left, Right, Up, Down, Space, Escape, Enter
43  };
44 
46  enum WindowCreateFlags : unsigned
47  {
48  Empty = 1 << 0,
49  Fullscreen = 1 << 1,
50  MSAA4 = 1 << 2,
51  MSAA8 = 1 << 3,
52  MSAA16 = 1 << 4
53  };
54 
56  struct WindowEvent
57  {
59  WindowEventType type = WindowEventType::None;
61  KeyCode keyCode = KeyCode::A;
63  int mouseX = 0;
65  int mouseY = 0;
67  float gamePadThumbX = 0;
69  float gamePadThumbY = 0;
70  };
71 
73  namespace Window
74  {
82  void Create( int width, int height, WindowCreateFlags flags );
83 
86  void GetSize( int& outWidth, int& outHeight );
87 
89  bool IsOpen();
90 
92  void PumpEvents();
93 
96  bool PollEvent( WindowEvent& outEvent );
97 
99  void SetTitle( const char* title );
100 
102  void SwapBuffers();
103  }
104 }
105 #endif
bool PollEvent(WindowEvent &outEvent)
Definition: AudioClip.hpp:4
void SwapBuffers()
Displays the contents of the screen.
void GetSize(int &outWidth, int &outHeight)
void Create(int width, int height, WindowCreateFlags flags)
void SetTitle(const char *title)
void PumpEvents()
Reads events from windowing system to be used in PollEvent depending on platform. ...
Window event is a key press, close event, mouse click etc.
Definition: Window.hpp:56