Reading/Setting the style
Decoration (Border, Titlebar)
By default, a window is decorated. This means that it has a border, a title bar, and can be moved by the user.
If you enable window decorations, your window will have a border and a title bar always.
Use fplIsWindowDecorated() to determine if the window has decoration enabled or not.
Use fplSetWindowDecorated() to enable/disable the window decoration.
Example:
fpl_platform_api void fplSetWindowDecorated(const bool value)
Enables or disables the window decoration (Titlebar, Border, etc.).
fpl_platform_api bool fplIsWindowDecorated()
Gets the window decorated state as boolean.
- Note
- You can overwrite the default decoration behavior by changing the value in fplWindowSettings::isDecorated from the fplSettings::window field at startup.
Floating (Always on top)
By default, a window is not in floating mode. This means when another window gets focus, your window loses its focus.
If you set your window to floating instead, your window will always be on top of others.
Use fplIsWindowFloating() to determine if the window is floating or not.
Use fplSetWindowFloating() to enable/disable the window floating.
Example:
fpl_platform_api void fplSetWindowFloating(const bool value)
Enables or disables the window floating (Top-most)
fpl_platform_api bool fplIsWindowFloating()
Gets the window floating state as boolean.
- Note
- You can overwrite the default floating behavior by changing the value in fplWindowSettings::isFloating from the fplSettings::window field at startup.
Resizeable
By default, a window is resizeable. This means you can resize your window however you like.
Use fplIsWindowResizable() to determine if the window is resizable or not.
Use fplSetWindowResizeable() to enable/disable the window resizing.
Example:
fpl_platform_api void fplSetWindowResizeable(const bool value)
Enables or disables the ability to resize the window.
fpl_platform_api bool fplIsWindowResizable()
Gets the window resizable state as boolean.
- Note
- You can overwrite the default resizable behavior by changing the value in fplWindowSettings::isResizable from the fplSettings::window field at startup.
Getting/Changing the size/position
Window position
By default, a window uses either the default position from the platform or a fixed location of 0x0 screen units.
Use fplSetWindowPosition() to change the position of the window Use fplGetWindowPosition() to retrieve the current absolute window position from the top-left corner
Example:
}
fpl_platform_api bool fplGetWindowPosition(fplWindowPosition *outPos)
Retrieves the absolute window position.
fpl_platform_api void fplSetWindowPosition(const int32_t left, const int32_t top)
Changes the window absolute position to the given coordinates.
A structure containing the position of a window.
Window size
By default, a window is created using either the default size of the platform or a fixed size of 400x400 screen units.
Use fplSetWindowSize() to change the size of the area of the window.
Use fplGetWindowSize() to get the size of the area of the window.
Example:
}
fpl_platform_api bool fplGetWindowSize(fplWindowSize *outSize)
Retrieves the inner window size.
fpl_platform_api void fplSetWindowSize(const uint32_t width, const uint32_t height)
Resizes the window to fit the inner size based on the given size.
A structure containing the size of a window.
- Note
- You can overwrite the default window size by changing the value in fplWindowSettings::windowSize from the fplSettings::window field at startup.
-
Changing the window size changes the total size of the window - when decorations are enabled.
Fullscreen size
By default, the window is created in non-fullscreen mode, using fplWindowSettings::windowSize from the fplSettings::window or the default window size. See Window size for more details.
Use fplSetWindowFullscreenSize() to enable/disable fullscreen for the window with a given size and a color depth with support of switching the screen-resolution if needed.
Use fplSetWindowFullscreenRect() to enable/disable fullscreen for the window with a given size and a position without changing the screen-resolution.
Use fplIsWindowFullscreen() to determine if the window is in fullscreen mode or not.
Enable fullscreen example:
fpl_platform_api bool fplSetWindowFullscreenRect(const bool value, const int32_t x, const int32_t y, const int32_t width, const int32_t height)
Enables or disables fullscreen mode based on the given rectangle.
fpl_platform_api bool fplEnableWindowFullscreen()
Enables fullscreen mode on the nearest display.
fpl_platform_api bool fplSetWindowFullscreenSize(const bool value, const uint32_t fullscreenWidth, const uint32_t fullscreenHeight, const uint32_t refreshRate)
Enables or disables fullscreen mode based on the given size and the current display.
Disable fullscreen example:
fpl_platform_api bool fplDisableWindowFullscreen()
Switches the window back to window mode.
Query fullscreen state:
}
fpl_platform_api bool fplIsWindowFullscreen()
Gets the window fullscreen state as boolean.
- Note
- Set fplWindowSettings::isFullscreen to true to enable fullscreen at startup.
-
You can overwrite the fullscreen window size by changing the value in fplWindowSettings::fullscreenSize from the fplSettings::window field at startup.
-
You can overwrite the fullscreen refresh rate by changing the value in fplWindowSettings::fullscreenRefreshRate from the fplSettings::window field at startup.
-
If width or height in the fplWindowSettings.fullscreenSize field is zero, the current desktop rectangle is used from the nearest display.
Changing the window cursor
By default, the window has cursors enabled. Use fplSetWindowCursorEnabled to show/hide the cursor.
Example:
fpl_platform_api void fplSetWindowCursorEnabled(const bool value)
Enables or disables the window cursor.
Get/Set the window title
By default, the window has an unnamed title. Use fplSetWindowTitle to set a window title on runtime.
Example:
#define FPL_MAX_NAME_LENGTH
Maximum length of a name (in characters)
#define fplArrayCount(arr)
Returns the element count from a static array. This should ideally produce a compile error when passi...
fpl_platform_api void fplSetWindowTitle(const char *title)
Changes the window title to the given string.
fpl_common_api char * fplGetWindowTitle(char *outTitle, const size_t maxOutTitleLength)
Retrieves the window title and writes it into the output string.
- Note
- You can overwrite the window title by changing the value in fplWindowSettings::title from the fplSettings::window field at startup.
Get/Set the window state
By default, the window has a normal default state.
Example:
}
fpl_platform_api bool fplSetWindowState(const fplWindowState newState)
Changes the current window state.
fplWindowState
An enumeration containg the states of a window.
fpl_platform_api fplWindowState fplGetWindowState()
Gets the current window state.
@ fplWindowState_Normal
Normal window state.
@ fplWindowState_Maximize
Maximize window state.
@ fplWindowState_Iconify
Iconify/Minimize window state.
- Note
- When the window is in fullscreen mode, fplWindowState_Fullscreen is returned from fplGetWindowState() always.
- Warning
- The window state fplWindowState_Fullscreen can never be set.
Notes
- Note
- Use fplSetDefaultWindowSettings() to initialize a fplWindowSettings to a default state.