Scaling for multiple devices

Hi there,

This is doing my head in. Im trying to create a fixed width game. I’ve installed britzls orthographic camera (its the third camera I’ve tried, couldnt make it work from scratch, or with ross grams camera) and I’ve set projection to FIXED. Seems fine on my laptop. I can scale the game window around and the content stays the same size (it adds black bars around the content as the window gets bigger, but shrinks the content if the window gets smaller) Cool. looks good.

Now - I want to scale all my game content so that it grows if the window size is bigger.

In the render script i detect what my screen width is, check it against the ‘default’ screen width, and get a ratio (if the screen I’m playing on is twice the width of the development screen, the ratio is 2) So i multiply all my game content scale (I’ve got all my game objects setup as children of one big game object) by that ratio. BOOM. looks great. I can scale the game window however I like in defold and my content stays fixed width and scaled correctly. I can also change the width and height in game settings and whatever i change it to it STILL works correctly. I must be some sort of genius.

Then i chuck it on my iPhone 8 and it doesn’t display correctly at all. scales all wacky. I can’t even figure out a consistent rule to the wackiness.

Is my logic totally flawed? is there a way easier way to do this? are my cameras just not working on my iPhone? All i want is to ensure the game will look the same regardless of what its played on.

I really don’t understand whats going on.

Have you added launch images to your game.project file for iOS? This is required by Apple otherwise it will not use the entire screen.

It would be awesome if the editor automatically provide the missing images by scaling the closest/default as a workaround. It would look like crap of curse, but save shitloads of time. It’s a flaw in iOS internal and nothing in Defold, but even though I posess the insider knowledge it’s easily forgotten.

1 Like

Can you tell me what’s wrong with iOS ?

It’s just for the records of someone who never program it :slight_smile:

@cubixpix as @britzl mentioned, unless the launch images are there the screen resolution is different. Which is how iOS does it by default, if you develop Apps in XCode. Why Apple decided on that behaviour one could only speculate, but it does seem like a hack / workaround to ensure backward compatibility.

1 Like