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 mkreitler

While porting one of my Impact games to Ejecta, I've run across the following bug: fillRect doesn't work when used in an offscreen buffer.

Here's a simple index.js demonstrating the problem:
var mainCanvas = document.getElementById('canvas');
var mainCtx = mainCanvas.getContext('2d');

var bgCanvas = document.createElement('canvas');
var bgCtx = bgCanvas.getContext('2d');

// Draw a square
bgCtx.fillStyle = '#88ff88';
bgCtx.strokeStyle = '#ffffff';

bgCtx.beginPath();

bgCtx.moveTo(50, 50);
bgCtx.lineTo(100, 50);
bgCtx.lineTo(100, 100);
bgCtx.lineTo(50, 100);

bgCtx.closePath();

bgCtx.fill(); // Comment out this line and the stroke will work.
bgCtx.stroke();

mainCtx.drawImage(bgCtx, 0, 0);

Note that these same draw commands, when applied directly to the main buffer, work perfectly.

On a side note, clearRect() doesn't seem to work at all.

Has anyone else run across (and hopefully fixed) this problem?

Mark

1 decade ago by dominic

Please try the latest version from github; I believe those bugs are already fixed:
https://github.com/phoboslab/Ejecta

1 decade ago by mkreitler

Thanks for the quick reply, Dominic.

The latest version does indeed work as expected.

Unfortunately, my game still does not -- but at least now I can look for the problem in my port.
Page 1 of 1
« first « previous next › last »