X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Fruntime.cpp;h=d77cf47c228fbbdbc573f1e5e26f2473f2ab00ed;hb=41652fb3d73f12e6ae4ce7380244a75a4f5c6797;hp=32a401220215dbeeb557e3a53e9b6a5f7ccf6737;hpb=551573ecb04969696f916aeb5485658e298a7f6b;p=blank.git diff --git a/src/app/runtime.cpp b/src/app/runtime.cpp index 32a4012..d77cf47 100644 --- a/src/app/runtime.cpp +++ b/src/app/runtime.cpp @@ -1,14 +1,15 @@ #include "Application.hpp" #include "Environment.hpp" -#include "PreloadState.hpp" #include "Runtime.hpp" #include "WorldState.hpp" #include "init.hpp" -#include "../world/WorldSave.hpp" +#include "../io/filesystem.hpp" +#include "../io/WorldSave.hpp" #include #include +#include #include #include @@ -50,7 +51,9 @@ Environment::Environment(Window &win, const string &asset_path) , window(win) , assets(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); @@ -244,9 +257,6 @@ int Runtime::Execute() { WorldState world_state(env, config.interface, config.world, save); app.PushState(&world_state); - PreloadState preloader(env, world_state.GetWorld().Loader()); - app.PushState(&preloader); - switch (mode) { default: case NORMAL: