mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-02 12:04:30 +00:00
Minor fixes based on code review feedback.
This commit is contained in:
parent
e04f0a8bd6
commit
b075428513
8 changed files with 27 additions and 30 deletions
|
|
@ -99,14 +99,23 @@ namespace MWGui
|
||||||
|
|
||||||
void ControllerButtonsOverlay::setIcon(MyGUI::ImageBox* image, const std::string& imagePath)
|
void ControllerButtonsOverlay::setIcon(MyGUI::ImageBox* image, const std::string& imagePath)
|
||||||
{
|
{
|
||||||
if (imagePath.length() > 0)
|
if (!imagePath.empty())
|
||||||
image->setImageTexture(imagePath);
|
image->setImageTexture(imagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ControllerButtonsOverlay::updateButton(
|
int ControllerButtonsOverlay::updateButton(
|
||||||
MyGUI::TextBox* text, MyGUI::ImageBox* image, const std::string& buttonStr)
|
MyGUI::TextBox* text, MyGUI::ImageBox* image, const std::string& buttonStr)
|
||||||
{
|
{
|
||||||
if (buttonStr.length() > 0)
|
if (buttonStr.empty())
|
||||||
|
{
|
||||||
|
image->setVisible(false);
|
||||||
|
image->setUserString("Hidden", "true");
|
||||||
|
|
||||||
|
text->setVisible(false);
|
||||||
|
text->setUserString("Hidden", "true");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
image->setVisible(true);
|
image->setVisible(true);
|
||||||
image->setUserString("Hidden", "false");
|
image->setUserString("Hidden", "false");
|
||||||
|
|
@ -117,14 +126,5 @@ namespace MWGui
|
||||||
text->setSize(text->getTextSize().width + 16, 48);
|
text->setSize(text->getTextSize().width + 16, 48);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
image->setVisible(false);
|
|
||||||
image->setUserString("Hidden", "true");
|
|
||||||
|
|
||||||
text->setVisible(false);
|
|
||||||
text->setUserString("Hidden", "true");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -347,6 +347,10 @@ namespace MWGui
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
// Morrowind uses 3 px invisible borders for padding topics
|
||||||
|
static constexpr int sVerticalPadding = 3;
|
||||||
|
|
||||||
DialogueWindow::DialogueWindow()
|
DialogueWindow::DialogueWindow()
|
||||||
: WindowBase("openmw_dialogue_window.layout")
|
: WindowBase("openmw_dialogue_window.layout")
|
||||||
, mIsCompanion(false)
|
, mIsCompanion(false)
|
||||||
|
|
@ -603,10 +607,9 @@ namespace MWGui
|
||||||
|
|
||||||
void DialogueWindow::updateTopicsPane()
|
void DialogueWindow::updateTopicsPane()
|
||||||
{
|
{
|
||||||
const std::string focusedTopic
|
std::string focusedTopic;
|
||||||
= Settings::gui().mControllerMenus && mControllerFocus < static_cast<int>(mTopicsList->getItemCount())
|
if (Settings::gui().mControllerMenus && mControllerFocus < static_cast<int>(mTopicsList->getItemCount()))
|
||||||
? mTopicsList->getItemNameAt(mControllerFocus)
|
focusedTopic = mTopicsList->getItemNameAt(mControllerFocus);
|
||||||
: "";
|
|
||||||
|
|
||||||
mTopicsList->clear();
|
mTopicsList->clear();
|
||||||
for (auto& linkPair : mTopicLinks)
|
for (auto& linkPair : mTopicLinks)
|
||||||
|
|
|
||||||
|
|
@ -226,9 +226,6 @@ namespace MWGui
|
||||||
|
|
||||||
MyGUI::IntSize mCurrentWindowSize;
|
MyGUI::IntSize mCurrentWindowSize;
|
||||||
|
|
||||||
// Morrowind uses 3 px invisible borders for padding topics
|
|
||||||
static const int sVerticalPadding = 3;
|
|
||||||
|
|
||||||
std::unique_ptr<ResponseCallback> mCallback;
|
std::unique_ptr<ResponseCallback> mCallback;
|
||||||
std::unique_ptr<ResponseCallback> mGreetingCallback;
|
std::unique_ptr<ResponseCallback> mGreetingCallback;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -977,22 +977,22 @@ namespace MWGui
|
||||||
case MWGui::GM_Companion:
|
case MWGui::GM_Companion:
|
||||||
mControllerButtons.a = "#{OMWEngine:InventorySelect}";
|
mControllerButtons.a = "#{OMWEngine:InventorySelect}";
|
||||||
mControllerButtons.b = "#{sClose}";
|
mControllerButtons.b = "#{sClose}";
|
||||||
mControllerButtons.x = "";
|
mControllerButtons.x.clear();
|
||||||
mControllerButtons.y = "";
|
mControllerButtons.y.clear();
|
||||||
mControllerButtons.r2 = "#{sCompanionShare}";
|
mControllerButtons.r2 = "#{sCompanionShare}";
|
||||||
break;
|
break;
|
||||||
case MWGui::GM_Container:
|
case MWGui::GM_Container:
|
||||||
mControllerButtons.a = "#{OMWEngine:InventorySelect}";
|
mControllerButtons.a = "#{OMWEngine:InventorySelect}";
|
||||||
mControllerButtons.b = "#{sClose}";
|
mControllerButtons.b = "#{sClose}";
|
||||||
mControllerButtons.x = "#{sTakeAll}";
|
mControllerButtons.x = "#{sTakeAll}";
|
||||||
mControllerButtons.y = "";
|
mControllerButtons.y.clear();
|
||||||
mControllerButtons.r2 = "#{sContainer}";
|
mControllerButtons.r2 = "#{sContainer}";
|
||||||
break;
|
break;
|
||||||
case MWGui::GM_Barter:
|
case MWGui::GM_Barter:
|
||||||
mControllerButtons.a = "#{sSell}";
|
mControllerButtons.a = "#{sSell}";
|
||||||
mControllerButtons.b = "#{sCancel}";
|
mControllerButtons.b = "#{sCancel}";
|
||||||
mControllerButtons.x = "#{sOffer}";
|
mControllerButtons.x = "#{sOffer}";
|
||||||
mControllerButtons.y = "";
|
mControllerButtons.y.clear();
|
||||||
mControllerButtons.r2 = "#{sBarter}";
|
mControllerButtons.r2 = "#{sBarter}";
|
||||||
break;
|
break;
|
||||||
case MWGui::GM_Inventory:
|
case MWGui::GM_Inventory:
|
||||||
|
|
@ -1001,7 +1001,7 @@ namespace MWGui
|
||||||
mControllerButtons.b = "#{sBack}";
|
mControllerButtons.b = "#{sBack}";
|
||||||
mControllerButtons.x = "#{sDrop}";
|
mControllerButtons.x = "#{sDrop}";
|
||||||
mControllerButtons.y = "#{sUnequip}";
|
mControllerButtons.y = "#{sUnequip}";
|
||||||
mControllerButtons.r2 = "";
|
mControllerButtons.r2.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return &mControllerButtons;
|
return &mControllerButtons;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ int MWGui::wrap(int index, int max)
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWGui::setControllerFocus(std::vector<MyGUI::Button*> buttons, int index, bool focused)
|
void MWGui::setControllerFocus(const std::vector<MyGUI::Button*>& buttons, int index, bool focused)
|
||||||
{
|
{
|
||||||
if (index >= 0 && index < static_cast<int>(buttons.size()))
|
if (index >= 0 && index < static_cast<int>(buttons.size()))
|
||||||
buttons[index]->setStateSelected(focused);
|
buttons[index]->setStateSelected(focused);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace MWGui
|
||||||
class DragAndDrop;
|
class DragAndDrop;
|
||||||
|
|
||||||
int wrap(int index, int max);
|
int wrap(int index, int max);
|
||||||
void setControllerFocus(std::vector<MyGUI::Button*> buttons, int index, bool selected);
|
void setControllerFocus(const std::vector<MyGUI::Button*>& buttons, int index, bool selected);
|
||||||
|
|
||||||
struct ControllerButtonStr
|
struct ControllerButtonStr
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -898,9 +898,6 @@ namespace MWGui
|
||||||
|
|
||||||
int activeIndex = std::clamp(mActiveControllerWindows[mode], 0, (int)state.mWindows.size() - 1);
|
int activeIndex = std::clamp(mActiveControllerWindows[mode], 0, (int)state.mWindows.size() - 1);
|
||||||
|
|
||||||
Log(Debug::Debug) << "Getting active controller window: mode=" << mode << ", " << state.mWindows.size()
|
|
||||||
<< " window(s), activeIndex=" << activeIndex;
|
|
||||||
|
|
||||||
// If the active window is no longer visible, find the next visible window.
|
// If the active window is no longer visible, find the next visible window.
|
||||||
if (!state.mWindows[activeIndex]->isVisible())
|
if (!state.mWindows[activeIndex]->isVisible())
|
||||||
cycleActiveControllerWindow(true);
|
cycleActiveControllerWindow(true);
|
||||||
|
|
@ -2634,7 +2631,7 @@ namespace MWGui
|
||||||
if (!Settings::gui().mControllerMenus || !mControllerButtonsOverlay)
|
if (!Settings::gui().mControllerMenus || !mControllerButtonsOverlay)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WindowBase* topWin = this->getActiveControllerWindow();
|
WindowBase* topWin = getActiveControllerWindow();
|
||||||
if (!topWin || !topWin->isVisible())
|
if (!topWin || !topWin->isVisible())
|
||||||
{
|
{
|
||||||
mControllerButtonsOverlay->setVisible(false);
|
mControllerButtonsOverlay->setVisible(false);
|
||||||
|
|
|
||||||
|
|
@ -538,7 +538,7 @@ namespace MWInput
|
||||||
return "textures/omw_steam_button_y.dds";
|
return "textures/omw_steam_button_y.dds";
|
||||||
case SDL_CONTROLLER_BUTTON_GUIDE:
|
case SDL_CONTROLLER_BUTTON_GUIDE:
|
||||||
default:
|
default:
|
||||||
return "";
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue