Skip to content

Commit

Permalink
Remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenMian authored and hyv1001 committed Apr 15, 2022
1 parent 9b77ccf commit 3621a38
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
15 changes: 7 additions & 8 deletions engine/source/editor/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@ int main(int argc, char** argv)
params.m_root_folder = pilot_root_folder;
params.m_config_file_path = pilot_root_folder / "PilotEditor.ini";

Pilot::PublicSingleton<Pilot::PilotEngine>::getInstance().startEngine(params);
Pilot::PublicSingleton<Pilot::PilotEngine>::getInstance().initialize();
Pilot::PilotEngine::getInstance().startEngine(params);
Pilot::PilotEngine::getInstance().initialize();

Pilot::PublicSingleton<Pilot::PilotEditor>::getInstance().initialize(
&(Pilot::PublicSingleton<Pilot::PilotEngine>::getInstance()));
Pilot::PilotEditor::getInstance().initialize(&(Pilot::PilotEngine::getInstance()));

Pilot::PublicSingleton<Pilot::PilotEditor>::getInstance().run();
Pilot::PilotEditor::getInstance().run();

Pilot::PublicSingleton<Pilot::PilotEditor>::getInstance().clear();
Pilot::PilotEditor::getInstance().clear();

Pilot::PublicSingleton<Pilot::PilotEngine>::getInstance().clear();
Pilot::PublicSingleton<Pilot::PilotEngine>::getInstance().shutdownEngine();
Pilot::PilotEngine::getInstance().clear();
Pilot::PilotEngine::getInstance().shutdownEngine();

return 0;
}
20 changes: 10 additions & 10 deletions engine/source/runtime/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ namespace Pilot

LOG_INFO("engine shutdown");

PublicSingleton<SceneManager>::getInstance().clear();
PublicSingleton<WorldManager>::getInstance().clear();
PublicSingleton<PUIManager>::getInstance().clear();
PublicSingleton<AssetManager>::getInstance().clear();
PublicSingleton<ConfigManager>::getInstance().clear();
SceneManager::getInstance().clear();
WorldManager::getInstance().clear();
PUIManager::getInstance().clear();
AssetManager::getInstance().clear();
ConfigManager::getInstance().clear();

Reflection::TypeMetaRegister::Unregister();

Expand Down Expand Up @@ -108,10 +108,10 @@ namespace Pilot
void PilotEngine::logicalTick(float delta_time)
{
m_tri_frame_buffer.producingBufferShift();
PublicSingleton<WorldManager>::getInstance().tick(delta_time);
PublicSingleton<SceneManager>::getInstance().tick(m_tri_frame_buffer.getProducingBuffer());
PublicSingleton<InputSystem>::getInstance().tick();
// PublicSingleton<PhysicsSystem>::getInstance().tick(delta_time);
WorldManager::getInstance().tick(delta_time);
SceneManager::getInstance().tick(m_tri_frame_buffer.getProducingBuffer());
InputSystem::getInstance().tick();
// PhysicsSystem::getInstance().tick(delta_time);
}

bool PilotEngine::rendererTick() { return m_renderer->tick(); }
Expand All @@ -125,7 +125,7 @@ namespace Pilot
three_buffers._struct._C = new FrameBuffer();

// tri frame buffers are designed to use same scene now
auto current_scene = PublicSingleton<SceneManager>::getInstance().getCurrentScene();
auto current_scene = SceneManager::getInstance().getCurrentScene();
three_buffers._struct._A->m_scene = current_scene;
three_buffers._struct._B->m_scene = current_scene;
three_buffers._struct._C->m_scene = current_scene;
Expand Down

1 comment on commit 3621a38

@sleeplessai
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to remove these codes in fact. 🤣
These are nice examples to demonstrate singleton pattern in such a big project.

Please sign in to comment.