SKTiledSceneCameraDelegate
@objc
public protocol SKTiledSceneCameraDelegate
Overview
Methods for interacting with the custom SKTiledSceneCamera
. Classes conforming to this
protocol are notified of camera position & zoom changes - unless the SKTiledSceneCameraDelegate.receiveCameraUpdates
flag is disabled.
Properties
Method | Description |
---|---|
receiveCameraUpdates | Delegate will receive camera updates. |
Instance Methods
Method | Description |
---|---|
containedNodesChanged | Called when the nodes in the camera view changes. |
cameraPositionChanged | Called when the camera positon changes. |
cameraZoomChanged | Called when the camera zoom changes. |
cameraBoundsChanged | Called when the camera bounds updated. |
sceneDoubleClicked | Called when the scene is double-clicked. (macOS only) |
mousePositionChanged | Called when the mouse moves in the scene. (macOS only) |
sceneDoubleTapped | Called when the scene is double-tapped. (iOS only) |
-
Allow delegate to receive updates from camera.
Declaration
Swift
@objc var receiveCameraUpdates: Bool { get set }
-
Allow delegates to receive updates when nodes in view change.
Declaration
Swift
@objc optional func containedNodesChanged(_ nodes: Set<SKNode>)
Parameters
nodes
[SKNode]
nodes in camera view. -
Called when the camera positon changes.
Declaration
Swift
@objc optional func cameraPositionChanged(newPosition: CGPoint)
Parameters
newPositon
CGPoint
updated camera position. -
Called when the camera zoom changes.
Declaration
Swift
@objc optional func cameraZoomChanged(newZoom: CGFloat)
Parameters
newZoom
CGFloat
camera zoom amount. -
Called when the camera bounds updated.
Declaration
Swift
@objc optional func cameraBoundsChanged(bounds: CGRect, position: CGPoint, zoom: CGFloat)
Parameters
bounds
CGRect
camera view bounds.positon
CGPoint
camera position.zoom
CGFloat
camera zoom amount. -
Called when the scene is double-clicked (macOS only).
Declaration
Swift
@objc optional func sceneDoubleClicked(event: NSEvent)
Parameters
event
NSEvent
mouse click event. -
Called when the mouse moves in the scene (macOS only).
Declaration
Swift
@objc optional func mousePositionChanged(event: NSEvent)
Parameters
event
NSEvent
mouse click event. -
Called when the scene receives a double-tap event (iOS only).