TiledSceneCameraDelegate
@objc
public protocol TiledSceneCameraDelegate
The TiledSceneCameraDelegate
protocol defines methods for interacting with the custom SKTiledSceneCamera
object. Classes conforming to this
protocol are notified of camera position & zoom changes unless the TiledSceneCameraDelegate.receiveCameraUpdates
flag is disabled.
This delegate also receives mouse & touch events and forwards them on to delegates accordingly.
Properties
receiveCameraUpdates
: delegate will receive camera updates.currentCoordinate
: currently focused map coordinate.
Instance Methods
containedNodesChanged
: nodes visible in camera haved changed.cameraPositionChanged
: camera position change.cameraZoomChanged
: camera zoom change.cameraBoundsChanged
: camera bounds updated.leftMouseDown
: scene is clicked (macOS only).rightMouseDown
: scene is right-clicked (macOS only).leftMouseUp
: left mouse button is released (macOS only).rightMouseUp
: right mouse button is released (macOS only).leftMouseDoubleClicked
: scene is double-clicked (macOS only).mousePositionChanged
: mouse moves in the scene (macOS only).sceneDoubleTapped
: scene is double-tapped (iOS only).sceneRotated
: scene is rotated via gesture (iOS only).
-
Allows the delegate to receive camera updates.
Declaration
Swift
@objc var receiveCameraUpdates: Bool { get set }
-
Current focus coordinate.
Declaration
Swift
@objc optional var currentCoordinate: simd_int2 { get set }
-
Allow delegates to receive updates when nodes in view change.
Declaration
Swift
@objc optional func containedNodesChanged(_ nodes: Set<SKNode>)
Parameters
nodes
nodes visible in the current camera viewport.
-
Called when the camera position changes.
Declaration
Swift
@objc optional func cameraPositionChanged(newPosition: CGPoint)
Parameters
newPosition
updated camera position.
-
Called when the camera zoom changes.
Declaration
Swift
@objc optional func cameraZoomChanged(newZoom: CGFloat)
Parameters
newZoom
camera zoom amount.
-
Called when the camera bounds are updated.
Declaration
Swift
@objc optional func cameraBoundsChanged(bounds: CGRect, position: CGPoint, zoom: CGFloat)
Parameters
bounds
camera view bounds.
position
camera position.
zoom
camera zoom amount.
-
Update delegates when camera attributes have changed.
Declaration
Swift
@objc optional func cameraAttributesChanged(_ camera: SKTiledSceneCamera, attributes: [String : Any])
Parameters
camera
camera node.
attributes
camera attributes.
-
Called when the scene is clicked (macOS only).
Declaration
Swift
@objc optional func leftMouseDown(event: NSEvent)
Parameters
event
mouse click event.
-
Called when the left mouse button is released (macOS only).
Declaration
Swift
@objc optional func leftMouseUp(event: NSEvent)
Parameters
event
mouse click event.
-
Called when the scene is right-clicked (macOS only).
Declaration
Swift
@objc optional func rightMouseDown(event: NSEvent)
Parameters
event
mouse click event.
-
Called when the right mouse button is released (macOS only).
Declaration
Swift
@objc optional func rightMouseUp(event: NSEvent)
Parameters
event
mouse click event.
-
Called when the scene is double-clicked (macOS only).
Declaration
Swift
@objc optional func leftMouseDoubleClicked(event: NSEvent)
Parameters
event
mouse click event.
-
Called when the right mouse button is released (macOS only).
Declaration
Swift
@objc optional func sceneRightClickReleased(event: NSEvent)
Parameters
event
mouse click event.
-
Called when the mouse moves in the scene (macOS only).
Declaration
Swift
@objc optional func mousePositionChanged(event: NSEvent)
Parameters
event
mouse move event.
-
Called when the scene receives a double-tap event (iOS only).
-
Called when the current scene has been rotated.