I'm making a behavior for the text plugin and i have a function call: Stroke Text.
I want to add:
ctx.strokeText[/code:3afufiqh]. But i don't have the ctx. 1. How do i get the ctx from text plugin to use? 2. Another thing, can i make a draw function in a behaviour? How do i draw in the instance from a behaviour?
andykenobi
1- If your behavior is going to be applied on the C2 Text plugin, then you can get access to its ctx with :
var ctx = this.inst.myctx; [/code:2ohq0w08] 2- Unfortunately there is not drawing prototype in behaviors. I recommend making a plugin instead if you need to draw stuff.
That context is private to the Text object, you shouldn't mess with it. IIRC it creates its own 2D context, even in WebGL mode, for text rendering.
Develop games in your browser. Powerful, performant & highly capable.
Hum i got it. Thanks