support scaling of avatar texture - multiples of 35x50

default was 35x50 avatar texture, if using 3x  (105x150), it will scale
it :)
This commit is contained in:
Anthony Calosa
2015-10-07 10:57:08 +08:00
parent 45b570b6f7
commit fb89183767
2 changed files with 6 additions and 6 deletions

View File

@@ -60,8 +60,8 @@ void GuiAvatar::Render()
{ {
if (corner == BOTTOM_RIGHT) if (corner == BOTTOM_RIGHT)
{ {
x0 -= player->getIcon()->mWidth * actZ; x0 -= Width * actZ;
y0 -= player->getIcon()->mHeight * actZ; y0 -= Height * actZ;
} }
switch (corner) switch (corner)
{ {
@@ -69,14 +69,14 @@ void GuiAvatar::Render()
player->getIcon()->SetHotSpot(0, 0); player->getIcon()->SetHotSpot(0, 0);
break; break;
case BOTTOM_RIGHT: case BOTTOM_RIGHT:
player->getIcon()->SetHotSpot(35, 50); player->getIcon()->SetHotSpot(player->getIcon()->mWidth, player->getIcon()->mHeight);
break; break;
} }
player->getIcon()->SetColor(ARGB((int)actA, 255, avatarRed, avatarRed)); player->getIcon()->SetColor(ARGB((int)actA, 255, avatarRed, avatarRed));
r->RenderQuad(player->getIcon().get(), actX, actY, actT, actZ, actZ); r->RenderQuad(player->getIcon().get(), actX, actY, actT, Width/player->getIcon()->mWidth*actZ, Height/player->getIcon()->mHeight*actZ);
if (mHasFocus) if (mHasFocus)
{ {
r->FillRect(x0, x0, player->getIcon()->mWidth * actZ, player->getIcon()->mHeight * actZ, ARGB(abs(128 - wave),255,255,255)); r->FillRect(x0, x0, Width/player->getIcon()->mWidth * actZ, Height/player->getIcon()->mHeight * actZ, ARGB(abs(128 - wave),255,255,255));
} }
} }

View File

@@ -89,7 +89,7 @@ bool Player::loadAvatar(string file, string resName)
} }
mAvatarTex = rm->RetrieveTexture(file, RETRIEVE_LOCK, TEXTURE_SUB_AVATAR); mAvatarTex = rm->RetrieveTexture(file, RETRIEVE_LOCK, TEXTURE_SUB_AVATAR);
if (mAvatarTex) { if (mAvatarTex) {
mAvatar = rm->RetrieveQuad(file, 0, 0, 35, 50, resName, RETRIEVE_NORMAL, TEXTURE_SUB_AVATAR); mAvatar = rm->RetrieveQuad(file, 0, 0, 0, 0, resName, RETRIEVE_NORMAL, TEXTURE_SUB_AVATAR);
return true; return true;
} }