add Console panel; fix the problem when cs set Rotation the direction not update; fix some little bug; add simple texture material Edit system;some treaks
This commit is contained in:
@ -4,8 +4,8 @@ file(GLOB_RECURSE SRC_SOURCE ./PrismRuntime/**.cpp)
|
||||
|
||||
add_executable(${PROJECT_NAME} WIN32 ${SRC_SOURCE})
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE PRISM_GUI)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Prism-static)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Prism-Runtime)
|
||||
|
||||
|
||||
add_executable(${PROJECT_NAME}-Console ${SRC_SOURCE})
|
||||
target_link_libraries(${PROJECT_NAME}-Console PRIVATE Prism-static)
|
||||
target_link_libraries(${PROJECT_NAME}-Console PRIVATE Prism-Runtime)
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "PrismRuntime.h"
|
||||
|
||||
#include "Prism/Core/Input.h"
|
||||
#include "Prism/Renderer/Renderer.h"
|
||||
#include "Prism/Renderer/SceneRenderer.h"
|
||||
#include "Prism/Scene/SceneSerializer.h"
|
||||
@ -15,13 +16,31 @@ void PrismRuntime::OnAttach()
|
||||
|
||||
AppInstance = &Prism::Application::Get();
|
||||
|
||||
PM_CLIENT_INFO("Create Scene");
|
||||
sceneName.emplace_back("assets/scenes/FPS.scene");
|
||||
sceneName.emplace_back("assets/scenes/FPSdemo.scene");
|
||||
|
||||
LoadScene(sceneName[0]);
|
||||
}
|
||||
|
||||
void PrismRuntime::OnDetach()
|
||||
{
|
||||
PM_CLIENT_INFO("Scene Shutdown");
|
||||
m_CurrentScene->OnShutdown();
|
||||
}
|
||||
|
||||
void PrismRuntime::LoadScene(const std::string& scene)
|
||||
{
|
||||
if (m_CurrentScene)
|
||||
{
|
||||
PM_CLIENT_INFO("Scene Shutdown");
|
||||
m_CurrentScene->OnShutdown();
|
||||
}
|
||||
|
||||
const Prism::Ref<Prism::Scene> newScene = Prism::Ref<Prism::Scene>::Create("runtime Scene", false, true);
|
||||
Prism::SceneSerializer serializer(newScene);
|
||||
|
||||
const char* scenePath = "assets/scenes/FPS.scene";
|
||||
PM_CLIENT_INFO("loading Scene: ", scenePath);
|
||||
serializer.Deserialize(scenePath);
|
||||
PM_CLIENT_INFO("loading Scene: ", scene);
|
||||
serializer.Deserialize(scene);
|
||||
|
||||
m_CurrentScene = newScene;
|
||||
|
||||
@ -32,16 +51,9 @@ void PrismRuntime::OnAttach()
|
||||
m_CurrentScene->SetViewportSize(windowSize);
|
||||
}
|
||||
|
||||
PM_CLIENT_INFO("Scene Start");
|
||||
m_CurrentScene->OnRuntimeStart();
|
||||
}
|
||||
|
||||
void PrismRuntime::OnDetach()
|
||||
{
|
||||
PM_CLIENT_INFO("Scene Shutdown");
|
||||
m_CurrentScene->OnShutdown();
|
||||
}
|
||||
|
||||
void PrismRuntime::OnUpdate(const Prism::TimeStep deltaTime)
|
||||
{
|
||||
m_CurrentScene->OnUpdate(deltaTime);
|
||||
@ -52,10 +64,25 @@ void PrismRuntime::OnUpdate(const Prism::TimeStep deltaTime)
|
||||
{
|
||||
m_CurrentScene->SetViewportSize(windowSize);
|
||||
}
|
||||
|
||||
if (shouldChangeScene)
|
||||
{
|
||||
LoadScene(sceneName[nextScene]);
|
||||
shouldChangeScene = false;
|
||||
}
|
||||
}
|
||||
|
||||
void PrismRuntime::OnEvent(Prism::Event& e)
|
||||
{
|
||||
if (Prism::Input::IsKeyPressed(Prism::KeyCode::L) && nextScene == 0)
|
||||
{
|
||||
shouldChangeScene = true;
|
||||
nextScene++;
|
||||
} else if (Prism::Input::IsKeyPressed(Prism::KeyCode::K) && nextScene == 1)
|
||||
{
|
||||
shouldChangeScene = true;
|
||||
nextScene--;
|
||||
}
|
||||
}
|
||||
|
||||
void PrismRuntime::OnImGuiRender()
|
||||
|
||||
@ -15,6 +15,8 @@ public:
|
||||
void OnAttach() override;
|
||||
void OnDetach() override;
|
||||
|
||||
void LoadScene(const std::string& scene);
|
||||
|
||||
void OnUpdate(Prism::TimeStep deltaTime) override;
|
||||
void OnEvent(Prism::Event& e) override;
|
||||
void OnImGuiRender() override;
|
||||
@ -24,6 +26,12 @@ private:
|
||||
Prism::Ref<Prism::Scene> m_CurrentScene;
|
||||
|
||||
Prism::Application* AppInstance = nullptr;
|
||||
|
||||
bool shouldChangeScene = false;
|
||||
|
||||
// debug
|
||||
std::vector<std::string> sceneName;
|
||||
int nextScene = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user