rework API
This commit is contained in:
@@ -24,64 +24,65 @@ namespace OpenVulkano
|
||||
{
|
||||
using clock = std::chrono::steady_clock;
|
||||
|
||||
GraphicsAppManager::GraphicsAppManager(RenderAPI::RenderApi renderApi) { Init(nullptr, nullptr, renderApi); }
|
||||
|
||||
GraphicsAppManager::GraphicsAppManager(OpenVulkano::IGraphicsApp* app, RenderAPI::RenderApi renderApi)
|
||||
: app(app), renderApi(renderApi)
|
||||
{
|
||||
Init(app, nullptr, renderApi);
|
||||
}
|
||||
|
||||
GraphicsAppManager::GraphicsAppManager(IGraphicsApp* app, IWindow* window, RenderAPI::RenderApi renderApi)
|
||||
: app(app), renderApi(renderApi)
|
||||
{
|
||||
Init(app, window, renderApi);
|
||||
}
|
||||
|
||||
void GraphicsAppManager::SetApp(IGraphicsApp* app)
|
||||
{
|
||||
this->app = app;
|
||||
app->SetGraphicsAppManager(this);
|
||||
}
|
||||
|
||||
void GraphicsAppManager::Init(IGraphicsApp* app, IWindow* window, RenderAPI::RenderApi renderApi)
|
||||
{
|
||||
Utils::SetThreadName("Main");
|
||||
#ifdef HAS_TRACY
|
||||
ZoneScoped;
|
||||
#endif
|
||||
|
||||
|
||||
Logger::SetupLogger();
|
||||
Logger::MANAGER->info("Initializing graphics app manager ...");
|
||||
this->renderApi = renderApi;
|
||||
if (!app)
|
||||
{
|
||||
constexpr auto msg = "The app must not be null!";
|
||||
Logger::MANAGER->error(msg);
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
platform = std::unique_ptr<IPlatform>(PlatformProducer::CreatePlatform(renderApi));
|
||||
window = platform->MakeWindow();
|
||||
renderer = std::unique_ptr<IRenderer>(PlatformProducer::CreateRenderManager(renderApi));
|
||||
app->SetGraphicsAppManager(this);
|
||||
window->SetWindowHandler(this);
|
||||
inputManager = Input::InputManager::GetInstance();
|
||||
engineConfig = EngineConfiguration::GetEngineConfiguration();
|
||||
engineConfig->OnFpsCapChanged += EventHandler(this, &GraphicsAppManager::UpdateCappedFpsInfo);
|
||||
if (window)
|
||||
{
|
||||
this->window = window;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->window = platform->MakeWindow();
|
||||
}
|
||||
if (app)
|
||||
{
|
||||
app->SetGraphicsAppManager(this);
|
||||
}
|
||||
this->window->SetWindowHandler(this);
|
||||
|
||||
// set initial values
|
||||
if (engineConfig->GetFpsCap() > 0)
|
||||
{
|
||||
UpdateCappedFpsInfo(engineConfig->GetFpsCap());
|
||||
}
|
||||
if (platform)
|
||||
}
|
||||
|
||||
GraphicsAppManager::GraphicsAppManager(IGraphicsApp* app, IWindow* window, RenderAPI::RenderApi renderApi)
|
||||
: app(app), renderApi(renderApi)
|
||||
{
|
||||
Utils::SetThreadName("Main");
|
||||
#ifdef HAS_TRACY
|
||||
ZoneScoped;
|
||||
#endif
|
||||
|
||||
Logger::SetupLogger();
|
||||
if (!app)
|
||||
{
|
||||
platform->Init();
|
||||
constexpr auto msg = "The app must not be null!";
|
||||
Logger::MANAGER->error(msg);
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
//platform = std::unique_ptr<IPlatform>(PlatformProducer::CreatePlatform(renderApi));
|
||||
this->window = window;
|
||||
renderer = std::unique_ptr<IRenderer>(PlatformProducer::CreateRenderManager(renderApi));
|
||||
app->SetGraphicsAppManager(this);
|
||||
window->SetWindowHandler(this);
|
||||
inputManager = OpenVulkano::Input::InputManager::GetInstance();
|
||||
engineConfig = OpenVulkano::EngineConfiguration::GetEngineConfiguration();
|
||||
engineConfig->OnFpsCapChanged += EventHandler(this, &GraphicsAppManager::UpdateCappedFpsInfo);
|
||||
// set initial values
|
||||
if (engineConfig->GetFpsCap() > 0)
|
||||
{
|
||||
UpdateCappedFpsInfo(engineConfig->GetFpsCap());
|
||||
}
|
||||
Logger::MANAGER->info("Initialized...");
|
||||
}
|
||||
|
||||
void GraphicsAppManager::UpdateCappedFpsInfo(int32_t newFpsCap)
|
||||
@@ -143,12 +144,6 @@ namespace OpenVulkano
|
||||
|
||||
void GraphicsAppManager::StartUp()
|
||||
{
|
||||
if (!app)
|
||||
{
|
||||
constexpr auto msg = "The app must not be null!";
|
||||
Logger::MANAGER->error(msg);
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
#ifdef HAS_TRACY
|
||||
ZoneScoped;
|
||||
#endif
|
||||
@@ -156,9 +151,7 @@ namespace OpenVulkano
|
||||
{
|
||||
Logger::MANAGER->info("Initializing ...");
|
||||
app->Init();
|
||||
|
||||
//if (platform) platform->Init();
|
||||
|
||||
if (platform) platform->Init();
|
||||
window->Init(renderApi);
|
||||
//TODO restore window settings if there are any set
|
||||
renderer->Init(static_cast<IGraphicsAppManager*>(this), window);
|
||||
|
||||
Reference in New Issue
Block a user