summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/lua_api.txt10
-rw-r--r--src/gui/guiFormSpecMenu.cpp15
2 files changed, 11 insertions, 14 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index bbd11c867..907f47e73 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -2092,15 +2092,11 @@ Elements
* Show an inventory image of registered item/node
-### `bgcolor[<color>]`
-
-* Sets background color of formspec as `ColorString`
-
### `bgcolor[<color>;<fullscreen>]`
-* If `color` is a valid `ColorString`, the fullscreen background color
- is set to `color`.
-* If `fullscreen` is a true value, the fullscreen background color is drawn.
+* Sets background color of formspec as `ColorString`
+* If `true`, a fullscreen background is drawn and the color is ignored
+ (does not affect the size of the formspec)
### `background[<X>,<Y>;<W>,<H>;<texture name>]`
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp
index 9dacf37d7..aee7da869 100644
--- a/src/gui/guiFormSpecMenu.cpp
+++ b/src/gui/guiFormSpecMenu.cpp
@@ -1885,17 +1885,17 @@ void GUIFormSpecMenu::parseBox(parserData* data, const std::string &element)
errorstream<< "Invalid Box element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseBackgroundColor(parserData *data, const std::string &element)
+void GUIFormSpecMenu::parseBackgroundColor(parserData* data, const std::string &element)
{
std::vector<std::string> parts = split(element,';');
if (((parts.size() == 1) || (parts.size() == 2)) ||
((parts.size() > 2) && (m_formspec_version > FORMSPEC_API_VERSION))) {
- if (parts.size() == 1) {
- parseColorString(parts[0], m_bgcolor, false);
- } else if (parts.size() == 2) {
- parseColorString(parts[0], m_fullscreen_bgcolor, false);
- m_bgfullscreen = is_yes(parts[1]);
+ parseColorString(parts[0], m_bgcolor, false);
+
+ if (parts.size() == 2) {
+ std::string fullscreen = parts[1];
+ m_bgfullscreen = is_yes(fullscreen);
}
return;
@@ -2925,7 +2925,8 @@ void GUIFormSpecMenu::drawMenu()
if (m_bgfullscreen)
driver->draw2DRectangle(m_fullscreen_bgcolor, allbg, &allbg);
- driver->draw2DRectangle(m_bgcolor, AbsoluteRect, &AbsoluteClippingRect);
+ else
+ driver->draw2DRectangle(m_bgcolor, AbsoluteRect, &AbsoluteClippingRect);
m_tooltip_element->setVisible(false);