add tooltip on textscroller

This commit is contained in:
Anthony Calosa
2016-07-13 13:07:29 +08:00
parent ab75c1d5e2
commit d6d147187d
2 changed files with 14 additions and 7 deletions

View File

@@ -67,10 +67,18 @@ void TextScroller::Update(float dt)
void TextScroller::Render()
{
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
//JRenderer::GetInstance()->DrawLine(mX,mY,mX+mWidth,mY, ARGB(100, 255, 255, 255));
JRenderer::GetInstance()->FillRoundRect(mX,mY,mWidth,mFont->GetHeight(), 1, ARGB(225,5,5,5));
//JRenderer::GetInstance()->FillRect(mX,mY,mWidth,mFont->GetHeight(), ARGB(25,205,0,0));
//JRenderer::GetInstance()->DrawLine(mX,mY+11,mX+mWidth,mY+11, ARGB(100, 255, 255, 255));
//tooltip
JQuadPtr tooltips;
tooltips = WResourceManager::Instance()->RetrieveTempQuad("tooltips.png");//new graphics tooltips
if (tooltips.get())
{
float xscale = (mWidth+(mWidth/18)) / tooltips->mWidth;
float yscale = mFont->GetHeight() / tooltips->mHeight;
JRenderer::GetInstance()->RenderQuad(tooltips.get(), mX-4.5f, mY+0.5f,0,xscale,yscale);
}
else
JRenderer::GetInstance()->FillRoundRect(mX,mY,mWidth,mFont->GetHeight(), 1, ARGB(225,5,5,5));
//end tooltip
mFont->DrawString(mText.c_str(), mX, mY, JGETEXT_LEFT, start, mWidth);
}