iOS Screen Resolution iPhone / iPad

Monkey Targets Forums/iOS/iOS Screen Resolution iPhone / iPad

tagoror(Posted 2011) [#1]
Hello,

Where I can change the screen resolution width/height) in the source code translated by monkey?

Regards,

Javier


Tri|Ga|De(Posted 2011) [#2]
Yes I think its in the X-code source.


skid(Posted 2011) [#3]
What exactly do you want to change the resolution to?

If you want to change from iPhone to iPad targets load the xcodeproject in the .build/ios folder into Xcode and change it there (pull down menu top left).


Qube(Posted 2011) [#4]
What about universal apps though when you want one binary to do iPad, iPhone (960x640) and iPhone (480x320)?


DGuy(Posted 2011) [#5]
(You can find RETINA_ENABLED at the top of main.h)

RETINA_ENABLED = FALSE
iPad: 768x1024
Non-Retina: 320x480
Retina: 320x480 (pixel-doubled)

RETINA_ENABLED = TRUE
iPad: 768x1024
Non-Retina: 320x480
Retina: 640x960

The above are, of course, device orientation dependent.


Hima(Posted 2011) [#6]
By setting RETINA_ENABLED to TRUE, how will the game select the resource? Is there a way to selective loading the resource according to the device or something that can solve this problem? To clarify, I want the game to use low-res resources if run on Non-retina devices, and use high-res resources on retina display devices.


Sledge(Posted 2011) [#7]
I was planning on manually checking DeviceWidth/DeviceHeight then having a path string that either points to an HD or SD assets directory respectively.


Hima(Posted 2011) [#8]
@Sledge
That's a good solution!

Though I just realized another problem. When working in Obj-C, everything is in point instead of pixel, so that you can still think of all the coordinate as if you're working on 320 x 480 resolution screen. Does RETINA_ENABLED handle this automatically for us as well?

-- EDITED --
Ok, I just tried and the problem is there as I expected. You need to change the coordinate depending on the resolution. Is there a way to change this? I've heard that cocos2d did something with the openGL setting to change this so that we don't have to change our coordinate. But I'm a noob at OpenGL so I can't recall what it is :(


matt(Posted 2011) [#9]
You can multiply by a factor of two for retina. Not sure of the best way for iPad.


Sledge(Posted 2011) [#10]
Ok, I just tried and the problem is there as I expected. You need to change the coordinate depending on the resolution. Is there a way to change this?

I'm using a virtual resolution (of 320x480) that gets scaled, centered and scissored appropriately regardless of the host res. My sprite class also knows what size sprites are supposed to be in relation to the virtual resolution so the texture can be any legitimate size -- well in theory, I should really test out HD assets with it!

But yeah, that would be my suggestion -- use a virtual resolution and factor all rendering by the same scale (oh and remember to adjust input coords accordingly).


Dabz(Posted 2011) [#11]
I thought if hi-res images had @x2 in the filename iOS would automatically load them:-

http://www.weston-fl.com/blog/?p=2151

I've never tested it or anything, only noticed it in a reference to something else.

Dabz


matt(Posted 2011) [#12]
@2x works for Xcode generated projects, though I'm not sure Mark has to do anything to get it to work in monkey generated code?


JaviCervera(Posted 2011) [#13]
@2x works automatically with the imageNamed: method of the UIImage class, but I don't think that's what Mark is using to load image resources.

But maybe he has handled @2x resource loading himself.