stories/engine/engine.h

71 lines
1.4 KiB
C++

#pragma once
#include <stdint.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_vulkan.h>
#include <vulkan/vulkan.h>
#include <vector>
#include <set>
#include <string>
#include <iostream>
#include <stdexcept>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <cstdint>
#include <limits>
#include <optional>
#include <set>
#include "window.h"
#include "surface.h"
#include "physicaldevice.h"
#include "logicaldevice.h"
namespace Engine {
const int MAX_FRAMES_IN_FLIGHT = 2;
class Instance;
class Engine {
friend class Instance;
public:
Engine();
~Engine();
void run();
bool enableValidationLayers() const;
void addLayer(const std::string& layerName);
void addInstanceExtension(const std::string& extensionName);
void addDeviceExtension(const std::string& extensionName);
void enableDebug();
std::vector<const char *> getRequiredVulkanExtensions() const;
private:
bool initialized;
Window* window;
Instance* instance;
Surface* surface;
PhysicalDevice* physicalDevice;
LogicalDevice* logicalDevice;
std::set<std::string> layerNames;
std::set<std::string> instanceExtensionNames;
std::set<std::string> deviceExtensionNames;
std::vector<const char*> layers;
std::vector<const char*> instanceExtensions;
std::vector<const char*> deviceExtensions;
void initVulkan();
void mainLoop();
void cleanup();
void pickPhysicalDevice();
};
}