SetFont - info...

Monkey Forums/Monkey Code/SetFont - info...

degac(Posted 2011) [#1]
First, I dont' know where exactly post 'useful' or 'explained' things in this forum (I didnt' find a 'tutorial section')

I hope there will be some on-line help (like in BlitzMax/Blitz3d) where to add new info/examples and solutions.

In the meanwhile...

HOW TO CHANGE THE DEFAULT FONT WITH SOMETHING BETTER!
(nothing exotic, but there's no example around... so here we go!)

Strict
Import mojo
Function Main:Int()
Local app := New MyApp
	Return 0
End 
Class MyApp Extends App
	Method OnCreate:Int()
        'you NEED to specify WIDTH and HEIGHT of the single tiles
        'the gliphs are 'boxed' in a single image (same sizes)
        'use ONLY CAPITAL characters - as the lower ones are no 'coded' in the image...
		SetFont(LoadImage("font_16.png",16,16,64))
		Return 0
	End
	
	Method OnUpdate:Int()
		Return 0
	End Method
	
	Method OnRender:Int()
		DrawText("123",100,100)
		Return 0
	End

End


you need this image


Cheers


Beaker(Posted 2011) [#2]
Or you could look at "bananas\beaker\angelfont_example.monkey" to get going with nicer outlined & kerned fonts. More info here:
http://www.monkeycoder.co.nz/Community/posts.php?topic=141


degac(Posted 2011) [#3]
Yes I know, and the module is great!
But if you want something to run immediately without too complications this allow a simple solution (not complete, sure, but better than the standard monkey font!)


Of course for high-end results the Angel module is a must.


dave.h(Posted 2011) [#4]
hi great example of an easy way to use this and is just what i needed but it need SetUpdateRate 30 in the OnCreate before it displays anything