1 | #include <iostream> |
2 | #include <thread> |
3 |
|
4 | #include "ZydecoCommon.hpp" |
5 | #include "EventHandlerSDL2.hpp" |
6 | #include "WindowSDL2.hpp" |
7 | #include "Engine.hpp" |
8 |
|
9 | static Logger LOGGER("MAIN"); |
10 |
|
11 | static const char *ZYDECO_TERMOUT[] = { |
12 | "Zydeco v0.1.0 Copyright (c) Joshua Stockin 2023", |
13 | "<https://joshstock.in> <josh@joshstock.in>", |
14 | }; |
15 |
|
16 | void on_terminate(void) |
17 | { |
18 | ZydecoFault("TERMINATED"); |
19 | } |
20 |
|
21 | int main(int argc, char *argv[]) |
22 | { |
23 | // Print boilerplate copyright output |
24 | for (const char *line : ZYDECO_TERMOUT) |
25 | { |
26 | std::cout << line << std::endl; |
27 | } |
28 |
|
29 | std::set_terminate((std::terminate_handler)on_terminate); |
30 |
|
31 | Logger::InitializeLogging(Logger::VERBOSE, &std::cout); |
32 | LOGGER.Log(Logger::INFO, "Logging initialized."); |
33 |
|
34 | EventHandlerSDL2 sdl_event_handler {}; |
35 | WindowSDL2 sdl_window {"Zydeco", SDL_WINDOW_MAXIMIZED | SDL_WINDOW_RESIZABLE}; |
36 |
|
37 | LOGGER.Log(Logger::INFO, "Creating engine..."); |
38 | Engine engine(sdl_event_handler, sdl_window); |
39 |
|
40 | LOGGER.Log(Logger::INFO, "Entering engine loop"); |
41 | engine.Start(); |
42 |
|
43 | LOGGER.Log(Logger::INFO, "Exiting"); |
44 |
|
45 | return 0; |
46 | } |
47 |
|