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