diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-06-24 17:42:10 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-08-04 21:24:44 +0200 |
commit | 8a5fc68d22fc85736d4c379ef88d3a7fd0eee391 (patch) | |
tree | 664af1ece27d6892c6ab96e8c8663f91a9958d53 /src/gui | |
parent | 350e7468d14e0b88e6b2eeb367d9488b394df8ba (diff) | |
download | mana-8a5fc68d22fc85736d4c379ef88d3a7fd0eee391.tar.gz mana-8a5fc68d22fc85736d4c379ef88d3a7fd0eee391.tar.bz2 mana-8a5fc68d22fc85736d4c379ef88d3a7fd0eee391.tar.xz mana-8a5fc68d22fc85736d4c379ef88d3a7fd0eee391.zip |
Small code simplification in Button::init
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/button.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 28d16b72..5c691705 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -140,27 +140,24 @@ void Button::init() if (mInstances == 0) { // Load the skin - Image *btn[BUTTON_COUNT]; mButton = new ImageRect[BUTTON_COUNT]; - int a, x, y, mode; - - for (mode = 0; mode < BUTTON_COUNT; ++mode) + for (int mode = 0; mode < BUTTON_COUNT; ++mode) { - btn[mode] = Theme::getImageFromTheme(data[mode].file); - a = 0; - for (y = 0; y < 3; y++) + Image *modeImage = Theme::getImageFromTheme(data[mode].file); + int a = 0; + for (int y = 0; y < 3; y++) { - for (x = 0; x < 3; x++) + for (int x = 0; x < 3; x++) { - mButton[mode].grid[a] = btn[mode]->getSubImage( + mButton[mode].grid[a] = modeImage->getSubImage( data[x].gridX, data[y].gridY, data[x + 1].gridX - data[x].gridX + 1, data[y + 1].gridY - data[y].gridY + 1); a++; } } - btn[mode]->decRef(); + modeImage->decRef(); } updateAlpha(); |