Mirage Engine
drawing outlined text - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: drawing outlined text (/showthread.php?tid=572)



- Matt - 02-01-2007

Replace your "Sub DrawText" with this:

Code:
Public Sub DrawText(ByVal hdc As Long, ByVal X, ByVal Y, ByVal Text As String, Color As Long)
    Call SelectObject(hdc, GameFont)
    Call SetBkMode(hdc, vbTransparent)
    Call SetTextColor(hdc, RGB(50, 50, 50))
    Call TextOut(hdc, X - 1, Y - 1, Text, Len(Text))
    Call TextOut(hdc, X + 1, Y - 1, Text, Len(Text))
    Call TextOut(hdc, X - 1, Y + 1, Text, Len(Text))
    Call TextOut(hdc, X + 1, Y + 1, Text, Len(Text))
    Call SetTextColor(hdc, Color)
    Call TextOut(hdc, X, Y, Text, Len(Text))
End Sub



- Tony - 02-01-2007

This was pretty easy to do, took a while for me to find out what did what but then I got a hold of it quickly.

:: Pando


- Matt - 03-01-2007

W/e works.


- Tony - 03-01-2007

one Wrote:jeah, im just not creative enuogh x)

but wouldnt it be better to make it like this?
Code:
Call TextOut(hDC, x - 1, y, Text, Len(Text))
    Call TextOut(hDC, x + 1, y, Text, Len(Text))
    Call TextOut(hDC, x, y - 1, Text, Len(Text))
    Call TextOut(hDC, x, y + 1, Text, Len(Text))
this works better for me Smile
there where some pixels missing with your method, and it looked horrible with some fonts.

Not method T.T
Code:
Call TextOut(HDC, X + 1, Y + 0, Text, Len(Text))
    Call TextOut(HDC, X + 0, Y + 1, Text, Len(Text))
    Call TextOut(HDC, X + 1, Y + 1, Text, Len(Text))
    Call TextOut(HDC, X - 1, Y - 0, Text, Len(Text))
    Call TextOut(HDC, X - 0, Y - 1, Text, Len(Text))
    Call TextOut(HDC, X - 1, Y - 1, Text, Len(Text))

Thats how I do it...

:: Pando