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 / How to stretch picture to keep it as a background

Author
Message
NewProgramer
User Offline
Joined: 10th Jan 2018
Location:
Posted: 10th Jan 2018 19:19
Hello was wondering how do you stretch a picture and put it as the background also what size pictures should i generally use for all my apps. Thank you
Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jan 2018 21:24
Determine the resolution of the largest device you plan on your app being used by. Make your background at least that size, because it'll look better reduced to fit smaller screens than it will enlarged to fit bigger ones.

And you can use setSpriteSize to match the resolution of the screen. I'm not positive, but I'm willing to bet not all phones have the same aspect ratio. So consider how you want to resize the background. Stretch to fit? Or maintain the aspect ratio and apply black borders.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Supertino
1
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 11th Jan 2018 11:22 Edited at: 11th Jan 2018 11:24
id say go no smaller than 1080p, most new phones\screens are 1080p or higher today.



The above does not account for aspect ratio but using GetDeviceWidth()\ GetDeviceHeight() and GetImageWidth() \ GetImageHeight() you can resize the sprite and keep aspect by chopping off sides or bottom as needed.
Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th Jan 2018 15:14
Just to point out, you can use -1 in place of one of the dimensions and it'll be calculated automatically to maintain aspect ratio.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Supertino
1
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 16th Jan 2018 11:23
baxslash
Bronze Codemaster
11
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 16th Jan 2018 18:39 Edited at: 16th Jan 2018 18:41
I would normally make it fit the maximum size it can without creating a squashed image. Something like this:


If you don't mind stretching it do something like this:
Using AppGameKit V2 Tier 1

Login to post a reply

Server time is: 2018-07-23 07:09:12
Your offset time is: 2018-07-23 07:09:12