From caeb26e90ef09fdad85af72f460644e09d3b2c7c Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 21 Mar 2020 16:12:16 +0100 Subject: Player sprite direction, read map file --- src/main.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 3f79ca7..b7168d6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,20 +1,24 @@ +#include +#include #include "game.hpp" #include "graphics.hpp" -int main() -{ - Game game( - "#######\n" - "# m #\n" - "#* #\n" - "# #\n" - "# U #\n" - "# U #\n" - "#######\n" - ); +#define DEFAULT_MAP_FILENAME "map/square.sokoban" +int main(int argc, char **argv) +{ + std::ifstream file; + if (argc == 1) + file.open(DEFAULT_MAP_FILENAME); + else if (argc == 2) + file.open(argv[1]); + else + { + std::cout << "Usage: " << argv[0] << " [mapfile]" << std::endl; + return 0; + } + Game game(file); Graphics graphics(game, "mario sokoban", 500, 500); - while (graphics.isRunning()) graphics.update(); return 0; -- cgit