vengine  0.1.0
3D graphics engine made with Vulkan
Loading...
Searching...
No Matches
Engine.hpp
Go to the documentation of this file.
1///
2/// @file Engine.hpp
3/// @brief This file contains the Engine class
4/// @namespace ven
5///
6
7#pragma once
8
9#include <vulkan/vulkan.h>
10
11#include "VEngine/Window.hpp"
12#include "VEngine/Constant.hpp"
13#include "VEngine/Device.hpp"
14#include "VEngine/Object.hpp"
15#include "VEngine/Renderer.hpp"
17
18namespace ven {
19
20 class Engine {
21
22 public:
23
24 explicit Engine(uint32_t = DEFAULT_WIDTH, uint32_t = DEFAULT_HEIGHT, const std::string &title = DEFAULT_TITLE.data());
25 ~Engine() = default;
26
27 Engine(const Engine &) = delete;
28 Engine operator=(const Engine &) = delete;
29
30 Window &getWindow() { return m_window; };
31
32 void mainLoop();
33
34 private:
35
36 void loadObjects();
37
41
42 std::unique_ptr<DescriptorPool> m_globalPool;
44
45 VkInstance m_instance{nullptr};
46 VkSurfaceKHR m_surface{nullptr};
47
48 void createInstance();
49 void createSurface() { if (glfwCreateWindowSurface(m_instance, m_window.getGLFWindow(), nullptr, &m_surface) != VK_SUCCESS) { throw std::runtime_error("Failed to create window surface"); } }
50
51 }; // class Engine
52
53} // namespace ven
This file contains the constant values used in the project.
This file contains the Descriptors class.
This file contains the Device class.
This file contains the Object class.
This file contains the Renderer class.
This file contains the Window class.
Object::Map m_objects
Definition Engine.hpp:43
void createInstance()
Definition engine.cpp:133
void mainLoop()
Definition engine.cpp:67
Engine(const Engine &)=delete
void createSurface()
Definition Engine.hpp:49
Renderer m_renderer
Definition Engine.hpp:40
Device m_device
Definition Engine.hpp:39
void loadObjects()
Definition engine.cpp:16
Engine operator=(const Engine &)=delete
VkInstance m_instance
Definition Engine.hpp:45
Window m_window
Definition Engine.hpp:38
Window & getWindow()
Definition Engine.hpp:30
~Engine()=default
Engine(uint32_t=DEFAULT_WIDTH, uint32_t=DEFAULT_HEIGHT, const std::string &title=DEFAULT_TITLE.data())
Definition engine.cpp:59
std::unique_ptr< DescriptorPool > m_globalPool
Definition Engine.hpp:42
VkSurfaceKHR m_surface
Definition Engine.hpp:46
std::unordered_map< id_t, Object > Map
Definition Object.hpp:37
GLFWwindow * getGLFWindow() const
Definition Window.hpp:27
static constexpr uint32_t DEFAULT_WIDTH
Definition Constant.hpp:11
static constexpr uint32_t DEFAULT_HEIGHT
Definition Constant.hpp:12
static constexpr std::string_view DEFAULT_TITLE
Definition Constant.hpp:14