Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Having Text Rendering with an Outline


Carim123
 Share

Recommended Posts

Yet again, I've decided to release something that I decided was gonna be for Iron Prelude. xD

![](http://www.freemmorpgmaker.com/files/imagehost/pics/24c9477d77e93068c69adcde19a2c28b.png)

I only made this, to make the text more readable. If you have the same issue as me, where you feel the text is not very readable. Post with a screeny and your FPS!

No credit required, but no claiming as own, either. <3

* * *

Before starting, I ~~recommend~~ want you to put in [Lightning's Text Rendering Fix](http://www.touchofdeathforums.com/smf/index.php/topic,71691.0.html).

Not really a tutorial, more of a copy and paste, as all you must do is simply replace Sub DrawText in modText with this:

```
' GDI text drawing onto buffer
Public Sub DrawText(ByVal hdc As Long, ByVal X, ByVal Y, ByVal text As String, color As Long)
    ' If debug mode, handle error then exit out
    Dim OldFont As Long ' HFONT

    If Options.Debug = 1 Then On Error GoTo errorhandler

    Call SetFont(FONT_NAME, FONT_SIZE)
    OldFont = SelectObject(hdc, GameFont)
    Call SetBkMode(hdc, vbTransparent)

    Call SetTextColor(hdc, 0)
    Call TextOut(hdc, X + 1, Y, text, Len(text))
    Call TextOut(hdc, X, Y + 1, 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 + 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))

    Call SelectObject(hdc, OldFont)
    Call DeleteObject(GameFont)

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "DrawText", "modText", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
And, you're done. Already. xD

**_Will there be any implications on my FPS?_**
Not much, provided you've done as I told you, and put in Lightning's Text Fix.
Previously, my FPS was averaging 160 (Yes, I know, it's crap.), now, it averages 150, so, not that much of a problem here.

Of course, that's just my laptop, and not much of a difference for me, so if you want to help me out, post your FPS before and after adding the fix!
Link to comment
Share on other sites

  • 1 month later...
@Robin:

> It's called 'stroke'. Before I started working on the engine text was rendered with a stroke. I'm the one who replaced it with a shadow.

Stroke, that's the word…couldn't remember the word. ;p

I'm guessing you replaced it with a shadow purely for FPS reasons? If so, it did occur to me, but I personally prefer being able to read the drawn text over slightly higher FPS...buuuut, just my opinion.

@Kermit:

> It doesn't work for me. And yes, I did lightnings tutorial.

You can't've followed Lightning's tutorial properly, this is simply a copy+paste…go back to it, carefully read it, and so on.
Link to comment
Share on other sites

@7:

> Stroke, that's the word…couldn't remember the word. ;p
>
> I'm guessing you replaced it with a shadow purely for FPS reasons? If so, it did occur to me, but I personally prefer being able to read the drawn text over slightly higher FPS...buuuut, just my opinion.
>
> You can't've followed Lightning's tutorial properly, this is simply a copy+paste...go back to it, carefully read it, and so on.

Wait, is it a seperate feature to have the text off to the side, instead of in the box?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...