diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-07-15 00:37:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-07-15 00:37:34 +0300 |
commit | 1361ff1aa1fd5d4b2bf1ff18d3b5bbf36b8ff734 (patch) | |
tree | 0c27bc66a83d9caeb3170638013c2c7853528bd4 | |
parent | 9802d5dd75312b8eacc4fd342b33b036980a8bf6 (diff) | |
download | plus-1361ff1aa1fd5d4b2bf1ff18d3b5bbf36b8ff734.tar.gz plus-1361ff1aa1fd5d4b2bf1ff18d3b5bbf36b8ff734.tar.bz2 plus-1361ff1aa1fd5d4b2bf1ff18d3b5bbf36b8ff734.tar.xz plus-1361ff1aa1fd5d4b2bf1ff18d3b5bbf36b8ff734.zip |
Change text buble theming.
-rw-r--r-- | data/graphics/gui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | data/graphics/gui/Makefile.am | 1 | ||||
-rw-r--r-- | data/graphics/gui/bubble.png | bin | 407 -> 390 bytes | |||
-rw-r--r-- | data/graphics/gui/bubble.xml | 18 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/text.cpp | 58 | ||||
-rw-r--r-- | src/text.h | 1 |
7 files changed, 31 insertions, 49 deletions
diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt index 713c6ffd2..5fda34b34 100644 --- a/data/graphics/gui/CMakeLists.txt +++ b/data/graphics/gui/CMakeLists.txt @@ -1,5 +1,6 @@ SET (FILES bubble.png + bubble.xml button.xml button_disabled.xml button_highlighted.xml diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am index 81c7da04f..f058c3bcc 100644 --- a/data/graphics/gui/Makefile.am +++ b/data/graphics/gui/Makefile.am @@ -3,6 +3,7 @@ guidir = $(pkgdatadir)/data/graphics/gui gui_DATA = \ bubble.png \ + bubble.xml \ button.xml \ button_disabled.xml \ button_highlighted.xml \ diff --git a/data/graphics/gui/bubble.png b/data/graphics/gui/bubble.png Binary files differindex 45322eb2e..72ef7ca6a 100644 --- a/data/graphics/gui/bubble.png +++ b/data/graphics/gui/bubble.png diff --git a/data/graphics/gui/bubble.xml b/data/graphics/gui/bubble.xml new file mode 100644 index 000000000..916428182 --- /dev/null +++ b/data/graphics/gui/bubble.xml @@ -0,0 +1,18 @@ +<skinset name="Default" image="bubble.png"> + <widget type="Window"> + <!-- Top Row --> + <part type="top-left-corner" xpos="0" ypos="0" width="5" height="5" /> + <part type="top-edge" xpos="5" ypos="0" width="5" height="5" /> + <part type="top-right-corner" xpos="10" ypos="0" width="5" height="5" /> + + <!-- Middle Row --> + <part type="left-edge" xpos="0" ypos="5" width="5" height="5" /> + <part type="bg-quad" xpos="5" ypos="5" width="5" height="5" /> + <part type="right-edge" xpos="10" ypos="5" width="5" height="5" /> + + <!-- Bottom Row --> + <part type="bottom-left-corner" xpos="0" ypos="10" width="5" height="5" /> + <part type="bottom-edge" xpos="5" ypos="10" width="5" height="5" /> + <part type="bottom-right-corner" xpos="10" ypos="10" width="5" height="5" /> + </widget> +</skinset> diff --git a/src/defaults.cpp b/src/defaults.cpp index 13ed6f7c1..d2265c501 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -71,7 +71,6 @@ DefaultsData* getConfigDefaults() DefaultsData* configData = new DefaultsData; // Init main config defaults AddDEF(configData, "OverlayDetail", 2); - AddDEF(configData, "speechBubblecolor", "000000"); AddDEF(configData, "speechBubbleAlpha", 1.0f); AddDEF(configData, "MostUsedServerName0", "server.themanaworld.org"); AddDEF(configData, "visiblenames", true); diff --git a/src/text.cpp b/src/text.cpp index 085441d22..6e08a048a 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -41,7 +41,6 @@ int Text::mInstances = 0; ImageRect Text::mBubble; -Image *Text::mBubbleArrow; Text::Text(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, @@ -59,37 +58,22 @@ Text::Text(const std::string &text, int x, int y, if (!textManager) { textManager = new TextManager; - Image *sbImage = Theme::getImageFromTheme("bubble.png|W:#" - + config.getStringValue("speechBubblecolor")); - if (sbImage) + if (Theme::instance()) { - mBubble.grid[0] = sbImage->getSubImage(0, 0, 5, 5); - mBubble.grid[1] = sbImage->getSubImage(5, 0, 5, 5); - mBubble.grid[2] = sbImage->getSubImage(10, 0, 5, 5); - mBubble.grid[3] = sbImage->getSubImage(0, 5, 5, 5); - mBubble.grid[4] = sbImage->getSubImage(5, 5, 5, 5); - mBubble.grid[5] = sbImage->getSubImage(10, 5, 5, 5); - mBubble.grid[6] = sbImage->getSubImage(0, 10, 5, 5); - mBubble.grid[7] = sbImage->getSubImage(5, 10, 5, 5); - mBubble.grid[8] = sbImage->getSubImage(10, 10, 5, 5); - mBubbleArrow = sbImage->getSubImage(0, 15, 15, 10); + Theme::instance()->loadRect(mBubble, "bubble.xml"); } else { for (int f = 0; f < 9; f ++) mBubble.grid[f] = nullptr; - mBubbleArrow = nullptr; } + const float bubbleAlpha = config.getFloatValue("speechBubbleAlpha"); for (int i = 0; i < 9; i++) { if (mBubble.grid[i]) mBubble.grid[i]->setAlpha(bubbleAlpha); } - if (mBubbleArrow) - mBubbleArrow->setAlpha(bubbleAlpha); - if (sbImage) - sbImage->decRef(); } ++mInstances; mHeight = mFont->getHeight(); @@ -123,26 +107,14 @@ Text::~Text() { delete textManager; textManager = nullptr; - delete mBubble.grid[0]; - mBubble.grid[0] = nullptr; - delete mBubble.grid[1]; - mBubble.grid[1] = nullptr; - delete mBubble.grid[2]; - mBubble.grid[2] = nullptr; - delete mBubble.grid[3]; - mBubble.grid[3] = nullptr; - delete mBubble.grid[4]; - mBubble.grid[4] = nullptr; - delete mBubble.grid[5]; - mBubble.grid[5] = nullptr; - delete mBubble.grid[6]; - mBubble.grid[6] = nullptr; - delete mBubble.grid[7]; - mBubble.grid[7] = nullptr; - delete mBubble.grid[8]; - mBubble.grid[8] = nullptr; - delete mBubbleArrow; - mBubbleArrow = nullptr; + for (int f = 0; f < 9; f ++) + { + if (mBubble.grid[f]) + { + mBubble.grid[f]->decRef(); + mBubble.grid[f] = nullptr; + } + } } } @@ -164,14 +136,6 @@ void Text::draw(gcn::Graphics *graphics, int xOff, int yOff) static_cast<Graphics*>(graphics)->drawImageRect( mX - xOff - 5, mY - yOff - 5, mWidth + 10, mHeight + 10, mBubble); - /* - if (mWidth >= 15) - { - static_cast<Graphics*>(graphics)->drawImage( - mBubbleArrow, mX - xOff - 7 + mWidth / 2, - mY - yOff + mHeight + 4); - } - */ } TextRenderer::renderText(graphics, mText, diff --git a/src/text.h b/src/text.h index d7d6f0cdd..f585cca36 100644 --- a/src/text.h +++ b/src/text.h @@ -81,7 +81,6 @@ class Text protected: static ImageRect mBubble; /**< Speech bubble graphic */ - static Image *mBubbleArrow; /**< Speech bubble arrow graphic */ }; class FlashText : public Text |