summaryrefslogtreecommitdiff
path: root/platform/glfw/settings_json.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-11-22 12:29:50 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-11-22 20:58:51 +0100
commit67ed3ae3eb25e5bb0ec2d0369d042438bd9b2c7f (patch)
treea71ef8fdf2ec4d080ceef8e4106e8db9ef5a26ff /platform/glfw/settings_json.cpp
parent9353fcbf4cde1f8ca2e0d30cabeb64aa3528682e (diff)
downloadqtlocation-mapboxgl-67ed3ae3eb25e5bb0ec2d0369d042438bd9b2c7f.tar.gz
[build] move GLFW-related files to platform/glfw
Diffstat (limited to 'platform/glfw/settings_json.cpp')
-rw-r--r--platform/glfw/settings_json.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/platform/glfw/settings_json.cpp b/platform/glfw/settings_json.cpp
new file mode 100644
index 0000000000..2ba1038dc7
--- /dev/null
+++ b/platform/glfw/settings_json.cpp
@@ -0,0 +1,41 @@
+#include "settings_json.hpp"
+#include <fstream>
+
+namespace mbgl {
+
+Settings_JSON::Settings_JSON() { load(); }
+
+void Settings_JSON::load() {
+ std::ifstream file("/tmp/mbgl-native.cfg");
+ if (file) {
+ file >> longitude;
+ file >> latitude;
+ file >> zoom;
+ file >> bearing;
+ file >> pitch;
+ file >> debug;
+ }
+}
+
+void Settings_JSON::save() {
+ std::ofstream file("/tmp/mbgl-native.cfg");
+ if (file) {
+ file << longitude << std::endl;
+ file << latitude << std::endl;
+ file << zoom << std::endl;
+ file << bearing << std::endl;
+ file << pitch << std::endl;
+ file << debug << std::endl;
+ }
+}
+
+void Settings_JSON::clear() {
+ longitude = 0;
+ latitude = 0;
+ zoom = 0;
+ bearing = 0;
+ pitch = 0;
+ debug = 0;
+}
+
+} // namespace mbgl