Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
VirtualKeyboardType
DisplayServer.swift:156enum VirtualKeyboardType
Cases
case `default`
Default text virtual keyboard.
case multiline
Multiline virtual keyboard.
case number
Virtual number keypad, useful for PIN entry.
case numberDecimal
Virtual number keypad, useful for entering fractional numbers.
case phone
Virtual phone number keypad.
case emailAddress
Virtual keyboard with additional keys to assist with typing email addresses.
case password
Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization.
case url
Virtual keyboard with additional keys to assist with typing URLs.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (187) members.
Types
enum CursorShape
enum Feature
enum FileDialogMode
enum HandleType
enum MouseMode
enum ScreenOrientation
enum TTSUtteranceEvent
enum VSyncMode
enum WindowEvent
enum WindowFlags
enum WindowMode
Type members
static let invalidWindowId: Int
The ID that refers to a nonexisting window. This is be returned by some
DisplayServer
methods if no window matches the requested result.static let mainWindowId: Int
The ID of the main window spawned by the engine, which can be passed to methods expecting a
window_id
.static let screenOfMainWindow: Int
Represents the screen where the main window is located. This is usually the default value in functions that allow specifying one of several screens.
static let screenPrimary: Int
Represents the primary screen.
static let screenWithKeyboardFocus: Int
Represents the screen containing the window with the keyboard focus.
static let screenWithMouseFocus: Int
Represents the screen containing the mouse pointer.
static func clipboardGet(
) -> String Returns the user’s clipboard as a string if possible.
static func clipboardGetImage(
) -> Image? Returns the user’s clipboard as an image if possible.
static 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 [kbd]Ctrl + C[/kbd]. The clipboard data can then be pasted by clicking the middle mouse button in any application that supports the primary clipboard mechanism.
static func clipboardHas(
) -> Bool Returns
true
if there is a text content on the user’s clipboard.static func clipboardHasImage(
) -> Bool Returns
true
if there is an image content on the user’s clipboard.static func clipboardSet(clipboard: String
) Sets the user’s clipboard content to the given string.
static func clipboardSetPrimary(clipboardPrimary: 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 [kbd]Ctrl + C[/kbd]. The clipboard data can then be pasted by clicking the middle mouse button in any application that supports the primary clipboard mechanism.
static func cursorGetShape(
) -> DisplayServer.CursorShape Returns the default mouse cursor shape set by
cursorSetShape(_:)
.static func cursorSetCustomImage(cursor: Resource?, shape: DisplayServer.CursorShape, hotspot: Vector2
) Sets a custom mouse cursor image for the defined
shape
. This means the user’s operating system and mouse cursor theme will no longer influence the mouse cursor’s appearance. The image must be256x256
or smaller for correct appearance.hotspot
can optionally be set to define the area where the cursor will click. By default,hotspot
is set toVector2(0, 0)
, which is the top-left corner of the image. See alsocursorSetShape(_:)
.static func cursorSetShape(DisplayServer.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
andcursorSetCustomImage(cursor:shape:hotspot:)
.static func dialogInputText(title: String, description: String, existingText: String, callback: Callable
) -> GodotError Shows a text input dialog which uses the operating system’s native look-and-feel.
callback
will be called with aString
argument equal to the text field’s contents when the dialog is closed for any reason.static func enableForStealingFocus(processId: Int
) Allows the
processId
PID to steal focus from this window. In other words, this disables the operating system’s focus stealing protection for the specified PID.static func fileDialogShow(title: String, currentDirectory: String, filename: String, showHidden: Bool, mode: DisplayServer.FileDialogMode, filters: PackedStringArray, callback: Callable
) -> GodotError Displays OS native dialog for selecting files or directories in the file system.
static func forceProcessAndDropEvents(
) Forces window manager processing while ignoring all
InputEvent
s. See alsoprocessEvents
.static func getAccentColor(
) -> Color Returns OS theme accent color. Returns
Color(0, 0, 0, 0)
, if accent color is unknown.static func getDisplayCutouts(
) -> VariantCollection<Rect2> Returns an
GArray
ofRect2
, 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 alsogetDisplaySafeArea
.static func getDisplaySafeArea(
) -> Rect2i Returns the unobscured area of the display where interactive controls should be rendered. See also
getDisplayCutouts
.static func getKeyboardFocusScreen(
) -> Int32 Returns the index of the screen containing the window with the keyboard focus, or the primary screen if there’s no focused window.
static func getName(
) -> String Returns the name of the
DisplayServer
currently in use. Most operating systems only have a singleDisplayServer
, but Linux has access to more than oneDisplayServer
(although only X11 is currently implemented in Godot).static func getPrimaryScreen(
) -> Int32 Returns index of the primary screen.
static func getScreenCount(
) -> Int32 Returns the number of displays available.
static func getScreenFromRect(Rect2
) -> Int32 Returns index of the screen which contains specified rectangle.
static 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 changingProjectSettings/gui/common/swapCancelOk
.static func getWindowAtScreenPosition(Vector2i
) -> Int32 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:static func getWindowList(
) -> PackedInt32Array Returns the list of Godot window IDs belonging to this process.
static func hasFeature(DisplayServer.Feature
) -> Bool Returns
true
if the specifiedfeature
is supported by the currentDisplayServer
,false
otherwise.static func imeGetSelection(
) -> Vector2i Returns the text selection in the Input Method Editor composition string, with the
Vector2i
’sx
component being the caret position andy
being the length of the selection.static func imeGetText(
) -> String Returns the composition string contained within the Input Method Editor window.
static func isDarkMode(
) -> Bool Returns
true
if OS is using dark mode.static func isDarkModeSupported(
) -> Bool Returns
true
if OS supports dark mode.static func isTouchscreenAvailable(
) -> Bool Returns
true
if touch events are available (Android or iOS), the capability is detected on the Web platform or ifProjectSettings/inputDevices/pointing/emulateTouchFromMouse
istrue
.static func keyboardGetCurrentLayout(
) -> Int32 Returns active keyboard layout index.
static func keyboardGetKeycodeFromPhysical(keycode: Key
) -> Key Converts a physical (US QWERTY)
keycode
to one in the active keyboard layout.static func keyboardGetLabelFromPhysical(keycode: Key
) -> Key Converts a physical (US QWERTY)
keycode
to localized label printed on the key in the active keyboard layout.static func keyboardGetLayoutCount(
) -> Int32 Returns the number of keyboard layouts.
static func keyboardGetLayoutLanguage(index: Int32
) -> String Returns the ISO-639/BCP-47 language code of the keyboard layout at position
index
.static func keyboardGetLayoutName(index: Int32
) -> String Returns the localized name of the keyboard layout at position
index
.static func keyboardSetCurrentLayout(index: Int32
) Sets the active keyboard layout.
static func mouseGetButtonState(
) -> 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
getMouseButtonMask
.static func mouseGetMode(
) -> DisplayServer.MouseMode Returns the current mouse mode. See also
mouseSetMode(mouseMode:)
.static func mouseGetPosition(
) -> Vector2i Returns the mouse cursor’s current position in screen coordinates.
static func mouseSetMode(mouseMode: DisplayServer.MouseMode
) Sets the current mouse mode. See also
mouseGetMode
.static func processEvents(
) Perform window manager processing, including input flushing. See also
forceProcessAndDropEvents
,flushBufferedEvents
anduseAccumulatedInput
.static func screenGetDpi(screen: Int32
) -> Int32 Returns the dots per inch density of the specified screen. If
screen
isscreenOfMainWindow
(the default value), a screen with the main window will be used.static func screenGetImage(screen: Int32
) -> Image? Returns screenshot of the
screen
.static func screenGetMaxScale(
) -> Double Returns the greatest scale factor of all screens.
static func screenGetOrientation(screen: Int32
) -> DisplayServer.ScreenOrientation Returns the
screen
’s current orientation. See alsoscreenSetOrientation(_:screen:)
.static func screenGetPixel(position: Vector2i
) -> Color Returns color of the display pixel at the
position
.static func screenGetPosition(screen: Int32
) -> Vector2i 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:
static func screenGetRefreshRate(screen: Int32
) -> Double Returns the current refresh rate of the specified screen. If
screen
isscreenOfMainWindow
(the default value), a screen with the main window will be used.static func screenGetScale(screen: Int32
) -> Double Returns the scale factor of the specified screen by index.
static func screenGetSize(screen: Int32
) -> Vector2i Returns the screen’s size in pixels. See also
screenGetPosition(screen:)
andscreenGetUsableRect(screen:)
.static func screenGetUsableRect(screen: Int32
) -> Rect2i Returns the portion of the screen that is not obstructed by a status bar in pixels. See also
screenGetSize(screen:)
.static func screenIsKeptOn(
) -> Bool Returns
true
if the screen should never be turned off by the operating system’s power-saving measures. See alsoscreenSetKeepOn(enable:)
.static func screenSetKeepOn(enable: Bool
) Sets whether the screen should never be turned off by the operating system’s power-saving measures. See also
screenIsKeptOn
.static func screenSetOrientation(DisplayServer.ScreenOrientation, screen: Int32
) Sets the
screen
’sorientation
. See alsoscreenGetOrientation(screen:)
.static func setIcon(image: Image?
) Sets the window icon (usually displayed in the top-left corner) with an
Image
. To use icons in the operating system’s native format, usesetNativeIcon(filename:)
instead.static 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(filename:)
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, usesetIcon(image:)
instead.static func tabletGetCurrentDriver(
) -> String Returns current active tablet driver name.
static func tabletGetDriverCount(
) -> Int32 Returns the total number of available tablet drivers.
static func tabletGetDriverName(idx: Int32
) -> String Returns the tablet driver name for the given index.
static func tabletSetCurrentDriver(name: String
) Set active tablet driver name.
static func ttsGetVoices(
) -> VariantCollection<GDictionary> Returns an
GArray
of voice information dictionaries.static func ttsGetVoicesForLanguage(String
) -> PackedStringArray Returns an
PackedStringArray
of voice identifiers for thelanguage
.static func ttsIsPaused(
) -> Bool Returns
true
if the synthesizer is in a paused state.static func ttsIsSpeaking(
) -> Bool Returns
true
if the synthesizer is generating speech, or have utterance waiting in the queue.static func ttsPause(
) Puts the synthesizer into a paused state.
static func ttsResume(
) Resumes the synthesizer if it was paused.
static func ttsSetUtteranceCallback(event: DisplayServer.TTSUtteranceEvent, callable: Callable
) Adds a callback, which is called when the utterance has started, finished, canceled or reached a text boundary.
static func ttsSpeak(text: String, voice: String, volume: Int32, pitch: Double, rate: Double, utteranceId: Int32, interrupt: Bool
) Adds an utterance to the queue. If
interrupt
istrue
, the queue is cleared first.static func ttsStop(
) Stops synthesis in progress and removes all utterances from the queue.
static func virtualKeyboardGetHeight(
) -> Int32 Returns the on-screen keyboard’s height in pixels. Returns 0 if there is no keyboard or if it is currently hidden.
static func virtualKeyboardHide(
) Hides the virtual keyboard if it is shown, does nothing otherwise.
static func virtualKeyboardShow(existingText: String, position: Rect2, type: DisplayServer.VirtualKeyboardType, maxLength: Int32, cursorStart: Int32, cursorEnd: Int32
) Shows the virtual keyboard if the platform has one.
static func warpMouse(position: Vector2i
) 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.static func windowCanDraw(windowId: Int32
) -> Bool Returns
true
if anything can be drawn in the window specified bywindowId
,false
otherwise. Using the--disable-render-loop
command line argument or a headless build will returnfalse
.static func windowGetActivePopup(
) -> Int32 Returns ID of the active popup window, or
invalidWindowId
if there is none.static func windowGetAttachedInstanceId(windowId: Int32
) -> UInt Returns the
getInstanceId
of theWindow
thewindowId
is attached to.static func windowGetCurrentScreen(windowId: Int32
) -> Int32 Returns the screen the window specified by
windowId
is currently positioned on. If the screen overlaps multiple displays, the screen where the window’s center is located is returned. See alsowindowSetCurrentScreen(_:windowId:)
.static func windowGetFlag(DisplayServer.WindowFlags, windowId: Int32
) -> Bool Returns the current value of the given window’s
flag
.static func windowGetMaxSize(windowId: Int32
) -> Vector2i Returns the window’s maximum size (in pixels). See also
windowSetMaxSize(_:windowId:)
.static func windowGetMinSize(windowId: Int32
) -> Vector2i Returns the window’s minimum size (in pixels). See also
windowSetMinSize(_:windowId:)
.static func windowGetMode(windowId: Int32
) -> DisplayServer.WindowMode Returns the mode of the given window.
static func windowGetNativeHandle(handleType: DisplayServer.HandleType, windowId: Int32
) -> Int Returns internal structure pointers for use in plugins.
static func windowGetPopupSafeRect(window: Int32
) -> Rect2i Returns the bounding box of control, or menu item that was used to open the popup window, in the screen coordinate system.
static func windowGetPosition(windowId: Int32
) -> Vector2i Returns the position of the client area of the given window on the screen.
static func windowGetPositionWithDecorations(windowId: Int32
) -> Vector2i Returns the position of the given window on the screen including the borders drawn by the operating system. See also
windowGetPosition(windowId:)
.static func windowGetSafeTitleMargins(windowId: Int32
) -> Vector3i 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.static func windowGetSize(windowId: Int32
) -> Vector2i Returns the size of the window specified by
windowId
(in pixels), excluding the borders drawn by the operating system. This is also called the “client area”. See alsowindowGetSizeWithDecorations(windowId:)
,windowSetSize(_:windowId:)
andwindowGetPosition(windowId:)
.static func windowGetSizeWithDecorations(windowId: Int32
) -> Vector2i Returns the size of the window specified by
windowId
(in pixels), including the borders drawn by the operating system. See alsowindowGetSize(windowId:)
.static func windowGetTitleSize(title: String, windowId: Int32
) -> Vector2i Returns the estimated window title bar size (including text and window buttons) for the window specified by
windowId
(in pixels). This method does not change the window title.static func windowGetVsyncMode(windowId: Int32
) -> DisplayServer.VSyncMode Returns the V-Sync mode of the given window.
static func windowIsFocused(windowId: Int32
) -> Bool Returns
true
if the window specified bywindowId
is focused.static func windowIsMaximizeAllowed(windowId: Int32
) -> Bool Returns
true
if the given window can be maximized (the maximize button is enabled).static func windowMaximizeOnTitleDblClick(
) -> Bool Returns
true
, if double-click on a window title should maximize it.static func windowMinimizeOnTitleDblClick(
) -> Bool Returns
true
, if double-click on a window title should minimize it.static func windowMoveToForeground(windowId: Int32
) Moves the window specified by
windowId
to the foreground, so that it is visible over other windows.static func windowRequestAttention(windowId: Int32
) Makes the window specified by
windowId
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.static func windowSetCurrentScreen(Int32, windowId: Int32
) Moves the window specified by
windowId
to the specifiedscreen
. See alsowindowGetCurrentScreen(windowId:)
.static func windowSetDropFilesCallback(Callable, windowId: Int32
) Sets the
callback
that should be called when files are dropped from the operating system’s file manager to the window specified bywindowId
.static func windowSetExclusive(windowId: Int32, exclusive: Bool
) 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.static func windowSetFlag(DisplayServer.WindowFlags, enabled: Bool, windowId: Int32
) Enables or disables the given window’s given
flag
. SeeWindowFlags
for possible values and their behavior.static func windowSetImeActive(Bool, windowId: Int32
) Sets whether Input Method Editor should be enabled for the window specified by
windowId
. See alsowindowSetImePosition(_:windowId:)
.static func windowSetImePosition(Vector2i, windowId: Int32
) Sets the position of the Input Method Editor popup for the specified
windowId
. Only effective ifwindowSetImeActive(_:windowId:)
was set totrue
for the specifiedwindowId
.static func windowSetInputEventCallback(Callable, windowId: Int32
) Sets the
callback
that should be called when anyInputEvent
is sent to the window specified bywindowId
.static func windowSetInputTextCallback(Callable, windowId: Int32
) Sets the
callback
that should be called when text is entered using the virtual keyboard to the window specified bywindowId
.static func windowSetMaxSize(Vector2i, windowId: Int32
) Sets the maximum size of the window specified by
windowId
in pixels. Normally, the user will not be able to drag the window to make it smaller than the specified size. See alsowindowGetMaxSize(windowId:)
.static func windowSetMinSize(Vector2i, windowId: Int32
) Sets the minimum size for the given window to
minSize
(in pixels). Normally, the user will not be able to drag the window to make it larger than the specified size. See alsowindowGetMinSize(windowId:)
.static func windowSetMode(DisplayServer.WindowMode, windowId: Int32
) Sets window mode for the given window to
mode
. SeeWindowMode
for possible values and how each mode behaves.static func windowSetMousePassthrough(region: PackedVector2Array, windowId: Int32
) Sets a polygonal region of the window which accepts mouse events. Mouse events outside the region will be passed through.
static func windowSetPopupSafeRect(window: Int32, rect: Rect2i
) 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.
static func windowSetPosition(Vector2i, windowId: Int32
) 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:static func windowSetRectChangedCallback(Callable, windowId: Int32
) Sets the
callback
that will be called when the window specified bywindowId
is moved or resized.static func windowSetSize(Vector2i, windowId: Int32
) Sets the size of the given window to
size
(in pixels). See alsowindowGetSize(windowId:)
andwindowGetPosition(windowId:)
.static func windowSetTitle(String, windowId: Int32
) Sets the title of the given window to
title
.static func windowSetTransient(windowId: Int32, parentWindowId: Int32
) Sets window transient parent. Transient window is 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.
static func windowSetVsyncMode(DisplayServer.VSyncMode, windowId: Int32
) Sets the V-Sync mode of the given window. See also
ProjectSettings/display/window/vsync/vsyncMode
.static func windowSetWindowButtonsOffset(Vector2i, windowId: Int32
) When .windowFlagExtendToTitle flag is set, set offset to the center of the first titlebar button.
static func windowSetWindowEventCallback(Callable, windowId: Int32
) Sets the
callback
that will be called when an event occurs in the window specified bywindowId
.class var godotClassName: StringName
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.