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 rgthree

Using iOSImpact in xcode on a simulator, mouse.x & mouse.y are incorrect when scaled--they are the screen's x/y, and not relative to the "canvas." I can solve this by dividing the touche's mouse.x/y by the game's scale, but wasn't sure if this was known or I'm doing something wrong..

In addition, I have a very simple game--not a lot of action happening or entities on the screen. I notice when using iOSImpact, movement is "laggy" compared to mobile safari (though, there is music/sound whereas in mobile safari there is not). It's not bad, but I can notice a difference between the two, and I was hoping iOSImpact would be better. Any ideas?

1 decade ago by stratman05

Are you testing on your device, or just the simulator? The simulator is notorious for being slow. I'd be surprised that your iOSImpact game deployed on a device would be slower than in mobile safari.

1 decade ago by rgthree

I don't have a developer account just yet, so it's just the simulator. Mobile Safari on my iPad 2 is speedy, which was expected. However, it seemed that Mobile Safari was still faster in the Simulator than the iOSImpact build.

Maybe it has something to do with the scaling in ig.main()? If I put scale down to 1, it runs just as fast as on Mobile Safari in the Simulator, but scaled up to 2 there was a noticeable lag, and 3 was unacceptable. Scaling doesn't have any negative lag-effect on Mobile Safari.

1 decade ago by fugufish

@rgthree what's the mobile safari version on your iPad 2?

1 decade ago by dominic

Does this happen for all simulators - iPhone3, iPhone4 and iPad?

I can't say for sure, but this is probably an issue with the graphics card in your mac. The scaling in iOSImpact works by just enlarging the OpenGL viewport and using the GL_NEAREST texture filter for scaling. Some of the older Intel GPUs are particularly bad at this, but the iPhone and iPad handle it well.

Try replacing all GL_NEAREST params in Classes/Impact/Canvas/Texture.m with GL_LINEAR and see if it makes a difference. Your game will look blurry, but if it runs faster you at least know why it was slow before.


Regarding the mouse coordinates: this is a bug, yes. I'll fix this in the next version. Sorry.

1 decade ago by rgthree

@dominic it does happen for all simulators when scaled.

I tried changing GL_NEAREST to GL_LINEAR but that didn't help. My Mac is only about a half-year-old Macbook Pro. I disabled the music, so that's not it either. I'll keep playing with it and see if I can figure out if it's my impactjs code at all...

1 decade ago by paulh

did this get fixed?

I still get incorrect co-ordinates for:


ig.input.mouse.x,ig.input.mouse.y

Page 1 of 1
« first « previous next › last »