minecraftvulkan/engine/xe_engine.hpp

64 lines
1.2 KiB
C++
Raw Normal View History

2022-09-19 11:08:42 +00:00
#pragma once
2022-09-27 21:03:43 +00:00
#include "xe_buffer.hpp"
2022-09-19 11:08:42 +00:00
#include "xe_device.hpp"
#include "xe_renderer.hpp"
2022-09-20 01:28:41 +00:00
#include "xe_camera.hpp"
2022-09-19 16:54:23 +00:00
#include "xe_descriptors.hpp"
#include "xe_input.hpp"
#include "xe_sound.hpp"
2022-09-19 11:08:42 +00:00
2022-09-21 02:02:58 +00:00
#include <chrono>
2022-09-19 20:35:45 +00:00
#include <string>
#include <iostream>
#include <AL/alc.h>
#include <AL/alut.h>
2022-09-19 11:08:42 +00:00
namespace xe {
2022-09-25 01:16:13 +00:00
class Engine {
2022-09-19 11:08:42 +00:00
public:
2022-09-27 01:24:28 +00:00
Engine(int width, int height, std::string name, const char *icon);
2022-09-20 01:28:41 +00:00
2022-09-25 01:16:13 +00:00
~Engine();
2022-09-19 11:08:42 +00:00
2022-09-25 01:16:13 +00:00
Engine(const Engine&) = delete;
Engine operator=(const Engine&) = delete;
2022-09-19 11:08:42 +00:00
2022-09-25 16:13:07 +00:00
Input& getInput() {return xeInput;}
2022-09-25 01:16:13 +00:00
Camera& getCamera() {return xeCamera;}
2022-09-21 02:02:58 +00:00
2022-09-19 20:35:45 +00:00
bool beginFrame() { return xeRenderer.beginFrame(); }
2022-09-20 01:28:41 +00:00
void endFrame() { xeRenderer.endFrame(); }
2022-09-19 20:35:45 +00:00
void close() { vkDeviceWaitIdle(xeDevice.device()); }
2022-09-20 01:28:41 +00:00
bool poll();
float getFrameTime() { return frameTime; }
2022-09-25 23:05:56 +00:00
static Engine* getInstance();
2022-09-19 11:08:42 +00:00
private:
2022-09-21 02:02:58 +00:00
void loadDescriptorPool();
2022-09-19 11:08:42 +00:00
2022-09-25 01:16:13 +00:00
Window xeWindow;
Device xeDevice;
Renderer xeRenderer;
Camera xeCamera;
2022-09-25 16:13:07 +00:00
Input xeInput;
2022-09-19 11:08:42 +00:00
2022-09-20 01:28:41 +00:00
std::chrono::_V2::system_clock::time_point currentTime;
float frameTime;
float FOV = 50.f;
2022-09-25 01:16:13 +00:00
std::unique_ptr<DescriptorPool> xeDescriptorPool;
2022-09-20 01:28:41 +00:00
2022-09-25 01:16:13 +00:00
friend class RenderSystem;
2022-09-27 21:03:43 +00:00
friend class Image;
friend class Model;
2022-09-19 11:08:42 +00:00
};
}