diff options
Diffstat (limited to 'src/StateManager.cpp')
-rw-r--r-- | src/StateManager.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/StateManager.cpp b/src/StateManager.cpp index 86fe07c..9753a18 100644 --- a/src/StateManager.cpp +++ b/src/StateManager.cpp @@ -27,6 +27,10 @@ using namespace std; StateManager::StateManager() { + _window_location.x = 0; + _window_location.y = 0; + _window_size.x = 640; + _window_size.y = 480; _zoom = 1.0; } @@ -100,16 +104,24 @@ StateManager::load(const string& filename) } string s; - is >> s; + is >> s; if (s == "window_location") { - is >> s; is >> s; is >> s;// skip + is >> s; + _window_location.x = atoi(s.c_str()); + is >> s; + _window_location.y = atoi(s.c_str()); } + is >> s; if (s == "window_size") { - is >> s; is >> s; is >> s;// skip + is >> s; + _window_size.x = atoi(s.c_str()); + is >> s; + _window_size.y = atoi(s.c_str()); } + is >> s; if (s != "zoom_level") { std::string msg = "Corrupt settings file: expected \"zoom_level\", found \""; msg.append(s).append("\""); @@ -165,6 +177,8 @@ StateManager::save(const string& filename) std::ofstream os; os.open(filename.c_str(), std::ios::out); + os << "window_location " << _window_location.x << " " << _window_location.y << std::endl; + os << "window_size " << _window_size.x << " " << _window_size.y << std::endl; os << "zoom_level " << _zoom << std::endl; ModuleLocation ml; |