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.

Newcomers AppGameKit Corner / Percentage system confusion

Author
Message
Alex_2015
7
Years of Service
User Offline
Joined: 13th Sep 2017
Location: Somewhere in Putin's Russia
Posted: 10th Sep 2018 20:45 Edited at: 10th Sep 2018 20:53
Hi everybody!

I was sure that SetSpritePosition (SpriteNumber, 0, 0) should put my sprite in top left corner of the app's window no matter what.
But it looks like it's true only when the screen size's aspect is 4:3 (e/g 1024 / 768).
It other cases the sprite is moved some distance towards the center along X axis.
Here are some code examples and screens:

With 4:3 screen



https://imgur.com/a/RXW64Yr

With some other aspect



https://imgur.com/a/GWYzvl0

So am I doing something wrong? Or do o,o coordinates not always mean the top left corner in percentage system?
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 10th Sep 2018 20:56
SetVirtualResolution (actual_windowsize_width, actual_windowsize_height)
Alex_2015
7
Years of Service
User Offline
Joined: 13th Sep 2017
Location: Somewhere in Putin's Russia
Posted: 10th Sep 2018 21:50
Quote: "
SetVirtualResolution (actual_windowsize_width, actual_windowsize_height)"


Yeah, but SetVirtualResolution turns off the percentage system, doesn't it?
Dark Raven
10
Years of Service
User Offline
Joined: 27th Jul 2014
Location: United States
Posted: 10th Sep 2018 22:12
I'm seeing the call to SetDisplayAspect. This will turn on percentage. So set something like SetDisplayAspect(1920.0/1080.0) and see if that works
Alex_2015
7
Years of Service
User Offline
Joined: 13th Sep 2017
Location: Somewhere in Putin's Russia
Posted: 12th Sep 2018 21:14
Thanks!
SetDisplayAspect being set to the same values as SetWindowSize seems to do the trick on a desktop/laptop.
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 17th Sep 2018 01:32 Edited at: 17th Sep 2018 01:34
You can also use SetScissor(0,0,0,0), which allows u to use negative coords to position stuff to the left of zero, and values over 100 to position them to the right.

This is handy as it keeps the aspect ratio the same, so your game doesn't stretch when running on devices with different aspects.

>edit<
AGK has commands to return the exact values of the left and right hand edges of the screen, but I forget what they are and I'm not at a PC right now.
PSY
Developer
8
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 23rd Sep 2018 05:03
Quote: "AGK has commands to return the exact values of the left and right hand edges of the screen, but I forget what they are and I'm not at a PC right now."




Also



PSY LABS Games
Coders don't die, they just gosub without return

Login to post a reply

Server time is: 2024-11-23 05:14:33
Your offset time is: 2024-11-23 05:14:33