stuff-from-scratch/apps/console-main.cpp

38 lines
709 B
C++
Raw Normal View History

2020-05-02 07:31:03 +00:00
#include <filesystem>
#include <unistd.h>
2020-05-03 06:56:27 +00:00
#include <iostream>
#include "CommandLineArgs.h"
2020-05-02 07:31:03 +00:00
#include "MainApplication.h"
2020-05-03 06:56:27 +00:00
int main(int argc, char *argv[])
2020-05-02 07:31:03 +00:00
{
2020-05-03 06:56:27 +00:00
CommandLineArgs command_line_args;
command_line_args.Process(argc, argv);
std::string program_type;
if(command_line_args.GetNumberOfArgs() > 1)
{
program_type = command_line_args.GetArg(1);
}
2020-05-02 07:31:03 +00:00
// Start the main app
auto main_app = MainApplication::Create();
main_app->Initialize(std::filesystem::current_path());
2020-05-03 06:56:27 +00:00
if(program_type == "server")
{
main_app->RunServer();
}
else if(program_type == "audio")
{
main_app->PlayAudio();
}
else
{
std::cerr << "Unknown program type" << std::endl;
}
2020-05-02 07:31:03 +00:00
main_app->ShutDown();
return 0;
}