mirror of
https://github.com/gwm17/Specter.git
synced 2024-11-22 18:28:52 -05:00
Add predefined entry point for use with external projects
This commit is contained in:
parent
852c17f04a
commit
40a3171da8
|
@ -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
|
||||||
|
|
35
Specter/src/Specter/Core/EntryPoint.h
Normal file
35
Specter/src/Specter/Core/EntryPoint.h
Normal 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
|
Loading…
Reference in New Issue
Block a user