# Portrait mode on Poki

**URL:** <https://forum.defold.com/t/portrait-mode-on-poki/78382>\
**Category:** Questions\
**Created:** [October 8, 2024, 10:36pm UTC](https://forum.defold.com/t/portrait-mode-on-poki/78382 "2024-10-08T22:36:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgs1000](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pgs1000/32/43053_2.png) [@pgs1000](https://forum.defold.com/u/pgs1000)\
**Post date:** [October 8, 2024, 10:36pm UTC](https://forum.defold.com/t/portrait-mode-on-poki/78382/1 "2024-10-08T22:36:49Z")

</div>

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:

 ![pki ptr](https://forum-defold-uploads.b-cdn.net/original/3X/f/c/fc466819a9df247359bf427923e4498bd378d6ba.jpeg)

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

---

<div class="post-metadata">

**Author:** ![Pkeod](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pkeod/32/606_2.png) [@Pkeod](https://forum.defold.com/u/Pkeod)\
**Post date:** [October 8, 2024, 11:04pm UTC](https://forum.defold.com/t/portrait-mode-on-poki/78382/2 "2024-10-08T23:04:30Z")

</div>

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. 🙃

---

<div class="post-metadata">

**Author:** ![SuperEly](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/superely/32/36691_2.png) [@SuperEly](https://forum.defold.com/u/SuperEly)\
**Post date:** [October 8, 2024, 11:23pm UTC](https://forum.defold.com/t/portrait-mode-on-poki/78382/3 "2024-10-08T23:23:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aglitchman](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/aglitchman/32/19432_2.png) [@aglitchman](https://forum.defold.com/u/aglitchman)\
**Post date:** [October 9, 2024, 12:56am UTC](https://forum.defold.com/t/portrait-mode-on-poki/78382/4 "2024-10-09T00:56:45Z")

</div>

> [@pgs1000](#):
>
> I’m trying make my game run on portrait mode on poki.

Use “Stretch” mode for HTML5 [Defold development for the HTML5 platform](https://defold.com/manuals/html5/#stretch)

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.

---

<div class="post-metadata">

**Author:** ![rayraytime](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/r/67e7ee/32.png) [@rayraytime](https://forum.defold.com/u/rayraytime)\
**Post date:** [October 9, 2024, 7:26pm UTC](https://forum.defold.com/t/portrait-mode-on-poki/78382/5 "2024-10-09T19:26:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pgs1000](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pgs1000/32/43053_2.png) [@pgs1000](https://forum.defold.com/u/pgs1000)\
**Post date:** [October 9, 2024, 7:38pm UTC](https://forum.defold.com/t/portrait-mode-on-poki/78382/6 "2024-10-09T19:38:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pgs1000](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pgs1000/32/43053_2.png) [@pgs1000](https://forum.defold.com/u/pgs1000)\
**Post date:** [October 9, 2024, 7:49pm UTC](https://forum.defold.com/t/portrait-mode-on-poki/78382/7 "2024-10-09T19:49:55Z")

</div>

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

```lua
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”](https://defold.com/ref/render/#window_resized) to detect when the device is rotated. So far so good.

---

<div class="post-metadata">

**Author:** ![SuperEly](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/superely/32/36691_2.png) [@SuperEly](https://forum.defold.com/u/SuperEly)\
**Post date:** [October 9, 2024, 7:54pm UTC](https://forum.defold.com/t/portrait-mode-on-poki/78382/8 "2024-10-09T19:54:07Z")

</div>

Topic saved as source of information. 🙂
