IWindowing#
Fully qualified name: carb::windowing::IWindowing
Defined in carb/windowing/IWindowing.h
-
struct IWindowing#
Defines a windowing interface.
Public Members
-
Window *(*createWindow)(const WindowDesc &desc)#
Creates a window.
- Param desc:
The descriptor for the window.
- Return:
The window created.
-
void (*destroyWindow)(Window *window)#
Destroys a window.
- Param window:
The window to be destroyed.
-
void (*showWindow)(Window *window)#
Shows a window making it visible.
- Param window:
The window to use.
-
void (*hideWindow)(Window *window)#
Hides a window making it hidden.
- Param window:
The window to use.
-
uint32_t (*getWindowWidth)(Window *window)#
Gets the current window width.
- Param window:
The window to use.
- Return:
The current window width.
-
uint32_t (*getWindowHeight)(Window *window)#
Gets the current window height.
- Param window:
The window to use.
- Return:
The current window height.
-
Int2 (*getWindowPosition)(Window *window)#
Gets the current window position.
- Param window:
The window to use.
- Return:
The current window position.
-
void (*setWindowPosition)(Window *window, const Int2 &position)#
Sets the current window position.
- Param window:
The window to use.
- Param position:
The position to set the window to.
-
void (*setWindowTitle)(Window *window, const char *title)#
Sets the window title.
- Param window:
The window to use.
- Param title:
The window title to be set (as a utf8 string)
-
void (*setWindowOpacity)(Window *window, float opacity)#
Sets the window opacity.
- Param window:
The window to use.
- Param opacity:
The window opacity. 1.0f is fully opaque. 0.0 is fully transparent.
-
float (*getWindowOpacity)(Window *window)#
Gets the window opacity.
- Param window:
The window to use.
- Return:
The window opacity. 1.0f is fully opaque. 0.0 is fully transparent.
-
void (*setWindowFullscreen)(Window *window, bool fullscreen)#
Sets the window into fullscreen or windowed mode.
- Param window:
The window to use.
- Param fullscreen:
true to be set to fullscreen, false to be set to windowed.
-
bool (*isWindowFullscreen)(Window *window)#
Determines if the window is in fullscreen mode.
- Param window:
The window to use.
- Return:
true if the window is in fullscreen mode, false if in windowed mode.
-
void (*setWindowResizeFn)(Window *window, OnWindowResizeFn onWindowResize, void *userData)#
Sets the function for handling resize events.
- Param window:
The window to use.
- Param onWindowResize:
The function callback to handle resize events on the window.
-
void (*resizeWindow)(Window *window, int width, int height)#
Resizes the window.
- Param window:
The window to resize.
- Param width:
The width to resize to.
- Param height:
The height to resize to.
-
void (*focusWindow)(Window *window)#
Set the window in focus.
- Param window:
The window to use.
-
void (*setWindowFocusFn)(Window *window, OnWindowFocusFn onWindowFocusFn, void *userData)#
Sets the function for handling window focus events.
- Param window:
The window to use.
- Param onWindowFocusFn:
The function callback to handle focus events on the window.
-
bool (*isWindowFocused)(Window *window)#
Determines if the window is in focus.
- Param window:
The window to use.
- Return:
true if the window is in focus, false if it is not.
-
void (*setWindowMinimizeFn)(Window *window, OnWindowMinimizeFn onWindowMinimizeFn, void *userData)#
Sets the function for handling window minimize events.
- Param window:
The window to use.
- Param onWindowMinimizeFn:
The function callback to handle minimize events on the window.
-
bool (*isWindowMinimized)(Window *window)#
Determines if the window is minimized.
- Param window:
The window to use.
- Return:
true if the window is minimized, false if it is not.
-
void (*setWindowDropFn)(Window *window, OnWindowDropFn onWindowDrop, void *userData)#
Sets the function for handling drag-n-drop events.
- Param window:
The window to use.
- Param onWindowDrop:
The function callback to handle drop events on the window.
-
void (*setWindowCloseFn)(Window *window, OnWindowCloseFn onWindowClose, void *userData)#
Sets the function for handling window close events.
- Param window:
The window to use.
- Param onWindowClose:
The function callback to handle window close events.
-
bool (*shouldWindowClose)(Window *window)#
Determines if the user has attempted to closer the window.
- Param window:
The window to use.
- Return:
true if the user has attempted to closer the window, false if still open.
-
void (*setWindowShouldClose)(Window *window, bool value)#
Hints to the window that it should close.
- Param window:
The window to use.
- Param value:
true to request the window to close, false to request it not to close.
-
void *(*getWindowUserPointer)(Window *window)#
This function returns the current value of the user-defined pointer of the specified window.
The initial value is nullptr.
- Param window:
The window to use.
- Return:
the current value of the user-defined pointer of the specified window.
-
void (*setWindowUserPointer)(Window *window, void *pointer)#
This function sets the user-defined pointer of the specified window.
The current value is retained until the window is destroyed. The initial value is nullptr.
- Param window:
The window to use.
- Param pointer:
The new pointer value.
-
void (*setWindowContentScaleFn)(Window *window, OnWindowContentScaleFn onWindowContentScale, void *userData)#
Sets the function for handling content scale events.
- Param window:
The window to use.
- Param onWindowContentScale:
The function callback to handle content scale events on the window.
-
Float2 (*getWindowContentScale)(Window *window)#
Retrieves the content scale for the specified monitor.
- Param window:
The window to use.
- Return:
The content scale of the window.
-
void *(*getNativeDisplay)(Window *window)#
Gets the native display handle.
windows = nullptr linux =
Display*
- Param window:
The window to use.
- Return:
The native display handle.
-
void *(*getNativeWindow)(Window *window)#
Gets the native window handle.
windows =
HWND
linux =Window
- Param window:
The window to use.
- Return:
The native window handle.
-
void (*setInputMode)(Window *window, InputMode mode, bool enabled)#
Sets an input mode option for the specified window.
- Param window:
The window to set input mode.
- Param mode:
The mode to set.
- Param enabled:
The new value to apply to
mode
.
-
bool (*getInputMode)(Window *window, InputMode mode)#
Gets the value of a input mode option for the specified window.
- Param window:
The window to get input mode value.
- Param mode:
The input mode to get value from.
- Return:
The input mode value associated with the window.
-
void (*updateInputDevices)()#
Updates input device states.
-
void (*pollEvents)()#
Polls and processes only those events that have already been received and then returns immediately.
-
void (*waitEvents)()#
Puts the calling thread to sleep until at least one event has been received.
-
input::Keyboard *(*getKeyboard)(Window *window)#
Gets the logical keyboard associated with the window.
- Param window:
The window to use.
- Return:
The keyboard.
-
input::Mouse *(*getMouse)(Window *window)#
Gets the logical mouse associated with the window.
- Param window:
The window to use.
- Return:
The mouse.
-
Cursor *(*createCursorStandard)(CursorStandardShape shape)#
Creates a cursor with a standard shape, that can be set for a window with setCursor.
Use destroyCursor to destroy cursors.
- Param shape:
The standard shape of cursor to be created.
- Return:
A new cursor ready to use or nullptr if an error occurred.
-
void (*destroyCursor)(Cursor *cursor)#
Destroys a cursor previously created with createCursorStandard.
If the specified cursor is current for any window, that window will be reverted to the default cursor.
- Param cursor:
the cursor object to destroy.
-
void (*setCursor)(Window *window, Cursor *cursor)#
Sets the cursor image to be used when the cursor is over the content area of the specified window.
- Param window:
The window to set the cursor for.
- Param cursor:
The cursor to set, or nullptr to switch back to the default arrow cursor.
-
void (*setCursorMode)(Window *window, CursorMode mode)#
Sets cursor mode option for the specified window.
- Param window:
The window to set cursor mode.
- Param mode:
The mouse mode to set to.
-
CursorMode (*getCursorMode)(Window *window)#
Gets cursor mode option for the specified window.
- Param window:
The window to get cursor mode.
- Return:
The mouse mode associated with the window.
-
void (*setCursorPosition)(Window *window, const Int2 &position)#
Sets cursor position relative to the window.
- Param window:
The window to set input mode.
- Param position:
The x/y coordinates relative to the window.
-
Int2 (*getCursorPosition)(Window *window)#
Gets cursor position relative to the window.
- Param window:
The window to set input mode.
- Return:
The x/y coordinates relative to the window.
-
void (*setClipboard)(Window *window, const char *text)#
The set clipboard function, which expects a Window and text.
- Param window:
The window that contains a glfwWindow
- Param text:
The text to set to the clipboard
-
const char *(*getClipboard)(Window *window)#
Gets the clipboard text.
- Param window:
The window that contains a glfwWindow
- Return:
The text from the clipboard
-
void (*setMonitorsChangeFn)(OnMonitorChangeFn onMonitorChange)#
Sets the monitors callback function for configuration changes.
The onMonitorChange function callback will occur when monitors are changed. Current changes that can occur are connected/disconnected.
- Param onMonitorChange:
The callback function when monitors change.
-
const Monitor *(*getMonitorPrimary)()#
Gets the primary monitor.
A Monitor object represents a currently connected monitor and is represented as a pointer to the opaque native monitor. Monitor objects cannot be created or destroyed by the application and retain their addresses until the monitors they represent are disconnected.
- Return:
The primary monitor.
-
const Monitor **(*getMonitors)(size_t *monitorCount)#
Gets the enumerated monitors.
This represents a currently connected monitors and is represented as a pointer to the opaque native monitor. Monitors cannot be created or destroyed and retain their addresses until the monitors are disconnected.
Use setMonitorsChangeFn to know when a monitor is disconnected.
- Param monitorCount:
The returned number of monitors enumerated.
- Return:
The enumerated monitors.
-
const char *(*getMonitorName)(const Monitor *monitor)#
Gets the human read-able monitor name.
The name pointer returned is only valid for the life of the Monitor. When the Monitor is disconnected, the name pointer becomes invalid.
Use setMonitorsChangeFn to know when a monitor is disconnected.
- Param monitor:
The monitor to use.
- Return:
The human read-able monitor name. Pointer returned is owned by monitor.
-
Int2 (*getMonitorPhysicalSize)(const Monitor *monitor)#
Gets a monitors physical size in millimeters.
The size returned is only valid for the life of the Monitor. When the Monitor is disconnected, the size becomes invalid.
Use setMonitorsChangeFn to know when a monitor is disconnected.
- Param monitor:
The monitor to use.
- Param size:
The monitor physical size returned.
-
const VideoMode *(*getMonitorVideoMode)(const Monitor *monitor)#
Gets a monitors current video mode.
The pointer returned is only valid for the life of the Monitor. When the Monitor is disconnected, the pointer becomes invalid.
Use setMonitorsChangeFn to know when a monitor is disconnected.
- Param monitor:
The monitor to use.
- Return:
The video mode.
-
Int2 (*getMonitorPosition)(const Monitor *monitor)#
Gets a monitors virtual position.
The position returned is only valid for the life of the Monitor. When the Monitor is disconnected, the position becomes invalid.
Use setMonitorsChangeFn to know when a monitor is disconnected.
- Param monitor:
The monitor to use.
- Param position:
The monitor virtual position returned.
-
Float2 (*getMonitorContentScale)(const Monitor *monitor)#
Gets a monitors content scale.
The content scale is the ratio between the current DPI and the platform’s default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.
The content scale returned is only valid for the life of the Monitor. When the Monitor is disconnected, the content scale becomes invalid.
Use setMonitorsChangeFn to know when a monitor is disconnected.
- Param monitor:
The monitor to use.
- Return:
The monitor content scale (dpi).
-
void (*getMonitorWorkArea)(const Monitor *monitor, Int2 *positionOut, Int2 *sizeOut)#
Gets a monitors work area.
The area of a monitor not occupied by global task bars or menu bars is the work area
The work area returned is only valid for the life of the Monitor. When the Monitor is disconnected, the work area becomes invalid.
Use setMonitorsChangeFn to know when a monitor is disconnected.
- Param monitor:
The monitor to use.
- Param position:
The returned position.
- Param size:
The returned size.
-
void (*setWindowMoveFn)(Window *window, OnWindowMoveFn onWindowMove, void *userData)#
Sets the function for handling move events.
Must be called on a main thread.
- Param window:
The window to use (shouldn’t be nullptr).
- Param onWindowMove:
The function callback to handle move events on the window (can be nullptr).
- Param userData:
User-specified pointer to the data. Lifetime and value can be anything.
-
bool (*isWindowFloating)(Window *window)#
Determines if the window is floating (or always-on-top).
- Param window:
The window to use.
- Return:
true if the window is floating.
-
void (*setWindowFloating)(Window *window, bool isFloating)#
Sets the window into floating (always-on-top) or regular mode.
- Param window:
The window to use.
- Param fullscreen:
true to be set to floating (always-on-top), false to be set to regular.
-
Cursor *(*createCursor)(const Image &image, int32_t xhot, int32_t yhot)#
Creates a new custom cursor image that can be set for a window with setCursor.
The cursor can be destroyed with destroyCursor.
The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner.
The cursor hotspot is specified in pixels, relative to the upper-left corner of the cursor image. Like all other coordinate systems in GLFW, the X-axis points to the right and the Y-axis points down.
- Param image:
The desired cursor image.
- Param xhot:
The desired x-coordinate, in pixels, of the cursor hotspot.
- Param yhot:
The desired y-coordinate, in pixels, of the cursor hotspot.
- Return:
created cursor, or nullptr if error occurred.
-
void (*maximizeWindow)(Window *window)#
Maximize the window.
- Param window:
The window to use.
-
void (*minimizeWindow)(Window *window)#
Minimize the window.
- Param window:
The window to use.
-
void (*restoreWindow)(Window *window)#
Restore the window.
- Param window:
The window to use.
-
void (*setWindowMaximizeFn)(Window *window, OnWindowMaximizeFn onWindowMaximizeFn, void *userData)#
Sets the function for handling window maximize events.
- Param window:
The window to use.
- Param onWindowMaximizeFn:
The function callback to handle maximize events on the window.
-
bool (*isWindowMaximized)(Window *window)#
Determines if the window is maximized.
- Param window:
The window to use.
- Return:
true if the window is maximized, false if it is not.
-
void (*setWindowIcon)(Window *window, const Image &image)#
This function sets the icon of the specified window.
This function will do nothing when pass a invalid image, i.e. image.width==0 or image.height ==0 or image.pixels == nullptr
The image.pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner.
The desired image sizes varies depending on platform and system settings. The selected images will be rescaled as needed. Good sizes include 16x16, 32x32 and 48x48.
- Param window:
The window to use.
- Param image:
The desired icon image.
-
carb::input::KeyboardInput (*translateKey)(carb::input::KeyboardInput input)#
Translate physical key to actual key of current keyboard layout.
- Param input:
Physical key input.
- Return:
Translated key based on current keyboard layout, or input::KeyboardInput::eUnknown.
Public Static Functions
- static inline constexpr carb::InterfaceDesc getInterfaceDesc(
Returns information about this interface.
Auto-generated by CARB_PLUGIN_INTERFACE() or CARB_PLUGIN_INTERFACE_EX.
- Returns:
The carb::InterfaceDesc struct with information about this interface.
- static inline constexpr carb::InterfaceDesc getLatestInterfaceDesc(
Returns information about the latest version of this interface.
Auto-generated by CARB_PLUGIN_INTERFACE() or CARB_PLUGIN_INTERFACE_EX.
- Returns:
The carb::InterfaceDesc struct with information about the latest version of this interface.
-
Window *(*createWindow)(const WindowDesc &desc)#