Portrait mode on Poki

Hi there! I’m trying make my game run on portrait mode on poki.
In desktop and lanscape all good, but when I try mobile:

How you guys do full portrait on poki? Any leads? I’m a bit lost here :pray:

3 Likes

Are you able to get the iframe viewport size with JS? Try debugging that.

They never accepted me into their program so I can’t give you good tips unfortunately. :upside_down_face:

2 Likes

This topic interests me because I have Poki as target soon.

Use “Stretch” mode for HTML5 Defold development for the HTML5 platform

There is no concept of screen orientation in HTML5. In fact, the canvas of your game should occupy all available space. Portrait mode is when the width of the canvas is less than the height.

7 Likes

I’m going through this situation now. Because the game is HTML5, you can’t check for the device. I think the best solution is something like this

local w,h = window.get_size()

If w < h, then the game will be in portrait mode.

I run this check when the game loads/resets and then set up the game accordingly.

1 Like

You are the goat, thanks :pray:. Totally missed that piece of the manual.

Yes I’m doing the same thing “If w < h”
I’m using these in my render script:

local window_width = render.get_window_width()
local window_height = render.get_window_height()

I’m using the Orthographic Camera library with projection “FIXED_AUTO”, with a custom script, to zoom in and out when needed.
Also this message “window_resized” to detect when the device is rotated. So far so good.

1 Like

Topic saved as source of information. :slightly_smiling_face:

2 Likes