Screen size "presets" for dmengine

Hello! I’ve got a feature request which, I believe, should be very useful for a lot of us.

We all know that mobile devices come with a variety of screen sizes with different aspect ratios. And we need to support them in our games. While you can easily resize dmengine window but you never know what the current aspect ratio is. It would be great to have a dropdown menu with presets for the most common resolutions/aspect ratios (like different iPhones, iPad, Android devices). Also I’ve got a special case for macOS: when I run dmengine with portrait orientation at 720x1280, the window height becomes too big (doesn’t fit on the screen) and it is automatically resized with breaking aspect ratio. It would be great that when I select some screen size/aspect ratio, it is strictly followed (when the height is too big, reduce window width as well to keep it and vice versa).

Thank you in advance!

EDIT 2018-06-17: The default render script will always stretch the content to fill the screen regardless of aspect ratio. The render script does however provide other projections as well, one for a fixed projection and one fixed fit projection. Make a copy of the render script and call fixed_projection() or fixed_fit_projection() instead of stretch_projection(). Or even better, switch to Defold-Orthographic or RenderCam from the asset store for even better control of the projection used when rendering.

ORIGINAL RESPONSE:
The default render script will always stretch the content to fill the screen dimensions regardless of aspect ratio. This is not always the best solution, sometimes you wish to show more of the content while maintaining the aspect ratio set in game.project, or perhaps you want black borders or maybe something else. All this can be achieved with a custom render script. One example of this can be seen in this example:

And specifically this render script: https://github.com/britzl/publicexamples/blob/master/examples/fixed_aspect_ratio/fixed_aspect_ratio/fixed_aspect_ratio.render_script

I know about render scripts and already use a custom one in my game :slight_smile: What I’m requesting is an easier way to test how your game will look on the devices with different screen aspect ratios with dmengine app. A very specific use case: I’m working on laying out GUI elements and want to check how they will look on iPhone 5 and iPad (16:9 vs 4:3 aspect ratio). I can resize dmengine window but I don’t know if this is the correct aspect ratio for iPhone 5 screen or for iPad screen. I would like to have a dropdown in dmengine with the list like:

  • 16:9 (Landscape)
  • 16:9 (Portrait)
  • 4:3 (Landscape)
  • 4:3 (Portrait)

Of course these are not the only existing aspect ratios, so maybe it would be good to have the list of popular devices (iPhones, iPad, different Android devices, some popular desktop resolutions). We set up the screen size in project settings but in the real world (especially in mobile world), your game will run on different screens and you need to make sure you support all of them perfectly.

It will help people to check how their GUI and game will look like on different devices without running them on these actual devices.

Hello @megus.sugem!

There’s currently a feature request DEF-2082 “Resize window size from script in runtime” that should enable you to implement this feature yourself. It is not implemented yet, but since it’s a requirement for a indie team to ship their game it is prioritised to be completed within the next three sprints. We have a meeting to plan the next sprint later today and I’ll make sure to bring this up.

Regards,
Jakob

Thank you! It will definitely help as a debug feature :slight_smile: But still could be good to have it in dmengine just for debugging means.

Ah, sorry, I misunderstood you. DEF-2082 mentioned by Jakob, combined with a couple of different key bindings to resize the window to different resolutions would do the trick I think. And in the future maybe also a drop down menu to chose from a set of predefined screen resolutions as well.

1 Like

I’ve been using the program Sizer to do this for me when running the game at my computer.

Sizer? Is it this program? http://www.brianapps.net/sizer/

Too bad it doesn’t exist for macOS :frowning:

That is the one. Adding a link slipped my mind.

@megus.sugem Yeah that is a shame.

404 on this thread

Updated my answer and link.

BTW It should be possible to create a nice little native extension using DefOS and Def-Mnu that does exactly this.

1 Like

Made an example for this! All of the heavy lifting was done with DefOS and Def-Mnu.

9 Likes

That’s really nice! Thanks for sharing!

1 Like

Hah, that is awesome! Was thinking of doing something like this, but you were once again too quick for me. :smiley: Great job!

2 Likes