WIP world pausing
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
#include "Editor/EditorGUI.h"
|
||||
|
||||
EditorGUI::EditorGUI(EventBroker* eventBroker)
|
||||
: m_EventBroker(eventBroker)
|
||||
EditorGUI::EditorGUI(World* world, EventBroker* eventBroker)
|
||||
: m_World(world)
|
||||
, m_EventBroker(eventBroker)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EditorGUI::Draw(World* world)
|
||||
void EditorGUI::Draw()
|
||||
{
|
||||
ImGui::ShowTestWindow();
|
||||
drawMenu();
|
||||
drawTools();
|
||||
drawEntities(world);
|
||||
drawEntities(m_World);
|
||||
drawComponents(m_CurrentSelection);
|
||||
}
|
||||
|
||||
@@ -65,10 +66,20 @@ void EditorGUI::drawTools()
|
||||
pauseIcon = ResourceManager::Load<Texture>("Textures/Icons/Pause.png")->m_Texture;
|
||||
} catch (const std::exception&) { }
|
||||
|
||||
|
||||
ImGui::ImageButton((void*)playIcon, ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), ImVec4(0, 1, 0, 1));
|
||||
static bool paused = false;
|
||||
if (ImGui::ImageButton((void*)playIcon, ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (!paused) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1))) {
|
||||
Events::Resume e;
|
||||
e.World = m_World;
|
||||
m_EventBroker->Publish(e);
|
||||
paused = false;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::ImageButton((void*)pauseIcon, ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0));
|
||||
if (ImGui::ImageButton((void*)pauseIcon, ImVec2(24, 24), ImVec2(0, 1), ImVec2(1, 0), -1, ImVec4(0, 0, 0, 0), (paused) ? ImVec4(0, 1, 0, 1) : ImVec4(1, 1, 1, 1))) {
|
||||
Events::Pause e;
|
||||
e.World = m_World;
|
||||
m_EventBroker->Publish(e);
|
||||
paused = true;
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ EditorSystem::EditorSystem(World* world, EventBroker* eventBroker, IRenderer* re
|
||||
m_EditorWorld->AttachComponent(m_Camera.ID, "Camera");
|
||||
m_DebugCameraInputController = new DebugCameraInputController<EditorSystem>(m_EventBroker, -1);
|
||||
|
||||
m_EditorGUI = new EditorGUI(m_EventBroker);
|
||||
m_EditorGUI = new EditorGUI(m_World, m_EventBroker);
|
||||
m_EditorGUI->SetEntitySelectedCallback(std::bind(&EditorSystem::OnEntitySelected, this, std::placeholders::_1));
|
||||
m_EditorGUI->SetEntityImportCallback(std::bind(&EditorSystem::importEntity, this, std::placeholders::_1, std::placeholders::_2));
|
||||
m_EditorGUI->SetEntitySaveCallback(std::bind(&EditorSystem::OnEntitySave, this, std::placeholders::_1, std::placeholders::_2));
|
||||
@@ -49,7 +49,7 @@ void EditorSystem::Update(double dt)
|
||||
{
|
||||
m_EditorWorldSystemPipeline->Update(dt);
|
||||
|
||||
m_EditorGUI->Draw(m_World);
|
||||
m_EditorGUI->Draw();
|
||||
m_EditorStats->Draw(dt);
|
||||
|
||||
m_DebugCameraInputController->Update(dt);
|
||||
|
||||
Reference in New Issue
Block a user