summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-06 23:15:18 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-06 23:15:18 +0300
commit4972739b76c2cbe9fe587e591431632b9e3cb547 (patch)
tree6f680ee6e09754cb4bb9924036f675754a85a426
parent2323c3ab4083af456a2251518c36220e28700186 (diff)
downloadmanaverse-4972739b76c2cbe9fe587e591431632b9e3cb547.tar.gz
manaverse-4972739b76c2cbe9fe587e591431632b9e3cb547.tar.bz2
manaverse-4972739b76c2cbe9fe587e591431632b9e3cb547.tar.xz
manaverse-4972739b76c2cbe9fe587e591431632b9e3cb547.zip
Set onscreen default buttons size depend on screen resolution.
-rw-r--r--src/client.cpp1
-rw-r--r--src/configuration.h3
-rw-r--r--src/defaults.cpp18
-rw-r--r--src/defaults.h1
4 files changed, 21 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp
index f4967a2d0..4c8ef0881 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -575,6 +575,7 @@ void Client::gameInit()
runCounters = config.getBoolValue("packetcounters");
applyVSync();
graphicsManager.setVideoMode();
+ getConfigDefaults2(config.getDefaultValues());
applyGrabMode();
applyGamma();
diff --git a/src/configuration.h b/src/configuration.h
index a24a36d0d..5d1554064 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -254,6 +254,9 @@ class Configuration final : public ConfigurationObject
*/
void setDefaultValues(DefaultsData *const defaultsData);
+ DefaultsData *getDefaultValues()
+ { return mDefaultsData; }
+
/**
* Writes the current settings back to the config file.
*/
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 5f6de0282..7ca57cfe8 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -287,8 +287,6 @@ DefaultsData* getConfigDefaults()
AddDEF("allowscreensaver", false);
AddDEF("debugOpenGL", 0);
AddDEF("protectChatFocus", true);
- AddDEF("screenButtonsSize", 1);
- AddDEF("screenJoystickSize", 1);
#if defined(__APPLE__)
AddDEF("enableGamma", false);
#else
@@ -309,6 +307,22 @@ DefaultsData* getConfigDefaults()
return configData;
}
+void getConfigDefaults2(DefaultsData *const configData)
+{
+ if (!configData)
+ return;
+ if (mainGraphics->getHeight() < 480)
+ {
+ AddDEF("screenButtonsSize", 0);
+ AddDEF("screenJoystickSize", 0);
+ }
+ else
+ {
+ AddDEF("screenButtonsSize", 1);
+ AddDEF("screenJoystickSize", 1);
+ }
+}
+
DefaultsData* getBrandingDefaults()
{
DefaultsData *const configData = new DefaultsData;
diff --git a/src/defaults.h b/src/defaults.h
index 0851dc6a6..12a8873d8 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -38,6 +38,7 @@ VariableData* createData(const std::string &defData) A_WARN_UNUSED;
VariableData* createData(const char *const defData) A_WARN_UNUSED;
VariableData* createData(const bool defData) A_WARN_UNUSED;
DefaultsData* getConfigDefaults() A_WARN_UNUSED;
+void getConfigDefaults2(DefaultsData *const configData);
DefaultsData* getBrandingDefaults() A_WARN_UNUSED;
DefaultsData* getPathsDefaults() A_WARN_UNUSED;