HTML Canvas Clearing

Paul59

Active Member
CX Code Contributor
Joined
Dec 13, 2018
Location
UK
Just experimenting with things before setting up a simple state machine. My main class has this OnRender method:

Code:
Method OnRender:Int()
   plyr.RenderPlayer(myCanvas)
   myCanvas.Flush
   Return(0)
End
and class Player has this

Code:
Method RenderPlayer:Void(myCanvas: Canvas)
  myCanvas.SetColor(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255))
  myCanvas.DrawText("Player update!", Rnd(0, myCanvas.Width), Rnd(0, myCanvas.Height))
End
It works as expected on Desktop target but on HTML the canvas is being cleared every frame (so the text doesn't accumulate). Why is that?
 
Top Bottom