Base Editor (WIP, no vulkan)

This commit is contained in:
Sri Sham Haran 2022-09-16 13:55:29 +08:00
parent cf3f74e47d
commit 6f67c1acc7
3 changed files with 87 additions and 0 deletions

View File

@ -60,6 +60,7 @@ namespace Sandbox
SHADE::SHScriptEngine::Exit(); SHADE::SHScriptEngine::Exit();
SDL_DestroyWindow(sdlWindow); SDL_DestroyWindow(sdlWindow);
SDL_Quit();
#ifdef SHEDITOR #ifdef SHEDITOR
#else #else
#endif #endif

View File

@ -0,0 +1,67 @@
#include "SHpch.h"
#include "SHEditor.h"
#include <imgui.h>
//IMGUI Backend includes
#include <backends/imgui_impl_sdl.h>
#include <backends/imgui_impl_vulkan.h>
#include "ECS_Base/System/SHSystemManager.h"
#include "Graphics/Instance/SHVkInstance.h"
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
namespace SHADE
{
void SHEditor::Initialise(SDL_Window* sdlWindow)
{
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGui_ImplSDL2_InitForVulkan(sdlWindow);
auto* gfxSystem = reinterpret_cast<SHGraphicsSystem*>(SHSystemManager::GetSystem("Graphics System"));
ImGui_ImplVulkan_InitInfo initInfo{};
initInfo.Instance = SHVkInstance::GetVkInstance();
initInfo.PhysicalDevice =
ImGui_ImplVulkan_DestroyFontUploadObjects();
}
void SHEditor::PreRender()
{
NewFrame();
ImGui::ShowDemoWindow();
}
void SHEditor::Render()
{
ImGui::Render();
}
void SHEditor::Exit()
{
ImGui_ImplVulkan_Shutdown();
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
}
void SHEditor::InitBackend()
{
}
void SHEditor::NewFrame()
{
ImGui_ImplVulkan_NewFrame();
ImGui_ImplSDL2_NewFrame();
ImGui::NewFrame();
}
void SHEditor::EndFrame()
{
}
}

View File

@ -0,0 +1,19 @@
#pragma once
#include <SDL.h>
namespace SHADE
{
class SHEditor
{
public:
static void Initialise(SDL_Window* sdlWindow);
static void PreRender();
static void Render();
static void Exit();
private:
static void InitBackend();
static void NewFrame();
static void EndFrame();
};
}