diff options
-rw-r--r-- | data/graphics/gui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | data/graphics/gui/Makefile.am | 1 | ||||
-rw-r--r-- | data/graphics/gui/equipment.xml | 25 | ||||
-rw-r--r-- | data/themes/enchilado/CMakeLists.txt | 1 | ||||
-rw-r--r-- | data/themes/enchilado/Makefile.am | 1 | ||||
-rw-r--r-- | data/themes/pink/CMakeLists.txt | 1 | ||||
-rw-r--r-- | data/themes/pink/Makefile.am | 1 | ||||
-rw-r--r-- | data/themes/unity/CMakeLists.txt | 1 | ||||
-rw-r--r-- | data/themes/unity/Makefile.am | 1 | ||||
-rw-r--r-- | data/themes/wood/CMakeLists.txt | 1 | ||||
-rw-r--r-- | data/themes/wood/Makefile.am | 1 | ||||
-rw-r--r-- | src/gui/equipmentwindow.cpp | 26 | ||||
-rw-r--r-- | src/gui/equipmentwindow.h | 2 |
13 files changed, 50 insertions, 13 deletions
diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt index c19714e94..2d1566b1a 100644 --- a/data/graphics/gui/CMakeLists.txt +++ b/data/graphics/gui/CMakeLists.txt @@ -17,6 +17,7 @@ SET (FILES dropdown_background.xml dropdown_pressed.xml emote_selection.xml + equipment.xml equipment_background.xml equipment_playerbox.xml equipmentbox.png diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am index 221418c71..5da480034 100644 --- a/data/graphics/gui/Makefile.am +++ b/data/graphics/gui/Makefile.am @@ -20,6 +20,7 @@ gui_DATA = \ dropdown_background.xml \ dropdown_pressed.xml \ emote_selection.xml \ + equipment.xml \ equipment_background.xml \ equipment_playerbox.xml \ equipmentbox.png \ diff --git a/data/graphics/gui/equipment.xml b/data/graphics/gui/equipment.xml new file mode 100644 index 000000000..f353e5a1e --- /dev/null +++ b/data/graphics/gui/equipment.xml @@ -0,0 +1,25 @@ +<skinset name="Default" image="window.png"> + <widget type="Window"> + <option name="itemPadding" value="2" /> + <option name="boxSize" value="36" /> + + <!-- Top Row --> + <part type="top-left-corner" xpos="0" ypos="0" width="4" height="4" /> + <part type="top-edge" xpos="4" ypos="0" width="32" height="4" /> + <part type="top-right-corner" xpos="36" ypos="0" width="4" height="4" /> + + <!-- Middle Row --> + <part type="left-edge" xpos="0" ypos="4" width="4" height="216" /> + <part type="bg-quad" xpos="4" ypos="4" width="32" height="216" /> + <part type="right-edge" xpos="36" ypos="4" width="4" height="216" /> + + <!-- Bottom Row --> + <part type="bottom-left-corner" xpos="0" ypos="220" width="4" height="4" /> + <part type="bottom-edge" xpos="4" ypos="220" width="32" height="4" /> + <part type="bottom-right-corner" xpos="36" ypos="220" width="4" height="4" /> + + <part type="closeImage" xpos="130" ypos="0" width="15" height="15" /> + <part type="stickyImageUp" xpos="130" ypos="51" width="15" height="15" /> + <part type="stickyImageDown" xpos="145" ypos="51" width="15" height="15" /> + </widget> +</skinset> diff --git a/data/themes/enchilado/CMakeLists.txt b/data/themes/enchilado/CMakeLists.txt index a008e8f86..f853912d8 100644 --- a/data/themes/enchilado/CMakeLists.txt +++ b/data/themes/enchilado/CMakeLists.txt @@ -1,6 +1,7 @@ SET (FILES buy.xml colors.xml + equipment.xml inventory.xml popup.xml progressbar.xml diff --git a/data/themes/enchilado/Makefile.am b/data/themes/enchilado/Makefile.am index 041c1aaf8..d3b517c9e 100644 --- a/data/themes/enchilado/Makefile.am +++ b/data/themes/enchilado/Makefile.am @@ -4,6 +4,7 @@ guidir = $(pkgdatadir)/data/themes/enchilado gui_DATA = \ buy.xml \ colors.xml \ + equipment.xml \ inventory.xml \ popup.xml \ progressbar.xml \ diff --git a/data/themes/pink/CMakeLists.txt b/data/themes/pink/CMakeLists.txt index 04e036ffa..a6353dbc4 100644 --- a/data/themes/pink/CMakeLists.txt +++ b/data/themes/pink/CMakeLists.txt @@ -2,6 +2,7 @@ SET (FILES bubble.png buy.xml colors.xml + equipment.xml inventory.xml popup.xml progress-indicator.png diff --git a/data/themes/pink/Makefile.am b/data/themes/pink/Makefile.am index 025b043bd..43c5982d0 100644 --- a/data/themes/pink/Makefile.am +++ b/data/themes/pink/Makefile.am @@ -5,6 +5,7 @@ gui_DATA = \ bubble.png \ buy.xml \ colors.xml \ + equipment.xml \ inventory.xml \ popup.xml \ progress-indicator.png \ diff --git a/data/themes/unity/CMakeLists.txt b/data/themes/unity/CMakeLists.txt index c54c64723..20545812c 100644 --- a/data/themes/unity/CMakeLists.txt +++ b/data/themes/unity/CMakeLists.txt @@ -2,6 +2,7 @@ SET (FILES buy.xml char.xml colors.xml + equipment.xml inventory.xml npc.xml popup.xml diff --git a/data/themes/unity/Makefile.am b/data/themes/unity/Makefile.am index 735028301..bed2b3c15 100644 --- a/data/themes/unity/Makefile.am +++ b/data/themes/unity/Makefile.am @@ -5,6 +5,7 @@ gui_DATA = \ buy.xml \ char.xml \ colors.xml \ + equipment.xml \ inventory.xml \ npc.xml \ popup.xml \ diff --git a/data/themes/wood/CMakeLists.txt b/data/themes/wood/CMakeLists.txt index c62b25d47..622c4dcd9 100644 --- a/data/themes/wood/CMakeLists.txt +++ b/data/themes/wood/CMakeLists.txt @@ -1,6 +1,7 @@ SET (FILES buy.xml colors.xml + equipment.xml inventory.xml item_shortcut_bgr.png mouse.png diff --git a/data/themes/wood/Makefile.am b/data/themes/wood/Makefile.am index 11af7c229..fc9518b16 100644 --- a/data/themes/wood/Makefile.am +++ b/data/themes/wood/Makefile.am @@ -4,6 +4,7 @@ guidir = $(pkgdatadir)/data/themes/wood gui_DATA = \ buy.xml \ colors.xml \ + equipment.xml \ inventory.xml \ item_shortcut_bgr.png \ mouse.png \ diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index b40a73afd..5b5c8d1d1 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -47,10 +47,6 @@ #include "debug.h" -static const int BOX_WIDTH = 36; -static const int BOX_HEIGHT = 36; -static const int BOX_X_PAD = (BOX_WIDTH - 32) / 2; -static const int BOX_Y_PAD = (BOX_HEIGHT - 32) / 2; static const int BOX_COUNT = 13; EquipmentWindow::EquipmentWindow(Equipment *const equipment, @@ -68,11 +64,16 @@ EquipmentWindow::EquipmentWindow(Equipment *const equipment, mBeing(being), mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)), mBorderColor(Theme::getThemeColor(Theme::BORDER)), - mLabelsColor(Theme::getThemeColor(Theme::LABEL)) + mLabelsColor(Theme::getThemeColor(Theme::LABEL)), + mItemPadding(getOption("itemPadding")), + mBoxSize(getOption("boxSize")) { if (setupWindow) setupWindow->registerWindowForReset(this); + if (!mBoxSize) + mBoxSize = 36; + // Control that shows the Player mPlayerBox->setDimension(gcn::Rectangle(50, 80, 74, 168)); mPlayerBox->setPlayer(being); @@ -176,20 +177,21 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) { image->setAlpha(1.0f); // Ensure the image is drawn // with maximum opacity - g->drawImage(image, box->x + 2, box->y + 2); + g->drawImage(image, box->x + mItemPadding, + box->y + mItemPadding); if (i == EQUIP_PROJECTILE_SLOT) { g->setColor(mLabelsColor); graphics->drawText(toString(item->getQuantity()), - box->x + (BOX_WIDTH / 2), box->y - fontHeight, + box->x + (mBoxSize / 2), box->y - fontHeight, gcn::Graphics::CENTER); } } } else if (box->image) { - g->drawImage(box->image, box->x + BOX_X_PAD, - box->y + BOX_Y_PAD); + g->drawImage(box->image, box->x + mItemPadding, + box->y + mItemPadding); } } } @@ -220,8 +222,7 @@ Item *EquipmentWindow::getItem(const int x, const int y) const const EquipmentBox *const box = *it; if (!box) continue; - const gcn::Rectangle tRect(box->x, box->y, - BOX_WIDTH, BOX_HEIGHT); + const gcn::Rectangle tRect(box->x, box->y, mBoxSize, mBoxSize); if (tRect.isPointInRect(x, y)) return mEquipment->getEquipment(i); @@ -253,8 +254,7 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) if (!box) continue; const Item *const item = mEquipment->getEquipment(i); - const gcn::Rectangle tRect(box->x, box->y, - BOX_WIDTH, BOX_HEIGHT); + const gcn::Rectangle tRect(box->x, box->y, mBoxSize, mBoxSize); if (tRect.isPointInRect(x, y) && item) setSelected(i); diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index 6a7158922..4d20a8447 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.h @@ -142,6 +142,8 @@ class EquipmentWindow final : public Window, public gcn::ActionListener gcn::Color mLabelsColor; Image *mSlotBackground; Image *mSlotHighlightedBackground; + int mItemPadding; + int mBoxSize; }; extern EquipmentWindow *equipmentWindow; |