Posted: 29th Aug 2011 4:30
When i call the GetDeviceWidth() and GetDeviceHeight() commands they give me the same results of 320x480 on both Retina and Non-Retina display in my iPhone Simulator.
When using the Retina display i would have expected a result of 640x960 instead, just like the iPad returns a resolution of 768x1024.

According to the resolution i could then load images of higher quality/resolution, or have a larger play field when the device is an iPad.

Why is the resolution the same for Retina and non-Retina display?
Posted: 29th Aug 2011 12:59
I'm not sure but maybe the emulator only supports 320x480
Posted: 29th Aug 2011 16:24
I was able to test it on my iPhone 4 today and it also says the GetDeviceWidth() and GetDeviceHeight() are 320x480.
Posted: 29th Aug 2011 16:51
I imagine it might have something to do with the API they are using to access it - I'm not familiar with iOS development, but I would imagine that depending on their target version and/or whatever instructions they've given the API it may be returning the lower resolution for the same reason older apps don't get the retina resolution.

There's also the possibility it was hard coded, so we'd have to hear from them to know for sure. I imagine either way it is probably capable of being fixed.
Posted: 29th Aug 2011 19:23
I've managed to check if it is a retina display using Objective-C code.
If so then i set the resolution with SetVirtualResolution to 640x960, if not then i set it to 320x480.
If GetDeviceWidth() and GetDeviceHeight() return 768x1024 then i know i am on an iPad and i set the resolution to that, and have a larger play field for the iPad version of the game.
Posted: 29th Aug 2011 23:47
If you are using Tier 1, look in your Setup.agc file and see if the resolution setting there is 320x480.

If it is, try commenting the 2 lines out that set that, and make sure the first lines in your main code file are the GetDeviceWidth() and GetDeviceHeight() and see what you end up with.
Posted: 30th Aug 2011 1:24
@KISTech: I am still playing around with stuff and haven't made my mind up just yet if i will continue in Tier 1 or Tier 2. The stuff described above is obviously in Tier 2 using Xcode and C++/Objective-C.
But i will have a look into Tier 1 and see what effect editing Setup.agc will have on the resolution.
Posted: 30th Aug 2011 3:16
In my Demo I have manually edited the res in the setup file to match the res I set in game. No idea how the res I picked will display on different devices, but for now I am happy with it. I assume it will give a border on some machines, but I am happy with that, at least on my PC (when I maximize it or run it in full screen mode).
I am hoping AppGameKit will scale it as best it can for any device. I am quite looking forward to seeing a demo running on any phone at the min lol.

As to whether to write in tier 1 or 2. If you are a c++ coder already then use that, it's bound to be faster than tier 1. Obviously it may be faster to prototype an idea in tier 1 even so. I am in the position of really having to use tier 1 as I am unfamiliar with c++, so it's a moot point for me. Still not really having any real issues with it, so it's all good fun.
Posted: 30th Aug 2011 3:20
It seems the screen resolution you set with SetVirtualResolution is working on any iDevice. So i don't need to check if the device has a retina display.

Setting the resolution to SetVirtualResolution(640, 960) is showing the same result on both my iPhone 4 (Retina) and my iPod Touch (Non-Retina). Both devices run the game in 640x960.
I used GetVirtualWidth() and GetVirtualHeight() to check this.

GetDeviceWidth() and GetDeviceHeight() are still usable to detect the iPad so i can set the resolution to 768x1024, because using 640x960 for an iPad would create black bars on the left and right since the aspect ratio for 768x1024 is 1.33 and for 640x960 it is 1.5
Posted: 30th Aug 2011 18:08
If you are in iOS tier 2 you can call agk::SetResolutionMode( 1 ) to use the maximum resolution of the device, or agk::SetResolutionMode( 0 ) to use a small render target (320x480) and scale it up to device resolution for better performance. Note that this must be called before agk::InitGL() for it to work and therefore cannot be used in tier 1 (hopefully there will be a setup.agc option to set this in future).

This is only used on iOS at the moment.
Posted: 31st Aug 2011 2:17
agk::SetResolutionMode( 1 ) was already set before agk::InitGL(self.view) in the xcode project template.

Setting the agk::SetResolutionMode to 0 only affected the GetDeviceWidth() and GetDeviceHeight() results on the iPad where they were 384x512 instead of 768x1024.

On both the iPhone(Non-Retina) and iPhone 4(Retina) the results of GetDeviceWidth() and GetDeviceHeight() were 320x480 no matter if i set the agk::SetResolutionMode to 0 or 1.
On both devices I was still able to set the resolution to 640x960 with agk::SetVirtualResolution and run the app in that resolution with agk::SetResolutionMode set to 0.
Posted: 31st Aug 2011 2:56
Looks like the retina display doesn't advertise it's native resolution like the iPad does, it uses a scale parameter instead to say it is twice the advertised resolution, which complicates things.

I'll see if I can detect this properly for a future version.
Posted: 31st Aug 2011 10:44
I think it would help to write some kind of identifier function if GetDeviceName() would return something more detailed than just ios.
Posted: 31st Aug 2011 10:55
important question: how can I know if agk is actually using the 960x640 graphics on iphone phone, and not scaling down to half res, and then the ios doubling the screen?
Posted: 31st Aug 2011 12:28
I checked it by using a 640x960 background image and then use different resolutions with SetVirtualResolution. If the resolution was 640x960 then the whole background image was visible, with a resolution of 320x480 the background image was only half visible. And on the iPad with the resolution set to 768x1024 there was of course space left on the right side and on the bottom of the background image since the 640x960 background image doesn't fill up the 768x1024 space.
Posted: 31st Aug 2011 15:19
I think it would help to write some kind of identifier function if GetDeviceName() would return something more detailed than just ios


This is already in the next update.

how can I know if agk is actually using the 960x640 graphics on iphone phone


Currently it will never use 960x640, but if it did you could detect it with GetDeviceWidth() and GetDeviceHeight()

It seems the screen resolution you set with SetVirtualResolution is working on any iDevice.


The virtual resolution is completely seperate from the device resolution and merely defines what the bounds of the screen are. For example a virtual resolution of 768x1024 would mean that to position something in the center of the screen would be at 384x512, regardless of the current device resolution.
Posted: 31st Aug 2011 17:17
Currently it will never use 960x640, but if it did you could detect it with GetDeviceWidth() and GetDeviceHeight()


I thought we could use a res of 960x640 for iPhone retina display and it would be displayed 1:1 not scaled.
Posted: 31st Aug 2011 17:23
I just got another bug or the pictures that i include in xcode project folder, on the left hand side, do not transfer over to my ipod.

I then compiled one of the examples and the pictures did transfer over to my ipod.

I dont know what I did different programming the template, and why the examples work and the template does not work. I guess i try using the examples as a template latter today to see if I can clear up this matter.
Posted: 31st Aug 2011 17:41
I thought we could use a res of 960x640 for iPhone retina display and it would be displayed 1:1 not scaled.


So did I, but as I said before, the retina display does not advertise its resolution in the way I expected so it will need to be changed in a future version.
Posted: 31st Aug 2011 18:16
While we're on the subject of GetDeviceHeight/Width, are they supposed to work on a Windows machine or not? They keep returning whatever values I set in setup.agc, but I want it to scale to the computer's screensize, unless this just isn't possible ofcourse.