X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Fruntime.cpp;h=d77cf47c228fbbdbc573f1e5e26f2473f2ab00ed;hb=ad7cf72ed47c39640d5588ba53386e090289b4d1;hp=72a51da2b6eef53e7e376e3d60693bc472b28dde;hpb=74b5bd523b0312ee71f0443789bb40f1476054a4;p=blank.git diff --git a/src/app/runtime.cpp b/src/app/runtime.cpp index 72a51da..d77cf47 100644 --- a/src/app/runtime.cpp +++ b/src/app/runtime.cpp @@ -4,10 +4,12 @@ #include "WorldState.hpp" #include "init.hpp" +#include "../io/filesystem.hpp" #include "../io/WorldSave.hpp" #include #include +#include #include #include @@ -51,6 +53,7 @@ Environment::Environment(Window &win, const string &asset_path) , counter() { viewport.Clear(); window.Flip(); + keymap.LoadDefault(); } @@ -232,6 +235,16 @@ int Runtime::Execute() { Environment env(init.window, config.asset_path); env.viewport.VSync(config.vsync); + std::string keys_path = config.save_path + "keys.conf"; + if (!is_file(keys_path)) { + std::ofstream file(keys_path); + env.keymap.Save(file); + } else { + std::ifstream file(keys_path); + env.keymap.Load(file); + } + + WorldSave save(config.save_path + config.world_name + '/'); if (save.Exists()) { save.Read(config.world);