TerraForge3D  2.3.1
3D Terrain And Landscape Generator
Window.h
1#pragma once
2
3struct GLFWwindow;
4
5#include <functional>
6#include <string>
7
8using EventFn = std::function<void(int, int)>;
9
11{
13 {
14 r = g = b = 0;
15 }
16
17 ClearColor(float r, float g, float b)
18 : r(r), g(g), b(b) {}
19
20 float r;
21 float g;
22 float b;
23};
24
25class Window
26{
27public:
28 Window(std::string title);
29 ~Window();
30
31 void SetShouldCloseCallback(EventFn callbackFunction);
32 void SetResizeCallback(EventFn callbackFunction);
33 void SetMouseCallback(EventFn callbackFunction);
34
35 void SetVSync(bool enabled);
36 void MakeCurrentContext();
37 void SetClearColor(ClearColor color);
38 void Update();
39 void Close();
40 void Clear();
41 void SetFullScreen(bool fullscreen);
42 void SetVisible(bool visibility);
43
44 inline bool IsVSyncEnabled()
45 {
46 return vSyncState;
47 }
48 inline GLFWwindow *GetNativeWindow()
49 {
50 return m_Window;
51 }
52
53private:
54 bool isActive, vSyncState, isFullscreen = false;
55 GLFWwindow *m_Window;
56 EventFn m_CloseEventCallback, m_ResizeEventCallback, m_MouseEventCallback;
57 ClearColor m_ClearColor;
58};
Definition: Window.h:26