Refactor SaveLoad and PartySelection GUI to use control binding
This commit is contained in:
parent
483f0a8f10
commit
7f7bc412b4
8 changed files with 246 additions and 90 deletions
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "partyselect.h"
|
||||
|
||||
#include "../../gui/control/label.h"
|
||||
#include "../../gui/control/togglebutton.h"
|
||||
#include "../../graphics/texture/textures.h"
|
||||
#include "../../resource/resources.h"
|
||||
#include "../../resource/strings.h"
|
||||
|
@ -63,6 +61,7 @@ PartySelection::PartySelection(Game *game) : GameGUI(game) {
|
|||
|
||||
void PartySelection::load() {
|
||||
GUI::load();
|
||||
bindControls();
|
||||
|
||||
for (int i = 0; i < kNpcCount; ++i) {
|
||||
ToggleButton &button = getNpcButton(i);
|
||||
|
@ -72,6 +71,62 @@ void PartySelection::load() {
|
|||
}
|
||||
}
|
||||
|
||||
void PartySelection::bindControls() {
|
||||
_binding.btnAccept = getControlPtr<Button>("BTN_ACCEPT");
|
||||
_binding.btnBack = getControlPtr<Button>("BTN_BACK");
|
||||
_binding.btnDone = getControlPtr<Button>("BTN_DONE");
|
||||
_binding.btnNpc0 = getControlPtr<ToggleButton>("BTN_NPC0");
|
||||
_binding.btnNpc1 = getControlPtr<ToggleButton>("BTN_NPC1");
|
||||
_binding.btnNpc2 = getControlPtr<ToggleButton>("BTN_NPC2");
|
||||
_binding.btnNpc3 = getControlPtr<ToggleButton>("BTN_NPC3");
|
||||
_binding.btnNpc4 = getControlPtr<ToggleButton>("BTN_NPC4");
|
||||
_binding.btnNpc5 = getControlPtr<ToggleButton>("BTN_NPC5");
|
||||
_binding.btnNpc6 = getControlPtr<ToggleButton>("BTN_NPC6");
|
||||
_binding.btnNpc7 = getControlPtr<ToggleButton>("BTN_NPC7");
|
||||
_binding.btnNpc8 = getControlPtr<ToggleButton>("BTN_NPC8");
|
||||
_binding.lbl3d = getControlPtr<Label>("LBL_3D");
|
||||
_binding.lblBevelL = getControlPtr<Label>("LBL_BEVEL_L");
|
||||
_binding.lblBevelM = getControlPtr<Label>("LBL_BEVEL_M");
|
||||
_binding.lblChar0 = getControlPtr<Label>("LBL_CHAR0");
|
||||
_binding.lblChar1 = getControlPtr<Label>("LBL_CHAR1");
|
||||
_binding.lblChar2 = getControlPtr<Label>("LBL_CHAR2");
|
||||
_binding.lblChar3 = getControlPtr<Label>("LBL_CHAR3");
|
||||
_binding.lblChar4 = getControlPtr<Label>("LBL_CHAR4");
|
||||
_binding.lblChar5 = getControlPtr<Label>("LBL_CHAR5");
|
||||
_binding.lblChar6 = getControlPtr<Label>("LBL_CHAR6");
|
||||
_binding.lblChar7 = getControlPtr<Label>("LBL_CHAR7");
|
||||
_binding.lblChar8 = getControlPtr<Label>("LBL_CHAR8");
|
||||
_binding.lblCount = getControlPtr<Label>("LBL_COUNT");
|
||||
_binding.lblNa0 = getControlPtr<Label>("LBL_NA0");
|
||||
_binding.lblNa1 = getControlPtr<Label>("LBL_NA1");
|
||||
_binding.lblNa2 = getControlPtr<Label>("LBL_NA2");
|
||||
_binding.lblNa3 = getControlPtr<Label>("LBL_NA3");
|
||||
_binding.lblNa4 = getControlPtr<Label>("LBL_NA4");
|
||||
_binding.lblNa5 = getControlPtr<Label>("LBL_NA5");
|
||||
_binding.lblNa6 = getControlPtr<Label>("LBL_NA6");
|
||||
_binding.lblNa7 = getControlPtr<Label>("LBL_NA7");
|
||||
_binding.lblNa8 = getControlPtr<Label>("LBL_NA8");
|
||||
_binding.lblNpcLevel = getControlPtr<Label>("LBL_NPC_LEVEL");
|
||||
_binding.lblNpcName = getControlPtr<Label>("LBL_NPC_NAME");
|
||||
_binding.lblTitle = getControlPtr<Label>("LBL_TITLE");
|
||||
|
||||
if (isTSL(_game->gameId())) {
|
||||
_binding.btnNpc9 = getControlPtr<ToggleButton>("BTN_NPC9");
|
||||
_binding.btnNpc10 = getControlPtr<ToggleButton>("BTN_NPC10");
|
||||
_binding.btnNpc11 = getControlPtr<ToggleButton>("BTN_NPC11");
|
||||
_binding.lblChar9 = getControlPtr<Label>("LBL_CHAR9");
|
||||
_binding.lblChar10 = getControlPtr<Label>("LBL_CHAR10");
|
||||
_binding.lblChar11 = getControlPtr<Label>("LBL_CHAR11");
|
||||
_binding.lblNa9 = getControlPtr<Label>("LBL_NA9");
|
||||
_binding.lblNa10 = getControlPtr<Label>("LBL_NA10");
|
||||
_binding.lblNa11 = getControlPtr<Label>("LBL_NA11");
|
||||
_binding.lblNameBack = getControlPtr<Label>("LBL_NAMEBACK");
|
||||
} else {
|
||||
_binding.lblAvailable = getControlPtr<Label>("LBL_AVAILABLE");
|
||||
_binding.lblBevelR = getControlPtr<Label>("LBL_BEVEL_R");
|
||||
}
|
||||
}
|
||||
|
||||
void PartySelection::prepare(const Context &ctx) {
|
||||
_context = ctx;
|
||||
_availableCount = kMaxFollowerCount;
|
||||
|
@ -163,14 +218,12 @@ void PartySelection::onAcceptButtonClick() {
|
|||
}
|
||||
|
||||
void PartySelection::refreshAvailableCount() {
|
||||
Label &label = getControl<Label>("LBL_COUNT");
|
||||
label.setTextMessage(to_string(_availableCount));
|
||||
_binding.lblCount->setTextMessage(to_string(_availableCount));
|
||||
}
|
||||
|
||||
void PartySelection::refreshAcceptButton() {
|
||||
string text(_game->services().resource().strings().get(_added[_selectedNpc] ? g_strRefRemove : g_strRefAdd));
|
||||
Button &btnAccept = getControl<Button>("BTN_ACCEPT");
|
||||
btnAccept.setTextMessage(text);
|
||||
_binding.btnAccept->setTextMessage(text);
|
||||
}
|
||||
|
||||
void PartySelection::removeNpc(int npc) {
|
||||
|
|
|
@ -17,16 +17,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../../gui/control/button.h"
|
||||
#include "../../gui/control/label.h"
|
||||
#include "../../gui/control/togglebutton.h"
|
||||
|
||||
#include "gui.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace gui {
|
||||
|
||||
class ToggleButton;
|
||||
|
||||
}
|
||||
|
||||
namespace game {
|
||||
|
||||
constexpr int kNpcCount = 9;
|
||||
|
@ -46,23 +44,82 @@ public:
|
|||
void prepare(const Context &ctx);
|
||||
|
||||
private:
|
||||
struct Binding {
|
||||
std::shared_ptr<gui::Button> btnAccept;
|
||||
std::shared_ptr<gui::Button> btnBack;
|
||||
std::shared_ptr<gui::Button> btnDone;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc0;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc1;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc2;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc3;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc4;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc5;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc6;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc7;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc8;
|
||||
std::shared_ptr<gui::Label> lbl3d;
|
||||
std::shared_ptr<gui::Label> lblBevelL;
|
||||
std::shared_ptr<gui::Label> lblBevelM;
|
||||
std::shared_ptr<gui::Label> lblChar0;
|
||||
std::shared_ptr<gui::Label> lblChar1;
|
||||
std::shared_ptr<gui::Label> lblChar2;
|
||||
std::shared_ptr<gui::Label> lblChar3;
|
||||
std::shared_ptr<gui::Label> lblChar4;
|
||||
std::shared_ptr<gui::Label> lblChar5;
|
||||
std::shared_ptr<gui::Label> lblChar6;
|
||||
std::shared_ptr<gui::Label> lblChar7;
|
||||
std::shared_ptr<gui::Label> lblChar8;
|
||||
std::shared_ptr<gui::Label> lblCount;
|
||||
std::shared_ptr<gui::Label> lblNa0;
|
||||
std::shared_ptr<gui::Label> lblNa1;
|
||||
std::shared_ptr<gui::Label> lblNa2;
|
||||
std::shared_ptr<gui::Label> lblNa3;
|
||||
std::shared_ptr<gui::Label> lblNa4;
|
||||
std::shared_ptr<gui::Label> lblNa5;
|
||||
std::shared_ptr<gui::Label> lblNa6;
|
||||
std::shared_ptr<gui::Label> lblNa7;
|
||||
std::shared_ptr<gui::Label> lblNa8;
|
||||
std::shared_ptr<gui::Label> lblNpcLevel;
|
||||
std::shared_ptr<gui::Label> lblNpcName;
|
||||
std::shared_ptr<gui::Label> lblTitle;
|
||||
|
||||
// KotOR only
|
||||
std::shared_ptr<gui::Label> lblAvailable;
|
||||
std::shared_ptr<gui::Label> lblBevelR;
|
||||
// END KotOR only
|
||||
|
||||
// TSL only
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc9;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc10;
|
||||
std::shared_ptr<gui::ToggleButton> btnNpc11;
|
||||
std::shared_ptr<gui::Label> lblChar9;
|
||||
std::shared_ptr<gui::Label> lblChar10;
|
||||
std::shared_ptr<gui::Label> lblChar11;
|
||||
std::shared_ptr<gui::Label> lblNa9;
|
||||
std::shared_ptr<gui::Label> lblNa10;
|
||||
std::shared_ptr<gui::Label> lblNa11;
|
||||
std::shared_ptr<gui::Label> lblNameBack;
|
||||
// END TSL only
|
||||
} _binding;
|
||||
|
||||
Context _context;
|
||||
int _selectedNpc { -1 };
|
||||
bool _added[kNpcCount] { false };
|
||||
int _availableCount { 0 };
|
||||
|
||||
void onClick(const std::string &control) override;
|
||||
|
||||
void bindControls();
|
||||
void addNpc(int npc);
|
||||
void changeParty();
|
||||
void onAcceptButtonClick();
|
||||
void onNpcButtonClick(const std::string &control);
|
||||
void refreshAcceptButton();
|
||||
void refreshAvailableCount();
|
||||
void refreshNpcButtons();
|
||||
void removeNpc(int npc);
|
||||
|
||||
gui::ToggleButton &getNpcButton(int npc);
|
||||
|
||||
void onClick(const std::string &control) override;
|
||||
void onAcceptButtonClick();
|
||||
void onNpcButtonClick(const std::string &control);
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
#include "../../common/log.h"
|
||||
#include "../../common/streamutil.h"
|
||||
#include "../../graphics/texture/tgareader.h"
|
||||
#include "../../gui/control/listbox.h"
|
||||
#include "../../resource/format/erfreader.h"
|
||||
#include "../../resource/format/gffreader.h"
|
||||
#include "../../resource/strings.h"
|
||||
|
||||
#include "../game.h"
|
||||
#include "../gameidutil.h"
|
||||
|
||||
#include "colorutil.h"
|
||||
|
||||
|
@ -60,28 +60,51 @@ SaveLoad::SaveLoad(Game *game) : GameGUI(game) {
|
|||
|
||||
void SaveLoad::load() {
|
||||
GUI::load();
|
||||
bindControls();
|
||||
|
||||
hideControl("LBL_PLANETNAME");
|
||||
hideControl("LBL_AREANAME");
|
||||
_binding.lblPlanetName->setVisible(false);
|
||||
_binding.lblAreaName->setVisible(false);
|
||||
|
||||
ListBox &lbGames = getControl<ListBox>("LB_GAMES");
|
||||
lbGames.setSelectionMode(ListBox::SelectionMode::OnClick);
|
||||
lbGames.setPadding(3);
|
||||
_binding.lbGames->setSelectionMode(ListBox::SelectionMode::OnClick);
|
||||
_binding.lbGames->setPadding(3);
|
||||
|
||||
Control &protoItem = lbGames.protoItem();
|
||||
protoItem.setUseBorderColorOverride(true);
|
||||
protoItem.setBorderColorOverride(getBaseColor(_game->gameId()));
|
||||
protoItem.setHilightColor(_defaultHilightColor);
|
||||
_binding.lbGames->protoItem().setUseBorderColorOverride(true);
|
||||
_binding.lbGames->protoItem().setBorderColorOverride(getBaseColor(_game->gameId()));
|
||||
_binding.lbGames->protoItem().setHilightColor(_defaultHilightColor);
|
||||
}
|
||||
|
||||
void SaveLoad::bindControls() {
|
||||
_binding.btnBack = getControlPtr<Button>("BTN_BACK");
|
||||
_binding.btnDelete = getControlPtr<Button>("BTN_DELETE");
|
||||
_binding.btnSaveLoad = getControlPtr<Button>("BTN_SAVELOAD");
|
||||
_binding.lblAreaName = getControlPtr<Label>("LBL_AREANAME");
|
||||
_binding.lblPanelName = getControlPtr<Label>("LBL_PANELNAME");
|
||||
_binding.lblPlanetName = getControlPtr<Label>("LBL_PLANETNAME");
|
||||
_binding.lblPm1 = getControlPtr<Label>("LBL_PM1");
|
||||
_binding.lblPm2 = getControlPtr<Label>("LBL_PM2");
|
||||
_binding.lblPm3 = getControlPtr<Label>("LBL_PM3");
|
||||
_binding.lblScreenshot = getControlPtr<Label>("LBL_SCREENSHOT");
|
||||
_binding.lbGames = getControlPtr<ListBox>("LB_GAMES");
|
||||
|
||||
if (isTSL(_game->gameId())) {
|
||||
_binding.btnFilter = getControlPtr<Button>("BTN_FILTER");
|
||||
_binding.lblBar1 = getControlPtr<Label>("LBL_BAR1");
|
||||
_binding.lblBar2 = getControlPtr<Label>("LBL_BAR2");
|
||||
_binding.lblBar3 = getControlPtr<Label>("LBL_BAR3");
|
||||
_binding.lblBar4 = getControlPtr<Label>("LBL_BAR4");
|
||||
_binding.lblPcName = getControlPtr<Label>("LBL_PCNAME");
|
||||
_binding.lblTimePlayed = getControlPtr<Label>("LBL_TIMEPLAYED");
|
||||
}
|
||||
}
|
||||
|
||||
void SaveLoad::refresh() {
|
||||
setControlDisabled("BTN_DELETE", _mode != Mode::Save);
|
||||
_binding.btnDelete->setDisabled(_mode != Mode::Save);
|
||||
|
||||
string panelName(_game->services().resource().strings().get(_mode == Mode::Save ? kStrRefSaveGame : kStrRefLoadGame));
|
||||
setControlText("LBL_PANELNAME", panelName);
|
||||
_binding.lblPanelName->setTextMessage(move(panelName));
|
||||
|
||||
string actionName(_game->services().resource().strings().get(_mode == Mode::Save ? kStrRefSave : kStrRefLoad));
|
||||
setControlText("BTN_SAVELOAD", actionName);
|
||||
_binding.btnSaveLoad->setTextMessage(move(actionName));
|
||||
|
||||
refreshSavedGames();
|
||||
}
|
||||
|
@ -105,14 +128,13 @@ void SaveLoad::refreshSavedGames() {
|
|||
}
|
||||
}
|
||||
|
||||
auto &lbGames = getControl<ListBox>("LB_GAMES");
|
||||
lbGames.clearItems();
|
||||
_binding.lbGames->clearItems();
|
||||
for (size_t i = 0; i < _saves.size(); ++i) {
|
||||
string name(str(boost::format("%06d") % _saves[i].number));
|
||||
ListBox::Item item;
|
||||
item.tag = name;
|
||||
item.text = name;
|
||||
lbGames.addItem(move(item));
|
||||
_binding.lbGames->addItem(move(item));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,8 +208,7 @@ void SaveLoad::onClick(const string &control) {
|
|||
refresh();
|
||||
}
|
||||
} else if (control == "BTN_BACK") {
|
||||
ListBox &lbGames = getControl<ListBox>("LB_GAMES");
|
||||
lbGames.clearSelection();
|
||||
_binding.lbGames->clearSelection();
|
||||
|
||||
switch (_mode) {
|
||||
case Mode::Save:
|
||||
|
@ -202,12 +223,10 @@ void SaveLoad::onClick(const string &control) {
|
|||
}
|
||||
|
||||
int SaveLoad::getSelectedSaveNumber() const {
|
||||
ListBox &lbGames = getControl<ListBox>("LB_GAMES");
|
||||
|
||||
int hilightedIdx = lbGames.selectedItemIndex();
|
||||
int hilightedIdx = _binding.lbGames->selectedItemIndex();
|
||||
if (hilightedIdx == -1) return -1;
|
||||
|
||||
string tag(lbGames.getItemAt(hilightedIdx).tag);
|
||||
string tag(_binding.lbGames->getItemAt(hilightedIdx).tag);
|
||||
|
||||
return stoi(tag);
|
||||
}
|
||||
|
@ -252,9 +271,8 @@ void SaveLoad::onListBoxItemClick(const string &control, const string &item) {
|
|||
|
||||
// Get save number by item tag
|
||||
int selectedSaveNumber = -1;
|
||||
auto &lbGames = getControl<ListBox>("LB_GAMES");
|
||||
for (int i = 0; i < lbGames.getItemCount(); ++i) {
|
||||
auto &lbItem = lbGames.getItemAt(i);
|
||||
for (int i = 0; i < _binding.lbGames->getItemCount(); ++i) {
|
||||
auto &lbItem = _binding.lbGames->getItemAt(i);
|
||||
if (lbItem.tag == item) {
|
||||
selectedSaveNumber = stoi(lbItem.tag);
|
||||
break;
|
||||
|
@ -273,8 +291,7 @@ void SaveLoad::onListBoxItemClick(const string &control, const string &item) {
|
|||
}
|
||||
|
||||
// Set screenshot
|
||||
Label &lblScreenshot = getControl<Label>("LBL_SCREENSHOT");
|
||||
lblScreenshot.setBorderFill(move(screenshot));
|
||||
_binding.lblScreenshot->setBorderFill(move(screenshot));
|
||||
}
|
||||
|
||||
} // namespace game
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../../gui/control/button.h"
|
||||
#include "../../gui/control/label.h"
|
||||
#include "../../gui/control/listbox.h"
|
||||
|
||||
#include "../savedgame.h"
|
||||
|
||||
#include "gui.h"
|
||||
|
@ -48,21 +52,46 @@ private:
|
|||
boost::filesystem::path path;
|
||||
};
|
||||
|
||||
struct Binding {
|
||||
std::shared_ptr<gui::Button> btnBack;
|
||||
std::shared_ptr<gui::Button> btnDelete;
|
||||
std::shared_ptr<gui::Button> btnSaveLoad;
|
||||
std::shared_ptr<gui::Label> lblAreaName;
|
||||
std::shared_ptr<gui::Label> lblPanelName;
|
||||
std::shared_ptr<gui::Label> lblPlanetName;
|
||||
std::shared_ptr<gui::Label> lblPm1;
|
||||
std::shared_ptr<gui::Label> lblPm2;
|
||||
std::shared_ptr<gui::Label> lblPm3;
|
||||
std::shared_ptr<gui::Label> lblScreenshot;
|
||||
std::shared_ptr<gui::ListBox> lbGames;
|
||||
|
||||
// TSL only
|
||||
std::shared_ptr<gui::Button> btnFilter;
|
||||
std::shared_ptr<gui::Label> lblBar1;
|
||||
std::shared_ptr<gui::Label> lblBar2;
|
||||
std::shared_ptr<gui::Label> lblBar3;
|
||||
std::shared_ptr<gui::Label> lblBar4;
|
||||
std::shared_ptr<gui::Label> lblPcName;
|
||||
std::shared_ptr<gui::Label> lblTimePlayed;
|
||||
// END TSL only
|
||||
} _binding;
|
||||
|
||||
Mode _mode { Mode::Save };
|
||||
std::vector<SavedGameDescriptor> _saves;
|
||||
|
||||
void bindControls();
|
||||
void refreshSavedGames();
|
||||
void indexSavedGame(boost::filesystem::path path);
|
||||
|
||||
void onClick(const std::string &control) override;
|
||||
void onListBoxItemClick(const std::string &control, const std::string &item) override;
|
||||
|
||||
void saveGame(int number);
|
||||
void loadGame(int number);
|
||||
void deleteGame(int number);
|
||||
|
||||
int getSelectedSaveNumber() const;
|
||||
int getNewSaveNumber() const;
|
||||
|
||||
void onClick(const std::string &control) override;
|
||||
void onListBoxItemClick(const std::string &control, const std::string &item) override;
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
|
|
|
@ -546,8 +546,8 @@ void Control::setFocus(bool focus) {
|
|||
_focus = focus;
|
||||
}
|
||||
|
||||
void Control::setExtent(const Extent &extent) {
|
||||
_extent = extent;
|
||||
void Control::setExtent(Extent extent) {
|
||||
_extent = move(extent);
|
||||
updateTransform();
|
||||
updateTextLines();
|
||||
}
|
||||
|
@ -562,19 +562,19 @@ void Control::setExtentTop(int top) {
|
|||
updateTransform();
|
||||
}
|
||||
|
||||
void Control::setBorder(const Border &border) {
|
||||
_border = make_shared<Border>(border);
|
||||
void Control::setBorder(Border border) {
|
||||
_border = make_shared<Border>(move(border));
|
||||
}
|
||||
|
||||
void Control::setBorderFill(const string &resRef) {
|
||||
void Control::setBorderFill(string resRef) {
|
||||
shared_ptr<Texture> texture;
|
||||
if (!resRef.empty()) {
|
||||
texture = _gui->graphics().textures().get(resRef, TextureUsage::GUI);
|
||||
}
|
||||
setBorderFill(texture);
|
||||
setBorderFill(move(texture));
|
||||
}
|
||||
|
||||
void Control::setBorderFill(const shared_ptr<Texture> &texture) {
|
||||
void Control::setBorderFill(shared_ptr<Texture> texture) {
|
||||
if (!texture && _border) {
|
||||
_border->fill.reset();
|
||||
return;
|
||||
|
@ -583,34 +583,34 @@ void Control::setBorderFill(const shared_ptr<Texture> &texture) {
|
|||
if (!_border) {
|
||||
_border = make_shared<Border>();
|
||||
}
|
||||
_border->fill = texture;
|
||||
_border->fill = move(texture);
|
||||
}
|
||||
}
|
||||
|
||||
void Control::setBorderColor(const glm::vec3 &color) {
|
||||
_border->color = color;
|
||||
void Control::setBorderColor(glm::vec3 color) {
|
||||
_border->color = move(color);
|
||||
}
|
||||
|
||||
void Control::setBorderColorOverride(const glm::vec3 &color) {
|
||||
_borderColorOverride = color;
|
||||
void Control::setBorderColorOverride(glm::vec3 color) {
|
||||
_borderColorOverride = move(color);
|
||||
}
|
||||
|
||||
void Control::setUseBorderColorOverride(bool use) {
|
||||
_useBorderColorOverride = use;
|
||||
}
|
||||
|
||||
void Control::setHilight(const Border &hilight) {
|
||||
void Control::setHilight(Border hilight) {
|
||||
_hilight = make_shared<Border>(hilight);
|
||||
}
|
||||
|
||||
void Control::setHilightColor(const glm::vec3 &color) {
|
||||
void Control::setHilightColor(glm::vec3 color) {
|
||||
if (!_hilight) {
|
||||
_hilight = make_shared<Border>();
|
||||
}
|
||||
_hilight->color = color;
|
||||
_hilight->color = move(color);
|
||||
}
|
||||
|
||||
void Control::setHilightFill(const string &resRef) {
|
||||
void Control::setHilightFill(string resRef) {
|
||||
shared_ptr<Texture> texture;
|
||||
if (!resRef.empty()) {
|
||||
texture = _gui->graphics().textures().get(resRef, TextureUsage::GUI);
|
||||
|
@ -618,7 +618,7 @@ void Control::setHilightFill(const string &resRef) {
|
|||
setHilightFill(texture);
|
||||
}
|
||||
|
||||
void Control::setHilightFill(const shared_ptr<Texture> &texture) {
|
||||
void Control::setHilightFill(shared_ptr<Texture> texture) {
|
||||
if (!texture && _hilight) {
|
||||
_hilight->fill.reset();
|
||||
return;
|
||||
|
@ -627,27 +627,27 @@ void Control::setHilightFill(const shared_ptr<Texture> &texture) {
|
|||
if (!_hilight) {
|
||||
_hilight = make_shared<Border>();
|
||||
}
|
||||
_hilight->fill = texture;
|
||||
_hilight->fill = move(texture);
|
||||
}
|
||||
}
|
||||
|
||||
void Control::setText(const Text &text) {
|
||||
_text = text;
|
||||
void Control::setText(Text text) {
|
||||
_text = move(text);
|
||||
updateTextLines();
|
||||
}
|
||||
|
||||
void Control::setTextMessage(const string &text) {
|
||||
_text.text = text;
|
||||
void Control::setTextMessage(string text) {
|
||||
_text.text = move(text);
|
||||
updateTextLines();
|
||||
}
|
||||
|
||||
void Control::setTextFont(const shared_ptr<Font> &font) {
|
||||
_text.font = font;
|
||||
void Control::setTextFont(shared_ptr<Font> font) {
|
||||
_text.font = move(font);
|
||||
updateTextLines();
|
||||
}
|
||||
|
||||
void Control::setTextColor(const glm::vec3 &color) {
|
||||
_text.color = color;
|
||||
void Control::setTextColor(glm::vec3 color) {
|
||||
_text.color = move(color);
|
||||
}
|
||||
|
||||
void Control::setScene(unique_ptr<SceneGraph> scene) {
|
||||
|
@ -664,7 +664,7 @@ void Control::setPadding(int padding) {
|
|||
_padding = padding;
|
||||
}
|
||||
|
||||
void Control::setDiscardColor(const glm::vec3 &color) {
|
||||
void Control::setDiscardColor(glm::vec3 color) {
|
||||
_discardEnabled = true;
|
||||
_discardColor = color;
|
||||
}
|
||||
|
|
|
@ -110,29 +110,29 @@ public:
|
|||
const Text &text() const { return _text; }
|
||||
const std::vector<std::string> &textLines() const { return _textLines; }
|
||||
|
||||
void setBorder(const Border &border);
|
||||
void setBorderFill(const std::string &resRef);
|
||||
void setBorderFill(const std::shared_ptr<graphics::Texture> &texture);
|
||||
void setBorderColor(const glm::vec3 &color);
|
||||
void setBorderColorOverride(const glm::vec3 &color);
|
||||
void setBorder(Border border);
|
||||
void setBorderFill(std::string resRef);
|
||||
void setBorderFill(std::shared_ptr<graphics::Texture> texture);
|
||||
void setBorderColor(glm::vec3 color);
|
||||
void setBorderColorOverride(glm::vec3 color);
|
||||
void setDisabled(bool disabled);
|
||||
void setDiscardColor(const glm::vec3 &color);
|
||||
virtual void setExtent(const Extent &extent);
|
||||
void setDiscardColor(glm::vec3 color);
|
||||
virtual void setExtent(Extent extent);
|
||||
virtual void setExtentHeight(int height);
|
||||
void setExtentTop(int top);
|
||||
virtual void setFocus(bool focus);
|
||||
void setFocusable(bool focusable);
|
||||
void setHeight(int height);
|
||||
void setHilight(const Border &hilight);
|
||||
void setHilightColor(const glm::vec3 &color);
|
||||
void setHilightFill(const std::string &resRef);
|
||||
void setHilightFill(const std::shared_ptr<graphics::Texture> &texture);
|
||||
void setHilight(Border hilight);
|
||||
void setHilightColor(glm::vec3 color);
|
||||
void setHilightFill(std::string resRef);
|
||||
void setHilightFill(std::shared_ptr<graphics::Texture> texture);
|
||||
void setPadding(int padding);
|
||||
void setScene(std::unique_ptr<scene::SceneGraph> scene);
|
||||
void setText(const Text &text);
|
||||
void setTextColor(const glm::vec3 & color);
|
||||
void setTextMessage(const std::string &text);
|
||||
void setTextFont(const std::shared_ptr<graphics::Font> &font);
|
||||
void setText(Text text);
|
||||
void setTextColor(glm::vec3 color);
|
||||
void setTextMessage(std::string text);
|
||||
void setTextFont(std::shared_ptr<graphics::Font> font);
|
||||
void setUseBorderColorOverride(bool use);
|
||||
void setVisible(bool visible);
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ void ListBox::setFocus(bool focus) {
|
|||
}
|
||||
}
|
||||
|
||||
void ListBox::setExtent(const Extent &extent) {
|
||||
void ListBox::setExtent(Extent extent) {
|
||||
Control::setExtent(extent);
|
||||
updateItemSlots();
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
void stretch(float x, float y, int mask) override;
|
||||
|
||||
void setFocus(bool focus) override;
|
||||
void setExtent(const Extent &extent) override;
|
||||
void setExtent(Extent extent) override;
|
||||
void setExtentHeight(int height) override;
|
||||
void setProtoItemType(ControlType type);
|
||||
void setSelectionMode(SelectionMode mode);
|
||||
|
|
Loading…
Reference in a new issue