mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- fixed: The alternative HUD's number printing function did not take texture scaling into account when calculating the printing position.
SVN r2947 (trunk)
This commit is contained in:
parent
8806ec294f
commit
650da24364
2 changed files with 12 additions and 9 deletions
|
@ -124,16 +124,16 @@ void SetHUDIcon(PClass *cls, FTextureID tex)
|
|||
//---------------------------------------------------------------------------
|
||||
static void DrawImageToBox(FTexture * tex, int x, int y, int w, int h, int trans=0xc000)
|
||||
{
|
||||
float scale1, scale2;
|
||||
double scale1, scale2;
|
||||
|
||||
if (tex)
|
||||
{
|
||||
int texwidth=tex->GetWidth();
|
||||
int texheight=tex->GetHeight();
|
||||
|
||||
if (w<texwidth) scale1=(float)w/texwidth;
|
||||
if (w<texwidth) scale1=(double)w/texwidth;
|
||||
else scale1=1.0f;
|
||||
if (h<texheight) scale2=(float)h/texheight;
|
||||
if (h<texheight) scale2=(double)h/texheight;
|
||||
else scale2=1.0f;
|
||||
if (scale2<scale1) scale1=scale2;
|
||||
|
||||
|
@ -170,11 +170,14 @@ static void DrawHudText(FFont *font, int color, char * text, int x, int y, int t
|
|||
FTexture *texc = font->GetChar(text[i], &width);
|
||||
if (texc != NULL)
|
||||
{
|
||||
int offset = texc->TopOffset - tex_zero->TopOffset + tex_zero->GetHeight();
|
||||
double offset = texc->GetScaledTopOffsetDouble()
|
||||
- tex_zero->GetScaledTopOffsetDouble()
|
||||
+ tex_zero->GetScaledHeightDouble();
|
||||
|
||||
screen->DrawChar(font, color, x, y, text[i],
|
||||
DTA_KeepRatio, true,
|
||||
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans,
|
||||
DTA_LeftOffset, width/2, DTA_TopOffset, offset,
|
||||
DTA_LeftOffset, width/2, DTA_TopOffsetF, offset,
|
||||
/*DTA_CenterBottomOffset, 1,*/ TAG_DONE);
|
||||
}
|
||||
x += zerowidth;
|
||||
|
|
|
@ -182,13 +182,13 @@ public:
|
|||
|
||||
int GetScaledWidth () { int foo = (Width << 17) / xScale; return (foo >> 1) + (foo & 1); }
|
||||
int GetScaledHeight () { int foo = (Height << 17) / yScale; return (foo >> 1) + (foo & 1); }
|
||||
double GetScaledWidthDouble () { return (Width * 65536.f) / xScale; }
|
||||
double GetScaledHeightDouble () { return (Height * 65536.f) / yScale; }
|
||||
double GetScaledWidthDouble () { return (Width * 65536.) / xScale; }
|
||||
double GetScaledHeightDouble () { return (Height * 65536.) / yScale; }
|
||||
|
||||
int GetScaledLeftOffset () { int foo = (LeftOffset << 17) / xScale; return (foo >> 1) + (foo & 1); }
|
||||
int GetScaledTopOffset () { int foo = (TopOffset << 17) / yScale; return (foo >> 1) + (foo & 1); }
|
||||
double GetScaledLeftOffsetDouble() { return (LeftOffset * 65536.f) / xScale; }
|
||||
double GetScaledTopOffsetDouble() { return (TopOffset * 65536.f) / yScale; }
|
||||
double GetScaledLeftOffsetDouble() { return (LeftOffset * 65536.) / xScale; }
|
||||
double GetScaledTopOffsetDouble() { return (TopOffset * 65536.) / yScale; }
|
||||
|
||||
virtual void SetFrontSkyLayer();
|
||||
|
||||
|
|
Loading…
Reference in a new issue