mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-14 13:58:04 +01:00
parent
331f1dc125
commit
cf8b53de01
3 changed files with 30 additions and 9 deletions
|
@ -211,8 +211,7 @@ void TTextBox::Draw()
|
||||||
render::vscreen.XPosition + OffsetX,
|
render::vscreen.XPosition + OffsetX,
|
||||||
render::vscreen.YPosition + OffsetY,
|
render::vscreen.YPosition + OffsetY,
|
||||||
Width,
|
Width,
|
||||||
Height,
|
Height);
|
||||||
255);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ void gdrv::end_blit_sequence()
|
||||||
ReleaseDC(hwnd, sequence_hdc);
|
ReleaseDC(hwnd, sequence_hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gdrv::blit(gdrv_bitmap8* bmp, int xSrc, int ySrcOff, int xDest, int yDest, int DestWidth, int DestHeight)
|
void gdrv::blit(gdrv_bitmap8* bmp, int xSrc, int ySrc, int xDest, int yDest, int DestWidth, int DestHeight)
|
||||||
{
|
{
|
||||||
HDC dc = winmain::_GetDC(hwnd);
|
HDC dc = winmain::_GetDC(hwnd);
|
||||||
SetStretchBltMode(dc, stretchMode);
|
SetStretchBltMode(dc, stretchMode);
|
||||||
|
@ -303,7 +303,7 @@ void gdrv::blit(gdrv_bitmap8* bmp, int xSrc, int ySrcOff, int xDest, int yDest,
|
||||||
DestWidth,
|
DestWidth,
|
||||||
DestHeight,
|
DestHeight,
|
||||||
xSrc,
|
xSrc,
|
||||||
bmp->Height - ySrcOff - DestHeight,
|
bmp->Height - ySrc - DestHeight,
|
||||||
DestWidth,
|
DestWidth,
|
||||||
DestHeight,
|
DestHeight,
|
||||||
bmp,
|
bmp,
|
||||||
|
@ -413,11 +413,24 @@ void gdrv::copy_bitmap_w_transparency(gdrv_bitmap8* dstBmp, int width, int heigh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gdrv::grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width, int height, int a6)
|
void gdrv::grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width, int height)
|
||||||
{
|
{
|
||||||
tagRECT rc{};
|
// Original font was 16 points, used with lowest table resolution
|
||||||
|
static const int fontSizes[3] =
|
||||||
|
{
|
||||||
|
16,
|
||||||
|
22,
|
||||||
|
28
|
||||||
|
};
|
||||||
|
|
||||||
|
xOff = static_cast<int>(xOff * fullscrn::ScaleX) + fullscrn::OffsetX;
|
||||||
|
yOff = static_cast<int>(yOff * fullscrn::ScaleY) + fullscrn::OffsetY;
|
||||||
|
width = static_cast<int>(width * fullscrn::ScaleX);
|
||||||
|
height = static_cast<int>(height * fullscrn::ScaleY);
|
||||||
|
auto fontSize = static_cast<int>(round(fontSizes[fullscrn::GetResolution()] * fullscrn::ScaleY));
|
||||||
|
|
||||||
HDC dc = GetDC(hwnd);
|
HDC dc = GetDC(hwnd);
|
||||||
|
tagRECT rc{};
|
||||||
rc.left = xOff;
|
rc.left = xOff;
|
||||||
rc.right = width + xOff;
|
rc.right = width + xOff;
|
||||||
rc.top = yOff;
|
rc.top = yOff;
|
||||||
|
@ -431,9 +444,18 @@ void gdrv::grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width,
|
||||||
if (fontColor)
|
if (fontColor)
|
||||||
sscanf_s(fontColor, "%d %d %d", &grtext_red, &grtext_green, &grtext_blue);
|
sscanf_s(fontColor, "%d %d %d", &grtext_red, &grtext_green, &grtext_blue);
|
||||||
}
|
}
|
||||||
int prevMode = SetBkMode(dc, 1);
|
|
||||||
|
// Default font does not scale well
|
||||||
|
auto hNewFont = CreateFont(fontSize, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
|
||||||
|
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Arial");
|
||||||
|
HFONT hOldFont = (HFONT)SelectObject(dc, hNewFont);
|
||||||
|
int prevMode = SetBkMode(dc, TRANSPARENT);
|
||||||
COLORREF color = SetTextColor(dc, grtext_red | grtext_green << 8 | grtext_blue << 16);
|
COLORREF color = SetTextColor(dc, grtext_red | grtext_green << 8 | grtext_blue << 16);
|
||||||
DrawTextA(dc, text, lstrlenA(text), &rc, 0x810u);
|
|
||||||
|
DrawTextA(dc, text, lstrlenA(text), &rc, DT_NOPREFIX | DT_WORDBREAK);
|
||||||
|
|
||||||
|
SelectObject(dc, hOldFont);
|
||||||
|
DeleteObject(hNewFont);
|
||||||
SetBkMode(dc, prevMode);
|
SetBkMode(dc, prevMode);
|
||||||
SetTextColor(dc, color);
|
SetTextColor(dc, color);
|
||||||
ReleaseDC(hwnd, dc);
|
ReleaseDC(hwnd, dc);
|
||||||
|
|
|
@ -64,7 +64,7 @@ public:
|
||||||
int srcXOff, int srcYOff);
|
int srcXOff, int srcYOff);
|
||||||
static void copy_bitmap_w_transparency(gdrv_bitmap8* dstBmp, int width, int height, int xOff, int yOff,
|
static void copy_bitmap_w_transparency(gdrv_bitmap8* dstBmp, int width, int height, int xOff, int yOff,
|
||||||
gdrv_bitmap8* srcBmp, int srcXOff, int srcYOff);
|
gdrv_bitmap8* srcBmp, int srcXOff, int srcYOff);
|
||||||
static void grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width, int height, int a6);
|
static void grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width, int height);
|
||||||
private:
|
private:
|
||||||
/*COLORONCOLOR or HALFTONE*/
|
/*COLORONCOLOR or HALFTONE*/
|
||||||
static const int stretchMode = COLORONCOLOR;
|
static const int stretchMode = COLORONCOLOR;
|
||||||
|
|
Loading…
Reference in a new issue