Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by JamesP

Hi guys,

was just wondering how easy it is to draw country poligons within the canvas using ImpactJS and making these interactive.

Has anyone tried something like this?

1 decade ago by dominic

You can access the canvas API at any time from within your draw Game&039;s or Entities' #draw method. So drawing of the polygons shouldn't be a problem. E.g.:

ig.system.context.fillStyle = '#f0f';
ig.system.context.fillRect( 0, 0, 100, 100 );

However, making them "interactive" (I assume you mean "selectable"?) could be a bit more challenging. Impact itself has now way to deal with arbitrary shapes, so again, you&039;d need to use the Canvas APIs #isPointInPath() method or something similar for that.
Page 1 of 1
« first « previous next › last »