Skip to content

Pictorial Loadouts #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Data/Base.rte/GUIs/BuyMenuGUI.ini
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ Anchor = Left, Top
Text = Shields
Checked = False

[SetsTab]
[LoadoutsTab]
ControlType = TAB
Parent = BuyGUIBox
X = 2
Expand All @@ -220,9 +220,9 @@ Width = 57
Height = 17
Visible = True
Enabled = True
Name = SetsTab
Name = LoadoutsTab
Anchor = Left, Top
Text = Presets
Text = Loadouts
Checked = False

[CargoLabel]
Expand Down Expand Up @@ -439,7 +439,7 @@ Name = SaveButton
Anchor = Left, Top
Text = Save

[ClearButton]
[DeleteButton]
ControlType = BUTTON
Parent = BuyGUIBox
X = 4
Expand All @@ -448,6 +448,6 @@ Width = 48
Height = 18
Visible = True
Enabled = True
Name = ClearButton
Name = DeleteButton
Anchor = Left, Top
Text = Clear
Text = Delete
21 changes: 14 additions & 7 deletions Source/GUI/GUIListPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,15 @@ void GUIListPanel::BuildDrawBitmap() {

// Draw the associated bitmap
if (I->m_pBitmap) {
if (bitmapWidth == thirdWidth) {
if (I->m_Name.empty()) {
// No text, just bitmap, so give it more room
I->m_pBitmap->DrawTrans(m_DrawBitmap, ((thirdWidth * 1.3f) - (bitmapWidth / 2)) - itemX + 4, bitmapY, 0);
} else if (bitmapWidth == thirdWidth) {
// If it was deemed too large, draw it scaled
I->m_pBitmap->DrawTransScaled(m_DrawBitmap, 3 - itemX, bitmapY, bitmapWidth, bitmapHeight);
} else if (!I->m_Name.empty()) {
} else {
// There's text to compete for space with
I->m_pBitmap->DrawTrans(m_DrawBitmap, ((thirdWidth / 2) - (bitmapWidth / 2)) - itemX + 2, bitmapY, 0);
} else {
// No text, just bitmap, so give it more room
I->m_pBitmap->DrawTrans(m_DrawBitmap, ((thirdWidth / 2) - (bitmapWidth / 2)) - itemX + 4, bitmapY, 0);
}
}

Expand Down Expand Up @@ -991,10 +991,15 @@ GUIListPanel::Item* GUIListPanel::GetItem(int Index) {
if (Index >= 0 && Index < m_Items.size()) {
return m_Items.at(Index);
}
return 0;
return nullptr;
}

GUIListPanel::Item* GUIListPanel::GetItem(int X, int Y) {
// If outside of X bounds, return nothing
if (X < m_X || X >= m_X + m_Width) {
return nullptr;
}

int Height = m_Height;
if (m_HorzScroll->_GetVisible()) {
Height -= m_HorzScroll->GetHeight();
Expand All @@ -1004,6 +1009,7 @@ GUIListPanel::Item* GUIListPanel::GetItem(int X, int Y) {
if (m_VertScroll->_GetVisible()) {
y -= m_VertScroll->GetValue();
}

int Count = 0;
for (std::vector<Item*>::iterator it = m_Items.begin(); it != m_Items.end(); it++, Count++) {
Item* pItem = *it;
Expand All @@ -1019,7 +1025,8 @@ GUIListPanel::Item* GUIListPanel::GetItem(int X, int Y) {
break;
}
}
return 0;

return nullptr;
}

int GUIListPanel::GetItemHeight(Item* pItem) {
Expand Down
Loading