39 lines
811 B
C
39 lines
811 B
C
#include "2048.h"
|
|
#include "gui.h"
|
|
#include "tui.h"
|
|
|
|
int main(int argc, char *argv[]) {
|
|
bool tui = false;
|
|
int size_x = 4;
|
|
int size_y = 4;
|
|
for (int i = 0; i < argc; i++) {
|
|
if (!strcmp(argv[i], "--tui")) {
|
|
tui = true;
|
|
}
|
|
if (!strcmp(argv[i], "--x")) {
|
|
if (argc >= i) {
|
|
size_x = atoi(argv[i + 1]);
|
|
}
|
|
}
|
|
if (!strcmp(argv[i], "--y")) {
|
|
if (argc >= i) {
|
|
size_y = atoi(argv[i + 1]);
|
|
}
|
|
}
|
|
}
|
|
Game game;
|
|
game = game_init(size_x, size_y);
|
|
if (tui) {
|
|
tui_init();
|
|
tui_loop(&game);
|
|
tui_destroy();
|
|
}
|
|
else {
|
|
gui_init();
|
|
gui_loop(&game);
|
|
gui_destroy();
|
|
game_destroy(game);
|
|
}
|
|
return 0;
|
|
}
|