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 / Problem with SetDisplayAspect resolution setting

Author
Message
JORGEMAL
14
Years of Service
User Offline
Joined: 2nd Aug 2009
Location:
Posted: 16th Aug 2012 19:34
I am writing a game with Basic Tier 1 and I have a problem with resolution. I am using the percentage approach so my game adapts to any resolution, but I always get a smaller screen than expected. I am attaching a screen shot for your review. Please look at the black space at left and right. It always appears no matter what resolution I use to calculate the Display Aspect. I have tried getting the device height and width, I have also set it directly, without success. The following function is used to set the resolution, it shows different options I have been playing with. Please advice.

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th Aug 2012 20:05
Can you show the code being used to add the sprites to the display?

Also, what are the settings in your setup.agc file? You have to open it in some editor other than the AppGameKit IDE. The setup.agc file is used in Windows only to set the display parameters and it might be interfering. Although I don't think that is the problem.

Cheers,
Ancient Lady
AGK Community Tester
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 16th Aug 2012 20:39
Ancient Lady is correct about the setup file. It controls the resolution on the PC. Your virtual settings are then used in the app. If they don't match then you will get borders.
Here is some code to help you. I got this off Mike from TGC when fine tuning Moon Snaker for iphone and ipad devices.

That works well for my game and so far no reports of problems on either android or iphone/ipad. The only problem is in that it uses the max resolution of the device and can vary a lot from one device to another. So you have to take into account the size and scale of text and sprites, as they will be different on different resolutions. It also does not use set aspect ratio, I prefer to use the set virtual resolution command than to use the aspec ration system.

Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 16th Aug 2012 20:50 Edited at: 16th Aug 2012 21:09
One thing... notice all those # at the end of DVader's variables? Those make the variables floats. In your code snippet, the variables are integers, which don't work as well as floats for setting display aspect.

Also in your code snippet you set width and height to the device, then immediatly set them to 800 by 600. Which did you want to use?

So, either



or



or



would work for a 800 x 600 screen.

@AL,

Quote: "Also, what are the settings in your setup.agc file? You have to open it in some editor other than the AppGameKit IDE."


Umm, what? You can edit it directly IN the IDE, just like your code. It's in the tree on the left, or as a tab across the top if you are using those.



Attachments

Login to view attachments
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 16th Aug 2012 21:54
SetDisplayAspect(-1)
Will always fill the entire screen but look differrent on differrent resolutions.

Android 2.3 Gingerbread , ZTE Skate , 480x800 , 800 mhz cpu , Samsung Galaxy Y , 240x320 , 832 mhz cpu
Android 4.0 Sandwich , Dmtech 3g 9738B , 1024x768 , 9.7 inches , cortex A8 1.2 cpu , 1 gb ram.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th Aug 2012 22:58
As Rich says it looks like an integer division problem.

Although in version 1076 you can also use SetScissor(0,0,0,0) to expand the visible area without stretching. For example using it with a resolution of 1024x768 is guaranteed to display anything placed within those bounds on every device, but placing a sprite at -100 in the X direction may be visible on devices that would normally have black borders to the left and right. Think of it like a safe zone where anything placed within the normal coordinate range will always be visible and anything placed in negative or greater than 1024 (or 768) positions may or may not be visible depending on the device.

To return to normal black border mode you would use SetScissor(0,0,1024,768)
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 16th Aug 2012 23:00
That SetScissor() looks very handy, I haven't played with it all yet.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th Aug 2012 23:08
At least with text objects, if they are positioned so that they would display outside of the normal window, they are not visible.

I can see this happen when testing on my iPad. My WIP is sized for the iPhone (960x640) and the iPad has black borders above and below.

This is good because that is how I am handling the scores and how to on my WIP.

Cheers,
Ancient Lady
AGK Community Tester

Login to post a reply

Server time is: 2024-05-02 11:37:26
Your offset time is: 2024-05-02 11:37:26