1 decade ago
by lazer
Hello,
I'm trying to test my app on iPhone and have a few questions:
1) Retina display resolution. I read a thread here earlier saying that the native res for iOSImpact is the old resolution (320 x 480) due to support for 3GS. However, we are now approaching our third release of a retina display iPhone and supporting the new res is in my opinion essential. Is there any way at all to use the 640 x 960 res with iOSImpact (or edit any of the core code to make it work?)
2) Even when I set my res to 320 x 480 to try to somewhat test the game when deployed to the hardware as opposed to the emulator the app does not appear to scale down. I'm not sure if this is an issue with the deployment process in XCode (it works fine in the emulator) or with something in the iOSImpact code I have...what am I doing wrong?
3) I'm trying to implement gestures by binding the left mouse button and using mouse.x and mouse.y. This works fine in the emulator, but not when I deploy to the hardware. Am I missing something? Should I be able to use the mouse bind to detect tap presses/releases? I thought so as it worked in the emulator, but now I'm not so sure?
Thanks in advance for any advice!
1 decade ago
by dominic
1) Have a look at
Classes/Impact/Canvas/EAGLView.m
around line 26; uncomment the two
contentScale
lines and you should be able to specify the 640x960 resolution in your call to
ig.main()
.
// Retina?
// Set contentScale Factor to 2
self.contentScaleFactor = 2.0;
eaglLayer.contentsScale = 2;
However, I think this will break on non-retina devices. It should be conditional and only apply the scaleFactor for retina displays. Something like this, maybe (untested):
if( [UIScreen mainScreen].scale == 2 ) {
self.contentScaleFactor = 2.0;
eaglLayer.contentsScale = 2;
}
You also have to check for
ig.ua.pixelRatio to determine the game resolution, before you call
ig.main()
.
2) Sorry, I don't get it. How is your game displayed? How should it be displayed?
3) For retina resolution, the mouse positions will have to be multiplied with the scale factor. Have a look at
Classes/Impact/Canvas/JS_TouchInput.m
in
invokeCallback
.
Edit: oh wow, regarding the mouse position: I think I screwed up with this entirely. It doesn't take the Game's scale factor into account at all. Trying to have an update ready in the next few days - with retina support.
I'm sorry this is such a mess :/
1 decade ago
by paulh
Would be great if your doing a fix to allow us to make a universal app... with different media for different resolutions :-)
1 decade ago
by lazer
Hi Dominic,
Thanks so much for the really quick reply! I'll try your #1 solution on the train to work today and see what happens.
In regards to #2 - right now basically what's happening in the retina display resolution on the emulator and hardware is that it's as if I'm viewing the game on my regular screen and not an iPhone screen - res doesn't fit onto the screen and I can only see a tiny portion of the game window. When I lower the res down to the old smaller version the emulator begins displaying it correctly in the smaller res, but the hardware keeps acting as if nothing changed. I'm hoping that this eventually won't be a problem if your solution above works to allow me to use the retina resolution.
1 decade ago
by lazer
Ok so I tried uncommenting the lines you specified, but unfortunately it made no difference - only the bottom left portion of the game window is still shown. I'm also wondering what checking for ig.ua.pixelRatio involves? I saw in other threads that the scale is multiplied by this, but for me running in the emulator it's always just '1', so the scale of 1 gets multiplied by 1.
1 decade ago
by lazer
Hey Dominic, just a follow-up:
I ended up doing this in my main.js to get it to display properly. I don't know if it's meant to work this way or if it's just a patch to get it to look right, to be honest I have no clue about iPhone deployment as I'm just now getting into it. Regardless, I'm essentially scaling the game down now:
# ig.main( '#canvas', MyGame, 60, 960, 640, 1 / 2); #
I don't know if this will look right on 3GS as well as I don't have one to test on, but theoretically it should...right? Am I doing something really screwed up here?
Also once that started working so did my gesture (right now I only have the swipe from left to right, which doesn't rely on exact mouse coordinates so much as the difference between the coordinate on release on and press, to calculate how long the swipe is).
1 decade ago
by paulh
Hey lazer, what happens on ipads 12/3?
1 decade ago
by lazer
I'm not actually sure paul, as I'm not going to be releasing on iPad and haven't even tried testing on one.
1 decade ago
by paulh
:-( I was getting the same problems when changing the resolution for ipads , always stayed the same size frame, different scale in the same sized window...
1 decade ago
by lazer
Well, uncommenting the lines that Dominic mentioned before and dividing the scale of 1 by 2 seems to have worked to get retina resolution (I noticed because commenting those lines back and leaving the modified scale, the images look totally crap but otherwise they look perfect). However this has caused a problem with my background maps not loading, which Dominic is aware of. I'll work on my project without background maps for now until that can be fixed up.
1 decade ago
by paulh
hey lazer, are you just focusing on iphone4 then, and no other platforms?
1 decade ago
by paulh
where will the update be?
Page 1 of 1
« first
« previous
next ›
last »