Refactor code
This commit is contained in:
36
openVulkanoCpp/Host/PlatformProducer.cpp
Normal file
36
openVulkanoCpp/Host/PlatformProducer.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "PlatformProducer.hpp"
|
||||
#include <stdexcept>
|
||||
#include "../Base/Logger.hpp"
|
||||
#include "../Vulkan/Renderer.hpp"
|
||||
#include "GLFW/PlatformGLFW.hpp"
|
||||
|
||||
namespace openVulkanoCpp
|
||||
{
|
||||
IRenderer* PlatformProducer::CreateRenderManager(RenderAPI::RenderApi renderApi)
|
||||
{
|
||||
switch (renderApi)
|
||||
{
|
||||
case RenderAPI::VULKAN: return new Vulkan::Renderer();
|
||||
default:
|
||||
Logger::RENDER->error("Unsupported render api requested! Requested %d", static_cast<int>(renderApi));
|
||||
throw std::runtime_error("Unsupported render api requested!");
|
||||
}
|
||||
}
|
||||
|
||||
IPlatform* PlatformProducer::CreatePlatform(RenderAPI::RenderApi renderApi)
|
||||
{
|
||||
switch (renderApi)
|
||||
{
|
||||
case RenderAPI::VULKAN: return new GLFW::PlatformGLFW();
|
||||
default:
|
||||
Logger::MANAGER->error("Unsupported render api requested! Requested %d", static_cast<int>(renderApi));
|
||||
throw std::runtime_error("Unsupported render api requested!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user