natiny_window_set_state

C
void natiny_window_set_state(NatinyWindow id, int state);

Requests one of four exclusive window states: normal, minimized, maximized or fullscreen.

Parameters

Name Type Description
id NatinyWindow Window handle from natiny_window_create
state int One of the constants below

States

Constant Value Desktop Web Android
NATINY_WINDOW_STATE_NORMAL 0 Restores the window from minimized, maximized or fullscreen Leaves fullscreen Shows the status bar
NATINY_WINDOW_STATE_MINIMIZED 1 Minimizes the window No effect No effect
NATINY_WINDOW_STATE_MAXIMIZED 2 Maximizes the window No effect No effect
NATINY_WINDOW_STATE_FULLSCREEN 3 Borderless fullscreen on the monitor the window is mostly on Fullscreen API Hides the status bar

The requested state replaces the current state. For example, requesting NATINY_WINDOW_STATE_MAXIMIZED for a fullscreen window leaves fullscreen before maximizing the window.

Example

C
if (natiny_input_get_key_pressed(NATINY_INPUT_KEY_F11)) {
    int state = natiny_window_get_state(win);
    natiny_window_set_state(win,
        state == NATINY_WINDOW_STATE_FULLSCREEN ? NATINY_WINDOW_STATE_NORMAL
                                                : NATINY_WINDOW_STATE_FULLSCREEN);
}

Notes

  • Web and Android builds support only NATINY_WINDOW_STATE_NORMAL and NATINY_WINDOW_STATE_FULLSCREEN. Other states have no effect.
  • On Android, fullscreen hides the status bar but does not hide the navigation bar.