CWindowManager.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <ionMath.h>
5 #include <ionGraphics.h>
6 
7 #include "CWindow.h"
8 #include "SWindowResizedEvent.h"
9 #include "SFileDroppedEvent.h"
10 
11 
12 namespace ion
13 {
14 
15  enum class EWindowType
16  {
17  Fullscreen,
18  Windowed
19  };
20 
21  enum class EVsyncMode
22  {
23  Default,
24  Off,
25  On
26  };
27 
28  class CWindowManager : public Singleton<CWindowManager>, public IEventListener
29  {
30 
31  public:
32 
33  void Init(CGraphicsAPI * GraphicsAPI);
34  void PollEvents();
35  bool ShouldClose() const;
36  bool Run();
37 
38  CWindow * CreateWindow(vec2i const & Size, std::string const & Title, EWindowType const Type, EVsyncMode const Vsync = EVsyncMode::Default);
39  CWindow * CreateWindowOnMonitor(int const Monitor, std::string const & Title, EVsyncMode const Vsync = EVsyncMode::Default);
40 
41  protected:
42 
43  CGraphicsAPI * GraphicsAPI = nullptr;
44 
45  CWindow * PrimaryWindow = nullptr;
46  std::map<GLFWwindow *, CWindow *> Windows;
47 
48  static void KeyCallback(GLFWwindow * window, int key, int scancode, int action, int mods);
49  static void MouseButtonCallback(GLFWwindow * window, int button, int action, int mods);
50  static void MouseScrollCallback(GLFWwindow * window, double xoffset, double yoffset);
51  static void MouseCursorCallback(GLFWwindow * window, double xpos, double ypos);
52  static void CharCallback(GLFWwindow * window, unsigned int c);
53  static void DropCallback(GLFWwindow* window, int count, const char** paths);
54 
55  private:
56 
57  friend class Singleton<CWindowManager>;
59 
60  };
61 
62 }
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
Base class for Singleton design pattern implementation.
Definition: Singleton.h:13
Lightweight wrapper for std::type_info that enables sorting (e.g. for use in a std::map) ...
Definition: ionClass.h:20
Definition: CWindow.h:16
Definition: IEventListener.h:8
std::map< GLFWwindow *, CWindow * > Windows
Definition: CWindowManager.h:46
EVsyncMode
Definition: CWindowManager.h:21
Definition: CWindowManager.h:28
Definition: CGraphicsAPI.h:53
EWindowType
Definition: CWindowManager.h:15