subprotocol / verlet-js

A simple Verlet physics engine written in javascript
Other
3.76k stars 461 forks source link

Custom bg and fg highlight #19

Open SebastianCrow opened 9 years ago

SebastianCrow commented 9 years ago

Hi,

I've added a possibility to define background and foreground highlights. It's also possible to drop highlight at all (by assigning empty function to drawFgHighlight).

Question is: why background highlight? For example, I've found it useful to render drop shadow under hovered entity.

Best Regards

SebastianCrow commented 9 years ago

P.S. Highlight is done by assigning appropriate render functions: entity.drawBgHighlight = function(ctx) { /* draw in context */ }; // empty function => no highlight; undefined, null => no highlight entity.drawFgHighlight = function(ctx) { /* draw in context */ }; // empty function => no highlight; undefined, null => default highlight