iTorque 1.5 Universal on iPhone4
by Daniel Liverance · in iTorque 2D · 10/12/2011 (2:41 pm) · 14 replies
Hello,
I am currently working on a project for the iPad and I decided to try and run my game on the iPhone simulator.
It worked fine (congratulations on the good job for universal app support so far) but when I tried it on my iPhone 4, nothing showed up. I also switched the simulator to the iPhone (Retina) version and it mimicked the same result that I got on my iPhone 4 device.
I was just wondering, is there anything that I need to change in the TGB to get it ready for retina display? I didn't use any "HD" images, or try to use the "HD" checkbox, because I figured that it would just default to the original low res images anyways.
Any suggestions would be helpful.
I am currently working on a project for the iPad and I decided to try and run my game on the iPhone simulator.
It worked fine (congratulations on the good job for universal app support so far) but when I tried it on my iPhone 4, nothing showed up. I also switched the simulator to the iPhone (Retina) version and it mimicked the same result that I got on my iPhone 4 device.
I was just wondering, is there anything that I need to change in the TGB to get it ready for retina display? I didn't use any "HD" images, or try to use the "HD" checkbox, because I figured that it would just default to the original low res images anyways.
Any suggestions would be helpful.
About the author
I am 21 years old, and have just recently graduated from College for Game Programming (with honours) and I am now the Lead Programmer at Blinker Studios.
#2
10/13/2011 (6:10 am)
Got the e-mail,. I'll read over it when I get to the office.
#3
Another user, Craig, has also reported the problem.
10/16/2011 (8:51 am)
@Daniel - I'm able to reproduce this with my own project. I'm debugging this as we speak. As soon as I find the cause, I will post here and work on getting a hot fix uploaded. Let me know if you make any other discoveries.Another user, Craig, has also reported the problem.
#4
10/16/2011 (9:21 am)
I've isolated the problem in source code. I'm working on a solution now.
#5
10/16/2011 (12:04 pm)
excellent, I look forward to the hotfix.
#6
At any rate, I'm close to the solution.
10/17/2011 (6:12 am)
The problem has to do with the resolution being set to double if the engine detects it is running on an iPhone 4. The fact that it works on landscape, but not in portrait, is baffling. When I hard set the resolution to 960x640, everything renders correctly. However, the actual window is incorrect. At any rate, I'm close to the solution.
#7
Any rate I'm glad to hear you are close to a solution.
Thanks for all the attention that you are giving this issue
10/17/2011 (7:08 am)
haha, I agree, that is very strange. You would think it would show the same behaviour in landscape as it does in portrait.Any rate I'm glad to hear you are close to a solution.
Thanks for all the attention that you are giving this issue
#8
10/17/2011 (7:41 am)
@Daniel - No need to thanks. I'm actually really upset it went out this way, so I appreciate your patience on resolving this.
#9
I know where this is happening. I should have a fix shortly
10/17/2011 (7:52 am)
Grr. Just as I thought. The camera is fine. The resolution the window is set up is just fine. However, the window is rotated off screen (!!!). If you enable the two rotation settings in the project tab, then start rotating (simulator or device), you will see it flash in quickly.I know where this is happening. I should have a fix shortly
#10
10/17/2011 (11:33 am)
Located the core problem, which is a set of hard-coded numbers being used for rotation. I'm putting together a simple calculation that will work for both landscape and portrait.
#11
Torque Minimal Template -- Part 4. Retina Display
10/17/2011 (2:16 pm)
not sure if it's the same but I found a similar issue in my own retina implementation; solved here Torque Minimal Template -- Part 4. Retina Display
#12
10/17/2011 (3:01 pm)
Yup. The difference between your code and my code in 4 - changes in iPhoneOGLVideo.mm is the problem. I discovered something else wrong with the rotation code, but that got it running in the right location.
#13
1. Open engine/source/platformiphone/iPhoneWindow.mm
2. Jump to the setScreenOrientation function
3. Replace this:
4. With this:
Recompile and run. Everything should be in the right place. Thanks Pedro! Now I need to fix the dynamic rotation bug I discovered. Both fixes will be added to a new installer (hopefully uploaded tomorrow).
10/17/2011 (3:23 pm)
Quick fix:1. Open engine/source/platformiphone/iPhoneWindow.mm
2. Jump to the setScreenOrientation function
3. Replace this:
if( platState.portrait )
{
point.x = platState.windowSize.x / 2;
point.y = platState.windowSize.y / 2;
}
else
{
point.x = platState.windowSize.y / 2;
point.y = platState.windowSize.x / 2;
}4. With this:
if( platState.portrait )
{
if([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2)
{
point.x = 320;
point.y = 0;
}
else
{
point.x = platState.windowSize.x / 2;
point.y = platState.windowSize.y / 2;
}
}
else
{
point.x = platState.windowSize.y / 2;
point.y = platState.windowSize.x / 2;
}Recompile and run. Everything should be in the right place. Thanks Pedro! Now I need to fix the dynamic rotation bug I discovered. Both fixes will be added to a new installer (hopefully uploaded tomorrow).
#14
10/17/2011 (7:17 pm)
you're welcome. glad I can help somehow.
Employee Michael Perry
ZombieShortbus