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 / Issue with scaling from PC to Phone

Author
Message
Zagaroth
7
Years of Service
User Offline
Joined: 10th Apr 2017
Location:
Posted: 22nd May 2018 01:03 Edited at: 22nd May 2018 01:03
So I am working on making a initial UI for a program I am working on. I can get the text and sprites to line up fine on my computer or phone. With the computer I used setspritescale() and on the phone I ended up using setspritesize(). Am I missing something here or do I needed to code 2 completely different UI's and do a check for if the program is running on an phone or a PC? Below is an example of the code (there is a lot of commented out code that I have been using as testing, hope that doesn't confuse anyone):

smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 22nd May 2018 09:06
No, its likely just the resolution change so you just need to account for it, either by using a % system (make everything as if the screen was 100x100) or by modifying your values to fit the devices used resolution compared to your intended resolution (for the devices that don't support your intended resolution).
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 23rd May 2018 09:46 Edited at: 23rd May 2018 09:50
For phone you need to keep in mind resolution and DPI if you're NOT using a virtual resolution, then again virtual resolution can come a cropper if the aspect ratios are different but it's the best solution if you don't want to create a create phone specific version.

If you do want to go the phone specific version you have 4 options;
1. Percentage system (as smallg suggested), down side is elements might appears too small on small screens so you might want design around a 4" screen
2. Virtual resolution, down side are black bars on the sides on devices that don't match your chosen aspect ratio
3. Use a Point (pt) system to scale elements (example below) in real world values, only really good for UI's and buttons
4. Uses GetDisplayAspect(), GetDisplayDPI(), GetDeviceWidth(), GetDeviceHeight() and design a fancy system to deal with different resolutions, DPIs and aspect ratios.

Zagaroth
7
Years of Service
User Offline
Joined: 10th Apr 2017
Location:
Posted: 24th May 2018 21:19
Awesome. Thanks for the advice.
Zagaroth
7
Years of Service
User Offline
Joined: 10th Apr 2017
Location:
Posted: 26th May 2018 01:19 Edited at: 26th May 2018 01:20
I tried the Virtual resolution idea and it's making everything super small. What am I missing? (It is currently commented out)


Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 27th May 2018 08:02
shouldn't SetVirtualResolution( 600,800) be SetVirtualResolution( 800,600)
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 27th May 2018 13:14
In order to use the percentage system you should specify an aspect ratio
SetDisplayAspect ()

Yours is currently commented out

The guide on using displays covers this:
https://www.appgamekit.com/documentation/guides/0_display.htm
Zagaroth
7
Years of Service
User Offline
Joined: 10th Apr 2017
Location:
Posted: 27th May 2018 19:08 Edited at: 27th May 2018 19:10
Thanks for that guide Bengismo! I read through it and I think I will go back and use the percentage system now that I have a better understanding of it. I had tired to use it before (that's why it was committed out) but i wasn't using it correctly. However, when using the percentage system does the window size still matter?
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 31st May 2018 21:41
Quote: "when using the percentage system does the window size still matter? "


It will on the desktop, but not on the mobile. I often use a virtual resolution of 100x100 and getscreenboundsTop/Left/Bottom/Right to make use of the entire screen.

Login to post a reply

Server time is: 2024-11-18 12:20:14
Your offset time is: 2024-11-18 12:20:14