get window from application for now

This commit is contained in:
Sri Sham Haran 2022-11-01 00:41:37 +08:00
parent 917009a5cb
commit 67ad65a2d5
3 changed files with 17 additions and 6 deletions

View File

@ -76,7 +76,9 @@ namespace Sandbox
SDL_Init(SDL_INIT_VIDEO);
sdlWindow = SDL_CreateWindowFrom(window.GetHWND());
SHSystemManager::CreateSystem<SHEditor>();
SHSystemManager::GetSystem<SHEditor>()->SetSDLWindow(sdlWindow);
auto editor = SHSystemManager::GetSystem<SHEditor>();
editor->SetSDLWindow(sdlWindow);
editor->SetSHWindow(&window);
#endif
// Create Routines

View File

@ -138,6 +138,9 @@ namespace SHADE
window->Update();
}
}
RenderUnsavedChangesPrompt();
RenderSceneNamePrompt();
//PollPicking();
@ -431,7 +434,7 @@ namespace SHADE
void SHEditor::NewScene()
{
if(windowMap.GetMainWindow()->IsUnsavedChanges())
if(shWindow->IsUnsavedChanges())
{
//Unsaved changes prompt
sceneToLoad = 0;
@ -440,6 +443,7 @@ namespace SHADE
else
{
SHSceneManager::RestartScene(0);
shWindow->ToggleUnsavedChanges();
}
}
@ -462,13 +466,16 @@ namespace SHADE
//Get data, if data is null, asset doesn't exist, prompt for a name and create a new asset with the name
//serialize the scene
SHSerialization::SerializeSceneToFile(SHSceneManager::GetCurrentSceneAssetID());
windowMap.GetMainWindow()->ToggleUnsavedChanges();
if(SHSerialization::SerializeSceneToFile(SHSceneManager::GetCurrentSceneAssetID()))
{
if(shWindow->IsUnsavedChanges())
shWindow->ToggleUnsavedChanges();
}
}
void SHEditor::LoadScene(AssetID const& assetID) noexcept
{
if(windowMap.GetMainWindow()->IsUnsavedChanges())
if(shWindow->IsUnsavedChanges())
{
//Unsaved changes prompt
isUnsavedChangesPromptOpen = true;

View File

@ -17,7 +17,7 @@
#include "EditorWindow/SHEditorWindow.h"
#include "Tools/SHLogger.h"
#include "Gizmos/SHTransformGizmo.h"
#include "Graphics/Windowing/SHWindow.h"
//#==============================================================#
//|| Library Includes ||
@ -172,6 +172,7 @@ namespace SHADE
void InitBackend();
void SetSDLWindow(SDL_Window* inSDLWindow){sdlWindow = inSDLWindow;};
void SetSHWindow(SHWindow* inWindow){shWindow = inWindow;}
void PollPicking();
@ -221,6 +222,7 @@ namespace SHADE
Handle<SHVkCommandBuffer> imguiCommandBuffer;
SDL_Window* sdlWindow {nullptr};
SHWindow* shWindow{nullptr};
ImGuiIO* io{nullptr};