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 MarkG

I've been testing out the Ejecta framework, and it works great except the initial orientation doesn't seem to work on my device.
When I start it up in the simulator, the orientation is Landscape (right home button) like I set it, but when I run it on my iPad, it always starts in Portrait mode. Does anyone know how to fix this?

iPad is on OS 5.1.1, Initial interface orientation = Landscape (right home button), Supported interface orientation = Landscape (right home button).

1 decade ago by dominic

Probably the same issue as in this thread. Solution: don't set any Supported interface orientation – leave them all deselected.

1 decade ago by MarkG

It's still not working, when I run the app on my iPad or iOS Simulator 5.1, it shows up with the opposite orientation as what I set as the default orientation, and on Simulator 6.0 it starts with the correct orientation, so it seems to be a bug with iOS 5.

I've also noticed when I drag 4 or 5 fingers to switch apps, the touchend event never gets called on them, so I end up with 4-5 touches lingering on the screen.
I'm also getting a crash when I switch fonts more than once or twice per frame, on line 175 in EJCanvasContext.m
[state->font release];

1 decade ago by dominic

Please try the current version from github again.

All touches are now ended when the application suspends, the font crash should be resolved (I hope) and the rotation should work correctly on iOS5 now as well.

1 decade ago by MarkG

Awesome, thanks! I'm getting a new bug after upating, though, I have some circles being filled and one of them always has a ring being drawn around it. It looks like the last circle that I fill is getting an extra stroke() call somehow.

1 decade ago by dominic

Can you upload a screenshot somewhere and post the code that's causing this, please.

There were some changes regarding how transformations are applied on paths. Maybe there's an issue with this now.

1 decade ago by MarkG

Screenshots:
http://i45.tinypic.com/2zpqex5.jpg
http://i45.tinypic.com/2d0igrq.jpg

When I move the camera in front of the first gray circle (second pic), the other gray circle becomes the last one to be drawn and it gets outlined instead.

Code:
// some transforms before this gets called
TestBlock.prototype.draw = function(g){

	g.fillStyle = this.color;

	if(this.circle){
		g.beginPath();
		g.arc(0, 0, this.render_radius, 0, Math.PI*2);
		g.fill();
		return;
	}
	g.fillRect(-this.xs/2, -this.ys/2, this.xs, this.ys);
}

1 decade ago by dominic

Sorry, I don't get it.

This pic is the expected result? But when you zoom in, the black circle with the grey outline disappears and another circle gets the outline?

Can you maybe build a test case or send me source?

1 decade ago by MarkG

No, neither circle is supposed to have a grey outline. I think I figured it out, if you call strokeRect, it strokes the path you have defined as well as the rect.
Here's a test index.js where you can see the bug:
var w = window.innerWidth;
var h = window.innerHeight;
var w2 = w/2;
var h2 = h/2;
var canvas = document.getElementById('canvas');
canvas.width = w
canvas.height = h;
var ctx = canvas.getContext('2d');

var circles = [];
(function(){ for(var i = 1; i < 10; i++){
 circles.push({ x: i * w/10, y: h/2, z: 0, s: w/20});
}})();

var animate = function() {
	var g = ctx;
	g.fillStyle = '#000000';
	g.fillRect(0,0,w,h);
	g.fillStyle = '#333333';
	
	circles.sort(function(a,b){return a.z - b.z;});
	
	for(var i = 0; i < circles.length; i++){
		var c = circles[i];
		c.z = Math.random();
		g.beginPath();
		g.arc(c.x, c.y, c.s*i/10, 0, Math.PI*2);
		g.fill();
	}
	g.strokeRect(0, 0, 100, 100);
};

ctx.strokeStyle = '#ffffff';
ctx.fillRect( 0, 0, w, h );
ctx.lineWidth = 4;
setInterval( animate, 2000 );

Seems to only happen with strokeRect, no circles got outlined with strokeText or this code:
ctx.beginPath();
ctx.rect(0,0,100,100);
ctx.stroke();
Page 1 of 1
« first « previous next › last »