defold / defold/examples

Add Safe Area example

Open
#146 0 comments 0 reactions 0 assignees View on GitHub
example
Dominant language
Lua
Stars
128
Forks
35
PR merge metrics
No merged PRs in 30d

Description

**Describe the example you'd like**
Safe Area is built-in since Defold 1.12.1

Safe Area support for Android and iOS phones is now available in the engine out of the box.
You can control how the GUI respects the safe area using gui.safe_area_mode = none|long|short|both in game.project, with the option to override this per GUI scene at runtime via gui.gui.set_safe_area_mode(gui.SAFE_AREA_*).

This allows UI elements to stay within safe zones on devices with notches, while still using the full screen when no cutout is present (On platforms without cutouts, the inset values are returned as 0).
The new window.get_safe_area() API provides the current safe area rectangle along with inset values, making it possible to use this data in custom layout and positioning logic.

**Additional context (optional)**
[Here you can specify references (screenshots, links) of what you would like to see in the example.](https://forum.defold.com/t/defold-1-12-1-has-been-released/82327)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.