Documentation
¶
Overview ¶
graphics.gd/classdb/DisplayServer handles everything related to window management. It is separated from graphics.gd/classdb/OS as a single operating system may support multiple display servers.
Headless mode: Starting the engine with the --headless command line argument disables all rendering and window management functions. Most functions from graphics.gd/classdb/DisplayServer will return dummy values in this case.
Index ¶
- func Advanced() class
- func Beep()
- func ClipboardGet() string
- func ClipboardGetImage() Image.Instance
- func ClipboardGetPrimary() string
- func ClipboardHas() bool
- func ClipboardHasImage() bool
- func ClipboardSet(clipboard string)
- func ClipboardSetPrimary(clipboard_primary string)
- func CursorSetCustomImage(cursor Resource.Instance, shape CursorShape, hotspot Vector2.XY)
- func CursorSetCustomImageOptions(cursor Resource.Instance, shape CursorShape, hotspot Vector2.XY)
- func CursorSetShape(shape CursorShape)
- func DeleteStatusIndicator(id StatusIndicator)
- func DialogInputText(title string, description string, existing_text string, ...) error
- func DialogShow(title string, description string, buttons []string, callback func(button int)) error
- func EnableForStealingFocus(process_id int)
- func FileDialogShow(title string, current_directory string, filename string, show_hidden bool, ...) error
- func FileDialogWithOptionsShow(title string, current_directory string, root string, filename string, ...) error
- func ForceProcessAndDropEvents()
- func GetAccentColor() Color.RGBA
- func GetBaseColor() Color.RGBA
- func GetDisplayCutouts() []Rect2.PositionSize
- func GetDisplaySafeArea() Rect2i.PositionSize
- func GetKeyboardFocusScreen() int
- func GetName() string
- func GetPrimaryScreen() int
- func GetScreenCount() int
- func GetScreenFromRect(rect Rect2.PositionSize) int
- func GetSwapCancelOk() bool
- func GetWindowAtScreenPosition(position Vector2i.XY) int
- func GetWindowList() []int32
- func GlobalMenuAddCheckItem(menu_root string, label string, callback func(tag any), ...) int
- func GlobalMenuAddCheckItemOptions(menu_root string, label string, callback func(tag any), ...) int
- func GlobalMenuAddIconCheckItem(menu_root string, icon Texture2D.Instance, label string, ...) int
- func GlobalMenuAddIconCheckItemOptions(menu_root string, icon Texture2D.Instance, label string, ...) int
- func GlobalMenuAddIconItem(menu_root string, icon Texture2D.Instance, label string, ...) int
- func GlobalMenuAddIconItemOptions(menu_root string, icon Texture2D.Instance, label string, ...) int
- func GlobalMenuAddIconRadioCheckItem(menu_root string, icon Texture2D.Instance, label string, ...) int
- func GlobalMenuAddIconRadioCheckItemOptions(menu_root string, icon Texture2D.Instance, label string, ...) int
- func GlobalMenuAddItem(menu_root string, label string, callback func(tag any), ...) int
- func GlobalMenuAddItemOptions(menu_root string, label string, callback func(tag any), ...) int
- func GlobalMenuAddMultistateItem(menu_root string, label string, max_states int, default_state int, ...) int
- func GlobalMenuAddMultistateItemOptions(menu_root string, label string, max_states int, default_state int, ...) int
- func GlobalMenuAddRadioCheckItem(menu_root string, label string, callback func(tag any), ...) int
- func GlobalMenuAddRadioCheckItemOptions(menu_root string, label string, callback func(tag any), ...) int
- func GlobalMenuAddSeparator(menu_root string) int
- func GlobalMenuAddSeparatorOptions(menu_root string, index int) int
- func GlobalMenuAddSubmenuItem(menu_root string, label string, submenu string) int
- func GlobalMenuAddSubmenuItemOptions(menu_root string, label string, submenu string, index int) int
- func GlobalMenuClear(menu_root string)
- func GlobalMenuGetItemAccelerator(menu_root string, idx int) Input.Key
- func GlobalMenuGetItemCallback(menu_root string, idx int) Callable.Function
- func GlobalMenuGetItemCount(menu_root string) int
- func GlobalMenuGetItemIcon(menu_root string, idx int) Texture2D.Instance
- func GlobalMenuGetItemIndentationLevel(menu_root string, idx int) int
- func GlobalMenuGetItemIndexFromTag(menu_root string, tag any) int
- func GlobalMenuGetItemIndexFromText(menu_root string, text string) int
- func GlobalMenuGetItemKeyCallback(menu_root string, idx int) Callable.Function
- func GlobalMenuGetItemMaxStates(menu_root string, idx int) int
- func GlobalMenuGetItemState(menu_root string, idx int) int
- func GlobalMenuGetItemSubmenu(menu_root string, idx int) string
- func GlobalMenuGetItemTag(menu_root string, idx int) any
- func GlobalMenuGetItemText(menu_root string, idx int) string
- func GlobalMenuGetItemTooltip(menu_root string, idx int) string
- func GlobalMenuGetSystemMenuRoots() map[string]string
- func GlobalMenuIsItemCheckable(menu_root string, idx int) bool
- func GlobalMenuIsItemChecked(menu_root string, idx int) bool
- func GlobalMenuIsItemDisabled(menu_root string, idx int) bool
- func GlobalMenuIsItemHidden(menu_root string, idx int) bool
- func GlobalMenuIsItemRadioCheckable(menu_root string, idx int) bool
- func GlobalMenuRemoveItem(menu_root string, idx int)
- func GlobalMenuSetItemAccelerator(menu_root string, idx int, keycode Input.Key)
- func GlobalMenuSetItemCallback(menu_root string, idx int, callback func(tag any))
- func GlobalMenuSetItemCheckable(menu_root string, idx int, checkable bool)
- func GlobalMenuSetItemChecked(menu_root string, idx int, checked bool)
- func GlobalMenuSetItemDisabled(menu_root string, idx int, disabled bool)
- func GlobalMenuSetItemHidden(menu_root string, idx int, hidden bool)
- func GlobalMenuSetItemHoverCallbacks(menu_root string, idx int, callback func(tag any))
- func GlobalMenuSetItemIcon(menu_root string, idx int, icon Texture2D.Instance)
- func GlobalMenuSetItemIndentationLevel(menu_root string, idx int, level int)
- func GlobalMenuSetItemKeyCallback(menu_root string, idx int, key_callback func(tag any))
- func GlobalMenuSetItemMaxStates(menu_root string, idx int, max_states int)
- func GlobalMenuSetItemRadioCheckable(menu_root string, idx int, checkable bool)
- func GlobalMenuSetItemState(menu_root string, idx int, state int)
- func GlobalMenuSetItemSubmenu(menu_root string, idx int, submenu string)
- func GlobalMenuSetItemTag(menu_root string, idx int, tag any)
- func GlobalMenuSetItemText(menu_root string, idx int, text string)
- func GlobalMenuSetItemTooltip(menu_root string, idx int, tooltip string)
- func GlobalMenuSetPopupCallbacks(menu_root string, open_callback func(), close_callback func())
- func HasAdditionalOutputs() bool
- func HasFeature(feature Feature) bool
- func HasHardwareKeyboard() bool
- func HelpSetSearchCallbacks(search_callback func(search_string string, result_limit int) map[any]any, ...)
- func ImeGetSelection() Vector2i.XY
- func ImeGetText() string
- func IsDarkMode() bool
- func IsDarkModeSupported() bool
- func IsTouchscreenAvailable() bool
- func IsWindowTransparencyAvailable() bool
- func KeyboardGetCurrentLayout() int
- func KeyboardGetKeycodeFromPhysical(keycode Input.Key) Input.Key
- func KeyboardGetLabelFromPhysical(keycode Input.Key) Input.Key
- func KeyboardGetLayoutCount() int
- func KeyboardGetLayoutLanguage(index int) string
- func KeyboardGetLayoutName(index int) string
- func KeyboardSetCurrentLayout(index int)
- func MouseGetButtonState() Input.MouseButtonMask
- func MouseGetPosition() Vector2i.XY
- func MouseSetMode(mouse_mode MouseModeValue)
- func ProcessEvents()
- func RegisterAdditionalOutput(obj Object.Instance)
- func ScreenGetDpi() int
- func ScreenGetDpiOptions(screen Screen) int
- func ScreenGetImage() Image.Instance
- func ScreenGetImageOptions(screen Screen) Image.Instance
- func ScreenGetImageRect(rect Rect2i.PositionSize) Image.Instance
- func ScreenGetMaxScale() Float.X
- func ScreenGetPixel(position Vector2i.XY) Color.RGBA
- func ScreenGetPosition() Vector2i.XY
- func ScreenGetPositionOptions(screen Screen) Vector2i.XY
- func ScreenGetRefreshRate() Float.X
- func ScreenGetRefreshRateOptions(screen Screen) Float.X
- func ScreenGetScale() Float.X
- func ScreenGetScaleOptions(screen Screen) Float.X
- func ScreenGetSize() Vector2i.XY
- func ScreenGetSizeOptions(screen Screen) Vector2i.XY
- func ScreenGetUsableRect() Rect2i.PositionSize
- func ScreenGetUsableRectOptions(screen Screen) Rect2i.PositionSize
- func ScreenIsKeptOn() bool
- func ScreenSetKeepOn(enable bool)
- func ScreenSetOrientation(orientation ScreenOrientation)
- func ScreenSetOrientationOptions(orientation ScreenOrientation, screen Screen)
- func SetIcon(image Image.Instance)
- func SetNativeIcon(filename string)
- func SetSystemThemeChangeCallback(callable func())
- func ShowEmojiAndSymbolPicker()
- func StatusIndicatorGetRect(id StatusIndicator) Rect2.PositionSize
- func StatusIndicatorSetCallback(id StatusIndicator, ...)
- func StatusIndicatorSetIcon(id StatusIndicator, icon Texture2D.Instance)
- func StatusIndicatorSetMenu(id StatusIndicator, menu_rid RID.NativeMenu)
- func StatusIndicatorSetTooltip(id StatusIndicator, tooltip string)
- func TabletGetCurrentDriver() string
- func TabletGetDriverCount() int
- func TabletGetDriverName(idx int) string
- func TabletSetCurrentDriver(name string)
- func TtsGetVoicesForLanguage(language string) []string
- func TtsIsPaused() bool
- func TtsIsSpeaking() bool
- func TtsPause()
- func TtsResume()
- func TtsSetUtteranceCallback(event TTSUtteranceEvent, callable func(int, int))
- func TtsSpeak(text string, voice string, utterance_id int, interrupt bool)
- func TtsSpeakOptions(text string, voice string, volume int, pitch Float.X, rate Float.X, ...)
- func TtsStop()
- func UnregisterAdditionalOutput(obj Object.Instance)
- func VirtualKeyboardGetHeight() int
- func VirtualKeyboardHide()
- func VirtualKeyboardShow(existing_text string, position Rect2.PositionSize, atype VirtualKeyboardType)
- func VirtualKeyboardShowOptions(existing_text string, position Rect2.PositionSize, atype VirtualKeyboardType, ...)
- func WarpMouse(position Vector2i.XY)
- func WindowCanDraw(window_id Window) bool
- func WindowCanDrawOptions(window_id Window) bool
- func WindowGetActivePopup() int
- func WindowGetAttachedInstanceId(window_id Window) int
- func WindowGetAttachedInstanceIdOptions(window_id Window) int
- func WindowGetCurrentScreen(window_id Window) int
- func WindowGetCurrentScreenOptions(window_id Window) int
- func WindowGetFlag(flag WindowFlags, window_id Window) bool
- func WindowGetFlagOptions(flag WindowFlags, window_id Window) bool
- func WindowGetMaxSize(window_id Window) Vector2i.XY
- func WindowGetMaxSizeOptions(window_id Window) Vector2i.XY
- func WindowGetMinSize(window_id Window) Vector2i.XY
- func WindowGetMinSizeOptions(window_id Window) Vector2i.XY
- func WindowGetNativeHandle(handle_type HandleType, window_id Window) int
- func WindowGetNativeHandleOptions(handle_type HandleType, window_id Window) int
- func WindowGetPopupSafeRect(window int) Rect2i.PositionSize
- func WindowGetPosition(window_id Window) Vector2i.XY
- func WindowGetPositionOptions(window_id Window) Vector2i.XY
- func WindowGetPositionWithDecorations(window_id Window) Vector2i.XY
- func WindowGetPositionWithDecorationsOptions(window_id Window) Vector2i.XY
- func WindowGetSafeTitleMargins(window_id Window) Vector3i.XYZ
- func WindowGetSafeTitleMarginsOptions(window_id Window) Vector3i.XYZ
- func WindowGetSize(window_id Window) Vector2i.XY
- func WindowGetSizeOptions(window_id Window) Vector2i.XY
- func WindowGetSizeWithDecorations(window_id Window) Vector2i.XY
- func WindowGetSizeWithDecorationsOptions(window_id Window) Vector2i.XY
- func WindowGetTitleSize(title string, window_id Window) Vector2i.XY
- func WindowGetTitleSizeOptions(title string, window_id Window) Vector2i.XY
- func WindowIsFocused(window_id Window) bool
- func WindowIsFocusedOptions(window_id Window) bool
- func WindowIsMaximizeAllowed(window_id Window) bool
- func WindowIsMaximizeAllowedOptions(window_id Window) bool
- func WindowMaximizeOnTitleDblClick() bool
- func WindowMinimizeOnTitleDblClick() bool
- func WindowMoveToForeground(window_id Window)
- func WindowMoveToForegroundOptions(window_id Window)
- func WindowRequestAttention(window_id Window)
- func WindowRequestAttentionOptions(window_id Window)
- func WindowSetCurrentScreen(screen Screen, window_id Window)
- func WindowSetCurrentScreenOptions(screen Screen, window_id Window)
- func WindowSetDropFilesCallback(callback func(tag any), window_id Window)
- func WindowSetDropFilesCallbackOptions(callback func(tag any), window_id Window)
- func WindowSetExclusive(window_id Window, exclusive bool)
- func WindowSetFlag(flag WindowFlags, enabled bool, window_id Window)
- func WindowSetFlagOptions(flag WindowFlags, enabled bool, window_id Window)
- func WindowSetImeActive(active bool, window_id Window)
- func WindowSetImeActiveOptions(active bool, window_id Window)
- func WindowSetImePosition(position Vector2i.XY, window_id Window)
- func WindowSetImePositionOptions(position Vector2i.XY, window_id Window)
- func WindowSetInputEventCallback(callback func(event InputEvent.Instance), window_id Window)
- func WindowSetInputEventCallbackOptions(callback func(event InputEvent.Instance), window_id Window)
- func WindowSetInputTextCallback(callback func(text string), window_id Window)
- func WindowSetInputTextCallbackOptions(callback func(text string), window_id Window)
- func WindowSetMaxSize(max_size Vector2i.XY, window_id Window)
- func WindowSetMaxSizeOptions(max_size Vector2i.XY, window_id Window)
- func WindowSetMinSize(min_size Vector2i.XY, window_id Window)
- func WindowSetMinSizeOptions(min_size Vector2i.XY, window_id Window)
- func WindowSetMode(mode WindowMode, window_id Window)
- func WindowSetModeOptions(mode WindowMode, window_id Window)
- func WindowSetMousePassthrough(region []Vector2.XY, window_id Window)
- func WindowSetMousePassthroughOptions(region []Vector2.XY, window_id Window)
- func WindowSetPopupSafeRect(window int, rect Rect2i.PositionSize)
- func WindowSetPosition(position Vector2i.XY, window_id Window)
- func WindowSetPositionOptions(position Vector2i.XY, window_id Window)
- func WindowSetRectChangedCallback(callback func(rect Rect2i.PositionSize), window_id Window)
- func WindowSetRectChangedCallbackOptions(callback func(rect Rect2i.PositionSize), window_id Window)
- func WindowSetSize(size Vector2i.XY, window_id Window)
- func WindowSetSizeOptions(size Vector2i.XY, window_id Window)
- func WindowSetTitle(title string, window_id Window)
- func WindowSetTitleOptions(title string, window_id Window)
- func WindowSetTransient(window_id Window, parent_window_id Window)
- func WindowSetVsyncMode(vsync_mode VSyncMode, window_id Window)
- func WindowSetVsyncModeOptions(vsync_mode VSyncMode, window_id Window)
- func WindowSetWindowButtonsOffset(offset Vector2i.XY, window_id Window)
- func WindowSetWindowButtonsOffsetOptions(offset Vector2i.XY, window_id Window)
- func WindowSetWindowEventCallback(callback func(event WindowEvent), window_id Window)
- func WindowSetWindowEventCallbackOptions(callback func(event WindowEvent), window_id Window)
- func WindowStartDrag(window_id Window)
- func WindowStartDragOptions(window_id Window)
- func WindowStartResize(edge WindowResizeEdge, window_id Window)
- func WindowStartResizeOptions(edge WindowResizeEdge, window_id Window)
- type CursorShape
- type Extension
- type Feature
- type FileDialogMode
- type FileDialogOption
- type HandleType
- type ID
- type Instance
- type MouseModeValue
- type Screen
- type ScreenOrientation
- type StatusIndicator
- type TTSUtteranceEvent
- type TextToSpeechVoice
- type VSyncMode
- type VirtualKeyboardType
- type Window
- type WindowEvent
- type WindowFlags
- type WindowMode
- type WindowResizeEdge
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Advanced ¶
func Advanced() class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
func Beep ¶
func Beep()
Plays the beep sound from the operative system, if possible. Because it comes from the OS, the beep sound will be audible even if the application is muted. It may also be disabled for the entire OS by the user.
Note: This method is implemented on macOS, Linux (X11/Wayland), and Windows.
func ClipboardGet ¶
func ClipboardGet() string
Returns the user's clipboard as a string if possible.
func ClipboardGetImage ¶
Returns the user's clipboard as an image if possible.
Note: This method uses the copied pixel data, e.g. from a image editing software or a web browser, not an image file copied from file explorer.
func ClipboardGetPrimary ¶
func ClipboardGetPrimary() string
Returns the user's primary clipboard as a string if possible. This is the clipboard that is set when the user selects text in any application, rather than when pressing Ctrl + C. The clipboard data can then be pasted by clicking the middle mouse button in any application that supports the primary clipboard mechanism.
Note: This method is only implemented on Linux (X11/Wayland).
func ClipboardHas ¶
func ClipboardHas() bool
Returns true if there is a text content on the user's clipboard.
func ClipboardHasImage ¶
func ClipboardHasImage() bool
Returns true if there is an image content on the user's clipboard.
func ClipboardSet ¶
func ClipboardSet(clipboard string)
Sets the user's clipboard content to the given string.
func ClipboardSetPrimary ¶
func ClipboardSetPrimary(clipboard_primary string)
Sets the user's primary clipboard content to the given string. This is the clipboard that is set when the user selects text in any application, rather than when pressing Ctrl + C. The clipboard data can then be pasted by clicking the middle mouse button in any application that supports the primary clipboard mechanism.
Note: This method is only implemented on Linux (X11/Wayland).
func CursorSetCustomImage ¶
func CursorSetCustomImage(cursor Resource.Instance, shape CursorShape, hotspot Vector2.XY)
Sets a custom mouse cursor image for the given 'shape'. This means the user's operating system and mouse cursor theme will no longer influence the mouse cursor's appearance.
'cursor' can be either a graphics.gd/classdb/Texture2D or an graphics.gd/classdb/Image, and it should not be larger than 256×256 to display correctly. Optionally, 'hotspot' can be set to offset the image's position relative to the click point. By default, 'hotspot' is set to the top-left corner of the image. See also CursorSetShape.
func CursorSetCustomImageOptions ¶
func CursorSetCustomImageOptions(cursor Resource.Instance, shape CursorShape, hotspot Vector2.XY)
Sets a custom mouse cursor image for the given 'shape'. This means the user's operating system and mouse cursor theme will no longer influence the mouse cursor's appearance.
'cursor' can be either a graphics.gd/classdb/Texture2D or an graphics.gd/classdb/Image, and it should not be larger than 256×256 to display correctly. Optionally, 'hotspot' can be set to offset the image's position relative to the click point. By default, 'hotspot' is set to the top-left corner of the image. See also CursorSetShape.
func CursorSetShape ¶
func CursorSetShape(shape CursorShape)
Sets the default mouse cursor shape. The cursor's appearance will vary depending on the user's operating system and mouse cursor theme. See also CursorGetShape and CursorSetCustomImage.
func DeleteStatusIndicator ¶
func DeleteStatusIndicator(id StatusIndicator)
Removes the application status indicator.
func DialogInputText ¶
func DialogInputText(title string, description string, existing_text string, callback func(text string)) error
Shows a text input dialog which uses the operating system's native look-and-feel. 'callback' should accept a single string parameter which contains the text field's contents.
Note: This method is implemented if the display server has the FeatureNativeDialogInput feature. Supported platforms include macOS, Windows, and Android.
func DialogShow ¶
func DialogShow(title string, description string, buttons []string, callback func(button int)) error
Shows a text dialog which uses the operating system's native look-and-feel. 'callback' should accept a single int parameter which corresponds to the index of the pressed button.
Note: This method is implemented if the display server has the FeatureNativeDialog feature. Supported platforms include macOS, Windows, and Android.
func EnableForStealingFocus ¶
func EnableForStealingFocus(process_id int)
Allows the 'process_id' PID to steal focus from this window. In other words, this disables the operating system's focus stealing protection for the specified PID.
Note: This method is implemented only on Windows.
func FileDialogShow ¶
func FileDialogShow(title string, current_directory string, filename string, show_hidden bool, mode FileDialogMode, filters []string, callback func(status bool, selected_paths []string, selected_filter_index int)) error
Displays OS native dialog for selecting files or directories in the file system.
Each filter string in the 'filters' array should be formatted like this: *.png,*.jpg,*.jpeg;Image Files;image/png,image/jpeg. The description text of the filter is optional and can be omitted. It is recommended to set both file extension and MIME type. See also graphics.gd/classdb/FileDialog.Instance.Filters.
Callbacks have the following arguments: status: bool, selected_paths: PackedStringArray, selected_filter_index: int. On Android, callback argument selected_filter_index is always zero.
Note: This method is implemented if the display server has the FeatureNativeDialogFile feature. Supported platforms include Linux (X11/Wayland), Windows, macOS, and Android.
Note: 'current_directory' might be ignored.
Note: Embedded file dialog and Windows file dialog support only file extensions, while Android, Linux, and macOS file dialogs also support MIME types.
Note: On Android and Linux, 'show_hidden' is ignored.
Note: On Android and macOS, native file dialogs have no title.
Note: On macOS, sandboxed apps will save security-scoped bookmarks to retain access to the opened folders across multiple sessions. Use graphics.gd/classdb/OS.GetGrantedPermissions to get a list of saved bookmarks.
func FileDialogWithOptionsShow ¶
func FileDialogWithOptionsShow(title string, current_directory string, root string, filename string, show_hidden bool, mode FileDialogMode, filters []string, options []FileDialogOption, callback func(status bool, selected_paths []string, selected_filter_index int, selected_option map[any]any)) error
Displays OS native dialog for selecting files or directories in the file system with additional user selectable options.
Each filter string in the 'filters' array should be formatted like this: *.png,*.jpg,*.jpeg;Image Files;image/png,image/jpeg. The description text of the filter is optional and can be omitted. It is recommended to set both file extension and MIME type. See also graphics.gd/classdb/FileDialog.Instance.Filters.
'options' is array of data structures with the following keys:
- "name" - option's name string.
- "values" - []string of values. If empty, boolean option (check box) is used.
- "default" - default selected option index (int) or default boolean value (bool).
Callbacks have the following arguments: status: bool, selected_paths: PackedStringArray, selected_filter_index: int, selected_option: Dictionary.
Note: This method is implemented if the display server has the FeatureNativeDialogFileExtra feature. Supported platforms include Linux (X11/Wayland), Windows, and macOS.
Note: 'current_directory' might be ignored.
Note: Embedded file dialog and Windows file dialog support only file extensions, while Android, Linux, and macOS file dialogs also support MIME types.
Note: On Linux (X11), 'show_hidden' is ignored.
Note: On macOS, native file dialogs have no title.
Note: On macOS, sandboxed apps will save security-scoped bookmarks to retain access to the opened folders across multiple sessions. Use graphics.gd/classdb/OS.GetGrantedPermissions to get a list of saved bookmarks.
func ForceProcessAndDropEvents ¶
func ForceProcessAndDropEvents()
Forces window manager processing while ignoring all [graphics.gd/classdb/InputEvent]s. See also ProcessEvents.
Note: This method is implemented on Windows and macOS.
func GetAccentColor ¶
Returns OS theme accent color. Returns Color(0, 0, 0, 0), if accent color is unknown.
Note: This method is implemented on macOS, Windows, and Android.
func GetBaseColor ¶
Returns the OS theme base color (default control background). Returns Color(0, 0, 0, 0) if the base color is unknown.
Note: This method is implemented on macOS, Windows, and Android.
func GetDisplayCutouts ¶
func GetDisplayCutouts() []Rect2.PositionSize
Returns an slice of [Rect2.PositionSize], each of which is the bounding rectangle for a display cutout or notch. These are non-functional areas on edge-to-edge screens used by cameras and sensors. Returns an empty array if the device does not have cutouts. See also GetDisplaySafeArea.
Note: Currently only implemented on Android. Other platforms will return an empty array even if they do have display cutouts or notches.
func GetDisplaySafeArea ¶
func GetDisplaySafeArea() Rect2i.PositionSize
Returns the unobscured area of the display where interactive controls should be rendered. See also GetDisplayCutouts.
Note: Currently only implemented on Android and iOS. On other platforms, screen_get_usable_rect(SCREEN_OF_MAIN_WINDOW) will be returned as a fallback. See also ScreenGetUsableRect.
func GetKeyboardFocusScreen ¶
func GetKeyboardFocusScreen() int
Returns the index of the screen containing the window with the keyboard focus, or the primary screen if there's no focused window.
func GetName ¶
func GetName() string
Returns the name of the graphics.gd/classdb/DisplayServer currently in use. Most operating systems only have a single graphics.gd/classdb/DisplayServer, but Linux has access to more than one graphics.gd/classdb/DisplayServer (currently X11 and Wayland).
The names of built-in display servers are Windows, macOS, X11 (Linux), Wayland (Linux), Android, iOS, web (HTML5), and headless (when started with the --headless command line argument).
func GetScreenFromRect ¶
func GetScreenFromRect(rect Rect2.PositionSize) int
Returns the index of the screen that overlaps the most with the given rectangle. Returns -1 if the rectangle doesn't overlap with any screen or has no area.
func GetSwapCancelOk ¶
func GetSwapCancelOk() bool
Returns true if positions of OK and Cancel buttons are swapped in dialogs. This is enabled by default on Windows to follow interface conventions, and be toggled by changing graphics.gd/classdb/ProjectSettings "gui/common/swap_cancel_ok".
Note: This doesn't affect native dialogs such as the ones spawned by graphics.gd/classdb/DisplayServer.DialogShow.
func GetWindowAtScreenPosition ¶
Returns the ID of the window at the specified screen 'position' (in pixels). On multi-monitor setups, the screen position is relative to the virtual desktop area. On multi-monitor setups with different screen resolutions or orientations, the origin may be located outside any display like this:
func GetWindowList ¶
func GetWindowList() []int32
Returns the list of Godot window IDs belonging to this process.
Note: Native dialogs are not included in this list.
func GlobalMenuAddCheckItem ¶
func GlobalMenuAddCheckItem(menu_root string, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key) int
Adds a new checkable item with text 'label' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddCheckItemOptions ¶
func GlobalMenuAddCheckItemOptions(menu_root string, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key, index int) int
Adds a new checkable item with text 'label' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddIconCheckItem ¶
func GlobalMenuAddIconCheckItem(menu_root string, icon Texture2D.Instance, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key) int
Adds a new checkable item with text 'label' and icon 'icon' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddIconCheckItemOptions ¶
func GlobalMenuAddIconCheckItemOptions(menu_root string, icon Texture2D.Instance, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key, index int) int
Adds a new checkable item with text 'label' and icon 'icon' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddIconItem ¶
func GlobalMenuAddIconItem(menu_root string, icon Texture2D.Instance, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key) int
Adds a new item with text 'label' and icon 'icon' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddIconItemOptions ¶
func GlobalMenuAddIconItemOptions(menu_root string, icon Texture2D.Instance, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key, index int) int
Adds a new item with text 'label' and icon 'icon' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddIconRadioCheckItem ¶
func GlobalMenuAddIconRadioCheckItem(menu_root string, icon Texture2D.Instance, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key) int
Adds a new radio-checkable item with text 'label' and icon 'icon' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See GlobalMenuSetItemChecked for more info on how to control it.
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddIconRadioCheckItemOptions ¶
func GlobalMenuAddIconRadioCheckItemOptions(menu_root string, icon Texture2D.Instance, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key, index int) int
Adds a new radio-checkable item with text 'label' and icon 'icon' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See GlobalMenuSetItemChecked for more info on how to control it.
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddItem ¶
func GlobalMenuAddItem(menu_root string, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key) int
Adds a new item with text 'label' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddItemOptions ¶
func GlobalMenuAddItemOptions(menu_root string, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key, index int) int
Adds a new item with text 'label' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddMultistateItem ¶
func GlobalMenuAddMultistateItem(menu_root string, label string, max_states int, default_state int, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key) int
Adds a new item with text 'label' to the global menu with ID 'menu_root'.
Contrarily to normal binary items, multistate items can have more than two states, as defined by 'max_states'. Each press or activate of the item will increase the state by one. The default value is defined by 'default_state'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: By default, there's no indication of the current item state, it should be changed manually.
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddMultistateItemOptions ¶
func GlobalMenuAddMultistateItemOptions(menu_root string, label string, max_states int, default_state int, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key, index int) int
Adds a new item with text 'label' to the global menu with ID 'menu_root'.
Contrarily to normal binary items, multistate items can have more than two states, as defined by 'max_states'. Each press or activate of the item will increase the state by one. The default value is defined by 'default_state'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: By default, there's no indication of the current item state, it should be changed manually.
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddRadioCheckItem ¶
func GlobalMenuAddRadioCheckItem(menu_root string, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key) int
Adds a new radio-checkable item with text 'label' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See GlobalMenuSetItemChecked for more info on how to control it.
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddRadioCheckItemOptions ¶
func GlobalMenuAddRadioCheckItemOptions(menu_root string, label string, callback func(tag any), key_callback func(tag any), tag any, accelerator Input.Key, index int) int
Adds a new radio-checkable item with text 'label' to the global menu with ID 'menu_root'.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
An 'accelerator' can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The 'accelerator' is generally a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See GlobalMenuSetItemChecked for more info on how to control it.
Note: The 'callback' and 'key_callback' Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to 'tag'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddSeparator ¶
Adds a separator between items to the global menu with ID 'menu_root'. Separators also occupy an index.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddSeparatorOptions ¶
Adds a separator between items to the global menu with ID 'menu_root'. Separators also occupy an index.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddSubmenuItem ¶
Adds an item that will act as a submenu of the global menu 'menu_root'. The 'submenu' argument is the ID of the global menu root that will be shown when the item is clicked.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuAddSubmenuItemOptions ¶
Adds an item that will act as a submenu of the global menu 'menu_root'. The 'submenu' argument is the ID of the global menu root that will be shown when the item is clicked.
Returns index of the inserted item, it's not guaranteed to be the same as 'index' value.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuClear ¶
func GlobalMenuClear(menu_root string)
Removes all items from the global menu with ID 'menu_root'.
Note: This method is implemented only on macOS.
Supported system menu IDs:
func GlobalMenuGetItemAccelerator ¶
Returns the accelerator of the item at index 'idx'. Accelerators are special combinations of keys that activate the item, no matter which control is focused.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemCallback ¶
Returns the callback of the item at index 'idx'.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemCount ¶
Returns number of items in the global menu with ID 'menu_root'.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemIcon ¶
Returns the icon of the item at index 'idx'.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemIndentationLevel ¶
Returns the horizontal offset of the item at the given 'idx'.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemIndexFromTag ¶
Returns the index of the item with the specified 'tag'. Indices are automatically assigned to each item by the engine, and cannot be set manually.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemIndexFromText ¶
Returns the index of the item with the specified 'text'. Indices are automatically assigned to each item by the engine, and cannot be set manually.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemKeyCallback ¶
Returns the callback of the item accelerator at index 'idx'.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemMaxStates ¶
Returns number of states of a multistate item. See GlobalMenuAddMultistateItem for details.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemState ¶
Returns the state of a multistate item. See GlobalMenuAddMultistateItem for details.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemSubmenu ¶
Returns the submenu ID of the item at index 'idx'. See GlobalMenuAddSubmenuItem for more info on how to add a submenu.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemTag ¶
Returns the metadata of the specified item, which might be of any type. You can set it with GlobalMenuSetItemTag, which provides a simple way of assigning context data to items.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemText ¶
Returns the text of the item at index 'idx'.
Note: This method is implemented only on macOS.
func GlobalMenuGetItemTooltip ¶
Returns the tooltip associated with the specified index 'idx'.
Note: This method is implemented only on macOS.
func GlobalMenuGetSystemMenuRoots ¶
Returns Dictionary of supported system menu IDs and names.
Note: This method is implemented only on macOS.
func GlobalMenuIsItemCheckable ¶
Returns true if the item at index 'idx' is checkable in some way, i.e. if it has a checkbox or radio button.
Note: This method is implemented only on macOS.
func GlobalMenuIsItemChecked ¶
Returns true if the item at index 'idx' is checked.
Note: This method is implemented only on macOS.
func GlobalMenuIsItemDisabled ¶
Returns true if the item at index 'idx' is disabled. When it is disabled it can't be selected, or its action invoked.
See GlobalMenuSetItemDisabled for more info on how to disable an item.
Note: This method is implemented only on macOS.
func GlobalMenuIsItemHidden ¶
Returns true if the item at index 'idx' is hidden.
See GlobalMenuSetItemHidden for more info on how to hide an item.
Note: This method is implemented only on macOS.
func GlobalMenuIsItemRadioCheckable ¶
Returns true if the item at index 'idx' has radio button-style checkability.
Note: This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.
Note: This method is implemented only on macOS.
func GlobalMenuRemoveItem ¶
Removes the item at index 'idx' from the global menu 'menu_root'.
Note: The indices of items after the removed item will be shifted by one.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemAccelerator ¶
Sets the accelerator of the item at index 'idx'. 'keycode' can be a single [Key], or a combination of [KeyModifierMask]s and [Key]s using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).
Note: This method is implemented only on macOS.
func GlobalMenuSetItemCallback ¶
Sets the callback of the item at index 'idx'. Callback is emitted when an item is pressed.
Note: The 'callback' Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemCheckable ¶
Sets whether the item at index 'idx' has a checkbox. If false, sets the type of the item to plain text.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemChecked ¶
Sets the checkstate status of the item at index 'idx'.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemDisabled ¶
Enables/disables the item at index 'idx'. When it is disabled, it can't be selected and its action can't be invoked.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemHidden ¶
Hides/shows the item at index 'idx'. When it is hidden, an item does not appear in a menu and its action cannot be invoked.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemHoverCallbacks ¶
Sets the callback of the item at index 'idx'. The callback is emitted when an item is hovered.
Note: The 'callback' Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemIcon ¶
Replaces the graphics.gd/classdb/Texture2D icon of the specified 'idx'.
Note: This method is implemented only on macOS.
Note: This method is not supported by macOS "_dock" menu items.
func GlobalMenuSetItemIndentationLevel ¶
Sets the horizontal offset of the item at the given 'idx'.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemKeyCallback ¶
Sets the callback of the item at index 'idx'. Callback is emitted when its accelerator is activated.
Note: The 'key_callback' Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemMaxStates ¶
Sets number of state of a multistate item. See GlobalMenuAddMultistateItem for details.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemRadioCheckable ¶
Sets the type of the item at the specified index 'idx' to radio button. If false, sets the type of the item to plain text.
Note: This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemState ¶
Sets the state of a multistate item. See GlobalMenuAddMultistateItem for details.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemSubmenu ¶
Sets the submenu of the item at index 'idx'. The submenu is the ID of a global menu root that would be shown when the item is clicked.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemTag ¶
Sets the metadata of an item, which may be of any type. You can later get it with GlobalMenuGetItemTag, which provides a simple way of assigning context data to items.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemText ¶
Sets the text of the item at index 'idx'.
Note: This method is implemented only on macOS.
func GlobalMenuSetItemTooltip ¶
Sets the string tooltip of the item at the specified index 'idx'.
Note: This method is implemented only on macOS.
func GlobalMenuSetPopupCallbacks ¶
func GlobalMenuSetPopupCallbacks(menu_root string, open_callback func(), close_callback func())
Registers callables to emit when the menu is respectively about to show or closed. Callback methods should have zero arguments.
func HasAdditionalOutputs ¶
func HasAdditionalOutputs() bool
Returns true if any additional outputs have been registered via RegisterAdditionalOutput.
func HasFeature ¶
Returns true if the specified 'feature' is supported by the current graphics.gd/classdb/DisplayServer, false otherwise.
func HasHardwareKeyboard ¶
func HasHardwareKeyboard() bool
Returns true if hardware keyboard is connected.
Note: This method is implemented on Android and iOS, on other platforms this method always returns true.
func HelpSetSearchCallbacks ¶
func HelpSetSearchCallbacks(search_callback func(search_string string, result_limit int) map[any]any, action_callback func(key string))
Sets native help system search callbacks.
'search_callback' has the following arguments: String search_string, int result_limit and return a data structure with "key, display name" pairs for the search results. Called when the user enters search terms in the Help menu.
'action_callback' has the following arguments: String key. Called when the user selects a search result in the Help menu.
Note: This method is implemented only on macOS.
func ImeGetSelection ¶
Returns the text selection in the Input Method Editor composition string, with the [Vector2i.XY]'s x component being the caret position and y being the length of the selection.
Note: This method is implemented only on macOS.
func ImeGetText ¶
func ImeGetText() string
Returns the composition string contained within the Input Method Editor window.
Note: This method is implemented only on macOS.
func IsDarkMode ¶
func IsDarkMode() bool
Returns true if OS is using dark mode.
Note: This method is implemented on Android, iOS, macOS, Windows, and Linux (X11/Wayland).
func IsDarkModeSupported ¶
func IsDarkModeSupported() bool
Returns true if OS supports dark mode.
Note: This method is implemented on Android, iOS, macOS, Windows, and Linux (X11/Wayland).
func IsTouchscreenAvailable ¶
func IsTouchscreenAvailable() bool
Returns true if touch events are available (Android or iOS), the capability is detected on the Web platform or if graphics.gd/classdb/ProjectSettings "input_devices/pointing/emulate_touch_from_mouse" is true.
func IsWindowTransparencyAvailable ¶
func IsWindowTransparencyAvailable() bool
Returns true if the window background can be made transparent. This method returns false if graphics.gd/classdb/ProjectSettings "display/window/per_pixel_transparency/allowed" is set to false, or if transparency is not supported by the renderer or OS compositor.
func KeyboardGetCurrentLayout ¶
func KeyboardGetCurrentLayout() int
Returns active keyboard layout index.
Note: This method is implemented on Linux (X11/Wayland), macOS, and Windows.
func KeyboardGetKeycodeFromPhysical ¶
Converts a physical (US QWERTY) 'keycode' to one in the active keyboard layout.
Note: This method is implemented on Linux (X11/Wayland), macOS and Windows.
func KeyboardGetLabelFromPhysical ¶
Converts a physical (US QWERTY) 'keycode' to localized label printed on the key in the active keyboard layout.
Note: This method is implemented on Linux (X11/Wayland), macOS and Windows.
func KeyboardGetLayoutCount ¶
func KeyboardGetLayoutCount() int
Returns the number of keyboard layouts.
Note: This method is implemented on Linux (X11/Wayland), macOS and Windows.
func KeyboardGetLayoutLanguage ¶
Returns the ISO-639/BCP-47 language code of the keyboard layout at position 'index'.
Note: This method is implemented on Linux (X11/Wayland), macOS and Windows.
func KeyboardGetLayoutName ¶
Returns the localized name of the keyboard layout at position 'index'.
Note: This method is implemented on Linux (X11/Wayland), macOS and Windows.
func KeyboardSetCurrentLayout ¶
func KeyboardSetCurrentLayout(index int)
Sets the active keyboard layout.
Note: This method is implemented on Linux (X11/Wayland), macOS and Windows.
func MouseGetButtonState ¶
func MouseGetButtonState() Input.MouseButtonMask
Returns the current state of mouse buttons (whether each button is pressed) as a bitmask. If multiple mouse buttons are pressed at the same time, the bits are added together. Equivalent to graphics.gd/classdb/Input.GetMouseButtonMask.
func MouseGetPosition ¶
Returns the mouse cursor's current position in screen coordinates.
func MouseSetMode ¶
func MouseSetMode(mouse_mode MouseModeValue)
Sets the current mouse mode. See also MouseGetMode.
func ProcessEvents ¶
func ProcessEvents()
Perform window manager processing, including input flushing. See also ForceProcessAndDropEvents, graphics.gd/classdb/Input.FlushBufferedEvents and graphics.gd/classdb/Input.UseAccumulatedInput.
func RegisterAdditionalOutput ¶
Registers an graphics.gd/classdb/Object which represents an additional output that will be rendered too, beyond normal windows. The graphics.gd/classdb/Object is only used as an identifier, which can be later passed to UnregisterAdditionalOutput.
This can be used to prevent Godot from skipping rendering when no normal windows are visible.
func ScreenGetDpi ¶
func ScreenGetDpi() int
Returns the dots per inch density of the specified screen. If 'screen' is ScreenOfMainWindow (the default value), a screen with the main window will be used.
Note: On macOS, returned value is inaccurate if fractional display scaling mode is used.
Note: On Android devices, the actual screen densities are grouped into six generalized densities:
Note: This method is implemented on Android, Linux (X11/Wayland), macOS and Windows. Returns 72 on unsupported platforms.
func ScreenGetDpiOptions ¶
Returns the dots per inch density of the specified screen. If 'screen' is ScreenOfMainWindow (the default value), a screen with the main window will be used.
Note: On macOS, returned value is inaccurate if fractional display scaling mode is used.
Note: On Android devices, the actual screen densities are grouped into six generalized densities:
Note: This method is implemented on Android, Linux (X11/Wayland), macOS and Windows. Returns 72 on unsupported platforms.
func ScreenGetImage ¶
Returns screenshot of the 'screen'.
Note: This method is implemented on Linux (X11), macOS, and Windows.
Note: On macOS, this method requires "Screen Recording" permission, if permission is not granted it will return desktop wallpaper color.
func ScreenGetImageOptions ¶
Returns screenshot of the 'screen'.
Note: This method is implemented on Linux (X11), macOS, and Windows.
Note: On macOS, this method requires "Screen Recording" permission, if permission is not granted it will return desktop wallpaper color.
func ScreenGetImageRect ¶
func ScreenGetImageRect(rect Rect2i.PositionSize) Image.Instance
Returns screenshot of the screen 'rect'.
Note: This method is implemented on macOS and Windows.
Note: On macOS, this method requires "Screen Recording" permission, if permission is not granted it will return desktop wallpaper color.
func ScreenGetMaxScale ¶
Returns the greatest scale factor of all screens.
Note: On macOS returned value is 2.0 if there is at least one hiDPI (Retina) screen in the system, and 1.0 in all other cases.
Note: This method is implemented only on macOS.
func ScreenGetPixel ¶
Returns color of the display pixel at the 'position'.
Note: This method is implemented on Linux (X11), macOS, and Windows.
Note: On macOS, this method requires "Screen Recording" permission, if permission is not granted it will return desktop wallpaper color.
func ScreenGetPosition ¶
Returns the screen's top-left corner position in pixels. On multi-monitor setups, the screen position is relative to the virtual desktop area. On multi-monitor setups with different screen resolutions or orientations, the origin may be located outside any display like this:
See also ScreenGetSize.
Note: On Linux (Wayland) this method always returns (0, 0).
func ScreenGetPositionOptions ¶
Returns the screen's top-left corner position in pixels. On multi-monitor setups, the screen position is relative to the virtual desktop area. On multi-monitor setups with different screen resolutions or orientations, the origin may be located outside any display like this:
See also ScreenGetSize.
Note: On Linux (Wayland) this method always returns (0, 0).
func ScreenGetRefreshRate ¶
Returns the current refresh rate of the specified screen. If 'screen' is ScreenOfMainWindow (the default value), a screen with the main window will be used.
Note: Returns -1.0 if the DisplayServer fails to find the refresh rate for the specified screen. On Web, ScreenGetRefreshRate will always return -1.0 as there is no way to retrieve the refresh rate on that platform.
To fallback to a default refresh rate if the method fails, try:
var refresh_rate = DisplayServer.ScreenGetRefreshRate() if refresh_rate < 0 { refresh_rate = 60.0 }
func ScreenGetRefreshRateOptions ¶
Returns the current refresh rate of the specified screen. If 'screen' is ScreenOfMainWindow (the default value), a screen with the main window will be used.
Note: Returns -1.0 if the DisplayServer fails to find the refresh rate for the specified screen. On Web, ScreenGetRefreshRate will always return -1.0 as there is no way to retrieve the refresh rate on that platform.
To fallback to a default refresh rate if the method fails, try:
var refresh_rate = DisplayServer.ScreenGetRefreshRate() if refresh_rate < 0 { refresh_rate = 60.0 }
func ScreenGetScale ¶
Returns the scale factor of the specified screen by index.
Note: On macOS, the returned value is 2.0 for hiDPI (Retina) screens, and 1.0 for all other cases.
Note: On Linux (Wayland), the returned value is accurate only when 'screen' is ScreenOfMainWindow. Due to API limitations, passing a direct index will return a rounded-up integer, if the screen has a fractional scale (e.g. 1.25 would get rounded up to 2.0).
Note: This method is implemented on Android, iOS, Web, macOS, and Linux (Wayland).
func ScreenGetScaleOptions ¶
Returns the scale factor of the specified screen by index.
Note: On macOS, the returned value is 2.0 for hiDPI (Retina) screens, and 1.0 for all other cases.
Note: On Linux (Wayland), the returned value is accurate only when 'screen' is ScreenOfMainWindow. Due to API limitations, passing a direct index will return a rounded-up integer, if the screen has a fractional scale (e.g. 1.25 would get rounded up to 2.0).
Note: This method is implemented on Android, iOS, Web, macOS, and Linux (Wayland).
func ScreenGetSize ¶
Returns the screen's size in pixels. See also ScreenGetPosition and ScreenGetUsableRect.
func ScreenGetSizeOptions ¶
Returns the screen's size in pixels. See also ScreenGetPosition and ScreenGetUsableRect.
func ScreenGetUsableRect ¶
func ScreenGetUsableRect() Rect2i.PositionSize
Returns the portion of the screen that is not obstructed by a status bar in pixels. See also ScreenGetSize.
func ScreenGetUsableRectOptions ¶
func ScreenGetUsableRectOptions(screen Screen) Rect2i.PositionSize
Returns the portion of the screen that is not obstructed by a status bar in pixels. See also ScreenGetSize.
func ScreenIsKeptOn ¶
func ScreenIsKeptOn() bool
Returns true if the screen should never be turned off by the operating system's power-saving measures. See also ScreenSetKeepOn.
func ScreenSetKeepOn ¶
func ScreenSetKeepOn(enable bool)
Sets whether the screen should never be turned off by the operating system's power-saving measures. See also ScreenIsKeptOn.
func ScreenSetOrientation ¶
func ScreenSetOrientation(orientation ScreenOrientation)
Sets the 'screen”s 'orientation'. See also ScreenGetOrientation.
Note: On iOS, this method has no effect if graphics.gd/classdb/ProjectSettings "display/window/handheld/orientation" is not set to ScreenSensor.
func ScreenSetOrientationOptions ¶
func ScreenSetOrientationOptions(orientation ScreenOrientation, screen Screen)
Sets the 'screen”s 'orientation'. See also ScreenGetOrientation.
Note: On iOS, this method has no effect if graphics.gd/classdb/ProjectSettings "display/window/handheld/orientation" is not set to ScreenSensor.
func SetIcon ¶
Sets the window icon (usually displayed in the top-left corner) with an graphics.gd/classdb/Image. To use icons in the operating system's native format, use SetNativeIcon instead.
Note: Requires support for FeatureIcon.
func SetNativeIcon ¶
func SetNativeIcon(filename string)
Sets the window icon (usually displayed in the top-left corner) in the operating system's native format. The file at 'filename' must be in .ico format on Windows or .icns on macOS. By using specially crafted .ico or .icns icons, SetNativeIcon allows specifying different icons depending on the size the icon is displayed at. This size is determined by the operating system and user preferences (including the display scale factor). To use icons in other formats, use SetIcon instead.
Note: Requires support for FeatureNativeIcon.
func SetSystemThemeChangeCallback ¶
func SetSystemThemeChangeCallback(callable func())
Sets the 'callable' that should be called when system theme settings are changed. Callback method should have zero arguments.
Note: This method is implemented on Android, iOS, macOS, Windows, and Linux (X11/Wayland).
func ShowEmojiAndSymbolPicker ¶
func ShowEmojiAndSymbolPicker()
Opens system emoji and symbol picker.
Note: This method is implemented on macOS and Windows.
func StatusIndicatorGetRect ¶
func StatusIndicatorGetRect(id StatusIndicator) Rect2.PositionSize
Returns the rectangle for the given status indicator 'id' in screen coordinates. If the status indicator is not visible, returns an empty [Rect2.PositionSize].
Note: This method is implemented on macOS and Windows.
func StatusIndicatorSetCallback ¶
func StatusIndicatorSetCallback(id StatusIndicator, callback func(button Input.MouseButton, click_position Vector2i.XY))
Sets the application status indicator activation callback. 'callback' should take two arguments: int mouse button index (one of [MouseButton] values) and [Vector2i.XY] click position in screen coordinates.
Note: This method is implemented on macOS and Windows.
func StatusIndicatorSetIcon ¶
func StatusIndicatorSetIcon(id StatusIndicator, icon Texture2D.Instance)
Sets the application status indicator icon.
Note: This method is implemented on macOS and Windows.
func StatusIndicatorSetMenu ¶
func StatusIndicatorSetMenu(id StatusIndicator, menu_rid RID.NativeMenu)
Sets the application status indicator native popup menu.
Note: On macOS, the menu is activated by any mouse button. Its activation callback is not triggered.
Note: On Windows, the menu is activated by the right mouse button, selecting the status icon and pressing Shift + F10, or the applications key. The menu's activation callback for the other mouse buttons is still triggered.
Note: Native popup is only supported if graphics.gd/classdb/NativeMenu supports the [Nativemenu.FeaturePopupMenu] feature.
func StatusIndicatorSetTooltip ¶
func StatusIndicatorSetTooltip(id StatusIndicator, tooltip string)
Sets the application status indicator tooltip.
Note: This method is implemented on macOS and Windows.
func TabletGetCurrentDriver ¶
func TabletGetCurrentDriver() string
Returns current active tablet driver name.
Note: This method is implemented only on Windows.
func TabletGetDriverCount ¶
func TabletGetDriverCount() int
Returns the total number of available tablet drivers.
Note: This method is implemented only on Windows.
func TabletGetDriverName ¶
Returns the tablet driver name for the given index.
Note: This method is implemented only on Windows.
func TabletSetCurrentDriver ¶
func TabletSetCurrentDriver(name string)
Set active tablet driver name.
Supported drivers:
- winink: Windows Ink API, default (Windows 8.1+ required).
- wintab: Wacom Wintab API (compatible device driver required).
- dummy: Dummy driver, tablet input is disabled.
Note: This method is implemented only on Windows.
func TtsGetVoicesForLanguage ¶
Returns an []string of voice identifiers for the 'language'.
Note: This method is implemented on Android, iOS, Web, Linux (X11/Wayland), macOS, and Windows.
Note: graphics.gd/classdb/ProjectSettings "audio/general/text_to_speech" should be true to use text-to-speech.
func TtsIsPaused ¶
func TtsIsPaused() bool
Returns true if the synthesizer is in a paused state.
Note: This method is implemented on Android, iOS, Web, Linux (X11/Wayland), macOS, and Windows.
Note: graphics.gd/classdb/ProjectSettings "audio/general/text_to_speech" should be true to use text-to-speech.
func TtsIsSpeaking ¶
func TtsIsSpeaking() bool
Returns true if the synthesizer is generating speech, or have utterance waiting in the queue.
Note: This method is implemented on Android, iOS, Web, Linux (X11/Wayland), macOS, and Windows.
Note: graphics.gd/classdb/ProjectSettings "audio/general/text_to_speech" should be true to use text-to-speech.
func TtsPause ¶
func TtsPause()
Puts the synthesizer into a paused state.
Note: This method is implemented on Android, iOS, Web, Linux (X11/Wayland), macOS, and Windows.
Note: graphics.gd/classdb/ProjectSettings "audio/general/text_to_speech" should be true to use text-to-speech.
func TtsResume ¶
func TtsResume()
Resumes the synthesizer if it was paused.
Note: This method is implemented on Android, iOS, Web, Linux (X11/Wayland), macOS, and Windows.
Note: graphics.gd/classdb/ProjectSettings "audio/general/text_to_speech" should be true to use text-to-speech.
func TtsSetUtteranceCallback ¶
func TtsSetUtteranceCallback(event TTSUtteranceEvent, callable func(int, int))
Adds a callback, which is called when the utterance has started, finished, canceled or reached a text boundary.
- TtsUtteranceStarted, TtsUtteranceEnded, and TtsUtteranceCanceled callable's method should take one int parameter, the utterance ID.
- TtsUtteranceBoundary callable's method should take two int parameters, the index of the character and the utterance ID.
Note: The granularity of the boundary callbacks is engine dependent.
Note: This method is implemented on Android, iOS, Web, Linux (X11/Wayland), macOS, and Windows.
Note: graphics.gd/classdb/ProjectSettings "audio/general/text_to_speech" should be true to use text-to-speech.
func TtsSpeak ¶
Adds an utterance to the queue. If 'interrupt' is true, the queue is cleared first.
- 'voice' identifier is one of the "id" values returned by TtsGetVoices or one of the values returned by TtsGetVoicesForLanguage.
- 'volume' ranges from 0 (lowest) to 100 (highest).
- 'pitch' ranges from 0.0 (lowest) to 2.0 (highest), 1.0 is default pitch for the current voice.
- 'rate' ranges from 0.1 (lowest) to 10.0 (highest), 1.0 is a normal speaking rate. Other values act as a percentage relative.
- 'utterance_id' is passed as a parameter to the callback functions.
Note: On Windows and Linux (X11/Wayland), utterance 'text' can use SSML markup. SSML support is engine and voice dependent. If the engine does not support SSML, you should strip out all XML markup before calling TtsSpeak.
Note: The granularity of pitch, rate, and volume is engine and voice dependent. Values may be truncated.
Note: This method is implemented on Android, iOS, Web, Linux (X11/Wayland), macOS, and Windows.
Note: graphics.gd/classdb/ProjectSettings "audio/general/text_to_speech" should be true to use text-to-speech.
func TtsSpeakOptions ¶
func TtsSpeakOptions(text string, voice string, volume int, pitch Float.X, rate Float.X, utterance_id int, interrupt bool)
Adds an utterance to the queue. If 'interrupt' is true, the queue is cleared first.
- 'voice' identifier is one of the "id" values returned by TtsGetVoices or one of the values returned by TtsGetVoicesForLanguage.
- 'volume' ranges from 0 (lowest) to 100 (highest).
- 'pitch' ranges from 0.0 (lowest) to 2.0 (highest), 1.0 is default pitch for the current voice.
- 'rate' ranges from 0.1 (lowest) to 10.0 (highest), 1.0 is a normal speaking rate. Other values act as a percentage relative.
- 'utterance_id' is passed as a parameter to the callback functions.
Note: On Windows and Linux (X11/Wayland), utterance 'text' can use SSML markup. SSML support is engine and voice dependent. If the engine does not support SSML, you should strip out all XML markup before calling TtsSpeak.
Note: The granularity of pitch, rate, and volume is engine and voice dependent. Values may be truncated.
Note: This method is implemented on Android, iOS, Web, Linux (X11/Wayland), macOS, and Windows.
Note: graphics.gd/classdb/ProjectSettings "audio/general/text_to_speech" should be true to use text-to-speech.
func TtsStop ¶
func TtsStop()
Stops synthesis in progress and removes all utterances from the queue.
Note: This method is implemented on Android, iOS, Web, Linux (X11/Linux), macOS, and Windows.
Note: graphics.gd/classdb/ProjectSettings "audio/general/text_to_speech" should be true to use text-to-speech.
func UnregisterAdditionalOutput ¶
Unregisters an graphics.gd/classdb/Object representing an additional output, that was registered via RegisterAdditionalOutput.
func VirtualKeyboardGetHeight ¶
func VirtualKeyboardGetHeight() int
Returns the on-screen keyboard's height in pixels. Returns 0 if there is no keyboard or if it is currently hidden.
func VirtualKeyboardHide ¶
func VirtualKeyboardHide()
Hides the virtual keyboard if it is shown, does nothing otherwise.
func VirtualKeyboardShow ¶
func VirtualKeyboardShow(existing_text string, position Rect2.PositionSize, atype VirtualKeyboardType)
Shows the virtual keyboard if the platform has one.
'existing_text' parameter is useful for implementing your own graphics.gd/classdb/LineEdit or graphics.gd/classdb/TextEdit, as it tells the virtual keyboard what text has already been typed (the virtual keyboard uses it for auto-correct and predictions).
'position' parameter is the screen space [Rect2.PositionSize] of the edited text.
'type' parameter allows configuring which type of virtual keyboard to show.
'max_length' limits the number of characters that can be entered if different from -1.
'cursor_start' can optionally define the current text cursor position if 'cursor_end' is not set.
'cursor_start' and 'cursor_end' can optionally define the current text selection.
Note: This method is implemented on Android, iOS and Web.
func VirtualKeyboardShowOptions ¶
func VirtualKeyboardShowOptions(existing_text string, position Rect2.PositionSize, atype VirtualKeyboardType, max_length int, cursor_start int, cursor_end int)
Shows the virtual keyboard if the platform has one.
'existing_text' parameter is useful for implementing your own graphics.gd/classdb/LineEdit or graphics.gd/classdb/TextEdit, as it tells the virtual keyboard what text has already been typed (the virtual keyboard uses it for auto-correct and predictions).
'position' parameter is the screen space [Rect2.PositionSize] of the edited text.
'type' parameter allows configuring which type of virtual keyboard to show.
'max_length' limits the number of characters that can be entered if different from -1.
'cursor_start' can optionally define the current text cursor position if 'cursor_end' is not set.
'cursor_start' and 'cursor_end' can optionally define the current text selection.
Note: This method is implemented on Android, iOS and Web.
func WarpMouse ¶
Sets the mouse cursor position to the given 'position' relative to an origin at the upper left corner of the currently focused game Window Manager window.
Note: WarpMouse is only supported on Windows, macOS, and Linux (X11/Wayland). It has no effect on Android, iOS, and Web.
func WindowCanDraw ¶
Returns true if anything can be drawn in the window specified by 'window_id', false otherwise. Using the --disable-render-loop command line argument or a headless build will return false.
func WindowCanDrawOptions ¶
Returns true if anything can be drawn in the window specified by 'window_id', false otherwise. Using the --disable-render-loop command line argument or a headless build will return false.
func WindowGetActivePopup ¶
func WindowGetActivePopup() int
Returns ID of the active popup window, or InvalidWindowId if there is none.
func WindowGetAttachedInstanceId ¶
Returns the graphics.gd/classdb/Object.Instance.GetInstanceId of the graphics.gd/classdb/Window the 'window_id' is attached to.
func WindowGetAttachedInstanceIdOptions ¶
Returns the graphics.gd/classdb/Object.Instance.GetInstanceId of the graphics.gd/classdb/Window the 'window_id' is attached to.
func WindowGetCurrentScreen ¶
Returns the screen the window specified by 'window_id' is currently positioned on. If the screen overlaps multiple displays, the screen where the window's center is located is returned. See also WindowSetCurrentScreen.
func WindowGetCurrentScreenOptions ¶
Returns the screen the window specified by 'window_id' is currently positioned on. If the screen overlaps multiple displays, the screen where the window's center is located is returned. See also WindowSetCurrentScreen.
func WindowGetFlag ¶
func WindowGetFlag(flag WindowFlags, window_id Window) bool
Returns the current value of the given window's 'flag'.
func WindowGetFlagOptions ¶
func WindowGetFlagOptions(flag WindowFlags, window_id Window) bool
Returns the current value of the given window's 'flag'.
func WindowGetMaxSize ¶
Returns the window's maximum size (in pixels). See also WindowSetMaxSize.
func WindowGetMaxSizeOptions ¶
Returns the window's maximum size (in pixels). See also WindowSetMaxSize.
func WindowGetMinSize ¶
Returns the window's minimum size (in pixels). See also WindowSetMinSize.
func WindowGetMinSizeOptions ¶
Returns the window's minimum size (in pixels). See also WindowSetMinSize.
func WindowGetNativeHandle ¶
func WindowGetNativeHandle(handle_type HandleType, window_id Window) int
Returns internal structure pointers for use in plugins.
Note: This method is implemented on Android, Linux (X11/Wayland), macOS, and Windows.
func WindowGetNativeHandleOptions ¶
func WindowGetNativeHandleOptions(handle_type HandleType, window_id Window) int
Returns internal structure pointers for use in plugins.
Note: This method is implemented on Android, Linux (X11/Wayland), macOS, and Windows.
func WindowGetPopupSafeRect ¶
func WindowGetPopupSafeRect(window int) Rect2i.PositionSize
Returns the bounding box of control, or menu item that was used to open the popup window, in the screen coordinate system.
func WindowGetPosition ¶
Returns the position of the client area of the given window on the screen.
func WindowGetPositionOptions ¶
Returns the position of the client area of the given window on the screen.
func WindowGetPositionWithDecorations ¶
Returns the position of the given window on the screen including the borders drawn by the operating system. See also WindowGetPosition.
func WindowGetPositionWithDecorationsOptions ¶
Returns the position of the given window on the screen including the borders drawn by the operating system. See also WindowGetPosition.
func WindowGetSafeTitleMargins ¶
Returns left margins (x), right margins (y) and height (z) of the title that are safe to use (contains no buttons or other elements) when WindowFlagExtendToTitle flag is set.
func WindowGetSafeTitleMarginsOptions ¶
Returns left margins (x), right margins (y) and height (z) of the title that are safe to use (contains no buttons or other elements) when WindowFlagExtendToTitle flag is set.
func WindowGetSize ¶
Returns the size of the window specified by 'window_id' (in pixels), excluding the borders drawn by the operating system. This is also called the "client area". See also WindowGetSizeWithDecorations, WindowSetSize and WindowGetPosition.
func WindowGetSizeOptions ¶
Returns the size of the window specified by 'window_id' (in pixels), excluding the borders drawn by the operating system. This is also called the "client area". See also WindowGetSizeWithDecorations, WindowSetSize and WindowGetPosition.
func WindowGetSizeWithDecorations ¶
Returns the size of the window specified by 'window_id' (in pixels), including the borders drawn by the operating system. See also WindowGetSize.
func WindowGetSizeWithDecorationsOptions ¶
Returns the size of the window specified by 'window_id' (in pixels), including the borders drawn by the operating system. See also WindowGetSize.
func WindowGetTitleSize ¶
Returns the estimated window title bar size (including text and window buttons) for the window specified by 'window_id' (in pixels). This method does not change the window title.
Note: This method is implemented on macOS and Windows.
func WindowGetTitleSizeOptions ¶
Returns the estimated window title bar size (including text and window buttons) for the window specified by 'window_id' (in pixels). This method does not change the window title.
Note: This method is implemented on macOS and Windows.
func WindowIsFocused ¶
Returns true if the window specified by 'window_id' is focused.
func WindowIsFocusedOptions ¶
Returns true if the window specified by 'window_id' is focused.
func WindowIsMaximizeAllowed ¶
Returns true if the given window can be maximized (the maximize button is enabled).
func WindowIsMaximizeAllowedOptions ¶
Returns true if the given window can be maximized (the maximize button is enabled).
func WindowMaximizeOnTitleDblClick ¶
func WindowMaximizeOnTitleDblClick() bool
Returns true, if double-click on a window title should maximize it.
Note: This method is implemented only on macOS.
func WindowMinimizeOnTitleDblClick ¶
func WindowMinimizeOnTitleDblClick() bool
Returns true, if double-click on a window title should minimize it.
Note: This method is implemented only on macOS.
func WindowMoveToForeground ¶
func WindowMoveToForeground(window_id Window)
Moves the window specified by 'window_id' to the foreground, so that it is visible over other windows.
func WindowMoveToForegroundOptions ¶
func WindowMoveToForegroundOptions(window_id Window)
Moves the window specified by 'window_id' to the foreground, so that it is visible over other windows.
func WindowRequestAttention ¶
func WindowRequestAttention(window_id Window)
Makes the window specified by 'window_id' request attention, which is materialized by the window title and taskbar entry blinking until the window is focused. This usually has no visible effect if the window is currently focused. The exact behavior varies depending on the operating system.
func WindowRequestAttentionOptions ¶
func WindowRequestAttentionOptions(window_id Window)
Makes the window specified by 'window_id' request attention, which is materialized by the window title and taskbar entry blinking until the window is focused. This usually has no visible effect if the window is currently focused. The exact behavior varies depending on the operating system.
func WindowSetCurrentScreen ¶
Moves the window specified by 'window_id' to the specified 'screen'. See also WindowGetCurrentScreen.
func WindowSetCurrentScreenOptions ¶
Moves the window specified by 'window_id' to the specified 'screen'. See also WindowGetCurrentScreen.
func WindowSetDropFilesCallback ¶
Sets the 'callback' that should be called when files are dropped from the operating system's file manager to the window specified by 'window_id'. 'callback' should take one []string argument, which is the list of dropped files.
Warning: Advanced users only! Adding such a callback to a graphics.gd/classdb/Window node will override its default implementation, which can introduce bugs.
Note: This method is implemented on Windows, macOS, Linux (X11/Wayland), and Web.
func WindowSetDropFilesCallbackOptions ¶
Sets the 'callback' that should be called when files are dropped from the operating system's file manager to the window specified by 'window_id'. 'callback' should take one []string argument, which is the list of dropped files.
Warning: Advanced users only! Adding such a callback to a graphics.gd/classdb/Window node will override its default implementation, which can introduce bugs.
Note: This method is implemented on Windows, macOS, Linux (X11/Wayland), and Web.
func WindowSetExclusive ¶
If set to true, this window will always stay on top of its parent window, parent window will ignore input while this window is opened.
Note: On macOS, exclusive windows are confined to the same space (virtual desktop or screen) as the parent window.
Note: This method is implemented on macOS and Windows.
func WindowSetFlag ¶
func WindowSetFlag(flag WindowFlags, enabled bool, window_id Window)
Enables or disables the given window's given 'flag'. See WindowFlags for possible values and their behavior.
func WindowSetFlagOptions ¶
func WindowSetFlagOptions(flag WindowFlags, enabled bool, window_id Window)
Enables or disables the given window's given 'flag'. See WindowFlags for possible values and their behavior.
func WindowSetImeActive ¶
Sets whether Input Method Editor should be enabled for the window specified by 'window_id'. See also WindowSetImePosition.
func WindowSetImeActiveOptions ¶
Sets whether Input Method Editor should be enabled for the window specified by 'window_id'. See also WindowSetImePosition.
func WindowSetImePosition ¶
Sets the position of the Input Method Editor popup for the specified 'window_id'. Only effective if WindowSetImeActive was set to true for the specified 'window_id'.
func WindowSetImePositionOptions ¶
Sets the position of the Input Method Editor popup for the specified 'window_id'. Only effective if WindowSetImeActive was set to true for the specified 'window_id'.
func WindowSetInputEventCallback ¶
func WindowSetInputEventCallback(callback func(event InputEvent.Instance), window_id Window)
Sets the 'callback' that should be called when any graphics.gd/classdb/InputEvent is sent to the window specified by 'window_id'.
Warning: Advanced users only! Adding such a callback to a graphics.gd/classdb/Window node will override its default implementation, which can introduce bugs.
func WindowSetInputEventCallbackOptions ¶
func WindowSetInputEventCallbackOptions(callback func(event InputEvent.Instance), window_id Window)
Sets the 'callback' that should be called when any graphics.gd/classdb/InputEvent is sent to the window specified by 'window_id'.
Warning: Advanced users only! Adding such a callback to a graphics.gd/classdb/Window node will override its default implementation, which can introduce bugs.
func WindowSetInputTextCallback ¶
Sets the 'callback' that should be called when text is entered using the virtual keyboard to the window specified by 'window_id'.
Warning: Advanced users only! Adding such a callback to a graphics.gd/classdb/Window node will override its default implementation, which can introduce bugs.
func WindowSetInputTextCallbackOptions ¶
Sets the 'callback' that should be called when text is entered using the virtual keyboard to the window specified by 'window_id'.
Warning: Advanced users only! Adding such a callback to a graphics.gd/classdb/Window node will override its default implementation, which can introduce bugs.
func WindowSetMaxSize ¶
Sets the maximum size of the window specified by 'window_id' in pixels. Normally, the user will not be able to drag the window to make it larger than the specified size. See also WindowGetMaxSize.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.MaxSize instead.
Note: Using third-party tools, it is possible for users to disable window geometry restrictions and therefore bypass this limit.
func WindowSetMaxSizeOptions ¶
Sets the maximum size of the window specified by 'window_id' in pixels. Normally, the user will not be able to drag the window to make it larger than the specified size. See also WindowGetMaxSize.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.MaxSize instead.
Note: Using third-party tools, it is possible for users to disable window geometry restrictions and therefore bypass this limit.
func WindowSetMinSize ¶
Sets the minimum size for the given window to 'min_size' in pixels. Normally, the user will not be able to drag the window to make it smaller than the specified size. See also WindowGetMinSize.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.MinSize instead.
Note: By default, the main window has a minimum size of Vector2i(64, 64). This prevents issues that can arise when the window is resized to a near-zero size.
Note: Using third-party tools, it is possible for users to disable window geometry restrictions and therefore bypass this limit.
func WindowSetMinSizeOptions ¶
Sets the minimum size for the given window to 'min_size' in pixels. Normally, the user will not be able to drag the window to make it smaller than the specified size. See also WindowGetMinSize.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.MinSize instead.
Note: By default, the main window has a minimum size of Vector2i(64, 64). This prevents issues that can arise when the window is resized to a near-zero size.
Note: Using third-party tools, it is possible for users to disable window geometry restrictions and therefore bypass this limit.
func WindowSetMode ¶
func WindowSetMode(mode WindowMode, window_id Window)
Sets window mode for the given window to 'mode'. See WindowMode for possible values and how each mode behaves.
Note: On Android, setting it to WindowModeFullscreen or WindowModeExclusiveFullscreen will enable immersive mode.
Note: Setting the window to full screen forcibly sets the borderless flag to true, so make sure to set it back to false when not wanted.
func WindowSetModeOptions ¶
func WindowSetModeOptions(mode WindowMode, window_id Window)
Sets window mode for the given window to 'mode'. See WindowMode for possible values and how each mode behaves.
Note: On Android, setting it to WindowModeFullscreen or WindowModeExclusiveFullscreen will enable immersive mode.
Note: Setting the window to full screen forcibly sets the borderless flag to true, so make sure to set it back to false when not wanted.
func WindowSetMousePassthrough ¶
Sets a polygonal region of the window which accepts mouse events. Mouse events outside the region will be passed through.
Passing an empty array will disable passthrough support (all mouse events will be intercepted by the window, which is the default behavior).
// Set region, using Path2D node. DisplayServer.WindowSetMousePassthrough(path2d.Curve().GetBakedPoints(), 0) // Set region, using Polygon2D node. DisplayServer.WindowSetMousePassthrough(polygon2d.Polygon(), 0) // Reset region to default. DisplayServer.WindowSetMousePassthrough(nil, 0)
Note: On Windows, the portion of a window that lies outside the region is not drawn, while on Linux (X11) and macOS it is.
Note: This method is implemented on Linux (X11), macOS and Windows.
func WindowSetMousePassthroughOptions ¶
Sets a polygonal region of the window which accepts mouse events. Mouse events outside the region will be passed through.
Passing an empty array will disable passthrough support (all mouse events will be intercepted by the window, which is the default behavior).
// Set region, using Path2D node. DisplayServer.WindowSetMousePassthrough(path2d.Curve().GetBakedPoints(), 0) // Set region, using Polygon2D node. DisplayServer.WindowSetMousePassthrough(polygon2d.Polygon(), 0) // Reset region to default. DisplayServer.WindowSetMousePassthrough(nil, 0)
Note: On Windows, the portion of a window that lies outside the region is not drawn, while on Linux (X11) and macOS it is.
Note: This method is implemented on Linux (X11), macOS and Windows.
func WindowSetPopupSafeRect ¶
func WindowSetPopupSafeRect(window int, rect Rect2i.PositionSize)
Sets the bounding box of control, or menu item that was used to open the popup window, in the screen coordinate system. Clicking this area will not auto-close this popup.
func WindowSetPosition ¶
Sets the position of the given window to 'position'. On multi-monitor setups, the screen position is relative to the virtual desktop area. On multi-monitor setups with different screen resolutions or orientations, the origin may be located outside any display like this:
See also WindowGetPosition and WindowSetSize.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.Position instead.
Note: On Linux (Wayland): this method is a no-op.
func WindowSetPositionOptions ¶
Sets the position of the given window to 'position'. On multi-monitor setups, the screen position is relative to the virtual desktop area. On multi-monitor setups with different screen resolutions or orientations, the origin may be located outside any display like this:
See also WindowGetPosition and WindowSetSize.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.Position instead.
Note: On Linux (Wayland): this method is a no-op.
func WindowSetRectChangedCallback ¶
func WindowSetRectChangedCallback(callback func(rect Rect2i.PositionSize), window_id Window)
Sets the 'callback' that will be called when the window specified by 'window_id' is moved or resized.
Warning: Advanced users only! Adding such a callback to a graphics.gd/classdb/Window node will override its default implementation, which can introduce bugs.
func WindowSetRectChangedCallbackOptions ¶
func WindowSetRectChangedCallbackOptions(callback func(rect Rect2i.PositionSize), window_id Window)
Sets the 'callback' that will be called when the window specified by 'window_id' is moved or resized.
Warning: Advanced users only! Adding such a callback to a graphics.gd/classdb/Window node will override its default implementation, which can introduce bugs.
func WindowSetSize ¶
Sets the size of the given window to 'size' (in pixels). See also WindowGetSize and WindowGetPosition.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.Size instead.
func WindowSetSizeOptions ¶
Sets the size of the given window to 'size' (in pixels). See also WindowGetSize and WindowGetPosition.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.Size instead.
func WindowSetTitle ¶
Sets the title of the given window to 'title'.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.Title instead.
Note: Avoid changing the window title every frame, as this can cause performance issues on certain window managers. Try to change the window title only a few times per second at most.
func WindowSetTitleOptions ¶
Sets the title of the given window to 'title'.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.Title instead.
Note: Avoid changing the window title every frame, as this can cause performance issues on certain window managers. Try to change the window title only a few times per second at most.
func WindowSetTransient ¶
Sets window transient parent. Transient window will be destroyed with its transient parent and will return focus to their parent when closed. The transient window is displayed on top of a non-exclusive full-screen parent window. Transient windows can't enter full-screen mode.
Note: It's recommended to change this value using graphics.gd/classdb/Window.Instance.Transient instead.
Note: The behavior might be different depending on the platform.
func WindowSetVsyncMode ¶
Sets the V-Sync mode of the given window. See also graphics.gd/classdb/ProjectSettings "display/window/vsync/vsync_mode".
See [DisplayServer.VSyncMode] for possible values and how they affect the behavior of your application.
Depending on the platform and used renderer, the engine will fall back to VsyncEnabled if the desired mode is not supported.
Note: V-Sync modes other than VsyncEnabled are only supported in the Forward+ and Mobile rendering methods, not Compatibility.
func WindowSetVsyncModeOptions ¶
Sets the V-Sync mode of the given window. See also graphics.gd/classdb/ProjectSettings "display/window/vsync/vsync_mode".
See [DisplayServer.VSyncMode] for possible values and how they affect the behavior of your application.
Depending on the platform and used renderer, the engine will fall back to VsyncEnabled if the desired mode is not supported.
Note: V-Sync modes other than VsyncEnabled are only supported in the Forward+ and Mobile rendering methods, not Compatibility.
func WindowSetWindowButtonsOffset ¶
When WindowFlagExtendToTitle flag is set, set offset to the center of the first titlebar button.
Note: This flag is implemented only on macOS.
func WindowSetWindowButtonsOffsetOptions ¶
When WindowFlagExtendToTitle flag is set, set offset to the center of the first titlebar button.
Note: This flag is implemented only on macOS.
func WindowSetWindowEventCallback ¶
func WindowSetWindowEventCallback(callback func(event WindowEvent), window_id Window)
Sets the 'callback' that will be called when an event occurs in the window specified by 'window_id'.
Warning: Advanced users only! Adding such a callback to a graphics.gd/classdb/Window node will override its default implementation, which can introduce bugs.
func WindowSetWindowEventCallbackOptions ¶
func WindowSetWindowEventCallbackOptions(callback func(event WindowEvent), window_id Window)
Sets the 'callback' that will be called when an event occurs in the window specified by 'window_id'.
Warning: Advanced users only! Adding such a callback to a graphics.gd/classdb/Window node will override its default implementation, which can introduce bugs.
func WindowStartDrag ¶
func WindowStartDrag(window_id Window)
Starts an interactive drag operation on the window with the given 'window_id', using the current mouse position. Call this method when handling a mouse button being pressed to simulate a pressed event on the window's title bar. Using this method allows the window to participate in space switching, tiling, and other system features.
Note: This method is implemented on Linux (X11/Wayland), macOS, and Windows.
func WindowStartDragOptions ¶
func WindowStartDragOptions(window_id Window)
Starts an interactive drag operation on the window with the given 'window_id', using the current mouse position. Call this method when handling a mouse button being pressed to simulate a pressed event on the window's title bar. Using this method allows the window to participate in space switching, tiling, and other system features.
Note: This method is implemented on Linux (X11/Wayland), macOS, and Windows.
func WindowStartResize ¶
func WindowStartResize(edge WindowResizeEdge, window_id Window)
Starts an interactive resize operation on the window with the given 'window_id', using the current mouse position. Call this method when handling a mouse button being pressed to simulate a pressed event on the window's edge.
Note: This method is implemented on Linux (X11/Wayland), macOS, and Windows.
func WindowStartResizeOptions ¶
func WindowStartResizeOptions(edge WindowResizeEdge, window_id Window)
Starts an interactive resize operation on the window with the given 'window_id', using the current mouse position. Call this method when handling a mouse button being pressed to simulate a pressed event on the window's edge.
Note: This method is implemented on Linux (X11/Wayland), macOS, and Windows.
Types ¶
type CursorShape ¶
type CursorShape int //gd:DisplayServer.CursorShape
const ( // Arrow cursor shape. This is the default when not pointing anything that overrides the mouse cursor, such as a [graphics.gd/classdb/LineEdit] or [graphics.gd/classdb/TextEdit]. CursorArrow CursorShape = 0 // I-beam cursor shape. This is used by default when hovering a control that accepts text input, such as [graphics.gd/classdb/LineEdit] or [graphics.gd/classdb/TextEdit]. CursorIbeam CursorShape = 1 // Pointing hand cursor shape. This is used by default when hovering a [graphics.gd/classdb/LinkButton] or a URL tag in a [graphics.gd/classdb/RichTextLabel]. CursorPointingHand CursorShape = 2 // Crosshair cursor. This is intended to be displayed when the user needs precise aim over an element, such as a rectangle selection tool or a color picker. CursorCross CursorShape = 3 // Wait cursor. On most cursor themes, this displays a spinning icon besides the arrow. Intended to be used for non-blocking operations (when the user can do something else at the moment). See also [CursorBusy]. CursorWait CursorShape = 4 // Wait cursor. On most cursor themes, this replaces the arrow with a spinning icon. Intended to be used for blocking operations (when the user can't do anything else at the moment). See also [CursorWait]. CursorBusy CursorShape = 5 // Dragging hand cursor. This is displayed during drag-and-drop operations. See also [CursorCanDrop]. CursorDrag CursorShape = 6 // "Can drop" cursor. This is displayed during drag-and-drop operations if hovering over a [graphics.gd/classdb/Control] that can accept the drag-and-drop event. On most cursor themes, this displays a dragging hand with an arrow symbol besides it. See also [CursorDrag]. CursorCanDrop CursorShape = 7 // Forbidden cursor. This is displayed during drag-and-drop operations if the hovered [graphics.gd/classdb/Control] can't accept the drag-and-drop event. CursorForbidden CursorShape = 8 // Vertical resize cursor. Intended to be displayed when the hovered [graphics.gd/classdb/Control] can be vertically resized using the mouse. See also [CursorVsplit]. CursorVsize CursorShape = 9 // Horizontal resize cursor. Intended to be displayed when the hovered [graphics.gd/classdb/Control] can be horizontally resized using the mouse. See also [CursorHsplit]. CursorHsize CursorShape = 10 // Secondary diagonal resize cursor (top-right/bottom-left). Intended to be displayed when the hovered [graphics.gd/classdb/Control] can be resized on both axes at once using the mouse. CursorBdiagsize CursorShape = 11 // Main diagonal resize cursor (top-left/bottom-right). Intended to be displayed when the hovered [graphics.gd/classdb/Control] can be resized on both axes at once using the mouse. CursorFdiagsize CursorShape = 12 // Move cursor. Intended to be displayed when the hovered [graphics.gd/classdb/Control] can be moved using the mouse. CursorMove CursorShape = 13 // Vertical split cursor. This is displayed when hovering a [graphics.gd/classdb/Control] with splits that can be vertically resized using the mouse, such as [graphics.gd/classdb/VSplitContainer]. On some cursor themes, this cursor may have the same appearance as [CursorVsize]. CursorVsplit CursorShape = 14 // Horizontal split cursor. This is displayed when hovering a [graphics.gd/classdb/Control] with splits that can be horizontally resized using the mouse, such as [graphics.gd/classdb/HSplitContainer]. On some cursor themes, this cursor may have the same appearance as [CursorHsize]. CursorHsplit CursorShape = 15 // Help cursor. On most cursor themes, this displays a question mark icon instead of the mouse cursor. Intended to be used when the user has requested help on the next element that will be clicked. CursorHelp CursorShape = 16 // Represents the size of the [CursorShape] enum. CursorMax CursorShape = 17 )
func CursorGetShape ¶
func CursorGetShape() CursorShape
Returns the default mouse cursor shape set by CursorSetShape.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
type Feature ¶
type Feature int //gd:DisplayServer.Feature
const ( // Display server supports global menu. This allows the application to display its menu items in the operating system's top bar. macOS FeatureGlobalMenu Feature = 0 // Display server supports multiple windows that can be moved outside of the main window. Windows, macOS, Linux (X11) FeatureSubwindows Feature = 1 // Display server supports touchscreen input. Windows, Linux (X11), Android, iOS, Web FeatureTouchscreen Feature = 2 // Display server supports mouse input. Windows, macOS, Linux (X11/Wayland), Android, Web FeatureMouse Feature = 3 // Display server supports warping mouse coordinates to keep the mouse cursor constrained within an area, but looping when one of the edges is reached. Windows, macOS, Linux (X11/Wayland) FeatureMouseWarp Feature = 4 // Display server supports setting and getting clipboard data. See also [FeatureClipboardPrimary]. Windows, macOS, Linux (X11/Wayland), Android, iOS, Web FeatureClipboard Feature = 5 // Display server supports popping up a virtual keyboard when requested to input text without a physical keyboard. Android, iOS, Web FeatureVirtualKeyboard Feature = 6 // Display server supports setting the mouse cursor shape to be different from the default. Windows, macOS, Linux (X11/Wayland), Android, Web FeatureCursorShape Feature = 7 // Display server supports setting the mouse cursor shape to a custom image. Windows, macOS, Linux (X11/Wayland), Web FeatureCustomCursorShape Feature = 8 // Display server supports spawning text dialogs using the operating system's native look-and-feel. See [Instance.DialogShow]. Windows, macOS FeatureNativeDialog Feature = 9 // Display server supports [Input Method Editor], which is commonly used for inputting Chinese/Japanese/Korean text. This is handled by the operating system, rather than by Godot. Windows, macOS, Linux (X11) // // [Input Method Editor]: https://en.wikipedia.org/wiki/Input_method FeatureIme Feature = 10 // Display server supports windows can use per-pixel transparency to make windows behind them partially or fully visible. Windows, macOS, Linux (X11/Wayland) FeatureWindowTransparency Feature = 11 // Display server supports querying the operating system's display scale factor. This allows for reliable automatic hiDPI display detection, as opposed to guessing based on the screen resolution and reported display DPI (which can be unreliable due to broken monitor EDID). Windows, Linux (Wayland), macOS FeatureHidpi Feature = 12 // Display server supports changing the window icon (usually displayed in the top-left corner). Windows, macOS, Linux (X11) FeatureIcon Feature = 13 // Display server supports changing the window icon (usually displayed in the top-left corner). Windows, macOS FeatureNativeIcon Feature = 14 // Display server supports changing the screen orientation. Android, iOS FeatureOrientation Feature = 15 // Display server supports V-Sync status can be changed from the default (which is forced to be enabled platforms not supporting this feature). Windows, macOS, Linux (X11/Wayland) FeatureSwapBuffers Feature = 16 // Display server supports Primary clipboard can be used. This is a different clipboard from [FeatureClipboard]. Linux (X11/Wayland) FeatureClipboardPrimary Feature = 18 // Display server supports text-to-speech. See tts_* methods. Windows, macOS, Linux (X11/Wayland), Android, iOS, Web FeatureTextToSpeech Feature = 19 // Display server supports expanding window content to the title. See [WindowFlagExtendToTitle]. macOS FeatureExtendToTitle Feature = 20 // Display server supports reading screen pixels. See [Instance.ScreenGetPixel]. FeatureScreenCapture Feature = 21 // Display server supports application status indicators. FeatureStatusIndicator Feature = 22 // Display server supports native help system search callbacks. See [Instance.HelpSetSearchCallbacks]. FeatureNativeHelp Feature = 23 // Display server supports spawning text input dialogs using the operating system's native look-and-feel. See [Instance.DialogInputText]. Windows, macOS FeatureNativeDialogInput Feature = 24 // Display server supports spawning dialogs for selecting files or directories using the operating system's native look-and-feel. See [Instance.FileDialogShow]. Windows, macOS, Linux (X11/Wayland), Android FeatureNativeDialogFile Feature = 25 // The display server supports all features of [FeatureNativeDialogFile], with the added functionality of Options and native dialog file access to res:// and user:// paths. See [Instance.FileDialogShow] and [Instance.FileDialogWithOptionsShow]. Windows, macOS, Linux (X11/Wayland) FeatureNativeDialogFileExtra Feature = 26 // The display server supports initiating window drag and resize operations on demand. See [Instance.WindowStartDrag] and [Instance.WindowStartResize]. FeatureWindowDrag Feature = 27 // Display server supports [WindowFlagExcludeFromCapture] window flag. FeatureScreenExcludeFromCapture Feature = 28 // Display server supports embedding a window from another process. Windows, Linux (X11) FeatureWindowEmbedding Feature = 29 // Native file selection dialog supports MIME types as filters. FeatureNativeDialogFileMime Feature = 30 // Display server supports system emoji and symbol picker. Windows, macOS FeatureEmojiAndSymbolPicker Feature = 31 )
type FileDialogMode ¶
type FileDialogMode int //gd:DisplayServer.FileDialogMode
const ( // The native file dialog allows selecting one, and only one file. FileDialogModeOpenFile FileDialogMode = 0 // The native file dialog allows selecting multiple files. FileDialogModeOpenFiles FileDialogMode = 1 // The native file dialog only allows selecting a directory, disallowing the selection of any file. FileDialogModeOpenDir FileDialogMode = 2 // The native file dialog allows selecting one file or directory. FileDialogModeOpenAny FileDialogMode = 3 // The native file dialog will warn when a file exists. FileDialogModeSaveFile FileDialogMode = 4 )
type FileDialogOption ¶
type HandleType ¶
type HandleType int //gd:DisplayServer.HandleType
const ( // Display handle: // // - Linux (X11): X11::Display* for the display. // // - Linux (Wayland): wl_display for the display. // // - Android: EGLDisplay for the display. DisplayHandle HandleType = 0 // Window handle: // // - Windows: HWND for the window. // // - Linux (X11): X11::Window* for the window. // // - Linux (Wayland): wl_surface for the window. // // - macOS: NSWindow* for the window. // // - iOS: UIViewController* for the view controller. // // - Android: jObject for the activity. WindowHandle HandleType = 1 // Window view: // // - Windows: HDC for the window (only with the Compatibility renderer). // // - macOS: NSView* for the window main view. // // - iOS: UIView* for the window main view. WindowView HandleType = 2 // OpenGL context (only with the Compatibility renderer): // // - Windows: HGLRC for the window (native GL), or EGLContext for the window (ANGLE). // // - Linux (X11): GLXContext* for the window. // // - Linux (Wayland): EGLContext for the window. // // - macOS: NSOpenGLContext* for the window (native GL), or EGLContext for the window (ANGLE). // // - Android: EGLContext for the window. OpenglContext HandleType = 3 // - Windows: EGLDisplay for the window (ANGLE). // // - macOS: EGLDisplay for the window (ANGLE). // // - Linux (Wayland): EGLDisplay for the window. EglDisplay HandleType = 4 // - Windows: EGLConfig for the window (ANGLE). // // - macOS: EGLConfig for the window (ANGLE). // // - Linux (Wayland): EGLConfig for the window. EglConfig HandleType = 5 )
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.DisplayServer
Instance of the class with convieniently typed arguments and results.
type MouseModeValue ¶
type MouseModeValue int //gd:DisplayServer.MouseMode
const ( // Makes the mouse cursor visible if it is hidden. MouseModeVisible MouseModeValue = 0 // Makes the mouse cursor hidden if it is visible. MouseModeHidden MouseModeValue = 1 // Captures the mouse. The mouse will be hidden and its position locked at the center of the window manager's window. // // Note: If you want to process the mouse's movement in this mode, you need to use [graphics.gd/classdb/InputEventMouseMotion.Instance.Relative]. MouseModeCaptured MouseModeValue = 2 // Confines the mouse cursor to the game window, and make it visible. MouseModeConfined MouseModeValue = 3 // Confines the mouse cursor to the game window, and make it hidden. MouseModeConfinedHidden MouseModeValue = 4 // Max value of the [MouseMode]. MouseModeMax MouseModeValue = 5 )
func MouseGetMode ¶
func MouseGetMode() MouseModeValue
Returns the current mouse mode. See also MouseSetMode.
type Screen ¶
type Screen int
const ScreenOfMainWindow Screen = -1 //gd:DisplayServer.SCREEN_OF_MAIN_WINDOW
const ScreenPrimary Screen = -2 //gd:DisplayServer.SCREEN_PRIMARY
const ScreenWithKeyboardFocus Screen = -3 //gd:DisplayServer.SCREEN_WITH_KEYBOARD_FOCUS
const ScreenWithMouseFocus Screen = -4 //gd:DisplayServer.SCREEN_WITH_MOUSE_FOCUS
type ScreenOrientation ¶
type ScreenOrientation int //gd:DisplayServer.ScreenOrientation
const ( // Default landscape orientation. ScreenLandscape ScreenOrientation = 0 // Default portrait orientation. ScreenPortrait ScreenOrientation = 1 // Reverse landscape orientation (upside down). ScreenReverseLandscape ScreenOrientation = 2 // Reverse portrait orientation (upside down). ScreenReversePortrait ScreenOrientation = 3 // Automatic landscape orientation (default or reverse depending on sensor). ScreenSensorLandscape ScreenOrientation = 4 // Automatic portrait orientation (default or reverse depending on sensor). ScreenSensorPortrait ScreenOrientation = 5 // Automatic landscape or portrait orientation (default or reverse depending on sensor). ScreenSensor ScreenOrientation = 6 )
func ScreenGetOrientation ¶
func ScreenGetOrientation() ScreenOrientation
Returns the 'screen”s current orientation. See also ScreenSetOrientation.
Note: This method is implemented on Android and iOS.
func ScreenGetOrientationOptions ¶
func ScreenGetOrientationOptions(screen Screen) ScreenOrientation
Returns the 'screen”s current orientation. See also ScreenSetOrientation.
Note: This method is implemented on Android and iOS.
type StatusIndicator ¶
type StatusIndicator int
const InvalidIndicatorId StatusIndicator = -1 //gd:DisplayServer.INVALID_INDICATOR_ID
func CreateStatusIndicator ¶
func CreateStatusIndicator(icon Texture2D.Instance, tooltip string, callback func(button Input.MouseButton, click_position Vector2i.XY)) StatusIndicator
Creates a new application status indicator with the specified icon, tooltip, and activation callback.
'callback' should take two arguments: the pressed mouse button (one of the [MouseButton] constants) and the click position in screen coordinates (a [Vector2i.XY]).
type TTSUtteranceEvent ¶
type TTSUtteranceEvent int //gd:DisplayServer.TTSUtteranceEvent
const ( // Utterance has begun to be spoken. TtsUtteranceStarted TTSUtteranceEvent = 0 // Utterance was successfully finished. TtsUtteranceEnded TTSUtteranceEvent = 1 // Utterance was canceled, or TTS service was unable to process it. TtsUtteranceCanceled TTSUtteranceEvent = 2 // Utterance reached a word or sentence boundary. TtsUtteranceBoundary TTSUtteranceEvent = 3 )
type TextToSpeechVoice ¶
type TextToSpeechVoice struct { Name string `gd:"name"` ID string `gd:"id"` Language string `gd:"language"` }
func TtsGetVoices ¶
func TtsGetVoices() []TextToSpeechVoice
Returns an slice of voice information dictionaries.
Each data structure contains two string entries:
- name is voice name.
- id is voice identifier.
- language is language code in lang_Variant format. The lang part is a 2 or 3-letter code based on the ISO-639 standard, in lowercase. The Variant part is an engine-dependent string describing country, region or/and dialect.
Note that Godot depends on system libraries for text-to-speech functionality. These libraries are installed by default on Windows and macOS, but not on all Linux distributions. If they are not present, this method will return an empty list. This applies to both Godot users on Linux, as well as end-users on Linux running Godot games that use text-to-speech.
Note: This method is implemented on Android, iOS, Web, Linux (X11/Wayland), macOS, and Windows.
Note: graphics.gd/classdb/ProjectSettings "audio/general/text_to_speech" should be true to use text-to-speech.
type VSyncMode ¶
type VSyncMode int //gd:DisplayServer.VSyncMode
const ( // No vertical synchronization, which means the engine will display frames as fast as possible (tearing may be visible). Framerate is unlimited (regardless of [graphics.gd/classdb/Engine.MaxFps]). VsyncDisabled VSyncMode = 0 // Default vertical synchronization mode, the image is displayed only on vertical blanking intervals (no tearing is visible). Framerate is limited by the monitor refresh rate (regardless of [graphics.gd/classdb/Engine.MaxFps]). VsyncEnabled VSyncMode = 1 // Behaves like [VsyncDisabled] when the framerate drops below the screen's refresh rate to reduce stuttering (tearing may be visible). Otherwise, vertical synchronization is enabled to avoid tearing. Framerate is limited by the monitor refresh rate (regardless of [graphics.gd/classdb/Engine.MaxFps]). Behaves like [VsyncEnabled] when using the Compatibility rendering method. VsyncAdaptive VSyncMode = 2 // Displays the most recent image in the queue on vertical blanking intervals, while rendering to the other images (no tearing is visible). Framerate is unlimited (regardless of [graphics.gd/classdb/Engine.MaxFps]). // // Although not guaranteed, the images can be rendered as fast as possible, which may reduce input lag (also called "Fast" V-Sync mode). [VsyncMailbox] works best when at least twice as many frames as the display refresh rate are rendered. Behaves like [VsyncEnabled] when using the Compatibility rendering method. VsyncMailbox VSyncMode = 3 )
func WindowGetVsyncMode ¶
Returns the V-Sync mode of the given window.
func WindowGetVsyncModeOptions ¶
Returns the V-Sync mode of the given window.
type VirtualKeyboardType ¶
type VirtualKeyboardType int //gd:DisplayServer.VirtualKeyboardType
const ( // Default text virtual keyboard. KeyboardTypeDefault VirtualKeyboardType = 0 // Multiline virtual keyboard. KeyboardTypeMultiline VirtualKeyboardType = 1 // Virtual number keypad, useful for PIN entry. KeyboardTypeNumber VirtualKeyboardType = 2 // Virtual number keypad, useful for entering fractional numbers. KeyboardTypeNumberDecimal VirtualKeyboardType = 3 // Virtual phone number keypad. KeyboardTypePhone VirtualKeyboardType = 4 // Virtual keyboard with additional keys to assist with typing email addresses. KeyboardTypeEmailAddress VirtualKeyboardType = 5 // Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization. // // Note: This is not supported on Web. Instead, this behaves identically to [KeyboardTypeDefault]. KeyboardTypePassword VirtualKeyboardType = 6 // Virtual keyboard with additional keys to assist with typing URLs. KeyboardTypeUrl VirtualKeyboardType = 7 )
type Window ¶
type Window int
const InvalidWindowId Window = -1 //gd:DisplayServer.INVALID_WINDOW_ID
const MainWindowId Window = 0 //gd:DisplayServer.MAIN_WINDOW_ID
type WindowEvent ¶
type WindowEvent int //gd:DisplayServer.WindowEvent
const ( // Sent when the mouse pointer enters the window. WindowEventMouseEnter WindowEvent = 0 // Sent when the mouse pointer exits the window. WindowEventMouseExit WindowEvent = 1 // Sent when the window grabs focus. WindowEventFocusIn WindowEvent = 2 // Sent when the window loses focus. WindowEventFocusOut WindowEvent = 3 // Sent when the user has attempted to close the window (e.g. close button is pressed). WindowEventCloseRequest WindowEvent = 4 // Sent when the device "Back" button is pressed. // // Note: This event is implemented only on Android. WindowEventGoBackRequest WindowEvent = 5 // Sent when the window is moved to the display with different DPI, or display DPI is changed. // // Note: This flag is implemented only on macOS. WindowEventDpiChange WindowEvent = 6 // Sent when the window title bar decoration is changed (e.g. [WindowFlagExtendToTitle] is set or window entered/exited full screen mode). // // Note: This flag is implemented only on macOS. WindowEventTitlebarChange WindowEvent = 7 )
type WindowFlags ¶
type WindowFlags int //gd:DisplayServer.WindowFlags
const ( // The window can't be resized by dragging its resize grip. It's still possible to resize the window using [Instance.WindowSetSize]. This flag is ignored for full screen windows. WindowFlagResizeDisabled WindowFlags = 0 // The window do not have native title bar and other decorations. This flag is ignored for full-screen windows. WindowFlagBorderless WindowFlags = 1 // The window is floating on top of all other windows. This flag is ignored for full-screen windows. WindowFlagAlwaysOnTop WindowFlags = 2 // The window background can be transparent. // // Note: This flag has no effect if [Instance.IsWindowTransparencyAvailable] returns false. // // Note: Transparency support is implemented on Linux (X11/Wayland), macOS, and Windows, but availability might vary depending on GPU driver, display manager, and compositor capabilities. WindowFlagTransparent WindowFlags = 3 // The window can't be focused. No-focus window will ignore all input, except mouse clicks. WindowFlagNoFocus WindowFlags = 4 // Window is part of menu or [graphics.gd/classdb/OptionButton] dropdown. This flag can't be changed when the window is visible. An active popup window will exclusively receive all input, without stealing focus from its parent. Popup windows are automatically closed when uses click outside it, or when an application is switched. Popup window must have transient parent set (see [Instance.WindowSetTransient]). WindowFlagPopup WindowFlags = 5 // Window content is expanded to the full size of the window. Unlike borderless window, the frame is left intact and can be used to resize the window, title bar is transparent, but have minimize/maximize/close buttons. // // Use [Instance.WindowSetWindowButtonsOffset] to adjust minimize/maximize/close buttons offset. // // Use [Instance.WindowGetSafeTitleMargins] to determine area under the title bar that is not covered by decorations. // // Note: This flag is implemented only on macOS. WindowFlagExtendToTitle WindowFlags = 6 // All mouse events are passed to the underlying window of the same application. WindowFlagMousePassthrough WindowFlags = 7 // Window style is overridden, forcing sharp corners. // // Note: This flag is implemented only on Windows (11). WindowFlagSharpCorners WindowFlags = 8 // Windows is excluded from screenshots taken by [Instance.ScreenGetImage], [Instance.ScreenGetImageRect], and [Instance.ScreenGetPixel]. // // Note: This flag is implemented on macOS and Windows. // // Note: Setting this flag will NOT prevent other apps from capturing an image, it should not be used as a security measure. WindowFlagExcludeFromCapture WindowFlags = 9 // Max value of the [WindowFlags]. WindowFlagMax WindowFlags = 10 )
type WindowMode ¶
type WindowMode int //gd:DisplayServer.WindowMode
const ( // Windowed mode, i.e. [graphics.gd/classdb/Window] doesn't occupy the whole screen (unless set to the size of the screen). WindowModeWindowed WindowMode = 0 // Minimized window mode, i.e. [graphics.gd/classdb/Window] is not visible and available on window manager's window list. Normally happens when the minimize button is pressed. WindowModeMinimized WindowMode = 1 // Maximized window mode, i.e. [graphics.gd/classdb/Window] will occupy whole screen area except task bar and still display its borders. Normally happens when the maximize button is pressed. WindowModeMaximized WindowMode = 2 // Full screen mode with full multi-window support. // // Full screen window covers the entire display area of a screen and has no decorations. The display's video mode is not changed. // // On Android: This enables immersive mode. // // On Windows: Multi-window full-screen mode has a 1px border of the [graphics.gd/classdb/ProjectSettings] "rendering/environment/defaults/default_clear_color" color. // // On macOS: A new desktop is used to display the running project. // // Note: Regardless of the platform, enabling full screen will change the window size to match the monitor's size. Therefore, make sure your project supports [multiple resolutions] when enabling full screen mode. // // [multiple resolutions]: https://docs.godotengine.org/tutorials/rendering/multiple_resolutions.html WindowModeFullscreen WindowMode = 3 // A single window full screen mode. This mode has less overhead, but only one window can be open on a given screen at a time (opening a child window or application switching will trigger a full screen transition). // // Full screen window covers the entire display area of a screen and has no border or decorations. The display's video mode is not changed. // // On Android: This enables immersive mode. // // On Windows: Depending on video driver, full screen transition might cause screens to go black for a moment. // // On macOS: A new desktop is used to display the running project. Exclusive full screen mode prevents Dock and Menu from showing up when the mouse pointer is hovering the edge of the screen. // // On Linux (X11): Exclusive full screen mode bypasses compositor. // // On Linux (Wayland): Equivalent to [WindowModeFullscreen]. // // Note: Regardless of the platform, enabling full screen will change the window size to match the monitor's size. Therefore, make sure your project supports [multiple resolutions] when enabling full screen mode. // // [multiple resolutions]: https://docs.godotengine.org/tutorials/rendering/multiple_resolutions.html WindowModeExclusiveFullscreen WindowMode = 4 )
func WindowGetMode ¶
func WindowGetMode(window_id Window) WindowMode
Returns the mode of the given window.
func WindowGetModeOptions ¶
func WindowGetModeOptions(window_id Window) WindowMode
Returns the mode of the given window.
type WindowResizeEdge ¶
type WindowResizeEdge int //gd:DisplayServer.WindowResizeEdge
const ( // Top-left edge of a window. WindowEdgeTopLeft WindowResizeEdge = 0 // Top edge of a window. WindowEdgeTop WindowResizeEdge = 1 // Top-right edge of a window. WindowEdgeTopRight WindowResizeEdge = 2 // Left edge of a window. WindowEdgeLeft WindowResizeEdge = 3 // Right edge of a window. WindowEdgeRight WindowResizeEdge = 4 // Bottom-left edge of a window. WindowEdgeBottomLeft WindowResizeEdge = 5 // Bottom edge of a window. WindowEdgeBottom WindowResizeEdge = 6 // Bottom-right edge of a window. WindowEdgeBottomRight WindowResizeEdge = 7 // Represents the size of the [WindowResizeEdge] enum. WindowEdgeMax WindowResizeEdge = 8 )