SubViewport
An interface to a game world that doesn’t create a window or draw to the screen directly.
SubViewport.swift:14class SubViewport
SubViewport
Isolates a rectangular region of a scene to be displayed independently. This can be used, for example, to display UI in 3D space.
Superclasses
class Viewport
Abstract base class for viewports. Encapsulates drawing and interaction with a game world.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
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 Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var renderTargetClearMode: SubViewport.ClearMode
The clear mode when the sub-viewport is used as a render target.
var renderTargetUpdateMode: SubViewport.UpdateMode
The update mode when the sub-viewport is used as a render target.
var size: Vector2i
The width and height of the sub-viewport. Must be set to a value greater than or equal to 2 pixels on both dimensions. Otherwise, nothing will be displayed.
var size2dOverride: Vector2i
The 2D size override of the sub-viewport. If either the width or height is
0
, the override is disabled.var size2dOverrideStretch: Bool
If
true
, the 2D size override affects stretch as well.