Vivid
Loading...
Searching...
No Matches
Window.h
1#pragma once
2
3#include "common/types/OpenGLTypes.h"
4#include "utils/Error.h"
5#include "core/renderer/FrameBuffer.h"
6#include "editor/RenderingInterface.h"
7#include "common/maths/Vec.h"
8
14class Window
15{
16private:
17 GLFWwindow* m_Window;
18 Vivid::Maths::Vec2 m_ViewportPosition;
19 int m_Width, m_Height;
20 float m_ViewportWidth, m_ViewportHeight;
21 const char* m_Title;
22 Vivid::Maths::Vec2* m_PrevMousePosition;
23 RenderingInterface* m_RenderingInterface;
24 FrameBuffer* m_FrameBuffer;
25
26 Window(int width, int height, const char* title);
27
28 static Window* s_Instance;
29
30public:
31 ~Window() = default;
32
38 static Window* Init(int width, int height, const char* title);
39
40 void Clear() const;
41 void Update();
42
43 int GetWidth() const { return m_Width; }
44 int GetHeight() const { return m_Height; }
45 GLFWwindow* GetGLFWWindow() const { return m_Window; }
46 float GetAspectRatio() const { return (float)m_Width / (float)m_Height; }
47
53 void SetRenderingInterface(RenderingInterface* renderingInterface);
54
55 Vivid::Maths::Vec2 GetViewportPosition() { return m_ViewportPosition; }
56 float GetViewportWidth() { return m_ViewportWidth; }
57 float GetViewportHeight() { return m_ViewportHeight; }
58};
Handles the creation and management of a frame buffer.
Definition: FrameBuffer.h:11
RenderingInterface class.
A class that represents a window and is wrapper of GLFWwindow.
Definition: Window.h:15
void SetRenderingInterface(RenderingInterface *renderingInterface)
Sets the rendering interface.
Definition: Window.cpp:77
static Window * Init(int width, int height, const char *title)
Initializes the window.
Definition: Window.cpp:64
Contains a 2D vector.
Definition: Vec.h:108