mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 07:05:39 +00:00
ComponentList elements can now choose not to be inverted when selected.
TextComponent now has a proper "alignment" setting (left, center, and right). Did some more styling on GuiMetaDataEd.
This commit is contained in:
parent
b4f5577bd5
commit
9a3b0af337
|
@ -385,8 +385,8 @@ Can be created as an extra.
|
||||||
- Path to a truetype font (.ttf).
|
- Path to a truetype font (.ttf).
|
||||||
* `fontSize` - type: FLOAT.
|
* `fontSize` - type: FLOAT.
|
||||||
- Size of the font as a percentage of screen height (e.g. for a value of `0.1`, the text's height would be 10% of the screen height).
|
- Size of the font as a percentage of screen height (e.g. for a value of `0.1`, the text's height would be 10% of the screen height).
|
||||||
* `center` - type: BOOLEAN.
|
* `alignment` - type: STRING.
|
||||||
- True to center, false to left-align.
|
- Valid values are "left", "center", or "right". Controls alignment on the X axis. "center" will also align vertically.
|
||||||
|
|
||||||
#### textlist
|
#### textlist
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ std::map< std::string, ElementMapType > ThemeData::sElementMap = boost::assign::
|
||||||
("color", COLOR)
|
("color", COLOR)
|
||||||
("fontPath", PATH)
|
("fontPath", PATH)
|
||||||
("fontSize", FLOAT)
|
("fontSize", FLOAT)
|
||||||
("center", BOOLEAN)))
|
("alignment", STRING)))
|
||||||
("textlist", makeMap(boost::assign::map_list_of
|
("textlist", makeMap(boost::assign::map_list_of
|
||||||
("pos", NORMALIZED_PAIR)
|
("pos", NORMALIZED_PAIR)
|
||||||
("size", NORMALIZED_PAIR)
|
("size", NORMALIZED_PAIR)
|
||||||
|
|
|
@ -150,7 +150,22 @@ void ComponentList::render(const Eigen::Affine3f& parentTrans)
|
||||||
trans.translate(Eigen::Vector3f(0, -round(mCameraOffset), 0));
|
trans.translate(Eigen::Vector3f(0, -round(mCameraOffset), 0));
|
||||||
|
|
||||||
// draw our entries
|
// draw our entries
|
||||||
renderChildren(trans);
|
std::vector<GuiComponent*> drawAfterCursor;
|
||||||
|
bool drawAll;
|
||||||
|
for(unsigned int i = 0; i < mEntries.size(); i++)
|
||||||
|
{
|
||||||
|
auto& entry = mEntries.at(i);
|
||||||
|
drawAll = !mFocused || i != mCursor;
|
||||||
|
for(auto it = entry.data.elements.begin(); it != entry.data.elements.end(); it++)
|
||||||
|
{
|
||||||
|
if(drawAll || it->invert_when_selected)
|
||||||
|
{
|
||||||
|
it->component->render(trans);
|
||||||
|
}else{
|
||||||
|
drawAfterCursor.push_back(it->component.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// custom rendering
|
// custom rendering
|
||||||
Renderer::setMatrix(trans);
|
Renderer::setMatrix(trans);
|
||||||
|
@ -172,6 +187,13 @@ void ComponentList::render(const Eigen::Affine3f& parentTrans)
|
||||||
// hack to draw 2px dark on left/right of the bar
|
// hack to draw 2px dark on left/right of the bar
|
||||||
Renderer::drawRect(0.0f, mSelectorBarOffset, 2.0f, selectedRowHeight, 0x878787FF);
|
Renderer::drawRect(0.0f, mSelectorBarOffset, 2.0f, selectedRowHeight, 0x878787FF);
|
||||||
Renderer::drawRect(mSize.x() - 2.0f, mSelectorBarOffset, 2.0f, selectedRowHeight, 0x878787FF);
|
Renderer::drawRect(mSize.x() - 2.0f, mSelectorBarOffset, 2.0f, selectedRowHeight, 0x878787FF);
|
||||||
|
|
||||||
|
for(auto it = drawAfterCursor.begin(); it != drawAfterCursor.end(); it++)
|
||||||
|
(*it)->render(trans);
|
||||||
|
|
||||||
|
// reset matrix if one of these components changed it
|
||||||
|
if(drawAfterCursor.size())
|
||||||
|
Renderer::setMatrix(trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw separators
|
// draw separators
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
|
|
||||||
struct ComponentListElement
|
struct ComponentListElement
|
||||||
{
|
{
|
||||||
ComponentListElement(const std::shared_ptr<GuiComponent>& cmp = nullptr, bool resize_w = true) : component(cmp), resize_width(resize_w) { };
|
ComponentListElement(const std::shared_ptr<GuiComponent>& cmp = nullptr, bool resize_w = true, bool inv = true)
|
||||||
|
: component(cmp), resize_width(resize_w), invert_when_selected(inv) { };
|
||||||
|
|
||||||
std::shared_ptr<GuiComponent> component;
|
std::shared_ptr<GuiComponent> component;
|
||||||
bool resize_width;
|
bool resize_width;
|
||||||
|
bool invert_when_selected;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ComponentListRow
|
struct ComponentListRow
|
||||||
|
@ -21,9 +23,9 @@ struct ComponentListRow
|
||||||
// the rightmost element in the currently selected row.
|
// the rightmost element in the currently selected row.
|
||||||
std::function<bool(InputConfig*, Input)> input_handler;
|
std::function<bool(InputConfig*, Input)> input_handler;
|
||||||
|
|
||||||
inline void addElement(const std::shared_ptr<GuiComponent>& component, bool resize_width)
|
inline void addElement(const std::shared_ptr<GuiComponent>& component, bool resize_width, bool invert_when_selected = true)
|
||||||
{
|
{
|
||||||
elements.push_back(ComponentListElement(component, resize_width));
|
elements.push_back(ComponentListElement(component, resize_width, invert_when_selected));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utility method for making an input handler for "when the users presses A on this, do func."
|
// Utility method for making an input handler for "when the users presses A on this, do func."
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
DateTimeComponent::DateTimeComponent(Window* window, DisplayMode dispMode) : GuiComponent(window),
|
DateTimeComponent::DateTimeComponent(Window* window, DisplayMode dispMode) : GuiComponent(window),
|
||||||
mEditing(false), mEditIndex(0), mDisplayMode(dispMode), mRelativeUpdateAccumulator(0),
|
mEditing(false), mEditIndex(0), mDisplayMode(dispMode), mRelativeUpdateAccumulator(0),
|
||||||
mColor(0x000000FF)
|
mColor(0x777777FF), mFont(Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT))
|
||||||
{
|
{
|
||||||
mSize << 64, (float)getFont()->getHeight();
|
mSize << 64, getFont()->getHeight();
|
||||||
updateTextCache();
|
updateTextCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ MenuComponent::MenuComponent(Window* window, const char* title) : GuiComponent(w
|
||||||
mBackground.setImagePath(":/frame.png");
|
mBackground.setImagePath(":/frame.png");
|
||||||
|
|
||||||
// set up title which will never change
|
// set up title which will never change
|
||||||
mTitle = std::make_shared<TextComponent>(mWindow, strToUpper(title), Font::get(FONT_SIZE_LARGE), 0x555555FF, true);
|
mTitle = std::make_shared<TextComponent>(mWindow, strToUpper(title), Font::get(FONT_SIZE_LARGE), 0x555555FF, TextComponent::ALIGN_CENTER);
|
||||||
mGrid.setEntry(mTitle, Vector2i(0, 0), false);
|
mGrid.setEntry(mTitle, Vector2i(0, 0), false);
|
||||||
|
|
||||||
// set up list which will never change (externally, anyway)
|
// set up list which will never change (externally, anyway)
|
||||||
|
|
|
@ -19,11 +19,11 @@ public:
|
||||||
|
|
||||||
inline void addRow(const ComponentListRow& row, bool setCursorHere = false) { mList->addRow(row, setCursorHere); updateSize(); }
|
inline void addRow(const ComponentListRow& row, bool setCursorHere = false) { mList->addRow(row, setCursorHere); updateSize(); }
|
||||||
|
|
||||||
inline void addWithLabel(const std::string& label, const std::shared_ptr<GuiComponent>& comp, bool setCursorHere = false)
|
inline void addWithLabel(const std::string& label, const std::shared_ptr<GuiComponent>& comp, bool setCursorHere = false, bool invert_when_selected = true)
|
||||||
{
|
{
|
||||||
ComponentListRow row;
|
ComponentListRow row;
|
||||||
row.addElement(std::make_shared<TextComponent>(mWindow, strToUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
|
row.addElement(std::make_shared<TextComponent>(mWindow, strToUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), TextComponent::ALIGN_CENTER);
|
||||||
row.addElement(comp, false);
|
row.addElement(comp, false, invert_when_selected);
|
||||||
addRow(row, setCursorHere);
|
addRow(row, setCursorHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ public:
|
||||||
auto font = Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT);
|
auto font = Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT);
|
||||||
mText.setFont(font);
|
mText.setFont(font);
|
||||||
mText.setColor(0x777777FF);
|
mText.setColor(0x777777FF);
|
||||||
mText.setCentered(true);
|
mText.setAlignment(TextComponent::ALIGN_CENTER);
|
||||||
addChild(&mText);
|
addChild(&mText);
|
||||||
|
|
||||||
if(mMultiSelect)
|
if(mMultiSelect)
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
#include "../Util.h"
|
#include "../Util.h"
|
||||||
|
|
||||||
TextComponent::TextComponent(Window* window) : GuiComponent(window),
|
TextComponent::TextComponent(Window* window) : GuiComponent(window),
|
||||||
mFont(Font::get(FONT_SIZE_MEDIUM)), mColor(0x000000FF), mAutoCalcExtent(true, true), mCentered(false)
|
mFont(Font::get(FONT_SIZE_MEDIUM)), mColor(0x000000FF), mAutoCalcExtent(true, true), mAlignment(ALIGN_LEFT)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TextComponent::TextComponent(Window* window, const std::string& text, const std::shared_ptr<Font>& font, unsigned int color, bool center,
|
TextComponent::TextComponent(Window* window, const std::string& text, const std::shared_ptr<Font>& font, unsigned int color, Alignment align,
|
||||||
Eigen::Vector3f pos, Eigen::Vector2f size) : GuiComponent(window),
|
Eigen::Vector3f pos, Eigen::Vector2f size) : GuiComponent(window),
|
||||||
mFont(NULL), mColor(0x000000FF), mAutoCalcExtent(true, true), mCentered(center)
|
mFont(NULL), mColor(0x000000FF), mAutoCalcExtent(true, true), mAlignment(align)
|
||||||
{
|
{
|
||||||
setFont(font);
|
setFont(font);
|
||||||
setColor(color);
|
setColor(color);
|
||||||
|
@ -62,11 +62,6 @@ void TextComponent::setText(const std::string& text)
|
||||||
onTextChanged();
|
onTextChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextComponent::setCentered(bool center)
|
|
||||||
{
|
|
||||||
mCentered = center;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextComponent::render(const Eigen::Affine3f& parentTrans)
|
void TextComponent::render(const Eigen::Affine3f& parentTrans)
|
||||||
{
|
{
|
||||||
Eigen::Affine3f trans = roundMatrix(parentTrans * getTransform());
|
Eigen::Affine3f trans = roundMatrix(parentTrans * getTransform());
|
||||||
|
@ -77,19 +72,28 @@ void TextComponent::render(const Eigen::Affine3f& parentTrans)
|
||||||
Eigen::Vector2i((int)(dim.x() + 0.5f), (int)(dim.y() + 0.5f)));
|
Eigen::Vector2i((int)(dim.x() + 0.5f), (int)(dim.y() + 0.5f)));
|
||||||
|
|
||||||
if(mTextCache)
|
if(mTextCache)
|
||||||
{
|
|
||||||
if(mCentered)
|
|
||||||
{
|
{
|
||||||
const Eigen::Vector2f& textSize = mTextCache->metrics.size;
|
const Eigen::Vector2f& textSize = mTextCache->metrics.size;
|
||||||
Eigen::Vector3f off((getSize().x() - textSize.x()) / 2, (getSize().y() - textSize.y()) / 2, 0);
|
Eigen::Vector3f off(0, 0, 0);
|
||||||
off = roundVector(off);
|
|
||||||
|
|
||||||
|
switch(mAlignment)
|
||||||
|
{
|
||||||
|
case ALIGN_LEFT:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ALIGN_CENTER:
|
||||||
|
off << (getSize().x() - textSize.x()) / 2, (getSize().y() - textSize.y()) / 2, 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ALIGN_RIGHT:
|
||||||
|
off << (getSize().x() - textSize.x()), 0, 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
off = roundVector(off);
|
||||||
trans.translate(off);
|
trans.translate(off);
|
||||||
Renderer::setMatrix(trans);
|
Renderer::setMatrix(trans);
|
||||||
trans.translate(-off);
|
trans.translate(-off);
|
||||||
}else{
|
|
||||||
Renderer::setMatrix(trans);
|
|
||||||
}
|
|
||||||
|
|
||||||
mFont->renderTextCache(mTextCache.get());
|
mFont->renderTextCache(mTextCache.get());
|
||||||
}
|
}
|
||||||
|
@ -171,8 +175,18 @@ void TextComponent::applyTheme(const std::shared_ptr<ThemeData>& theme, const st
|
||||||
if(properties & COLOR && elem->has("color"))
|
if(properties & COLOR && elem->has("color"))
|
||||||
setColor(elem->get<unsigned int>("color"));
|
setColor(elem->get<unsigned int>("color"));
|
||||||
|
|
||||||
if(properties & ALIGNMENT && elem->has("center"))
|
if(properties & ALIGNMENT && elem->has("alignment"))
|
||||||
setCentered(elem->get<bool>("center"));
|
{
|
||||||
|
std::string str = elem->get<std::string>("alignment");
|
||||||
|
if(str == "left")
|
||||||
|
setAlignment(ALIGN_LEFT);
|
||||||
|
else if(str == "center")
|
||||||
|
setAlignment(ALIGN_CENTER);
|
||||||
|
else if(str == "ALIGN_RIGHT")
|
||||||
|
setAlignment(ALIGN_RIGHT);
|
||||||
|
else
|
||||||
|
LOG(LogError) << "Unknown text alignment string: " << str;
|
||||||
|
}
|
||||||
|
|
||||||
if(properties & TEXT && elem->has("text"))
|
if(properties & TEXT && elem->has("text"))
|
||||||
setText(elem->get<std::string>("text"));
|
setText(elem->get<std::string>("text"));
|
||||||
|
|
|
@ -14,15 +14,22 @@ class ThemeData;
|
||||||
class TextComponent : public GuiComponent
|
class TextComponent : public GuiComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum Alignment
|
||||||
|
{
|
||||||
|
ALIGN_LEFT,
|
||||||
|
ALIGN_CENTER, // centers both horizontally and vertically
|
||||||
|
ALIGN_RIGHT
|
||||||
|
};
|
||||||
|
|
||||||
TextComponent(Window* window);
|
TextComponent(Window* window);
|
||||||
TextComponent(Window* window, const std::string& text, const std::shared_ptr<Font>& font, unsigned int color = 0x000000FF, bool center = false,
|
TextComponent(Window* window, const std::string& text, const std::shared_ptr<Font>& font, unsigned int color = 0x000000FF, Alignment align = ALIGN_LEFT,
|
||||||
Eigen::Vector3f pos = Eigen::Vector3f::Zero(), Eigen::Vector2f size = Eigen::Vector2f::Zero());
|
Eigen::Vector3f pos = Eigen::Vector3f::Zero(), Eigen::Vector2f size = Eigen::Vector2f::Zero());
|
||||||
|
|
||||||
void setFont(const std::shared_ptr<Font>& font);
|
void setFont(const std::shared_ptr<Font>& font);
|
||||||
void onSizeChanged() override;
|
void onSizeChanged() override;
|
||||||
void setText(const std::string& text);
|
void setText(const std::string& text);
|
||||||
void setColor(unsigned int color);
|
void setColor(unsigned int color);
|
||||||
void setCentered(bool center); // Will horizontally center text. Default is false.
|
inline void setAlignment(Alignment align) { mAlignment = align; }
|
||||||
|
|
||||||
void render(const Eigen::Affine3f& parentTrans) override;
|
void render(const Eigen::Affine3f& parentTrans) override;
|
||||||
|
|
||||||
|
@ -47,7 +54,7 @@ private:
|
||||||
Eigen::Matrix<bool, 1, 2> mAutoCalcExtent;
|
Eigen::Matrix<bool, 1, 2> mAutoCalcExtent;
|
||||||
std::string mText;
|
std::string mText;
|
||||||
std::shared_ptr<TextCache> mTextCache;
|
std::shared_ptr<TextCache> mTextCache;
|
||||||
bool mCentered;
|
Alignment mAlignment;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,14 +19,14 @@ GuiFastSelect::GuiFastSelect(Window* window, IGameListView* gamelist) : GuiCompo
|
||||||
addChild(&mBackground);
|
addChild(&mBackground);
|
||||||
|
|
||||||
mLetterText.setSize(mSize.x(), mSize.y() * 0.75f);
|
mLetterText.setSize(mSize.x(), mSize.y() * 0.75f);
|
||||||
mLetterText.setCentered(true);
|
mLetterText.setAlignment(TextComponent::ALIGN_CENTER);
|
||||||
mLetterText.applyTheme(theme, "fastSelect", "letter", FONT_PATH | COLOR);
|
mLetterText.applyTheme(theme, "fastSelect", "letter", FONT_PATH | COLOR);
|
||||||
// TODO - set font size
|
// TODO - set font size
|
||||||
addChild(&mLetterText);
|
addChild(&mLetterText);
|
||||||
|
|
||||||
mSortText.setPosition(0, mSize.y() * 0.75f);
|
mSortText.setPosition(0, mSize.y() * 0.75f);
|
||||||
mSortText.setSize(mSize.x(), mSize.y() * 0.25f);
|
mSortText.setSize(mSize.x(), mSize.y() * 0.25f);
|
||||||
mSortText.setCentered(true);
|
mSortText.setAlignment(TextComponent::ALIGN_CENTER);
|
||||||
mSortText.applyTheme(theme, "fastSelect", "subtext", FONT_PATH | COLOR);
|
mSortText.applyTheme(theme, "fastSelect", "subtext", FONT_PATH | COLOR);
|
||||||
// TODO - set font size
|
// TODO - set font size
|
||||||
addChild(&mSortText);
|
addChild(&mSortText);
|
||||||
|
|
|
@ -19,7 +19,7 @@ GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std::
|
||||||
addChild(&mGrid);
|
addChild(&mGrid);
|
||||||
|
|
||||||
// header
|
// header
|
||||||
mHeader = std::make_shared<TextComponent>(mWindow, getCleanFileName(mSearchParams.game->getName()), Font::get(FONT_SIZE_LARGE), 0x777777FF, true);
|
mHeader = std::make_shared<TextComponent>(mWindow, getCleanFileName(mSearchParams.game->getName()), Font::get(FONT_SIZE_LARGE), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||||
mGrid.setEntry(mHeader, Eigen::Vector2i(0, 0), false, true);
|
mGrid.setEntry(mHeader, Eigen::Vector2i(0, 0), false, true);
|
||||||
|
|
||||||
// ScraperSearchComponent
|
// ScraperSearchComponent
|
||||||
|
|
|
@ -31,35 +31,39 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
||||||
|
|
||||||
// create ed and add it (and any related components) to mMenu
|
// create ed and add it (and any related components) to mMenu
|
||||||
// ed's value will be set below
|
// ed's value will be set below
|
||||||
|
ComponentListRow row;
|
||||||
|
auto lbl = std::make_shared<TextComponent>(mWindow, strToUpper(iter->key), Font::get(FONT_SIZE_SMALL), 0x777777FF);
|
||||||
|
row.addElement(lbl, true); // label
|
||||||
|
|
||||||
switch(iter->type)
|
switch(iter->type)
|
||||||
{
|
{
|
||||||
case MD_RATING:
|
case MD_RATING:
|
||||||
{
|
{
|
||||||
ed = std::make_shared<RatingComponent>(window);
|
ed = std::make_shared<RatingComponent>(window);
|
||||||
mMenu.addWithLabel(iter->key, ed);
|
ed->setSize(0, lbl->getSize().y());
|
||||||
|
row.addElement(ed, false, false);
|
||||||
|
mMenu.addRow(row);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MD_DATE:
|
case MD_DATE:
|
||||||
{
|
{
|
||||||
ed = std::make_shared<DateTimeComponent>(window);
|
ed = std::make_shared<DateTimeComponent>(window);
|
||||||
mMenu.addWithLabel(iter->key, ed);
|
row.addElement(ed, false);
|
||||||
|
mMenu.addRow(row);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MD_TIME:
|
case MD_TIME:
|
||||||
{
|
{
|
||||||
ed = std::make_shared<DateTimeComponent>(window, DateTimeComponent::DISP_RELATIVE_TO_NOW);
|
ed = std::make_shared<DateTimeComponent>(window, DateTimeComponent::DISP_RELATIVE_TO_NOW);
|
||||||
mMenu.addWithLabel(iter->key, ed);
|
row.addElement(ed, false);
|
||||||
|
mMenu.addRow(row);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MD_MULTILINE_STRING:
|
case MD_MULTILINE_STRING:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// MD_STRING
|
// MD_STRING
|
||||||
ComponentListRow row;
|
ed = std::make_shared<TextComponent>(window, "", Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT), 0x777777FF, TextComponent::ALIGN_RIGHT);
|
||||||
auto lbl = std::make_shared<TextComponent>(mWindow, iter->key, Font::get(FONT_SIZE_SMALL), 0x777777FF);
|
|
||||||
row.addElement(lbl, true); // label
|
|
||||||
|
|
||||||
ed = std::make_shared<TextComponent>(window, "", Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT), 0x777777FF);
|
|
||||||
row.addElement(ed, true);
|
row.addElement(ed, true);
|
||||||
|
|
||||||
auto bracket = std::make_shared<ImageComponent>(mWindow);
|
auto bracket = std::make_shared<ImageComponent>(mWindow);
|
||||||
|
|
|
@ -14,7 +14,7 @@ GuiMsgBox::GuiMsgBox(Window* window, const std::string& text,
|
||||||
float width = Renderer::getScreenWidth() * 0.6f; // max width
|
float width = Renderer::getScreenWidth() * 0.6f; // max width
|
||||||
float minWidth = Renderer::getScreenWidth() * 0.3f; // minimum width
|
float minWidth = Renderer::getScreenWidth() * 0.3f; // minimum width
|
||||||
|
|
||||||
mMsg = std::make_shared<TextComponent>(mWindow, text, Font::get(FONT_SIZE_MEDIUM), 0x777777FF, true);
|
mMsg = std::make_shared<TextComponent>(mWindow, text, Font::get(FONT_SIZE_MEDIUM), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||||
|
|
||||||
// create the buttons
|
// create the buttons
|
||||||
mButtons.push_back(std::make_shared<ButtonComponent>(mWindow, name1, name1, std::bind(&GuiMsgBox::deleteMeAndCall, this, func1)));
|
mButtons.push_back(std::make_shared<ButtonComponent>(mWindow, name1, name1, std::bind(&GuiMsgBox::deleteMeAndCall, this, func1)));
|
||||||
|
|
|
@ -20,10 +20,10 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
|
||||||
mCurrentGame = 0;
|
mCurrentGame = 0;
|
||||||
|
|
||||||
// set up grid
|
// set up grid
|
||||||
mTitle = std::make_shared<TextComponent>(mWindow, "SCRAPING IN PROGRESS", Font::get(FONT_SIZE_SMALL), 0x777777FF, true);
|
mTitle = std::make_shared<TextComponent>(mWindow, "SCRAPING IN PROGRESS", Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||||
mGrid.setEntry(mTitle, Vector2i(0, 0), false, true);
|
mGrid.setEntry(mTitle, Vector2i(0, 0), false, true);
|
||||||
|
|
||||||
mSubtitle = std::make_shared<TextComponent>(mWindow, "subtitle text", Font::get(FONT_SIZE_SMALL), 0x888888FF, true);
|
mSubtitle = std::make_shared<TextComponent>(mWindow, "subtitle text", Font::get(FONT_SIZE_SMALL), 0x888888FF, TextComponent::ALIGN_CENTER);
|
||||||
mGrid.setEntry(mSubtitle, Vector2i(0, 1), false, true);
|
mGrid.setEntry(mSubtitle, Vector2i(0, 1), false, true);
|
||||||
|
|
||||||
mSearchComp = std::make_shared<ScraperSearchComponent>(mWindow,
|
mSearchComp = std::make_shared<ScraperSearchComponent>(mWindow,
|
||||||
|
|
|
@ -10,7 +10,7 @@ GuiTextEditPopup::GuiTextEditPopup(Window* window, const std::string& title, con
|
||||||
addChild(&mBackground);
|
addChild(&mBackground);
|
||||||
addChild(&mGrid);
|
addChild(&mGrid);
|
||||||
|
|
||||||
mTitle = std::make_shared<TextComponent>(mWindow, strToUpper(title), Font::get(FONT_SIZE_MEDIUM), 0x777777FF, true);
|
mTitle = std::make_shared<TextComponent>(mWindow, strToUpper(title), Font::get(FONT_SIZE_MEDIUM), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||||
|
|
||||||
mText = std::make_shared<TextEditComponent>(mWindow);
|
mText = std::make_shared<TextEditComponent>(mWindow);
|
||||||
mText->setValue(initValue);
|
mText->setValue(initValue);
|
||||||
|
|
|
@ -46,7 +46,7 @@ void SystemView::populate()
|
||||||
text->setText((*it)->getName());
|
text->setText((*it)->getName());
|
||||||
text->setSize(logoSize().x(), 0);
|
text->setSize(logoSize().x(), 0);
|
||||||
text->setPosition(0, (logoSize().y() - text->getSize().y()) / 2); // vertically center
|
text->setPosition(0, (logoSize().y() - text->getSize().y()) / 2); // vertically center
|
||||||
text->setCentered(true); // horizontally center
|
text->setAlignment(TextComponent::ALIGN_CENTER);
|
||||||
e.data.logo = std::shared_ptr<GuiComponent>(text);
|
e.data.logo = std::shared_ptr<GuiComponent>(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ ISimpleGameListView::ISimpleGameListView(Window* window, FileData* root) : IGame
|
||||||
mHeaderText.setText("Logo Text");
|
mHeaderText.setText("Logo Text");
|
||||||
mHeaderText.setSize(mSize.x(), 0);
|
mHeaderText.setSize(mSize.x(), 0);
|
||||||
mHeaderText.setPosition(0, 0);
|
mHeaderText.setPosition(0, 0);
|
||||||
mHeaderText.setCentered(true);
|
mHeaderText.setAlignment(TextComponent::ALIGN_CENTER);
|
||||||
|
|
||||||
mHeaderImage.setResize(0, mSize.y() * 0.185f);
|
mHeaderImage.setResize(0, mSize.y() * 0.185f);
|
||||||
mHeaderImage.setOrigin(0.5f, 0.0f);
|
mHeaderImage.setOrigin(0.5f, 0.0f);
|
||||||
|
|
Loading…
Reference in a new issue