diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-05-21 00:32:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-05-21 00:32:40 +0300 |
commit | 593dcda16950ae79ebe97de6a3b49cf7bb5e95f7 (patch) | |
tree | 405e2692f991149f087f4fb25dc1ae167b936c6d | |
parent | 4a93a8cee81a1e49e17fb51f4e0c9ec51899ddea (diff) | |
download | plus-593dcda16950ae79ebe97de6a3b49cf7bb5e95f7.tar.gz plus-593dcda16950ae79ebe97de6a3b49cf7bb5e95f7.tar.bz2 plus-593dcda16950ae79ebe97de6a3b49cf7bb5e95f7.tar.xz plus-593dcda16950ae79ebe97de6a3b49cf7bb5e95f7.zip |
Add ability to change gui opacity from theme file.
Set opacity for jewelry theme to 1.
-rw-r--r-- | data/themes/jewelry/info.xml | 1 | ||||
-rw-r--r-- | src/gui/setup_theme.cpp | 2 | ||||
-rw-r--r-- | src/gui/theme.cpp | 6 | ||||
-rw-r--r-- | src/gui/theme.h | 4 |
4 files changed, 12 insertions, 1 deletions
diff --git a/data/themes/jewelry/info.xml b/data/themes/jewelry/info.xml index 05c7b7dbd..867550a05 100644 --- a/data/themes/jewelry/info.xml +++ b/data/themes/jewelry/info.xml @@ -2,4 +2,5 @@ <info> <name>Jewelry</name> <copyright>2012-2013 Hal9000\n2012-2013 ManaPlus developers</copyright> + <guialpha>1.0</guialpha> </info> diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp index 8002ceff8..f46202eb7 100644 --- a/src/gui/setup_theme.cpp +++ b/src/gui/setup_theme.cpp @@ -500,6 +500,8 @@ void Setup_Theme::apply() if (size >= 0) mNpcFontSizeDropDown->setSelected(size); } + if (mInfo->guiAlpha > 0.01f) + config.setValue("guialpha", mInfo->guiAlpha); } config.setValue("theme", mTheme); config.setValue("lang", mLang); diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 999b2ec2b..8f10a9372 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -1226,6 +1226,10 @@ ImageSet *Theme::getImageSetFromThemeXml(const std::string &name, info->name = atoi(reinterpret_cast<const char*>(\ xmlNodeGetContent(infoNode))) +#define readFloatValue(name) \ + info->name = atof(reinterpret_cast<const char*>(\ + xmlNodeGetContent(infoNode))) + ThemeInfo *Theme::loadInfo(const std::string &themeName) { std::string path; @@ -1271,6 +1275,8 @@ ThemeInfo *Theme::loadInfo(const std::string &themeName) readIntValue(fontSize); else if (xmlNameEqual(infoNode, "npcfontSize")) readIntValue(npcfontSize); + else if (xmlNameEqual(infoNode, "guialpha")) + readFloatValue(guiAlpha); else if (xmlNameEqual(infoNode, fontSize2.c_str())) readIntValue(fontSize); else if (xmlNameEqual(infoNode, npcfontSize2.c_str())) diff --git a/src/gui/theme.h b/src/gui/theme.h index 38e3b7024..3a56cfcfb 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -53,7 +53,8 @@ struct ThemeInfo final secureFont(), japanFont(), fontSize(0), - npcfontSize(0) + npcfontSize(0), + guiAlpha(0.0f) { } std::string name; @@ -66,6 +67,7 @@ struct ThemeInfo final std::string japanFont; int fontSize; int npcfontSize; + float guiAlpha; }; class Skin final |