Enumerationmigueldeicaza.swiftgodot 0.46.0SwiftGodot
AnchorMode
Camera2D.swift:26enum AnchorMode
Cases
case fixedTopLeft
The camera’s position is fixed so that the top-left corner is always at the origin.
case dragCenter
The camera’s position takes into account vertical/horizontal offsets and the screen size.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (36) members.
Types
Type members
Instance members
var anchorMode: Camera2D.AnchorMode
The Camera2D’s anchor point. See
AnchorMode
constants.var customViewport: Node?
The custom
Viewport
node attached to theCamera2D
. Ifnull
or not aViewport
, uses the default viewport instead.var dragBottomMargin: Double
Bottom margin needed to drag the camera. A value of
1
makes the camera move only when reaching the bottom edge of the screen.var dragHorizontalEnabled: Bool
If
true
, the camera only moves when reaching the horizontal (left and right) drag margins. Iffalse
, the camera moves horizontally regardless of margins.var dragHorizontalOffset: Double
The relative horizontal drag offset of the camera between the right (
-1
) and left (1
) drag margins.var dragLeftMargin: Double
Left margin needed to drag the camera. A value of
1
makes the camera move only when reaching the left edge of the screen.var dragRightMargin: Double
Right margin needed to drag the camera. A value of
1
makes the camera move only when reaching the right edge of the screen.var dragTopMargin: Double
Top margin needed to drag the camera. A value of
1
makes the camera move only when reaching the top edge of the screen.var dragVerticalEnabled: Bool
If
true
, the camera only moves when reaching the vertical (top and bottom) drag margins. Iffalse
, the camera moves vertically regardless of the drag margins.var dragVerticalOffset: Double
The relative vertical drag offset of the camera between the bottom (
-1
) and top (1
) drag margins.var editorDrawDragMargin: Bool
If
true
, draws the camera’s drag margin rectangle in the editor.var editorDrawLimits: Bool
If
true
, draws the camera’s limits rectangle in the editor.var editorDrawScreen: Bool
If
true
, draws the camera’s screen rectangle in the editor.var enabled: Bool
Controls whether the camera can be active or not. If
true
, theCamera2D
will become the main camera when it enters the scene tree and there is no active camera currently (seegetCamera2d
).var ignoreRotation: Bool
If
true
, the camera’s rendered view is not affected by itsrotation
andglobalRotation
.var limitBottom: Int32
Bottom scroll limit in pixels. The camera stops moving when reaching this value, but
offset
can push the view past the limit.var limitLeft: Int32
Left scroll limit in pixels. The camera stops moving when reaching this value, but
offset
can push the view past the limit.var limitRight: Int32
Right scroll limit in pixels. The camera stops moving when reaching this value, but
offset
can push the view past the limit.var limitSmoothed: Bool
If
true
, the camera smoothly stops when reaches its limits.var limitTop: Int32
Top scroll limit in pixels. The camera stops moving when reaching this value, but
offset
can push the view past the limit.var offset: Vector2
The camera’s relative offset. Useful for looking around or camera shake animations. The offsetted camera can go past the limits defined in
limitTop
,limitBottom
,limitLeft
andlimitRight
.var positionSmoothingEnabled: Bool
If
true
, the camera’s view smoothly moves towards its target position atpositionSmoothingSpeed
.var positionSmoothingSpeed: Double
Speed in pixels per second of the camera’s smoothing effect when
positionSmoothingEnabled
istrue
.var processCallback: Camera2D.Camera2DProcessCallback
The camera’s process callback. See
Camera2DProcessCallback
.var rotationSmoothingEnabled: Bool
If
true
, the camera’s view smoothly rotates, via asymptotic smoothing, to align with its target rotation atrotationSmoothingSpeed
.var rotationSmoothingSpeed: Double
The angular, asymptotic speed of the camera’s rotation smoothing effect when
rotationSmoothingEnabled
istrue
.var zoom: Vector2
The camera’s zoom. A zoom of
Vector(2, 2)
doubles the size seen in the viewport. A zoom ofVector(0.5, 0.5)
halves the size seen in the viewport.func align(
) Aligns the camera to the tracked node.
func forceUpdateScroll(
) Forces the camera to update scroll immediately.
func getScreenCenterPosition(
) -> Vector2 Returns the center of the screen from this camera’s point of view, in global coordinates.
func getTargetPosition(
) -> Vector2 Returns this camera’s target position, in global coordinates.
func isCurrent(
) -> Bool Returns
true
if thisCamera2D
is the active camera (seegetCamera2d
).func makeCurrent(
) Forces this
Camera2D
to become the current active one.enabled
must betrue
.func resetSmoothing(
) Sets the camera’s position immediately to its current smoothing destination.
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.