Vivid
Loading...
Searching...
No Matches
Application.cpp
1#include "Application.h"
2#include "editor/camera/movable/EditorCamera.h"
3
4Window* Window::s_Instance = nullptr;
5
6Application::Application()
7{
8 m_Window = Window::Init(m_Width, m_Height, m_Title);
9}
10
11Application::Application(int width, int height, const char* title, Camera* camera)
12 : m_Width(width)
13 , m_Height(height)
14 , m_Title(std::move(title))
15{
16 if (title == nullptr)
17 m_Title = "Vivid";
18 m_Window = Window::Init(m_Width, m_Height, m_Title);
19 if (camera != nullptr)
20 m_Camera = camera;
21 else
22 m_Camera = new EditorCamera(60.0f, 1.7778f, 0.1f, 10000.0f);
23}
24
25bool Application::IsRunning()
26{
27 return !glfwWindowShouldClose(m_Window->GetGLFWWindow());
28}
29
30void Application::Terminate()
31{
32 glfwTerminate();
33}
34
35void Application::Run()
36{
37 while (IsRunning())
38 {
39 m_Window->Update();
40 }
41}
A class that represents the camera.
Definition: Camera.h:25
A class for the EditorCamera.
Definition: EditorCamera.h:14
A class that represents a window and is wrapper of GLFWwindow.
Definition: Window.h:15
static Window * Init(int width, int height, const char *title)
Initializes the window.
Definition: Window.cpp:64