Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
CursorShape
Input.swift:57enum CursorShape
Cases
case arrow
Arrow cursor. Standard, default pointing cursor.
case ibeam
I-beam cursor. Usually used to show where the text cursor will appear when the mouse is clicked.
case pointingHand
Pointing hand cursor. Usually used to indicate the pointer is over a link or other interactable item.
case cross
Cross cursor. Typically appears over regions in which a drawing operation can be performed or for selections.
case wait
Wait cursor. Indicates that the application is busy performing an operation. This cursor shape denotes that the application isn’t usable during the operation (e.g. something is blocking its main thread).
case busy
Busy cursor. Indicates that the application is busy performing an operation. This cursor shape denotes that the application is still usable during the operation.
case drag
Drag cursor. Usually displayed when dragging something.
case canDrop
Can drop cursor. Usually displayed when dragging something to indicate that it can be dropped at the current position.
case forbidden
Forbidden cursor. Indicates that the current action is forbidden (for example, when dragging something) or that the control at a position is disabled.
case vsize
Vertical resize mouse cursor. A double-headed vertical arrow. It tells the user they can resize the window or the panel vertically.
case hsize
Horizontal resize mouse cursor. A double-headed horizontal arrow. It tells the user they can resize the window or the panel horizontally.
case bdiagsize
Window resize mouse cursor. The cursor is a double-headed arrow that goes from the bottom left to the top right. It tells the user they can resize the window or the panel both horizontally and vertically.
case fdiagsize
Window resize mouse cursor. The cursor is a double-headed arrow that goes from the top left to the bottom right, the opposite of .cursorBdiagsize. It tells the user they can resize the window or the panel both horizontally and vertically.
case move
Move cursor. Indicates that something can be moved.
case vsplit
Vertical split mouse cursor. On Windows, it’s the same as .cursorVsize.
case hsplit
Horizontal split mouse cursor. On Windows, it’s the same as .cursorHsize.
case help
Help cursor. Usually a question mark.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (52) members.
Types
enum MouseMode
class Signal1
Signal support.
Type members
static var mouseMode: Input.MouseMode
Controls the mouse mode. See
MouseMode
for more information.static var useAccumulatedInput: Bool
If
true
, similar input events sent by the operating system are accumulated. When input accumulation is enabled, all input events generated during a frame will be merged and emitted when the frame is done rendering. Therefore, this limits the number of input method calls per second to the rendering FPS.static func actionPress(action: StringName, strength: Double
) This will simulate pressing the specified action.
static func actionRelease(action: StringName
) If the specified action is already pressed, this will release it.
static func addJoyMapping(String, updateExisting: Bool
) Adds a new mapping entry (in SDL2 format) to the mapping database. Optionally update already connected devices.
static func flushBufferedEvents(
) Sends all input events which are in the current buffer to the game loop. These events may have been buffered as a result of accumulated input (
useAccumulatedInput
) or agile input flushing (ProjectSettings/inputDevices/buffering/agileEventFlushing
).static func getAccelerometer(
) -> Vector3 Returns the acceleration in m/s² of the device’s accelerometer sensor, if the device has one. Otherwise, the method returns
Vector3.ZERO
.static func getActionRawStrength(action: StringName, exactMatch: Bool
) -> Double Returns a value between 0 and 1 representing the raw intensity of the given action, ignoring the action’s deadzone. In most cases, you should use
getActionStrength(action:exactMatch:)
instead.static func getActionStrength(action: StringName, exactMatch: Bool
) -> Double Returns a value between 0 and 1 representing the intensity of the given action. In a joypad, for example, the further away the axis (analog sticks or L2, R2 triggers) is from the dead zone, the closer the value will be to 1. If the action is mapped to a control that has no axis such as the keyboard, the value returned will be 0 or 1.
static func getAxis(negativeAction: StringName, positiveAction: StringName
) -> Double Get axis input by specifying two actions, one negative and one positive.
static func getConnectedJoypads(
) -> VariantCollection<Int64> Returns an
GArray
containing the device IDs of all currently connected joypads.static func getCurrentCursorShape(
) -> Input.CursorShape Returns the currently assigned cursor shape (see
CursorShape
).static func getGravity(
) -> Vector3 Returns the gravity in m/s² of the device’s accelerometer sensor, if the device has one. Otherwise, the method returns
Vector3.ZERO
.static func getGyroscope(
) -> Vector3 Returns the rotation rate in rad/s around a device’s X, Y, and Z axes of the gyroscope sensor, if the device has one. Otherwise, the method returns
Vector3.ZERO
.static func getJoyAxis(device: Int32, axis: JoyAxis
) -> Double Returns the current value of the joypad axis at given index (see
JoyAxis
).static func getJoyGuid(device: Int32
) -> String Returns a SDL2-compatible device GUID on platforms that use gamepad remapping, e.g.
030000004c050000c405000000010000
. Returns"Default Gamepad"
otherwise. Godot uses the SDL2 game controller database to determine gamepad names and mappings based on this GUID.static func getJoyInfo(device: Int32
) -> GDictionary Returns a dictionary with extra platform-specific information about the device, e.g. the raw gamepad name from the OS or the Steam Input index.
static func getJoyName(device: Int32
) -> String Returns the name of the joypad at the specified device index, e.g.
PS4 Controller
. Godot uses the SDL2 game controller database to determine gamepad names.static func getJoyVibrationDuration(device: Int32
) -> Double Returns the duration of the current vibration effect in seconds.
static func getJoyVibrationStrength(device: Int32
) -> Vector2 Returns the strength of the joypad vibration: x is the strength of the weak motor, and y is the strength of the strong motor.
static func getLastMouseVelocity(
) -> Vector2 Returns the last mouse velocity. To provide a precise and jitter-free velocity, mouse velocity is only calculated every 0.1s. Therefore, mouse velocity will lag mouse movements.
static func getMagnetometer(
) -> Vector3 Returns the magnetic field strength in micro-Tesla for all axes of the device’s magnetometer sensor, if the device has one. Otherwise, the method returns
Vector3.ZERO
.static func getMouseButtonMask(
) -> MouseButtonMask Returns mouse buttons as a bitmask. If multiple mouse buttons are pressed at the same time, the bits are added together. Equivalent to
mouseGetButtonState
.static func getVector(negativeX: StringName, positiveX: StringName, negativeY: StringName, positiveY: StringName, deadzone: Double
) -> Vector2 Gets an input vector by specifying four actions for the positive and negative X and Y axes.
static func isActionJustPressed(action: StringName, exactMatch: Bool
) -> Bool Returns
true
when the user has started pressing the action event in the current frame or physics tick. It will only returntrue
on the frame or tick that the user pressed down the button.static func isActionJustReleased(action: StringName, exactMatch: Bool
) -> Bool Returns
true
when the user stops pressing the action event in the current frame or physics tick. It will only returntrue
on the frame or tick that the user releases the button.static func isActionPressed(action: StringName, exactMatch: Bool
) -> Bool Returns
true
if you are pressing the action event.static func isAnythingPressed(
) -> Bool Returns
true
if any action, key, joypad button, or mouse button is being pressed. This will also returntrue
if any action is simulated via code by callingactionPress(action:strength:)
.static func isJoyKnown(device: Int32
) -> Bool Returns
true
if the system knows the specified device. This means that it sets all button and axis indices. Unknown joypads are not expected to match these constants, but you can still retrieve events from them.static func isKeyLabelPressed(keycode: Key
) -> Bool Returns
true
if you are pressing the key with thekeycode
printed on it. You can pass aKey
constant or any Unicode character code.static func isKeyPressed(keycode: Key
) -> Bool Returns
true
if you are pressing the Latin key in the current keyboard layout. You can pass aKey
constant.static func isPhysicalKeyPressed(keycode: Key
) -> Bool Returns
true
if you are pressing the key in the physical location on the 101/102-key US QWERTY keyboard. You can pass aKey
constant.static func parseInputEvent(InputEvent?
) Feeds an
InputEvent
to the game. Can be used to artificially trigger input events from code. Also generates_input(event:)
calls.static func removeJoyMapping(guid: String
) Removes all mappings from the internal database that match the given GUID.
static func setAccelerometer(value: Vector3
) Sets the acceleration value of the accelerometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.
static func setCustomMouseCursor(image: Resource?, shape: Input.CursorShape, hotspot: Vector2
) Sets a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. Passing
null
to the image parameter resets to the system cursor. SeeCursorShape
for the list of shapes.static func setDefaultCursorShape(Input.CursorShape
) Sets the default cursor shape to be used in the viewport instead of .cursorArrow.
static func setGravity(value: Vector3
) Sets the gravity value of the accelerometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.
static func setGyroscope(value: Vector3
) Sets the value of the rotation rate of the gyroscope sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.
static func setMagnetometer(value: Vector3
) Sets the value of the magnetic field of the magnetometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC.
static func shouldIgnoreDevice(vendorId: Int32, productId: Int32
) -> Bool Queries whether an input device should be ignored or not. Devices can be ignored by setting the environment variable
SDL_GAMECONTROLLER_IGNORE_DEVICES
. Read the SDL documentation for more information.static func startJoyVibration(device: Int32, weakMagnitude: Double, strongMagnitude: Double, duration: Double
) Starts to vibrate the joypad. Joypads usually come with two rumble motors, a strong and a weak one.
weakMagnitude
is the strength of the weak motor (between 0 and 1) andstrongMagnitude
is the strength of the strong motor (between 0 and 1).duration
is the duration of the effect in seconds (a duration of 0 will try to play the vibration indefinitely). The vibration can be stopped early by callingstopJoyVibration(device:)
.static func stopJoyVibration(device: Int32
) Stops the vibration of the joypad started with
startJoyVibration(device:weakMagnitude:strongMagnitude:duration:)
.static func vibrateHandheld(durationMs: Int32
) Vibrate the handheld device for the specified duration in milliseconds.
static func warpMouse(position: Vector2
) Sets the mouse position to the specified vector, provided in pixels and relative to an origin at the upper left corner of the currently focused Window Manager game window.
class var godotClassName: StringName
Instance members
var joyConnectionChanged: Signal1
Emitted when a joypad device has been connected or disconnected.
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.