mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 21:54:15 +01:00
-draw button text the same way as labels to fix problems with
displaying things like _ or ' (issue 97)
This commit is contained in:
parent
6e9b705ce2
commit
4f033e38a7
@ -38,7 +38,8 @@ s16 CButtonsMgr::addButton(SFont font, const wstringEx &text, int x, int y, u32
|
|||||||
|
|
||||||
b->font = font;
|
b->font = font;
|
||||||
b->visible = false;
|
b->visible = false;
|
||||||
b->text = text;
|
//b->text = text;
|
||||||
|
b->text.setText(b->font, text);
|
||||||
b->textColor = color;
|
b->textColor = color;
|
||||||
b->x = x + width / 2;
|
b->x = x + width / 2;
|
||||||
b->y = y + height / 2;
|
b->y = y + height / 2;
|
||||||
@ -379,6 +380,7 @@ void CButtonsMgr::SButton::tick(void)
|
|||||||
CButtonsMgr::SElement::tick();
|
CButtonsMgr::SElement::tick();
|
||||||
click += -click * 0.2f;
|
click += -click * 0.2f;
|
||||||
if (click < 0.01f) click = 0.f;
|
if (click < 0.01f) click = 0.f;
|
||||||
|
text.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CButtonsMgr::SProgressBar::tick(void)
|
void CButtonsMgr::SProgressBar::tick(void)
|
||||||
@ -483,10 +485,13 @@ void CButtonsMgr::setText(s16 id, const wstringEx &text, bool unwrap)
|
|||||||
if (id < (s32)m_elts.size())
|
if (id < (s32)m_elts.size())
|
||||||
{
|
{
|
||||||
CButtonsMgr::SLabel *lbl;
|
CButtonsMgr::SLabel *lbl;
|
||||||
|
CButtonsMgr::SButton *btn;
|
||||||
switch (m_elts[id]->t)
|
switch (m_elts[id]->t)
|
||||||
{
|
{
|
||||||
case CButtonsMgr::GUIELT_BUTTON:
|
case CButtonsMgr::GUIELT_BUTTON:
|
||||||
((CButtonsMgr::SButton *)m_elts[id].get())->text = text;
|
//((CButtonsMgr::SButton *)m_elts[id].get())->text = text;
|
||||||
|
btn = (CButtonsMgr::SButton *)m_elts[id].get();
|
||||||
|
btn->text.setText(btn->font, text);
|
||||||
break;
|
break;
|
||||||
case CButtonsMgr::GUIELT_LABEL:
|
case CButtonsMgr::GUIELT_LABEL:
|
||||||
lbl = (CButtonsMgr::SLabel *)m_elts[id].get();
|
lbl = (CButtonsMgr::SLabel *)m_elts[id].get();
|
||||||
@ -506,10 +511,13 @@ void CButtonsMgr::setText(s16 id, const wstringEx &text, u32 startline,bool unwr
|
|||||||
if (id < (s32)m_elts.size())
|
if (id < (s32)m_elts.size())
|
||||||
{
|
{
|
||||||
CButtonsMgr::SLabel *lbl;
|
CButtonsMgr::SLabel *lbl;
|
||||||
|
CButtonsMgr::SButton *btn;
|
||||||
switch (m_elts[id]->t)
|
switch (m_elts[id]->t)
|
||||||
{
|
{
|
||||||
case CButtonsMgr::GUIELT_BUTTON:
|
case CButtonsMgr::GUIELT_BUTTON:
|
||||||
//((CButtonsMgr::SButton *)m_elts[id].get())->text = text;
|
//((CButtonsMgr::SButton *)m_elts[id].get())->text = text;
|
||||||
|
btn = (CButtonsMgr::SButton *)m_elts[id].get();
|
||||||
|
btn->text.setText(btn->font, text);
|
||||||
break;
|
break;
|
||||||
case CButtonsMgr::GUIELT_LABEL:
|
case CButtonsMgr::GUIELT_LABEL:
|
||||||
lbl = (CButtonsMgr::SLabel *)m_elts[id].get();
|
lbl = (CButtonsMgr::SLabel *)m_elts[id].get();
|
||||||
@ -591,7 +599,7 @@ void CButtonsMgr::setProgress(s16 id, float f, bool instant)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CButtonsMgr::_drawBtn(const CButtonsMgr::SButton &b, bool selected, bool click)
|
void CButtonsMgr::_drawBtn(CButtonsMgr::SButton &b, bool selected, bool click)
|
||||||
{
|
{
|
||||||
GXTexObj texObjLeft;
|
GXTexObj texObjLeft;
|
||||||
GXTexObj texObjCenter;
|
GXTexObj texObjCenter;
|
||||||
@ -699,10 +707,13 @@ void CButtonsMgr::_drawBtn(const CButtonsMgr::SButton &b, bool selected, bool cl
|
|||||||
}
|
}
|
||||||
if (!b.font.font) return;
|
if (!b.font.font) return;
|
||||||
b.font.font->reset();
|
b.font.font->reset();
|
||||||
CColor txtColor(b.textColor.r, b.textColor.g, b.textColor.b, (u8)((int)b.textColor.a * (int)alpha / 0xFF));
|
//CColor txtColor(b.textColor.r, b.textColor.g, b.textColor.b, (u8)((int)b.textColor.a * (int)alpha / 0xFF));
|
||||||
b.font.font->setXScale(scaleX);
|
b.font.font->setXScale(scaleX);
|
||||||
b.font.font->setYScale(scaleY);
|
b.font.font->setYScale(scaleY);
|
||||||
b.font.font->drawText(0, 0, b.text.c_str(), txtColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
|
//b.font.font->drawText(0, 0, b.text.c_str(), txtColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
|
||||||
|
b.text.setColor(CColor(b.textColor.r, b.textColor.g, b.textColor.b, (u8)((int)b.textColor.a * (int)alpha / 0xFF)));
|
||||||
|
b.text.setFrame(b.w, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, true, true);
|
||||||
|
b.text.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CButtonsMgr::_drawLbl(CButtonsMgr::SLabel &b)
|
void CButtonsMgr::_drawLbl(CButtonsMgr::SLabel &b)
|
||||||
|
@ -108,7 +108,7 @@ private:
|
|||||||
{
|
{
|
||||||
SFont font;
|
SFont font;
|
||||||
SButtonTextureSet tex;
|
SButtonTextureSet tex;
|
||||||
wstringEx text;
|
CText text;
|
||||||
CColor textColor;
|
CColor textColor;
|
||||||
float click;
|
float click;
|
||||||
SmartGuiSound clickSound;
|
SmartGuiSound clickSound;
|
||||||
@ -152,7 +152,7 @@ private:
|
|||||||
bool m_mouse;
|
bool m_mouse;
|
||||||
CVideo m_vid;
|
CVideo m_vid;
|
||||||
private:
|
private:
|
||||||
void _drawBtn(const SButton &b, bool selected, bool click);
|
void _drawBtn(SButton &b, bool selected, bool click);
|
||||||
void _drawLbl(SLabel &b);
|
void _drawLbl(SLabel &b);
|
||||||
void _drawPBar(const SProgressBar &b);
|
void _drawPBar(const SProgressBar &b);
|
||||||
static STexture _noTexture;
|
static STexture _noTexture;
|
||||||
|
Loading…
Reference in New Issue
Block a user