natiny_window_get_orientation

C
uint32_t natiny_window_get_orientation(NatinyWindow id);

Returns the current window orientation derived from its dimensions.

Parameters

Name Type Description
id NatinyWindow Window handle from natiny_window_create

Returns

Type Description
uint32_t NATINY_ORIENTATION_LANDSCAPE when width is greater than height, NATINY_ORIENTATION_PORTRAIT otherwise, or 0 for an invalid handle

Example

C
if (natiny_window_get_orientation(win) == NATINY_ORIENTATION_LANDSCAPE)
    draw_toolbar_down_the_side();
else
    draw_toolbar_across_the_bottom();

Notes

  • The result is based on the current window width and height on every platform.
  • Use natiny_window_set_orientation to set the allowed Android orientations. This function does not return that mask.