-
Notifications
You must be signed in to change notification settings - Fork 13
Window style layout
- Reading/Setting the style
- Getting/Changing the size/position
- Changing the window cursor
- Get/Set the window title
- Get/Set the window state
- Reading/Writing the clipboard
- Querying displays/monitors
- Notes
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:
// Enable window decoration
(true);
// Disable window decoration
(false);
// Toggle window decoration
(!());Note: You can overwrite the default decoration behavior by changing the value in
fplWindowSettings::isDecorated from the
fplSettings::window field at startup.
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:
// Enable window floating
(true);
// Disable window floating
(false);
// Toggle window floating
(!());Note: You can overwrite the default floating behavior by changing the value in
fplWindowSettings::isFloating from the
fplSettings::window field at startup.
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:
// Enable resizing of the window
(true);
// Disable resizing of the window
(false);
// Toggle window resizing mode
(!());Note: You can overwrite the default resizable behavior by changing the value in
fplWindowSettings::isResizable from the
fplSettings::window field at startup.
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:
// Retrieve absolute window position
curPos;
if ((&curPos)) {
// Do something with the window position
}
// Change window absolute position to 0x0
(0, 0);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:
// Retrieve window inner/client size
curSize;
if ((&curSize)) {
// Do something with the client size
}
// Change window size to fit 800x600 screen units inside the client area
(800, 600);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.
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:
// Enable fullscreen on the nearest desktop
();
// or
// Enable fullscreen on the nearest desktop
(true, 0, 0, 0);
// Enable 1080p fullscreen on the nearest desktop
(true, 1920, 1080, 0);
// Switch to 1080p screen resolution with a refresh rate of 60 Hz on the nearest desktop
(true, 1920, 1080, 60);
// Enable a 4k stretched resolution on two 1080p monitor left-right configuration
(true, 0, 0, 3840, 1080);Disable fullscreen example:
// Disable fullscreen size
(false, 0, 0, 0);
// or
// Disable fullscreen rect
(false, 0, 0, 0, 0);
// or
// Disable fullscreen
();Query fullscreen state:
if (()) {
// Do something on fullscreen mode
}
// Toggle fullscreen
(!fplIsWindowFullScreen(), 0, 0, 0);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.
By default, the window has cursors enabled. Use fplSetWindowCursorEnabled to show/hide the cursor.
Example:
// Enable the cursor
(true);
// Disable the cursor
(false);By default, the window has an unnamed title. Use fplSetWindowTitle to set a window title on runtime.
Example:
// Set window title
("My awesome application");
// Get the window title
char titleBuffer[];
(titleBuffer, (titleBuffer));Note: You can overwrite the window title by changing the value in
fplWindowSettings::title from the
fplSettings::window field at startup.
By default, the window has a normal default state.
- Use fplSetWindowState to change to state the window state to a different one.
- Use fplGetWindowState to retrieve the current state of the window
Example:
// Iconify the window
();
// Maximize the window
();
// Reset to the normal when not normal
curState = ();
if (curState != ) {
();
}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.
FPL can read and write the system clipboard text.
- Use fplGetClipboardText() to read the current clipboard text into a destination buffer.
- Use fplSetClipboardText() to overwrite the clipboard text with a new string.
Both functions return a boolean indicating success.
// Write text into the clipboard
("Copied from FPL");
// Read text from the clipboard
char clipboard[256];
if ((clipboard, (clipboard))) {
("Clipboard: %s\n", clipboard);
}Note: fplGetClipboardText() returns false when the clipboard does not contain any text.
FPL can enumerate the connected displays and query their properties through the fplDisplayInfo and fplDisplayMode structures.
Use fplGetDisplayCount() to get the number of active displays, and fplGetDisplays() to fill an array of fplDisplayInfo structures.
displays[8];
size_t displayCount = (displays, (displays));
for (size_t i = 0; i < displayCount; ++i) {
("Display '%s' %dx%d%s\n",
displays[i].id,
displays[i].physicalSize.width, displays[i].physicalSize.height,
displays[i].isPrimary ? " (primary)" : "");
}FPL provides several functions to retrieve a single display info:
- fplGetPrimaryDisplay() gets the primary display.
- fplGetWindowDisplay() gets the display the FPL window is currently on.
- fplGetDisplayFromPosition() gets the display that contains a given screen coordinate.
info;
// Get the display the window currently lives on
if ((&info)) {
("Window is on display '%s'\n", info.);
}Use fplGetDisplayModes() to retrieve the supported fplDisplayMode entries (size, color depth, refresh rate) for a display id.
primary;
if ((&primary)) {
modes[64];
size_t modeCount = (primary., modes, (modes));
for (size_t i = 0; i < modeCount; ++i) {
("%dx%d @ %d Hz, %d bpp\n",
modes[i].width, modes[i].height,
modes[i].refreshRate, modes[i].colorBits);
}
}Note: Use
fplSetDefaultWindowSettings() to initialize a
fplWindowSettings to a default state.
- Assertion & Debug
- Atomic operations
- Audio functions
- Clipboard functions
- Console functions
- Constants
- Display/Monitor functions
- Dynamic library loading
- Error Handling
- Files/IO functions
- Function macros
- Hardware Infos
- Input types and functions
- Localization functions
- Logging
- Memory Macros
- Memory functions
- Operating system Infos
- Path functions
- Platform functions
- Session Infos
- Settings & Configurations
- Storage class identifiers
- String functions
- Threading and synchronizations routines
- Timing functions
- Video functions
- Window events
- Window functions
- fplARMCPUCapabilities
- fplAudioChannelMap
- fplAudioDeviceID
- fplAudioDeviceInfo
- fplAudioFormat
- fplAudioSettings
- fplColor32
- fplConditionVariable
- fplConsoleSettings
- fplCPUCapabilities
- fplCPUIDLeaf
- fplDateTime
- fplDateTimeCreationResult
- fplDateTimeResult
- fplDisplayInfo
- fplDisplayMode
- fplDynamicLibraryHandle
- fplEndianess
- fplEvent
- fplFileEntry
- fplFileHandle
- fplFilePermissions
- fplFileTimeStamps
- fplGamepadButton
- fplGamepadData
- fplGamepadEvent
- fplGamepadInfo
- fplGamepadInputBinding
- fplGamepadMapping
- fplGamepadSettings
- fplGamepadState
- fplGamepadStates
- fplGraphicsApiSettings
- fplImageSource
- fplInputBackendMask
- fplInputBackendSupport
- fplInputDevice
- fplInputDeviceGuid
- fplInputSettings
- fplInternalConditionVariable
- fplInternalDynamicLibraryHandle
- fplInternalFileEntryHandle
- fplInternalFileHandle
- fplInternalFileRootInfo
- fplInternalMutexHandle
- fplInternalSemaphoreHandle
- fplInternalSignalHandle
- fplInternalThreadHandle
- fplKeyboardEvent
- fplKeyboardState
- fplLogSettings
- fplLogWriter
- fplLogWriterConsole
- fplLogWriterCustom
- fplMemoryAllocationSettings
- fplMemoryBlock
- fplMemoryInfos
- fplMemorySettings
- fplMouseEvent
- fplMouseState
- fplMutexHandle
- fplOpenGLSettings
- fplOSVersionInfos
- fplSemaphoreHandle
- fplSettings
- fplSignalHandle
- fplSpecificAudioSettings
- fplThreadHandle
- fplThreadParameters
- fplTimestamp
- fplVersionInfo
- fplVideoBackBuffer
- fplVideoRect
- fplVideoRequirements
- fplVideoRequirementsVulkan
- fplVideoSettings
- fplVideoSurface
- fplVideoSurfaceOpenGL
- fplVideoSurfaceVulkan
- fplVideoWindow
- fplVulkanSettings
- fplWindowCallbacks
- fplWindowDropFiles
- fplWindowEvent
- fplWindowPosition
- fplWindowSettings
- fplWindowSize
- fplX86CPUCapabilities