diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
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 <iostream> +#include <fstream> #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; |
