From 58ee835c3763e7bf088fa6c7e31dda1d687589cc Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Tue, 10 Mar 2009 11:50:27 -0600 Subject: Extended window layout to take relative positions, as well as offsets to that position. This makes it so that when resolutions are changed, the default locations stay relative to the window's position, and not the 800x600 screen resolution. Signed-off-by: Ira Rice --- src/gui/equipmentwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/equipmentwindow.cpp') diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 27ea38ff..0d2097f8 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -71,7 +71,7 @@ EquipmentWindow::EquipmentWindow(): setWindowName("Equipment"); setCloseButton(true); - setDefaultSize(5, 195, 180, 300); + setDefaultSize(180, 300, ImageRect::CENTER); loadWindowState(); mUnequip = new Button(_("Unequip"), "unequip", this); -- cgit v1.2.3-70-g09d2 From 78c607671bc62daf0901417ffc557f50bbf63f76 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Sat, 14 Mar 2009 15:06:53 -0600 Subject: Fixed item popups in the equipment window to display the proper item type colors. Signed-off-by: Ira Rice --- src/gui/equipmentwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gui/equipmentwindow.cpp') diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 0d2097f8..1d9b4721 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -63,6 +63,7 @@ EquipmentWindow::EquipmentWindow(): mSelected(-1) { mItemPopup = new ItemPopup(); + mItemPopup->setOpaque(false); // Control that shows the Player mPlayerBox = new PlayerBox; @@ -235,8 +236,9 @@ void EquipmentWindow::mouseMoved(gcn::MouseEvent &event) int mouseX, mouseY; SDL_GetMouseState(&mouseX, &mouseY); - mItemPopup->setItem(item->getInfo()); - mItemPopup->setOpaque(false); + if (item->getInfo().getName() != mItemPopup->getItemName()) + mItemPopup->setItem(item->getInfo()); + mItemPopup->updateColors(); mItemPopup->view(x + getX(), y + getY()); } else -- cgit v1.2.3-70-g09d2 From 79fa5a629426888f51241914d90ca8599373f2d0 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Sat, 14 Mar 2009 15:17:38 -0600 Subject: Modified the equipment window to use the highlight color for selections. Signed-off-by: Ira Rice --- src/gui/equipmentwindow.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/gui/equipmentwindow.cpp') diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 1d9b4721..31fe3b8b 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -28,6 +28,7 @@ #include "button.h" #include "equipmentwindow.h" #include "itempopup.h" +#include "palette.h" #include "playerbox.h" #include "viewport.h" @@ -114,6 +115,22 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) for (int i = EQUIP_LEGS_SLOT; i < EQUIP_VECTOREND; i++) { + if (i == mSelected) + { + const gcn::Color color = guiPalette->getColor(Palette::HIGHLIGHT); + + // Set color to the highligh color + g->setColor(gcn::Color(color.r, color.g, color.b, getGuiAlpha())); + g->fillRectangle(gcn::Rectangle(mEquipBox[i].posX, mEquipBox[i].posY, + BOX_WIDTH, BOX_HEIGHT)); + } + + // Set color black. + g->setColor(gcn::Color(0, 0, 0)); + // Draw box border. + g->drawRectangle(gcn::Rectangle(mEquipBox[i].posX, mEquipBox[i].posY, + BOX_WIDTH, BOX_HEIGHT)); + item = (i != EQUIP_AMMO_SLOT) ? mInventory->getItem(mEquipment->getEquipment(i)) : mInventory->getItem(mEquipment->getArrows()); @@ -124,28 +141,13 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) g->drawImage(image, mEquipBox[i].posX, mEquipBox[i].posY); if (i == EQUIP_AMMO_SLOT) { - g->setColor(gcn::Color(0, 0, 0)); + g->setColor(guiPalette->getColor(Palette::TEXT)); graphics->drawText(toString(item->getQuantity()), mEquipBox[i].posX + (BOX_WIDTH / 2), mEquipBox[i].posY - getFont()->getHeight(), gcn::Graphics::CENTER); } } - - if (i == mSelected) - { - // Set color red. - g->setColor(gcn::Color(255, 0, 0)); - } - else - { - // Set color black. - g->setColor(gcn::Color(0, 0, 0)); - } - - // Draw box border. - g->drawRectangle(gcn::Rectangle(mEquipBox[i].posX, mEquipBox[i].posY, - BOX_WIDTH, BOX_HEIGHT)); } } -- cgit v1.2.3-70-g09d2