Hi, I want to draw some small marks on the screen, and I thought it was possible to get the canvas, use the getContext() method and draw directily with fillRect() for instance.
This is the code:
var canvas = this.app.graphicsDevice.canvas; var canvasWidth = parseInt(canvas.clientWidth, 10); var canvasHeight = parseInt(canvas.clientHeight, 10); var ctx = canvas.getContext("2d"); ctx.fillStyle = "#00FF1D"; ctx.fillRect(canvasWidth/2,canvasHeight/2,1,1); ctx.fillRect(0,0,1,1); ctx.fillRect(0,canvasHeight,1,1); ctx.fillRect(canvasWidth,0,1,1); ctx.fillRect(canvasWidth,canvasHeight,1,1);
However, ctx is NULL.
Does anyone know what I am doing wrong??
Thanks in advance.