This project is read-only.

Static drawing

staticdrawing.png
To draw arbitrary things on the canvas, you can use the HTML5 context of the main canvas, just make sure you draw on it after calling drawScene, since it will redraw the whole canvas:

var context = sheetengine.context;
To determine the coordinates of a point in the rendered world we can use the following:

sheetengine.drawing.getPointuv(point);
Parameters are:
  • point: the point given in world coordinates (JSON with x,y,z keys).
Example:

sheetengine.drawing.drawScene();

var ctx = sheetengine.context;
ctx.save();
ctx.scale(1, 0.5);
ctx.lineWidth = 3;
ctx.globalAlpha = 0.5;
ctx.strokeStyle = '#AAF';
ctx.beginPath();
var characterp = sheetengine.drawing.getPointuv(character.centerp);
ctx.arc(characterp.u, characterp.v*2, 15, 0, Math.PI*2);
ctx.stroke();
ctx.restore();

Last edited Dec 11, 2012 at 9:42 PM by dobsonl, version 2

Comments

No comments yet.