A weird game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
turings-tarpit/main.cpp

63 lines
1.4 KiB

#include "backend.hpp"
#include "guecs/sfml/components.hpp"
#include "builder.hpp"
#include "gui.hpp"
#include "config.hpp"
#include <fmt/core.h>
#include "sound.hpp"
#include "textures.hpp"
#include "shaders.hpp"
#include <unistd.h>
#include <codecvt>
int main(int argc, char *argv[])
{
int opt = 0;
int timer_seconds = 60 * 60;
int start_hp = 100;
int max_hp = 100;
std::wstring goal{L"No Goal"};
while((opt = getopt(argc, argv, "ht:c:g:H:M:")) != -1) {
switch(opt) {
case 't':
timer_seconds = atoi(optarg) * 60;
fmt::println("Setting count down timer to {} seconds.", timer_seconds);
break;
case 'c':
Config::set_base_dir(optarg);
break;
case 'g': {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
goal = converter.from_bytes(optarg);
} break;
case 'H': {
start_hp = std::atoi(optarg);
} break;
case 'M': {
max_hp = std::atoi(optarg);
} break;
case 'h':
fmt::println("USAGE: ttpit [-t time] [-c config_dir] [-g goal] [-H hp] [-M max_hp]");
return 0;
break;
}
}
sfml::Backend backend;
guecs::init(&backend);
GameEngine game{start_hp, max_hp};
GUI gui(timer_seconds, goal);
auto builder = Builder(gui, game);
gui.startup();
while(gui.is_open()) {
builder.event(BuildEvent::GO);
gui.main_loop();
}
builder.event(BuildEvent::QUIT);
return 0;
}