mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 17:45:38 +00:00
Moved Alignment enum from inside TextComponent to global namespace in Font.h.
Removed some old functions in Font.
This commit is contained in:
parent
cf8801701a
commit
64d6af09b4
|
@ -225,9 +225,17 @@ void Window::setAllowSleep(bool sleep)
|
|||
|
||||
void Window::renderLoadingScreen()
|
||||
{
|
||||
Renderer::setMatrix(Eigen::Affine3f::Identity());
|
||||
Eigen::Affine3f trans = Eigen::Affine3f::Identity();
|
||||
Renderer::setMatrix(trans);
|
||||
Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x000000FF);
|
||||
mDefaultFonts.at(2)->drawCenteredText("LOADING", 0, (Renderer::getScreenHeight() - mDefaultFonts.at(2)->getHeight()) / 2.0f , 0xFFFFFFFF);
|
||||
|
||||
auto& font = mDefaultFonts.at(2);
|
||||
TextCache* cache = font->buildTextCache("LOADING", 0, 0, 0xFFFFFFFF);
|
||||
trans.translation() = Eigen::Vector3f((Renderer::getScreenWidth() - cache->metrics.size.x())/2, (Renderer::getScreenHeight() - cache->metrics.size.y())/2, 0);
|
||||
Renderer::setMatrix(trans);
|
||||
font->renderTextCache(cache);
|
||||
delete cache;
|
||||
|
||||
Renderer::swapBuffers();
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,10 @@ protected:
|
|||
|
||||
mGradient.setOpacity(mTitleOverlayOpacity);
|
||||
mGradient.render(identTrans);
|
||||
mTitleOverlayFont->drawText(text, off, (mTitleOverlayColor & 0xFFFFFF00) | mTitleOverlayOpacity); // relies on mGradient's render for Renderer::setMatrix()
|
||||
|
||||
TextCache* cache = mTitleOverlayFont->buildTextCache(text, off.x(), off.y(), 0xFFFFFF00 | mTitleOverlayOpacity);
|
||||
mTitleOverlayFont->renderTextCache(cache); // relies on mGradient's render for Renderer::setMatrix()
|
||||
delete cache;
|
||||
}
|
||||
|
||||
void scroll(int amt)
|
||||
|
|
|
@ -18,7 +18,7 @@ MenuComponent::MenuComponent(Window* window, const char* title, const std::share
|
|||
|
||||
// set up title
|
||||
mTitle = std::make_shared<TextComponent>(mWindow);
|
||||
mTitle->setAlignment(TextComponent::ALIGN_CENTER);
|
||||
mTitle->setAlignment(ALIGN_CENTER);
|
||||
mTitle->setColor(0x555555FF);
|
||||
setTitle(title, titleFont);
|
||||
mGrid.setEntry(mTitle, Vector2i(0, 0), false);
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
inline void addWithLabel(const std::string& label, const std::shared_ptr<GuiComponent>& comp, bool setCursorHere = false, bool invert_when_selected = true)
|
||||
{
|
||||
ComponentListRow row;
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, strToUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), TextComponent::ALIGN_CENTER);
|
||||
row.addElement(std::make_shared<TextComponent>(mWindow, strToUpper(label), Font::get(FONT_SIZE_MEDIUM), 0x777777FF), ALIGN_CENTER);
|
||||
row.addElement(comp, false, invert_when_selected);
|
||||
addRow(row, setCursorHere);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
auto font = Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT);
|
||||
mText.setFont(font);
|
||||
mText.setColor(0x777777FF);
|
||||
mText.setAlignment(TextComponent::ALIGN_CENTER);
|
||||
mText.setAlignment(ALIGN_CENTER);
|
||||
addChild(&mText);
|
||||
|
||||
if(mMultiSelect)
|
||||
|
|
|
@ -14,13 +14,6 @@ class ThemeData;
|
|||
class TextComponent : public GuiComponent
|
||||
{
|
||||
public:
|
||||
enum Alignment
|
||||
{
|
||||
ALIGN_LEFT,
|
||||
ALIGN_CENTER, // centers both horizontally and vertically
|
||||
ALIGN_RIGHT
|
||||
};
|
||||
|
||||
TextComponent(Window* window);
|
||||
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());
|
||||
|
|
|
@ -123,8 +123,6 @@ void TextListComponent<T>::render(const Eigen::Affine3f& parentTrans)
|
|||
|
||||
if(size() == 0)
|
||||
{
|
||||
Renderer::setMatrix(trans);
|
||||
font->drawText("The list is empty.", Eigen::Vector2f(0, 0), 0xFF0000FF);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun) : GuiComponent(w
|
|||
|
||||
// title
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, firstRun ? "WELCOME" : "CONFIGURE INPUT",
|
||||
Font::get(FONT_SIZE_LARGE), 0x555555FF, TextComponent::ALIGN_CENTER);
|
||||
Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mTitle, Vector2i(0, 0), false, true, Vector2i(1, 1), GridFlags::BORDER_BOTTOM);
|
||||
|
||||
// device info
|
||||
|
@ -43,17 +43,17 @@ GuiDetectDevice::GuiDetectDevice(Window* window, bool firstRun) : GuiComponent(w
|
|||
deviceInfo << numDevices << " GAMEPAD" << (numDevices > 1 ? "S" : "") << " DETECTED";
|
||||
else
|
||||
deviceInfo << "NO GAMEPADS DETECTED";
|
||||
mDeviceInfo = std::make_shared<TextComponent>(mWindow, deviceInfo.str(), Font::get(FONT_SIZE_SMALL), 0x999999FF, TextComponent::ALIGN_CENTER);
|
||||
mDeviceInfo = std::make_shared<TextComponent>(mWindow, deviceInfo.str(), Font::get(FONT_SIZE_SMALL), 0x999999FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mDeviceInfo, Vector2i(0, 1), false, true);
|
||||
|
||||
// message
|
||||
mMsg1 = std::make_shared<TextComponent>(mWindow, "HOLD A BUTTON ON YOUR DEVICE TO CONFIGURE IT.", Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||
mMsg1 = std::make_shared<TextComponent>(mWindow, "HOLD A BUTTON ON YOUR DEVICE TO CONFIGURE IT.", Font::get(FONT_SIZE_SMALL), 0x777777FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mMsg1, Vector2i(0, 2), false, true);
|
||||
mMsg2 = std::make_shared<TextComponent>(mWindow, "PRESS F4 TO QUIT AT ANY TIME.", Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||
mMsg2 = std::make_shared<TextComponent>(mWindow, "PRESS F4 TO QUIT AT ANY TIME.", Font::get(FONT_SIZE_SMALL), 0x777777FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mMsg2, Vector2i(0, 3), false, true);
|
||||
|
||||
// currently held device
|
||||
mDeviceHeld = std::make_shared<TextComponent>(mWindow, "", Font::get(FONT_SIZE_MEDIUM), 0xFFFFFFFF, TextComponent::ALIGN_CENTER);
|
||||
mDeviceHeld = std::make_shared<TextComponent>(mWindow, "", Font::get(FONT_SIZE_MEDIUM), 0xFFFFFFFF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mDeviceHeld, Vector2i(0, 4), false, true);
|
||||
|
||||
setSize(Renderer::getScreenWidth() * 0.6f, Renderer::getScreenHeight() * 0.5f);
|
||||
|
|
|
@ -19,14 +19,14 @@ GuiFastSelect::GuiFastSelect(Window* window, IGameListView* gamelist) : GuiCompo
|
|||
addChild(&mBackground);
|
||||
|
||||
mLetterText.setSize(mSize.x(), mSize.y() * 0.75f);
|
||||
mLetterText.setAlignment(TextComponent::ALIGN_CENTER);
|
||||
mLetterText.setAlignment(ALIGN_CENTER);
|
||||
mLetterText.applyTheme(theme, "fastSelect", "letter", FONT_PATH | COLOR);
|
||||
// TODO - set font size
|
||||
addChild(&mLetterText);
|
||||
|
||||
mSortText.setPosition(0, mSize.y() * 0.75f);
|
||||
mSortText.setSize(mSize.x(), mSize.y() * 0.25f);
|
||||
mSortText.setAlignment(TextComponent::ALIGN_CENTER);
|
||||
mSortText.setAlignment(ALIGN_CENTER);
|
||||
mSortText.applyTheme(theme, "fastSelect", "subtext", FONT_PATH | COLOR);
|
||||
// TODO - set font size
|
||||
addChild(&mSortText);
|
||||
|
|
|
@ -21,13 +21,13 @@ GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std::
|
|||
// row 0 is a spacer
|
||||
|
||||
mGameName = std::make_shared<TextComponent>(mWindow, strToUpper(mSearchParams.game->getPath().filename().generic_string()),
|
||||
Font::get(FONT_SIZE_MEDIUM), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||
Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mGameName, Eigen::Vector2i(0, 1), false, true);
|
||||
|
||||
// row 2 is a spacer
|
||||
|
||||
mSystemName = std::make_shared<TextComponent>(mWindow, strToUpper(mSearchParams.system->getFullName()), Font::get(FONT_SIZE_SMALL),
|
||||
0x888888FF, TextComponent::ALIGN_CENTER);
|
||||
0x888888FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mSystemName, Eigen::Vector2i(0, 3), false, true);
|
||||
|
||||
// row 4 is a spacer
|
||||
|
|
|
@ -40,7 +40,7 @@ GuiInputConfig::GuiInputConfig(Window* window, InputConfig* target, bool reconfi
|
|||
// 0 is a spacer row
|
||||
mGrid.setEntry(std::make_shared<GuiComponent>(mWindow), Vector2i(0, 0), false);
|
||||
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, "CONFIGURING", Font::get(FONT_SIZE_LARGE), 0x555555FF, TextComponent::ALIGN_CENTER);
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, "CONFIGURING", Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mTitle, Vector2i(0, 1), false, true);
|
||||
|
||||
std::stringstream ss;
|
||||
|
@ -48,10 +48,10 @@ GuiInputConfig::GuiInputConfig(Window* window, InputConfig* target, bool reconfi
|
|||
ss << "KEYBOARD";
|
||||
else
|
||||
ss << "GAMEPAD " << (target->getDeviceId() + 1);
|
||||
mSubtitle1 = std::make_shared<TextComponent>(mWindow, strToUpper(ss.str()), Font::get(FONT_SIZE_MEDIUM), 0x555555FF, TextComponent::ALIGN_CENTER);
|
||||
mSubtitle1 = std::make_shared<TextComponent>(mWindow, strToUpper(ss.str()), Font::get(FONT_SIZE_MEDIUM), 0x555555FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mSubtitle1, Vector2i(0, 2), false, true);
|
||||
|
||||
mSubtitle2 = std::make_shared<TextComponent>(mWindow, "HOLD ANY BUTTON TO SKIP", Font::get(FONT_SIZE_SMALL), 0x99999900, TextComponent::ALIGN_CENTER);
|
||||
mSubtitle2 = std::make_shared<TextComponent>(mWindow, "HOLD ANY BUTTON TO SKIP", Font::get(FONT_SIZE_SMALL), 0x99999900, ALIGN_CENTER);
|
||||
mGrid.setEntry(mSubtitle2, Vector2i(0, 3), false, true);
|
||||
|
||||
// 4 is a spacer row
|
||||
|
@ -76,7 +76,7 @@ GuiInputConfig::GuiInputConfig(Window* window, InputConfig* target, bool reconfi
|
|||
auto text = std::make_shared<TextComponent>(mWindow, inputDispName[i], Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
||||
row.addElement(text, true);
|
||||
|
||||
auto mapping = std::make_shared<TextComponent>(mWindow, "-NOT DEFINED-", Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT), 0x999999FF, TextComponent::ALIGN_RIGHT);
|
||||
auto mapping = std::make_shared<TextComponent>(mWindow, "-NOT DEFINED-", Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT), 0x999999FF, ALIGN_RIGHT);
|
||||
setNotDefined(mapping); // overrides text and color set above
|
||||
row.addElement(mapping, true);
|
||||
mMappings.push_back(mapping);
|
||||
|
|
|
@ -206,7 +206,7 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
|
|||
mVersion.setFont(Font::get(FONT_SIZE_SMALL));
|
||||
mVersion.setColor(0xC6C6C6FF);
|
||||
mVersion.setText("EMULATIONSTATION V" PROGRAM_VERSION_STRING);
|
||||
mVersion.setAlignment(TextComponent::ALIGN_CENTER);
|
||||
mVersion.setAlignment(ALIGN_CENTER);
|
||||
|
||||
addChild(&mMenu);
|
||||
addChild(&mVersion);
|
||||
|
|
|
@ -30,9 +30,9 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
|||
|
||||
mHeaderGrid = std::make_shared<ComponentGrid>(mWindow, Vector2i(1, 5));
|
||||
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, "EDIT METADATA", Font::get(FONT_SIZE_LARGE), 0x333333FF, TextComponent::ALIGN_CENTER);
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, "EDIT METADATA", Font::get(FONT_SIZE_LARGE), 0x333333FF, ALIGN_CENTER);
|
||||
mSubtitle = std::make_shared<TextComponent>(mWindow, strToUpper(scraperParams.game->getPath().filename().generic_string()),
|
||||
Font::get(FONT_SIZE_SMALL), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||
Font::get(FONT_SIZE_SMALL), 0x777777FF, ALIGN_CENTER);
|
||||
mHeaderGrid->setEntry(mTitle, Vector2i(0, 1), false, true);
|
||||
mHeaderGrid->setEntry(mSubtitle, Vector2i(0, 3), false, true);
|
||||
|
||||
|
@ -98,7 +98,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
|||
default:
|
||||
{
|
||||
// MD_STRING
|
||||
ed = std::make_shared<TextComponent>(window, "", Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT), 0x777777FF, TextComponent::ALIGN_RIGHT);
|
||||
ed = std::make_shared<TextComponent>(window, "", Font::get(FONT_SIZE_SMALL, FONT_PATH_LIGHT), 0x777777FF, ALIGN_RIGHT);
|
||||
row.addElement(ed, true);
|
||||
|
||||
auto spacer = std::make_shared<GuiComponent>(mWindow);
|
||||
|
|
|
@ -16,7 +16,7 @@ GuiMsgBox::GuiMsgBox(Window* window, const std::string& text,
|
|||
float width = Renderer::getScreenWidth() * 0.6f; // max width
|
||||
float minWidth = Renderer::getScreenWidth() * 0.3f; // minimum width
|
||||
|
||||
mMsg = std::make_shared<TextComponent>(mWindow, text, Font::get(FONT_SIZE_MEDIUM), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||
mMsg = std::make_shared<TextComponent>(mWindow, text, Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mMsg, Eigen::Vector2i(0, 0), false, false);
|
||||
|
||||
// create the buttons
|
||||
|
|
|
@ -25,13 +25,13 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
|
|||
mTotalSkipped = 0;
|
||||
|
||||
// set up grid
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, "SCRAPING IN PROGRESS", Font::get(FONT_SIZE_LARGE), 0x555555FF, TextComponent::ALIGN_CENTER);
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, "SCRAPING IN PROGRESS", Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mTitle, Vector2i(0, 0), false, true);
|
||||
|
||||
mSystem = std::make_shared<TextComponent>(mWindow, "SYSTEM", Font::get(FONT_SIZE_MEDIUM), 0x777777FF, TextComponent::ALIGN_CENTER);
|
||||
mSystem = std::make_shared<TextComponent>(mWindow, "SYSTEM", Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mSystem, Vector2i(0, 1), false, true);
|
||||
|
||||
mSubtitle = std::make_shared<TextComponent>(mWindow, "subtitle text", Font::get(FONT_SIZE_SMALL), 0x888888FF, TextComponent::ALIGN_CENTER);
|
||||
mSubtitle = std::make_shared<TextComponent>(mWindow, "subtitle text", Font::get(FONT_SIZE_SMALL), 0x888888FF, ALIGN_CENTER);
|
||||
mGrid.setEntry(mSubtitle, Vector2i(0, 2), false, true);
|
||||
|
||||
mSearchComp = std::make_shared<ScraperSearchComponent>(mWindow,
|
||||
|
|
|
@ -10,7 +10,7 @@ GuiTextEditPopup::GuiTextEditPopup(Window* window, const std::string& title, con
|
|||
addChild(&mBackground);
|
||||
addChild(&mGrid);
|
||||
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, strToUpper(title), Font::get(FONT_SIZE_LARGE), 0x555555FF, TextComponent::ALIGN_CENTER);
|
||||
mTitle = std::make_shared<TextComponent>(mWindow, strToUpper(title), Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER);
|
||||
|
||||
mText = std::make_shared<TextEditComponent>(mWindow);
|
||||
mText->setValue(initValue);
|
||||
|
|
|
@ -228,14 +228,6 @@ void Font::buildAtlas(ResourceData data)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Font::drawText(std::string text, const Eigen::Vector2f& offset, unsigned int color)
|
||||
{
|
||||
TextCache* cache = buildTextCache(text, offset[0], offset[1], color);
|
||||
renderTextCache(cache);
|
||||
delete cache;
|
||||
}
|
||||
|
||||
void Font::renderTextCache(TextCache* cache)
|
||||
{
|
||||
if(!textureID)
|
||||
|
@ -315,25 +307,6 @@ float Font::getLetterHeight() const
|
|||
return charData['S'].texH * fontScale;
|
||||
}
|
||||
|
||||
void Font::drawCenteredText(std::string text, float xOffset, float y, unsigned int color)
|
||||
{
|
||||
Eigen::Vector2f pos = sizeText(text);
|
||||
|
||||
pos[0] = (Renderer::getScreenWidth() - pos.x());
|
||||
pos[0] = (pos.x() / 2) + (xOffset / 2);
|
||||
pos[1] = y;
|
||||
|
||||
drawText(text, pos, color);
|
||||
}
|
||||
|
||||
//this could probably be optimized
|
||||
//draws text and ensures it's never longer than xLen
|
||||
void Font::drawWrappedText(std::string text, const Eigen::Vector2f& offset, float xLen, unsigned int color)
|
||||
{
|
||||
text = wrapText(text, xLen);
|
||||
drawText(text, offset, color);
|
||||
}
|
||||
|
||||
//the worst algorithm ever written
|
||||
//breaks up a normal string with newlines to make it fit xLen
|
||||
std::string Font::wrapText(std::string text, float xLen) const
|
||||
|
@ -447,6 +420,19 @@ Eigen::Vector2f Font::getWrappedTextCursorOffset(std::string text, float xLen, i
|
|||
//TextCache
|
||||
//=============================================================================================================
|
||||
|
||||
TextCache* Font::buildWrappedTextCache(const std::string& text, const Eigen::Vector2f& offset, float xLen, Alignment alignment, unsigned int color)
|
||||
{
|
||||
if(!textureID)
|
||||
{
|
||||
LOG(LogError) << "Error - tried to build TextCache with Font that has no texture loaded!";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// todo
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TextCache* Font::buildTextCache(const std::string& text, float offsetX, float offsetY, unsigned int color)
|
||||
{
|
||||
if(!textureID)
|
||||
|
|
|
@ -19,6 +19,13 @@ class TextCache;
|
|||
#define FONT_PATH_LIGHT ":/opensans_hebrew_condensed_light.ttf"
|
||||
#define FONT_PATH_REGULAR ":/opensans_hebrew_condensed_regular.ttf"
|
||||
|
||||
enum Alignment
|
||||
{
|
||||
ALIGN_LEFT,
|
||||
ALIGN_CENTER, // centers both horizontally and vertically
|
||||
ALIGN_RIGHT
|
||||
};
|
||||
|
||||
//A TrueType Font renderer that uses FreeType and OpenGL.
|
||||
//The library is automatically initialized when it's needed.
|
||||
class Font : public IReloadable
|
||||
|
@ -50,20 +57,14 @@ public:
|
|||
|
||||
GLuint textureID;
|
||||
|
||||
Eigen::Vector2f sizeText(std::string text) const; // Returns the expected size of a string when rendered. Extra spacing is applied to the Y axis.
|
||||
TextCache* buildTextCache(const std::string& text, float offsetX, float offsetY, unsigned int color);
|
||||
TextCache* buildWrappedTextCache(const std::string& text, const Eigen::Vector2f& offset, float xLen, Alignment alignment, unsigned int color);
|
||||
void renderTextCache(TextCache* cache);
|
||||
|
||||
//Create a TextCache, render with it, then delete it. Best used for short text or text that changes frequently.
|
||||
void drawText(std::string text, const Eigen::Vector2f& offset, unsigned int color);
|
||||
Eigen::Vector2f sizeText(std::string text) const; //Sets the width and height of a given string to supplied pointers. A dimension is skipped if its pointer is NULL.
|
||||
|
||||
std::string wrapText(std::string text, float xLen) const;
|
||||
|
||||
void drawWrappedText(std::string text, const Eigen::Vector2f& offset, float xLen, unsigned int color);
|
||||
Eigen::Vector2f sizeWrappedText(std::string text, float xLen) const;
|
||||
Eigen::Vector2f getWrappedTextCursorOffset(std::string text, float xLen, int cursor) const;
|
||||
|
||||
void drawCenteredText(std::string text, float xOffset, float y, unsigned int color);
|
||||
std::string wrapText(std::string text, float xLen) const; // Inserts newlines into text to make it wrap properly.
|
||||
Eigen::Vector2f sizeWrappedText(std::string text, float xLen) const; // Returns the expected size of a string after wrapping is applied.
|
||||
Eigen::Vector2f getWrappedTextCursorOffset(std::string text, float xLen, int cursor) const; // Returns the position of of the cursor after moving "cursor" characters.
|
||||
|
||||
float getHeight() const;
|
||||
float getLetterHeight() const;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define BAND_HEIGHT (logoSize().y() * SELECTED_SCALE)
|
||||
|
||||
SystemView::SystemView(Window* window) : IList<SystemViewData, SystemData*>(window, LIST_SCROLL_STYLE_SLOW, LIST_ALWAYS_LOOP),
|
||||
mSystemInfo(window, "SYSTEM INFO", Font::get(FONT_SIZE_SMALL), 0x33333300, TextComponent::ALIGN_CENTER)
|
||||
mSystemInfo(window, "SYSTEM INFO", Font::get(FONT_SIZE_SMALL), 0x33333300, ALIGN_CENTER)
|
||||
{
|
||||
mCamOffset = 0;
|
||||
|
||||
|
@ -58,7 +58,7 @@ void SystemView::populate()
|
|||
(*it)->getName(),
|
||||
Font::get(FONT_SIZE_LARGE),
|
||||
0x000000FF,
|
||||
TextComponent::ALIGN_CENTER);
|
||||
ALIGN_CENTER);
|
||||
text->setSize(logoSize());
|
||||
e.data.logo = std::shared_ptr<GuiComponent>(text);
|
||||
|
||||
|
@ -66,7 +66,7 @@ void SystemView::populate()
|
|||
(*it)->getName(),
|
||||
Font::get((int)(FONT_SIZE_LARGE * SELECTED_SCALE)),
|
||||
0x000000FF,
|
||||
TextComponent::ALIGN_CENTER);
|
||||
ALIGN_CENTER);
|
||||
textSelected->setSize(logoSize());
|
||||
e.data.logoSelected = std::shared_ptr<GuiComponent>(textSelected);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ ISimpleGameListView::ISimpleGameListView(Window* window, FileData* root) : IGame
|
|||
mHeaderText.setText("Logo Text");
|
||||
mHeaderText.setSize(mSize.x(), 0);
|
||||
mHeaderText.setPosition(0, 0);
|
||||
mHeaderText.setAlignment(TextComponent::ALIGN_CENTER);
|
||||
mHeaderText.setAlignment(ALIGN_CENTER);
|
||||
|
||||
mHeaderImage.setResize(0, mSize.y() * 0.185f);
|
||||
mHeaderImage.setOrigin(0.5f, 0.0f);
|
||||
|
|
Loading…
Reference in a new issue