MetaCore/MetaPlayer/PlayerApplication.cpp

43 lines
1.5 KiB
C++

#include "MetaPlayer/PlayerApplication.h"
#include "MetaCore/foundation/Log.h"
namespace metacore::player {
bool PlayerApplication::initialize(const std::filesystem::path& scene_file) {
scene_file_ = scene_file;
platform_.initialize("MetaPlayer");
render_backend_.initialize();
runtime_ui_.initialize();
scene_serializer_.load_scene(scene_file_, scene_);
foundation::log(foundation::LogLevel::Info, "MetaPlayer initialized");
foundation::log(
foundation::LogLevel::Info,
"Panda window bootstrap: enabled=" + std::string(platform_.window_enabled() ? "true" : "false") +
" opened=" + std::string(platform_.window_opened() ? "true" : "false")
);
return true;
}
int PlayerApplication::run() {
const auto documents = runtime_ui_.collect_documents(scene_);
preview_session_.set_documents(documents);
if (!documents.empty()) {
runtime_ui_.load_document(documents.front());
}
foundation::log(foundation::LogLevel::Info, "Runtime UI documents: " + std::to_string(documents.size()));
foundation::log(foundation::LogLevel::Info, preview_session_.describe());
foundation::log(foundation::LogLevel::Info, "MetaPlayer skeleton run loop started");
platform_.pump_frame();
return 0;
}
void PlayerApplication::shutdown() {
runtime_ui_.shutdown();
render_backend_.shutdown();
platform_.shutdown();
foundation::log(foundation::LogLevel::Info, "MetaPlayer shutdown complete");
}
} // namespace metacore::player