Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Screen resolutions for iPhone

Author
Message
Doveyy04
12
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 8th Jul 2013 18:46
Sorry if this has been mentioned before but I've been writing my program using a virtual resolution of 480x320 but I see that the iPhone 4 and later is a resolution of 960x480, is it simple enough to add a command for the app to recognise what type of iPhone the app is running on and adjust the coordinates to suit and if so what is the command/s

Thanks for any help
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 8th Jul 2013 18:59
if you use a virtual resolution it should span on the whole screen.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Jul 2013 19:11
I have my WIP at 960x640 (the high-res before they changed to the different ratio for the not-so-newest iPhone).

Basically it really depends on whether you are going to use the percentage or virtual resolution system of display setup/coordinates.

With the percentage system, everything is addressed as some fractional value between 0 and 100. You can set the aspect ratio so that your images sort of display properly. But you lose the pixel perfect placement and detection. In theory, you don't have to worry about the actual resolution of the device. But in practice, at least from what I've heard in this forum, there can sometimes be issues with how graphics are squished or stretched.

With the virtual resolution system, you set a specific resolution (like 960x640 for my landscape WIP) and all of your positions and points are some value within those ranges. The AppGameKit will fill the target device as much as possible, expanding or contracting to make sure that it can 'think' in terms of the resolution you set. If the aspect ratio of the target device is different, than you get black bars either above/below or left/right of your actual app. And you can do things to fill those using SetScissor(0,0,0,0) (which allows you to draw outside of your defined resolution (left or above would be negative values). In this mode, your graphics always maintain the display ratio that you create for them (unless you deliberately change the display ratio of a particular sprite). The downside on this one is if you decide to change your resolution. Then you need to make sure that your code takes into account the new resolution (and there are ways to handle this in the initial design). Changing the resolution after you have created your graphics also affects how they appear.

I have tested my WIP on devices that range from 480x320 (smaller than my designated resolution) and the iPad 4 2048x1536 resolution. And it works fine (and looks pretty good). On the smaller device, the text is a bit more difficult to read for the one I created, but it is readable. And the game plays just fine on everything.

Basically, assuming virtual resolution, you are better with something at least at the iOS 4.0/5.0 resolution of 960x640, than going for the lower 480x320 resolution. The AppGameKit engine will shrink as necessary to fit the smaller resolution and expand to fit the higher ones.

This page gives you info about all the resolutions, including aspect ratios, for the Apple iOS devices.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Jul 2013 19:25
It is beneficial to use the screen bounds... so if you have a sprite at each corner for example, you'd use getscreenboundsleft() and getscreenboundsright() - then it's easy to allow for wider displays.

That's the worst thing - the iPhone5 and it's slightly-bigger-for-the-hell-of-it display, AppGameKit makes it really easy to support any resolution, but screen aspect is something we should always try and code for. If we don't allow for them from the outset - we end up having to do things like have borders at the sides, and iPhone users tend to hate that.

I got a fever, and the only prescription, is more memes.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Jul 2013 20:23
Or getscreenboundstop/bottom for devices with ratios the other way.

Not all devices will have the extra space on the left/right.

One way to allow for the black bars (and it occurs much more often on Android devices) is to have at least one way in the very background sprite (at the very furthest depth) that is sized so that it will fill any range of overages. For my 960x640 resolution, my background is 1280x1024. I call SetScissor(0.0,0.0,0.0,0.0), which allows using the black bar space and set the offsets for the background image at the center of the image and position it by SetSpritePositionByOffset to 480.0,320.0. This positions it in the center and the extra areas are all covered, independent of the size.

I actually have an animated sprite that is similar to let the player know where 'out of bounds' is while actually playing.

I still consider out of bounds based on my target resolution and make sure to check the player for out of bounds using that information. So, it is possible, on a device with different aspect ratio to actually see the player in out of bounds territory just before the 'oops' message shows up.

And I do use the entirety of what is available on the device for the displays that show user statistics and the leader board.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
haliop
User Banned
Posted: 9th Jul 2013 09:37
i for example did something else completly.

first i always use aspect ration of 1.0 cause the sprites just looks right.

second
i check:

dw = GetDeviceWidth()
dh = GetDeviceHeight()

then i have
a simple switch and a var like SizeMulti as float

if dw = 960 and dh = 640
SizeMulti = 2.0
elseif dw = 1000 and dh = 700
SizeMulti = 2.1 etc...

then when i set my sprites and buttons
i Scale them *SizeMulti

so AddVirtualButton(1,50,50,10 * SizeMulti)

and you run your app on windows just to test if everything fits.

ive also added a function

Function ChangeAllSpriteSizes(size as float)
SizeMulti = size
save it to settings file.
and ask the user to restart the app , once it is restarted Buttons and Sprites will look diffrent
endfunction

also you can create a function to just change the button sizes , text sizes etc.. and the next time you run the app everything will fit..

with a bit of extra code you can manipulate the sprites,text,buttons etc just after setting a new sizeMulti just size them all up again (use Scale for sprites as it will be better then using ,SetSpriteSize which take pixels if virtual or precentage if not ... but when you use SetSpriteScale(id,SizeMulti,SizeMulti) it will keep it as it is and then scale it which will end in better fine results.



Doveyy04
12
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 11th Jul 2013 21:17
Wow thanks for the response guys, I've got a lot to learn still

Login to post a reply

Server time is: 2024-05-08 12:55:06
Your offset time is: 2024-05-08 12:55:06