light/Engine/src/Engine/UserInterface/UserInterface.cpp

37 lines
955 B
C++
Raw Normal View History

2021-05-26 18:39:40 +04:30
#include "ltpch.h"
2021-05-27 10:41:32 +04:30
#include "UserInterface.h"
2021-05-27 18:55:30 +04:30
#include "OpenGL/glUserInterface.h"
2021-05-27 10:41:32 +04:30
2021-06-02 17:20:15 +04:30
#ifdef LIGHT_PLATFORM_WINDOWS
#include "DirectX/dxUserInterface.h"
#include "DirectX/dxSharedContext.h"
2021-06-02 17:20:15 +04:30
#endif
2021-05-27 18:55:30 +04:30
#include "Events/Event.h"
#include "Events/CharEvent.h"
2021-05-27 12:51:39 +04:30
#include "Events/MouseEvents.h"
2021-05-27 18:55:30 +04:30
#include "Events/KeyboardEvents.h"
2021-05-27 12:51:39 +04:30
2021-07-29 17:12:13 +04:30
#include "Graphics/GraphicsContext.h"
2021-05-27 12:51:39 +04:30
#include <imgui.h>
2021-05-26 18:39:40 +04:30
namespace Light {
Scope<UserInterface> UserInterface::Create(GLFWwindow* windowHandle, Ref<SharedContext> sharedContext)
2021-05-26 18:39:40 +04:30
{
2021-05-27 10:41:32 +04:30
switch (GraphicsContext::GetGraphicsAPI())
{
case GraphicsAPI::OpenGL:
return CreateScope<glUserInterface>(windowHandle);
2021-05-27 19:54:05 +04:30
2021-06-02 17:20:15 +04:30
case GraphicsAPI::DirectX: LT_WIN(
return CreateScope<dxUserInterface>(windowHandle, std::dynamic_pointer_cast<dxSharedContext>(sharedContext));)
2021-06-02 17:20:15 +04:30
2021-05-27 19:54:05 +04:30
default:
LT_ENGINE_ASSERT(false, "UserInterface::Create: invalid/unsupported 'GraphicsAPI' {}", GraphicsContext::GetGraphicsAPI());
2021-05-27 19:54:05 +04:30
return nullptr;
2021-05-27 10:41:32 +04:30
}
}
2021-05-26 18:39:40 +04:30
}