Responsiveness

Good evening,
I have been reading through the documentation of defold to find out how to make a responsive game, I know you could easily change the layout for GUI elements easily, but my problem is I would like to sort of change the game layout too, I don’t know if this should be done using renderer script or not, but here is an example of what I want to achieve, where the whole “level area” is rendered above the GUI position.

here are pics of what I mean:


Sorry, I don’t see a question?

1 Like

I just have no idea how to start with this problem, I want to develop games for the HTML5 platform, so I played around with the scale mode but to no avail, but I figured out how to position the GUI in the desired location with GUI layouts and anchors, but I have no idea how to change the level and all game objects that are in it to just show inside the red box on portrait, since the base resolution is landscape, could you give me a place to start?

Yep, GUI layouts will help you with this: GUI layouts in Defold

You can change the viewport in the render script to only draw your game in one part of the screen. If you make a copy of the render script from builtins and change your game.project settings to use your copy you can modify the viewport. In the update function there’s a line that sets the viewport

render.set_viewport(0, 0, render.get_window_width(), render.get_window_height())

Use the width and height to determine if you are in portrait or landscape mode and adjust the viewport accordingly.

1 Like