I want to set/load the font I imported in the New() method of my Window Class. I cannot get this to work, because I have no access to the private _canvas field.
This is my work around at the moment in the OnRender() method:
Monkey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Method OnRender(c:Canvas)Override
' this forces rendering each frame.
' uses vsync
App.RequestRender()
c.Font=Font.Load("asset::arcade.ttf",20)
' drawing is done by calling canvas method
c.DrawImage(i,100,10)
c.DrawText("hello",0,0)
' key checks are method of the keyboard class
IfKeyboard.KeyDown(Key.A)ThenApp.Terminate()
EndMethod
Of course, this sucks. I want to set up before hand, and I do not want to load a font file on each render. Has any of you solved this?
Oh and another thing: I see people using this method to run update code as well. How to separate updates from render code?? Can this be done or am I over complicating things??