mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Added fast select font tag.
This commit is contained in:
parent
fa7f0a488c
commit
34c3d607b5
|
@ -140,6 +140,7 @@ Display tags define some "meta" display attributes about your theme. Display tag
|
|||
|
||||
`<boxCorner>` - path to the "top left corner" image file. It will be flipped for the top right, bottom right, and bottom left corners. ~ and . are expanded.
|
||||
|
||||
There is also a `<fastSelectFont>` font tag (see the Fonts section for more info).
|
||||
|
||||
|
||||
Fonts
|
||||
|
@ -156,12 +157,15 @@ Fonts are defined like so:
|
|||
|
||||
You can leave off any tags you don't want to use, and they'll use the default. Size is defined as a percentage of the screen height. "." and "~" are expanded for paths.
|
||||
|
||||
NOTE: If your font size is too big, it'll overrun the maximum texture size.
|
||||
|
||||
**Font tags:**
|
||||
|
||||
`<listFont>` - font to use for the game list.
|
||||
|
||||
`<descriptionFont>` - font to use for description text.
|
||||
|
||||
`<fastSelectFont>` - font to use for the fast select letter.
|
||||
|
||||
Audio
|
||||
=====
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
March 17, 2013
|
||||
-Added Fast Select font tag.
|
||||
|
||||
January 26, 2013
|
||||
-Added "Reload" option to the menu. This option reloads all game data.
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ const std::string GuiFastSelect::LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|||
const int GuiFastSelect::SCROLLSPEED = 100;
|
||||
const int GuiFastSelect::SCROLLDELAY = 507;
|
||||
|
||||
GuiFastSelect::GuiFastSelect(GuiComponent* parent, GuiList<FileData*>* list, char startLetter, GuiBoxData data, int textcolor, Sound* scrollsound)
|
||||
GuiFastSelect::GuiFastSelect(GuiComponent* parent, GuiList<FileData*>* list, char startLetter, GuiBoxData data, int textcolor, Sound* scrollsound, Font* font)
|
||||
{
|
||||
mLetterID = LETTERS.find(toupper(startLetter));
|
||||
if(mLetterID == std::string::npos)
|
||||
|
@ -18,6 +18,7 @@ GuiFastSelect::GuiFastSelect(GuiComponent* parent, GuiList<FileData*>* list, cha
|
|||
mParent = parent;
|
||||
mList = list;
|
||||
mScrollSound = scrollsound;
|
||||
mFont = font;
|
||||
|
||||
mScrolling = false;
|
||||
mScrollTimer = 0;
|
||||
|
@ -51,7 +52,7 @@ void GuiFastSelect::onRender()
|
|||
|
||||
mBox->render();
|
||||
|
||||
Renderer::drawCenteredText(LETTERS.substr(mLetterID, 1), 0, sh * 0.5 - (Renderer::getDefaultFont(Renderer::LARGE)->getHeight() * 0.5), mTextColor, Renderer::getDefaultFont(Renderer::LARGE));
|
||||
Renderer::drawCenteredText(LETTERS.substr(mLetterID, 1), 0, sh * 0.5 - (mFont->getHeight() * 0.5), mTextColor, mFont);
|
||||
}
|
||||
|
||||
void GuiFastSelect::onInput(InputManager::InputButton button, bool keyDown)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
class GuiFastSelect : GuiComponent
|
||||
{
|
||||
public:
|
||||
GuiFastSelect(GuiComponent* parent, GuiList<FileData*>* list, char startLetter, GuiBoxData data, int textcolor, Sound* scrollsound);
|
||||
GuiFastSelect(GuiComponent* parent, GuiList<FileData*>* list, char startLetter, GuiBoxData data, int textcolor, Sound* scrollsound, Font* font);
|
||||
~GuiFastSelect();
|
||||
|
||||
void onRender();
|
||||
|
@ -38,6 +38,7 @@ private:
|
|||
bool mScrolling;
|
||||
|
||||
Sound* mScrollSound;
|
||||
Font* mFont;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -170,7 +170,7 @@ void GuiGameList::onInput(InputManager::InputButton button, bool keyDown)
|
|||
//open the fast select menu
|
||||
if(button == InputManager::SELECT && keyDown)
|
||||
{
|
||||
new GuiFastSelect(this, mList, mList->getSelectedObject()->getName()[0], mTheme->getBoxData(), mTheme->getColor("fastSelect"), mTheme->getSound("menuScroll"));
|
||||
new GuiFastSelect(this, mList, mList->getSelectedObject()->getName()[0], mTheme->getBoxData(), mTheme->getColor("fastSelect"), mTheme->getSound("menuScroll"), mTheme->getFastSelectFont());
|
||||
}
|
||||
|
||||
if(mDetailed)
|
||||
|
|
|
@ -51,6 +51,14 @@ Font* GuiTheme::getDescriptionFont()
|
|||
return mDescFont;
|
||||
}
|
||||
|
||||
Font* GuiTheme::getFastSelectFont()
|
||||
{
|
||||
if(mFastSelectFont == NULL)
|
||||
return Renderer::getDefaultFont(Renderer::LARGE);
|
||||
else
|
||||
return mFastSelectFont;
|
||||
}
|
||||
|
||||
GuiTheme::GuiTheme(bool detailed, std::string path)
|
||||
{
|
||||
mDetailed = detailed;
|
||||
|
@ -62,6 +70,7 @@ GuiTheme::GuiTheme(bool detailed, std::string path)
|
|||
|
||||
mListFont = NULL;
|
||||
mDescFont = NULL;
|
||||
mFastSelectFont = NULL;
|
||||
|
||||
setDefaults();
|
||||
|
||||
|
@ -122,6 +131,11 @@ void GuiTheme::setDefaults()
|
|||
delete mDescFont;
|
||||
mDescFont = NULL;
|
||||
}
|
||||
if(mFastSelectFont != NULL)
|
||||
{
|
||||
delete mFastSelectFont;
|
||||
mFastSelectFont = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void GuiTheme::deleteComponents()
|
||||
|
@ -134,6 +148,9 @@ void GuiTheme::deleteComponents()
|
|||
mComponentVector.clear();
|
||||
|
||||
clearChildren();
|
||||
|
||||
//deletes fonts if any were created
|
||||
setDefaults();
|
||||
}
|
||||
|
||||
|
||||
|
@ -234,6 +251,7 @@ void GuiTheme::readXML(std::string path)
|
|||
//fonts
|
||||
mListFont = resolveFont(root.child("listFont"), Font::getDefaultPath(), Renderer::getDefaultFont(Renderer::MEDIUM)->getSize());
|
||||
mDescFont = resolveFont(root.child("descriptionFont"), Font::getDefaultPath(), Renderer::getDefaultFont(Renderer::SMALL)->getSize());
|
||||
mFastSelectFont = resolveFont(root.child("fastSelectFont"), Font::getDefaultPath(), Renderer::getDefaultFont(Renderer::LARGE)->getSize());
|
||||
|
||||
//actually read the components
|
||||
createComponentChildren(root, this);
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
|
||||
Font* getListFont();
|
||||
Font* getDescriptionFont();
|
||||
Font* getFastSelectFont();
|
||||
private:
|
||||
void setDefaults();
|
||||
void deleteComponents();
|
||||
|
@ -53,6 +54,7 @@ private:
|
|||
GuiBoxData mBoxData;
|
||||
Font* mListFont;
|
||||
Font* mDescFont;
|
||||
Font* mFastSelectFont;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue