Karma Engine
Loading...
Searching...
No Matches
WindowsWindow.h
1#pragma once
2
3#include "Karma/Window.h"
4
5struct GLFWwindow;
6
7namespace Karma
8{
9 class GraphicsContext;
10
11 class WindowsWindow : public Window
12 {
13 public:
14 WindowsWindow(const WindowProps& props);
15 virtual ~WindowsWindow();
16
17 virtual void OnUpdate() override;
18 virtual bool OnResize(WindowResizeEvent& event) override;
19
20 inline unsigned int GetWidth() const override { return m_Data.Width; }
21 inline unsigned int GetHeight() const override { return m_Data.Height; }
22
23 inline void SetEventCallback(const EventCallbackFn& callback) override
24 {
25 m_Data.EventCallback = callback;
26 }
27 inline virtual void* GetNativeWindow() const override { return m_Window; }
28
29 void SetVSync(bool enabled) override;
30 bool IsVSync() const override;
31
32 GLFWwindow* GetHandle() const { return m_Window; }
33
34 private:
35 void Init(const WindowProps& props);
36
37 void SetGLFWCallbacks(GLFWwindow* glfwWindow);
38 void ShutDown();
39
40 GLFWwindow* m_Window;
41 GraphicsContext* m_Context;
42
43 struct WindowData
44 {
45 std::string Title;
46 unsigned int Width, Height;
47 bool VSync;
48
49 EventCallbackFn EventCallback;
50 };
51
52 WindowData m_Data;
53 };
54}
Definition GraphicsContext.h:8
Definition ApplicationEvent.h:10
Definition Window.h:27
Definition WindowsWindow.h:12
Definition Window.h:12