1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-11-26 04:08:50 -05:00

Add predefined entry point for use with external projects

This commit is contained in:
Gordon McCann 2022-11-11 15:17:55 -05:00
parent 852c17f04a
commit 40a3171da8
2 changed files with 36 additions and 0 deletions

View File

@ -124,6 +124,7 @@ target_sources(Specter PRIVATE
Specter/Utils/Functions.cpp Specter/Utils/Functions.cpp
Specter/Utils/RandomGenerator.h Specter/Utils/RandomGenerator.h
Specter/Utils/ThreadSafeQueue.h Specter/Utils/ThreadSafeQueue.h
Specter/Core/EntryPoint.h
) )
#ImPlot sources #ImPlot sources

View File

@ -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