diff --git a/Specter/src/CMakeLists.txt b/Specter/src/CMakeLists.txt index 98132a0..3c579cf 100644 --- a/Specter/src/CMakeLists.txt +++ b/Specter/src/CMakeLists.txt @@ -124,6 +124,7 @@ target_sources(Specter PRIVATE Specter/Utils/Functions.cpp Specter/Utils/RandomGenerator.h Specter/Utils/ThreadSafeQueue.h + Specter/Core/EntryPoint.h ) #ImPlot sources diff --git a/Specter/src/Specter/Core/EntryPoint.h b/Specter/src/Specter/Core/EntryPoint.h new file mode 100644 index 0000000..f744722 --- /dev/null +++ b/Specter/src/Specter/Core/EntryPoint.h @@ -0,0 +1,35 @@ +/* + EntryPoint.h + + Predefined main function for Specter-based projects. Makes it so user doesn't have to know + about initializing the Logger, Profiling sessions, etc. +*/ +#ifndef ENTRY_POINT_H +#define ENTRY_POINT_H + +#include "Specter/Core/Application.h" + +//Make sure to initialize log BEFORE creating application. +int main(int argc, const char** argv) +{ + Specter::Logger::Init(); + SPEC_INFO("Logger Initialized"); + + Specter::ApplicationArgs args; + args.name = "Specter"; + args.runtimePath = std::filesystem::current_path(); + + SPEC_PROFILE_BEGIN_SESSION("Startup", "navprofile_startup.json"); + auto app = Specter::CreateApplication(args); + SPEC_PROFILE_END_SESSION(); + + SPEC_PROFILE_BEGIN_SESSION("Runtime", "navprofile_runtime.json"); + app->Run(); + SPEC_PROFILE_END_SESSION(); + + SPEC_PROFILE_BEGIN_SESSION("Shutdown", "navprofile_shutdown.json"); + delete app; + SPEC_PROFILE_END_SESSION(); +} + +#endif \ No newline at end of file