CWindow.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <ionFramework.h>
5 #include <ionGraphics.h>
6 
7 #include "SKeyboardEvent.h"
8 #include "SMouseEvent.h"
9 #include "SWindowResizedEvent.h"
10 
11 
12 struct GLFWwindow;
13 
14 namespace ion
15 {
16 
17  class CWindow : public IEventListener
18  {
19 
20  friend class CWindowManager;
21 
22  public:
23 
24  void MakeContextCurrent();
25  bool ShouldClose() const;
26  void Close();
27 
28  vec2i const & GetSize() const;
29  vec2i const & GetFrameBufferSize() const;
30 
31  f32 GetAspectRatio() const;
32  void SwapBuffers();
33 
34  vec2i GetPosition() const;
35  void SetPosition(vec2i const & Position);
36 
37  bool IsKeyDown(EKey const Key);
38  bool IsMouseDown(SMouseEvent::EButton const Button);
39 
40  vec2f const & GetCursorLocation() const;
41  void SetCursorLocation(vec2f const & position);
42  void SetCursorVisible(bool const Visible);
43 
45  void SetRelativeCursorLocation(vec2f const & position);
46 
47  GLFWwindow * const GetHandle() const;
48 
49  string GetClipboardText() const;
50  void SetClipboardText(string const & Text);
51 
52  bool IsFocused() const;
53 
55 
56  protected:
57 
58  GLFWwindow * const WindowHandle;
59 
60  bool KeyStates[(int) EKey::Count];
63 
66 
67  private:
68 
69  CWindow(GLFWwindow * windowHandle);
70 
71  static CWindow * CurrentContext;
72 
73  };
74 
75 }
vec2i const & GetFrameBufferSize() const
Definition: CWindow.cpp:37
std::shared_ptr< T > SharedPointer
Definition: ionSmartPointer.h:22
vec2f CursorLocation
Definition: CWindow.h:62
vec2f const & GetCursorLocation() const
Definition: CWindow.cpp:74
void MakeContextCurrent()
Definition: CWindow.cpp:13
void SetRelativeCursorLocation(vec2f const &position)
Definition: CWindow.cpp:102
void SetClipboardText(string const &Text)
Definition: CWindow.cpp:128
SharedPointer< Graphics::IGraphicsContext > GetContext()
Definition: CWindow.cpp:138
vec2i const & GetSize() const
Definition: CWindow.cpp:32
bool IsFocused() const
Definition: CWindow.cpp:133
vec2i Size
Definition: CWindow.h:64
void SetCursorLocation(vec2f const &position)
Definition: CWindow.cpp:79
EKey
Definition: EKey.h:8
bool ShouldClose() const
Definition: CWindow.cpp:27
float f32
Definition: ionTypes.h:94
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
f32 GetAspectRatio() const
Definition: CWindow.cpp:42
vec2i GetPosition() const
Definition: CWindow.cpp:52
bool IsMouseDown(SMouseEvent::EButton const Button)
Definition: CWindow.cpp:69
Definition: CWindow.h:17
Definition: IEventListener.h:8
vec2f GetRelativeCursorLocation() const
Definition: CWindow.cpp:97
void SetPosition(vec2i const &Position)
Definition: CWindow.cpp:59
GLFWwindow *const GetHandle() const
Definition: CWindow.cpp:118
bool IsKeyDown(EKey const Key)
Definition: CWindow.cpp:64
void SwapBuffers()
Definition: CWindow.cpp:47
vec2i FrameBufferSize
Definition: CWindow.h:65
void Close()
Definition: CWindow.cpp:22
string GetClipboardText() const
Definition: CWindow.cpp:123
EButton
Definition: SMouseEvent.h:16
bool MouseStates[(int) SMouseEvent::EButton::Count]
Definition: CWindow.h:61
GLFWwindow *const WindowHandle
Definition: CWindow.h:58
bool KeyStates[(int) EKey::Count]
Definition: CWindow.h:60
Definition: CWindowManager.h:19
void SetCursorVisible(bool const Visible)
Definition: CWindow.cpp:85