cstoquer / pixelbox

A sandbox framework to fast-prototype tile-based games in HTML5 and JavaScript
MIT License
469 stars 36 forks source link

rect does not behave as expected #15

Closed leenattress closed 4 years ago

leenattress commented 4 years ago
pen(2);
rect(10,10,1,1)

I would expect a single pixel at 10, 10.

But

pen(2);
rect(10,10,2,2)

gives this effect.

It would also seem that the editor gives 0 as black and 1 as 'white' in the default project, but its actually 1 and 2 that is black and white.

perhaps the numbers start at 1?

cstoquer commented 4 years ago

Thanks for this bug report.

This was indeed a bug in the Canvas2D implementation. It is fixed in 2d16807 and will be included in next release.

For 1 pixel rectangles, I recommend to use rectf instead of rect (rectf performs better than rect in webGL implementation). Note that rectf use paper color instead of pen color.

Colors do starts at 0 and should have the same displayed in the editor. If you get a different result, maybe something was modified in the palette? Please check again and if the problem persist, open another issue.