mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 15:21:48 +00:00
- properly scale imgWeap x position based on length of ammo string.
* Simple divisor based on length of string was insufficient, ammo sprite was too close to ammo count when ammo string length was 1-2. * Using chain-cannon with ammo levels at 100, 10 and 1, at 2560x1440 the sprite is always 48px from the 1 in the ammo count.
This commit is contained in:
parent
72c4a5281c
commit
742fab83df
1 changed files with 14 additions and 7 deletions
|
@ -157,14 +157,21 @@ public:
|
|||
{
|
||||
format.Format("%d", p->ammo_amount[weapon]);
|
||||
SBar_DrawString(this, &numberFont, format, -3, -numberFont.mFont->GetHeight() + 4.5, DI_TEXT_ALIGN_RIGHT, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
int wicon = ammo_sprites[p->curr_weapon];
|
||||
if (wicon > 0)
|
||||
{
|
||||
auto imgWeap = tileGetTexture(wicon);
|
||||
auto weapScale = imgScale / imgWeap->GetDisplayHeight();
|
||||
DrawGraphic(imgWeap, -(15. * format.Len()), -1.5, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, weapScale, weapScale);
|
||||
int wicon = ammo_sprites[p->curr_weapon];
|
||||
if (wicon > 0)
|
||||
{
|
||||
auto imgWeap = tileGetTexture(wicon);
|
||||
auto weapScale = imgScale / imgWeap->GetDisplayHeight();
|
||||
auto imgX = 20.;
|
||||
auto strlen = format.Len();
|
||||
if (strlen > 1)
|
||||
{
|
||||
auto scaler = strlen - 1;
|
||||
imgX += ((imgX / 2.) * scaler) + ((imgX / 10.) * scaler);
|
||||
}
|
||||
DrawGraphic(imgWeap, -imgX, -1.5, DI_ITEM_RIGHT_BOTTOM, 1, -1, -1, weapScale, weapScale);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue