Documentation
¶
Overview ¶
Package spritekit provides Go bindings for the SpriteKit framework.
Add high-performance 2D content with smooth animations to your app, or create a game with a high-level set of 2D game-based tools.
SpriteKit is a general-purpose framework for drawing shapes, particles, text, images, and video in two dimensions. It leverages Metal to achieve high-performance rendering, while offering a simple programming interface to make it easy to create games and other graphics-intensive apps. Using a rich set of animations and physics behaviors, you can quickly add life to your visual elements and gracefully transition between screens.
Essentials ¶
- Drawing SpriteKit Content in a View: Display visual content using SpriteKit.
- SKScene: An object that organizes all of the active SpriteKit content. (SKSceneScaleMode, SKSceneDelegate)
- Nodes for Scene Building: Define the appearance or layout of scene content. (SKNode, SKCameraNode, SKReferenceNode, SKSpriteNode, SKShapeNode)
Scene Renderers ¶
- Choosing a SpriteKit Scene Renderer: Compare the different ways to display a SpriteKit scene.
- SKView: A view subclass that renders a SpriteKit scene. (SKTransition, SKViewDelegate)
- SKRenderer: An object that renders a scene into a custom Metal rendering pipeline and drives the scene update cycle.
Textures ¶
- Maximizing Texture Performance: Speed up image display and enable more images to be displayed at one time.
- SKTexture: An image, decoded on the GPU, that can be used to render various SpriteKit objects. (SKTextureFilteringMode)
- SKTextureAtlas: A collection of textures optimized for storage and drawing performance.
- SKMutableTexture: A texture whose contents can be dynamically updated.
Animation ¶
- Getting Started with Actions: Create, configure, and run actions in SpriteKit.
- SKAction: An object that is run by a node to change its structure or content. (SKActionTimingMode, SKActionTimingFunction)
Constraints ¶
- SKConstraint: A specification for constraining a node’s position or rotation.
- SKReachConstraints: A specification of the degree of freedom when solving inverse kinematics.
Mathematical Tools ¶
- SKKeyframeSequence: An object that performs interpolation between values specified at different times (keyframes). (SKInterpolationMode, SKRepeatMode)
- SKRange: A definition of a range of floating-point values.
- SKRegion: The definition of an arbitrary area.
Physics Simulation ¶
- Getting Started with Physics: Simulate gravity, acceleration, collision detection, or joints.
- SKPhysicsWorld: The driver of the physics engine in a scene; it exposes the ability for you to configure and query the physics system.
- SKPhysicsBody: An object that adds physics simulation to a node.
- SKPhysicsContact: A description of the contact between two physics bodies.
- SKPhysicsContactDelegate: Methods your app can implement to respond when physics bodies come into contact.
- SKFieldNode: A node that applies physics effects to nearby nodes. (SKFieldForceEvaluator)
Physics Joints ¶
- Working with Inverse Kinematics: Gain fine-tuned control of objects that are connected by joints.
- SKPhysicsJoint: The abstract superclass for objects that connect physics bodies.
- SKPhysicsJointFixed: A joint that fuses two physics bodies together at a reference point.
- SKPhysicsJointLimit: A joint that imposes a maximum distance between two physics bodies, as if they were connected by a rope.
- SKPhysicsJointPin: A joint that pins together two physics bodies, allowing independent rotation.
- SKPhysicsJointSliding: A joint that allows two physics bodies to slide along an axis.
- SKPhysicsJointSpring: A joint that simulates a spring connecting two physics bodies.
Tiling ¶
- SKTileMapNode: A two-dimensional array of images.
- SKTileDefinition: A single tile that can be repeated in a tile map. (SKTileDefinitionRotation)
- SKTileGroup: A set of tiles that collectively define one type of terrain.
- SKTileGroupRule: Rules that describe how various tiles should be placed in a map. (SKTileAdjacencyMask)
- SKTileSet: A container for related tile groups. (SKTileSetType)
Shaders ¶
- SKShader: An object that allows you to apply a custom fragment shader.
- SKAttribute: A specification for dynamic per-node data used with a custom shader. (SKAttributeType)
- SKAttributeValue: A container for dynamic shader data associated with a node.
- SKUniform: A container for uniform shader data. (SKUniformType)
Warping ¶
- SKWarpGeometry: A definition for a deformation of nodes that conform to .
- SKWarpGeometryGrid: A definition for a grid-based deformation of nodes that conform to .
- SKWarpable: A protocol for objects that can be warped and animated by an .//
Key Types ¶
- SKNode - The base class of all SpriteKit nodes.
- SKEmitterNode - A source of various particle effects.
- SKPhysicsBody - An object that adds physics simulation to a node.
- SKShapeNode - A mathematical shape that can be stroked or filled.
- SKSpriteNode - An image or solid color.
- SKScene - An object that organizes all of the active SpriteKit content.
- SKFieldNode - A node that applies physics effects to nearby nodes.
- SKTileMapNode - A two-dimensional array of images.
- SKView - A view subclass that renders a SpriteKit scene.
- SKLabelNode - A graphical element that draws text.
Code generated from Apple documentation. DO NOT EDIT.
Index ¶
- func NewFloat32Float32Block(handler Float32Float32Handler) (objc.ID, func())
- func NewSKActionTimingFunctionBlock(handler SKActionTimingFunction) (objc.ID, func())
- func NewSKNodeBoolBlock(handler SKNodeBoolHandler) (objc.ID, func())
- func NewSKPhysicsBodyBoolBlock(handler SKPhysicsBodyBoolHandler) (objc.ID, func())
- func NewSKPhysicsBodyCGPointCGVectorBoolBlock(handler SKPhysicsBodyCGPointCGVectorBoolHandler) (objc.ID, func())
- func NewSKTextureAtlasArrayErrorBlock(handler SKTextureAtlasArrayErrorHandler) (objc.ID, func())
- func NewUnsafePointerUintptrBlock(handler UnsafePointerUintptrHandler) (objc.ID, func())
- func NewVoidBlock(handler VoidHandler) (objc.ID, func())
- type Float32Float32Handler
- type ISKAction
- type ISKAttribute
- type ISKAttributeValue
- type ISKAudioNode
- type ISKCameraNode
- type ISKConstraint
- type ISKCropNode
- type ISKEffectNode
- type ISKEmitterNode
- type ISKFieldNode
- type ISKKeyframeSequence
- type ISKLabelNode
- type ISKLightNode
- type ISKMutableTexture
- type ISKNode
- type ISKPhysicsBody
- type ISKPhysicsContact
- type ISKPhysicsJoint
- type ISKPhysicsJointFixed
- type ISKPhysicsJointLimit
- type ISKPhysicsJointPin
- type ISKPhysicsJointSliding
- type ISKPhysicsJointSpring
- type ISKPhysicsWorld
- type ISKRange
- type ISKReachConstraints
- type ISKReferenceNode
- type ISKRegion
- type ISKRenderer
- type ISKScene
- type ISKShader
- type ISKShapeNode
- type ISKSpriteNode
- type ISKTexture
- type ISKTextureAtlas
- type ISKTileDefinition
- type ISKTileGroup
- type ISKTileGroupRule
- type ISKTileMapNode
- type ISKTileSet
- type ISKTransformNode
- type ISKTransition
- type ISKUniform
- type ISKVideoNode
- type ISKView
- type ISKWarpGeometry
- type ISKWarpGeometryGrid
- type SKAction
- func (a SKAction) Autorelease() SKAction
- func (a SKAction) Duration() foundation.NSTimeInterval
- func (a SKAction) EncodeWithCoder(coder foundation.INSCoder)
- func (a SKAction) Init() SKAction
- func (a SKAction) SetDuration(value foundation.NSTimeInterval)
- func (a SKAction) SetSpeed(value float64)
- func (a SKAction) SetTimingFunction(value Float32Float32Handler)
- func (a SKAction) SetTimingMode(value SKActionTimingMode)
- func (a SKAction) Speed() float64
- func (a SKAction) TimingFunction() Float32Float32Handler
- func (a SKAction) TimingMode() SKActionTimingMode
- type SKActionClass
- type SKActionTimingFunction
- type SKActionTimingMode
- type SKAttribute
- func (a SKAttribute) Autorelease() SKAttribute
- func (a SKAttribute) EncodeWithCoder(coder foundation.INSCoder)
- func (a SKAttribute) Init() SKAttribute
- func (a SKAttribute) InitWithNameType(name string, type_ SKAttributeType) SKAttribute
- func (a SKAttribute) Name() string
- func (a SKAttribute) Type() SKAttributeType
- type SKAttributeClass
- type SKAttributeType
- type SKAttributeValue
- func NewAttributeValueWithFloat(value float32) SKAttributeValue
- func NewAttributeValueWithVectorFloat2(value [2]float32) SKAttributeValue
- func NewAttributeValueWithVectorFloat3(value Vector_float3) SKAttributeValue
- func NewAttributeValueWithVectorFloat4(value [4]float32) SKAttributeValue
- func NewSKAttributeValue() SKAttributeValue
- func SKAttributeValueFromID(id objc.ID) SKAttributeValue
- func (a SKAttributeValue) Autorelease() SKAttributeValue
- func (a SKAttributeValue) EncodeWithCoder(coder foundation.INSCoder)
- func (a SKAttributeValue) FloatValue() float32
- func (a SKAttributeValue) Init() SKAttributeValue
- func (a SKAttributeValue) SetFloatValue(value float32)
- func (a SKAttributeValue) SetVectorFloat2Value(value [2]float32)
- func (a SKAttributeValue) SetVectorFloat3Value(value Vector_float3)
- func (a SKAttributeValue) SetVectorFloat4Value(value [4]float32)
- func (a SKAttributeValue) VectorFloat2Value() [2]float32
- func (a SKAttributeValue) VectorFloat3Value() Vector_float3
- func (a SKAttributeValue) VectorFloat4Value() [4]float32
- type SKAttributeValueClass
- type SKAudioNode
- func NewAudioNodeWithAVAudioNode(node avfaudio.AVAudioNode) SKAudioNode
- func NewAudioNodeWithCoder(aDecoder foundation.INSCoder) SKAudioNode
- func NewAudioNodeWithFileNamed(name string) SKAudioNode
- func NewAudioNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKAudioNode, error)
- func NewAudioNodeWithURL(url foundation.NSURL) SKAudioNode
- func NewSKAudioNode() SKAudioNode
- func SKAudioNodeFromID(id objc.ID) SKAudioNode
- func (a SKAudioNode) AutoplayLooped() bool
- func (a SKAudioNode) Autorelease() SKAudioNode
- func (a SKAudioNode) AvAudioNode() avfaudio.AVAudioNode
- func (a SKAudioNode) Init() SKAudioNode
- func (a SKAudioNode) InitWithAVAudioNode(node avfaudio.AVAudioNode) SKAudioNode
- func (a SKAudioNode) InitWithFileNamed(name string) SKAudioNode
- func (a SKAudioNode) InitWithURL(url foundation.NSURL) SKAudioNode
- func (a SKAudioNode) IsPositional() bool
- func (a SKAudioNode) SetAutoplayLooped(value bool)
- func (a SKAudioNode) SetAvAudioNode(value avfaudio.AVAudioNode)
- func (a SKAudioNode) SetPositional(value bool)
- type SKAudioNodeClass
- type SKBlendMode
- type SKCameraNode
- func NewCameraNodeWithCoder(aDecoder foundation.INSCoder) SKCameraNode
- func NewCameraNodeWithFileNamed(filename string) SKCameraNode
- func NewCameraNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKCameraNode, error)
- func NewSKCameraNode() SKCameraNode
- func SKCameraNodeFromID(id objc.ID) SKCameraNode
- type SKCameraNodeClass
- type SKConstraint
- func (c SKConstraint) Autorelease() SKConstraint
- func (c SKConstraint) Enabled() bool
- func (c SKConstraint) EncodeWithCoder(coder foundation.INSCoder)
- func (c SKConstraint) Init() SKConstraint
- func (c SKConstraint) ReferenceNode() ISKNode
- func (c SKConstraint) SetEnabled(value bool)
- func (c SKConstraint) SetReferenceNode(value ISKNode)
- type SKConstraintClass
- func (sc SKConstraintClass) Alloc() SKConstraint
- func (sc SKConstraintClass) Class() objc.Class
- func (_SKConstraintClass SKConstraintClass) DistanceToNode(range_ ISKRange, node ISKNode) SKConstraint
- func (_SKConstraintClass SKConstraintClass) DistanceToPoint(range_ ISKRange, point corefoundation.CGPoint) SKConstraint
- func (_SKConstraintClass SKConstraintClass) DistanceToPointInNode(range_ ISKRange, point corefoundation.CGPoint, node ISKNode) SKConstraint
- func (_SKConstraintClass SKConstraintClass) OrientToNodeOffset(node ISKNode, radians ISKRange) SKConstraint
- func (_SKConstraintClass SKConstraintClass) OrientToPointInNodeOffset(point corefoundation.CGPoint, node ISKNode, radians ISKRange) SKConstraint
- func (_SKConstraintClass SKConstraintClass) OrientToPointOffset(point corefoundation.CGPoint, radians ISKRange) SKConstraint
- func (_SKConstraintClass SKConstraintClass) PositionX(range_ ISKRange) SKConstraint
- func (_SKConstraintClass SKConstraintClass) PositionXY(xRange ISKRange, yRange ISKRange) SKConstraint
- func (_SKConstraintClass SKConstraintClass) PositionY(range_ ISKRange) SKConstraint
- func (_SKConstraintClass SKConstraintClass) ZRotation(zRange ISKRange) SKConstraint
- type SKCropNode
- func NewCropNodeWithCoder(aDecoder foundation.INSCoder) SKCropNode
- func NewCropNodeWithFileNamed(filename string) SKCropNode
- func NewCropNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKCropNode, error)
- func NewSKCropNode() SKCropNode
- func SKCropNodeFromID(id objc.ID) SKCropNode
- type SKCropNodeClass
- type SKEffectNode
- func NewEffectNodeWithCoder(aDecoder foundation.INSCoder) SKEffectNode
- func NewEffectNodeWithFileNamed(filename string) SKEffectNode
- func NewEffectNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKEffectNode, error)
- func NewSKEffectNode() SKEffectNode
- func SKEffectNodeFromID(id objc.ID) SKEffectNode
- func (e SKEffectNode) AttributeValues() foundation.INSDictionary
- func (e SKEffectNode) Autorelease() SKEffectNode
- func (e SKEffectNode) BlendMode() SKBlendMode
- func (e SKEffectNode) Filter() coreimage.CIFilter
- func (e SKEffectNode) Init() SKEffectNode
- func (e SKEffectNode) SetAttributeValues(value foundation.INSDictionary)
- func (e SKEffectNode) SetBlendMode(value SKBlendMode)
- func (e SKEffectNode) SetFilter(value coreimage.CIFilter)
- func (e SKEffectNode) SetShader(value ISKShader)
- func (e SKEffectNode) SetShouldCenterFilter(value bool)
- func (e SKEffectNode) SetShouldEnableEffects(value bool)
- func (e SKEffectNode) SetShouldRasterize(value bool)
- func (o SKEffectNode) SetSubdivisionLevels(value int)
- func (e SKEffectNode) SetValueForAttributeNamed(value ISKAttributeValue, key string)
- func (o SKEffectNode) SetWarpGeometry(value ISKWarpGeometry)
- func (e SKEffectNode) Shader() ISKShader
- func (e SKEffectNode) ShouldCenterFilter() bool
- func (e SKEffectNode) ShouldEnableEffects() bool
- func (e SKEffectNode) ShouldRasterize() bool
- func (e SKEffectNode) SubdivisionLevels() int
- func (e SKEffectNode) ValueForAttributeNamed(key string) ISKAttributeValue
- func (e SKEffectNode) WarpGeometry() ISKWarpGeometry
- type SKEffectNodeClass
- type SKEmitterNode
- func NewEmitterNodeWithCoder(aDecoder foundation.INSCoder) SKEmitterNode
- func NewEmitterNodeWithFileNamed(filename string) SKEmitterNode
- func NewEmitterNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKEmitterNode, error)
- func NewSKEmitterNode() SKEmitterNode
- func SKEmitterNodeFromID(id objc.ID) SKEmitterNode
- func (e SKEmitterNode) AdvanceSimulationTime(sec foundation.NSTimeInterval)
- func (e SKEmitterNode) AttributeValues() foundation.INSDictionary
- func (e SKEmitterNode) Autorelease() SKEmitterNode
- func (e SKEmitterNode) EmissionAngle() float64
- func (e SKEmitterNode) EmissionAngleRange() float64
- func (e SKEmitterNode) FieldBitMask() uint32
- func (e SKEmitterNode) Init() SKEmitterNode
- func (e SKEmitterNode) NumParticlesToEmit() uint
- func (e SKEmitterNode) ParticleAction() ISKAction
- func (e SKEmitterNode) ParticleAlpha() float64
- func (e SKEmitterNode) ParticleAlphaRange() float64
- func (e SKEmitterNode) ParticleAlphaSequence() ISKKeyframeSequence
- func (e SKEmitterNode) ParticleAlphaSpeed() float64
- func (e SKEmitterNode) ParticleBirthRate() float64
- func (e SKEmitterNode) ParticleBlendMode() SKBlendMode
- func (e SKEmitterNode) ParticleColor() appkit.NSColor
- func (e SKEmitterNode) ParticleColorAlphaRange() float64
- func (e SKEmitterNode) ParticleColorAlphaSpeed() float64
- func (e SKEmitterNode) ParticleColorBlendFactor() float64
- func (e SKEmitterNode) ParticleColorBlendFactorRange() float64
- func (e SKEmitterNode) ParticleColorBlendFactorSequence() ISKKeyframeSequence
- func (e SKEmitterNode) ParticleColorBlendFactorSpeed() float64
- func (e SKEmitterNode) ParticleColorBlueRange() float64
- func (e SKEmitterNode) ParticleColorBlueSpeed() float64
- func (e SKEmitterNode) ParticleColorGreenRange() float64
- func (e SKEmitterNode) ParticleColorGreenSpeed() float64
- func (e SKEmitterNode) ParticleColorRedRange() float64
- func (e SKEmitterNode) ParticleColorRedSpeed() float64
- func (e SKEmitterNode) ParticleColorSequence() ISKKeyframeSequence
- func (e SKEmitterNode) ParticleLifetime() float64
- func (e SKEmitterNode) ParticleLifetimeRange() float64
- func (e SKEmitterNode) ParticlePosition() corefoundation.CGPoint
- func (e SKEmitterNode) ParticlePositionRange() corefoundation.CGVector
- func (e SKEmitterNode) ParticleRenderOrder() SKParticleRenderOrder
- func (e SKEmitterNode) ParticleRotation() float64
- func (e SKEmitterNode) ParticleRotationRange() float64
- func (e SKEmitterNode) ParticleRotationSpeed() float64
- func (e SKEmitterNode) ParticleScale() float64
- func (e SKEmitterNode) ParticleScaleRange() float64
- func (e SKEmitterNode) ParticleScaleSequence() ISKKeyframeSequence
- func (e SKEmitterNode) ParticleScaleSpeed() float64
- func (e SKEmitterNode) ParticleSize() corefoundation.CGSize
- func (e SKEmitterNode) ParticleSpeed() float64
- func (e SKEmitterNode) ParticleSpeedRange() float64
- func (e SKEmitterNode) ParticleTexture() ISKTexture
- func (e SKEmitterNode) ParticleZPosition() float64
- func (e SKEmitterNode) ResetSimulation()
- func (e SKEmitterNode) SetAttributeValues(value foundation.INSDictionary)
- func (e SKEmitterNode) SetEmissionAngle(value float64)
- func (e SKEmitterNode) SetEmissionAngleRange(value float64)
- func (e SKEmitterNode) SetFieldBitMask(value uint32)
- func (e SKEmitterNode) SetNumParticlesToEmit(value uint)
- func (e SKEmitterNode) SetParticleAction(value ISKAction)
- func (e SKEmitterNode) SetParticleAlpha(value float64)
- func (e SKEmitterNode) SetParticleAlphaRange(value float64)
- func (e SKEmitterNode) SetParticleAlphaSequence(value ISKKeyframeSequence)
- func (e SKEmitterNode) SetParticleAlphaSpeed(value float64)
- func (e SKEmitterNode) SetParticleBirthRate(value float64)
- func (e SKEmitterNode) SetParticleBlendMode(value SKBlendMode)
- func (e SKEmitterNode) SetParticleColor(value appkit.NSColor)
- func (e SKEmitterNode) SetParticleColorAlphaRange(value float64)
- func (e SKEmitterNode) SetParticleColorAlphaSpeed(value float64)
- func (e SKEmitterNode) SetParticleColorBlendFactor(value float64)
- func (e SKEmitterNode) SetParticleColorBlendFactorRange(value float64)
- func (e SKEmitterNode) SetParticleColorBlendFactorSequence(value ISKKeyframeSequence)
- func (e SKEmitterNode) SetParticleColorBlendFactorSpeed(value float64)
- func (e SKEmitterNode) SetParticleColorBlueRange(value float64)
- func (e SKEmitterNode) SetParticleColorBlueSpeed(value float64)
- func (e SKEmitterNode) SetParticleColorGreenRange(value float64)
- func (e SKEmitterNode) SetParticleColorGreenSpeed(value float64)
- func (e SKEmitterNode) SetParticleColorRedRange(value float64)
- func (e SKEmitterNode) SetParticleColorRedSpeed(value float64)
- func (e SKEmitterNode) SetParticleColorSequence(value ISKKeyframeSequence)
- func (e SKEmitterNode) SetParticleLifetime(value float64)
- func (e SKEmitterNode) SetParticleLifetimeRange(value float64)
- func (e SKEmitterNode) SetParticlePosition(value corefoundation.CGPoint)
- func (e SKEmitterNode) SetParticlePositionRange(value corefoundation.CGVector)
- func (e SKEmitterNode) SetParticleRenderOrder(value SKParticleRenderOrder)
- func (e SKEmitterNode) SetParticleRotation(value float64)
- func (e SKEmitterNode) SetParticleRotationRange(value float64)
- func (e SKEmitterNode) SetParticleRotationSpeed(value float64)
- func (e SKEmitterNode) SetParticleScale(value float64)
- func (e SKEmitterNode) SetParticleScaleRange(value float64)
- func (e SKEmitterNode) SetParticleScaleSequence(value ISKKeyframeSequence)
- func (e SKEmitterNode) SetParticleScaleSpeed(value float64)
- func (e SKEmitterNode) SetParticleSize(value corefoundation.CGSize)
- func (e SKEmitterNode) SetParticleSpeed(value float64)
- func (e SKEmitterNode) SetParticleSpeedRange(value float64)
- func (e SKEmitterNode) SetParticleTexture(value ISKTexture)
- func (e SKEmitterNode) SetParticleZPosition(value float64)
- func (e SKEmitterNode) SetShader(value ISKShader)
- func (e SKEmitterNode) SetTargetNode(value ISKNode)
- func (e SKEmitterNode) SetValueForAttributeNamed(value ISKAttributeValue, key string)
- func (e SKEmitterNode) SetXAcceleration(value float64)
- func (e SKEmitterNode) SetYAcceleration(value float64)
- func (e SKEmitterNode) Shader() ISKShader
- func (e SKEmitterNode) TargetNode() ISKNode
- func (e SKEmitterNode) ValueForAttributeNamed(key string) ISKAttributeValue
- func (e SKEmitterNode) XAcceleration() float64
- func (e SKEmitterNode) YAcceleration() float64
- type SKEmitterNodeClass
- type SKFieldForceEvaluator
- type SKFieldNode
- func NewFieldNodeWithCoder(aDecoder foundation.INSCoder) SKFieldNode
- func NewFieldNodeWithFileNamed(filename string) SKFieldNode
- func NewFieldNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKFieldNode, error)
- func NewSKFieldNode() SKFieldNode
- func SKFieldNodeFromID(id objc.ID) SKFieldNode
- func (f SKFieldNode) AnimationSpeed() float32
- func (f SKFieldNode) Autorelease() SKFieldNode
- func (f SKFieldNode) CategoryBitMask() uint32
- func (f SKFieldNode) Direction() Vector_float3
- func (f SKFieldNode) Falloff() float32
- func (f SKFieldNode) Init() SKFieldNode
- func (f SKFieldNode) IsEnabled() bool
- func (f SKFieldNode) IsExclusive() bool
- func (f SKFieldNode) MinimumRadius() float32
- func (f SKFieldNode) Region() ISKRegion
- func (f SKFieldNode) SetAnimationSpeed(value float32)
- func (f SKFieldNode) SetCategoryBitMask(value uint32)
- func (f SKFieldNode) SetDirection(value Vector_float3)
- func (f SKFieldNode) SetEnabled(value bool)
- func (f SKFieldNode) SetExclusive(value bool)
- func (f SKFieldNode) SetFalloff(value float32)
- func (f SKFieldNode) SetMinimumRadius(value float32)
- func (f SKFieldNode) SetRegion(value ISKRegion)
- func (f SKFieldNode) SetSmoothness(value float32)
- func (f SKFieldNode) SetStrength(value float32)
- func (f SKFieldNode) SetTexture(value ISKTexture)
- func (f SKFieldNode) Smoothness() float32
- func (f SKFieldNode) Strength() float32
- func (f SKFieldNode) Texture() ISKTexture
- type SKFieldNodeClass
- func (sc SKFieldNodeClass) Alloc() SKFieldNode
- func (sc SKFieldNodeClass) Class() objc.Class
- func (_SKFieldNodeClass SKFieldNodeClass) CustomFieldWithEvaluationBlock(block Float32Float32Handler) SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) DragField() SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) ElectricField() SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) LinearGravityFieldWithVector(direction Vector_float3) SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) MagneticField() SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) NoiseFieldWithSmoothnessAnimationSpeed(smoothness float64, speed float64) SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) RadialGravityField() SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) SpringField() SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) TurbulenceFieldWithSmoothnessAnimationSpeed(smoothness float64, speed float64) SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) VelocityFieldWithTexture(velocityTexture ISKTexture) SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) VelocityFieldWithVector(direction Vector_float3) SKFieldNode
- func (_SKFieldNodeClass SKFieldNodeClass) VortexField() SKFieldNode
- type SKInterpolationMode
- type SKKeyframeSequence
- func NewKeyframeSequenceWithCapacity(numItems uint) SKKeyframeSequence
- func NewKeyframeSequenceWithCoder(aDecoder foundation.INSCoder) SKKeyframeSequence
- func NewKeyframeSequenceWithKeyframeValuesTimes(values foundation.INSArray, times []foundation.NSNumber) SKKeyframeSequence
- func NewSKKeyframeSequence() SKKeyframeSequence
- func SKKeyframeSequenceFromID(id objc.ID) SKKeyframeSequence
- func (k SKKeyframeSequence) AddKeyframeValueTime(value objectivec.IObject, time float64)
- func (k SKKeyframeSequence) Autorelease() SKKeyframeSequence
- func (k SKKeyframeSequence) Count() uint
- func (k SKKeyframeSequence) EncodeWithCoder(coder foundation.INSCoder)
- func (k SKKeyframeSequence) GetKeyframeTimeForIndex(index uint) float64
- func (k SKKeyframeSequence) GetKeyframeValueForIndex(index uint) objectivec.IObject
- func (k SKKeyframeSequence) Init() SKKeyframeSequence
- func (k SKKeyframeSequence) InitWithCapacity(numItems uint) SKKeyframeSequence
- func (k SKKeyframeSequence) InitWithCoder(aDecoder foundation.INSCoder) SKKeyframeSequence
- func (k SKKeyframeSequence) InitWithKeyframeValuesTimes(values foundation.INSArray, times []foundation.NSNumber) SKKeyframeSequence
- func (k SKKeyframeSequence) InterpolationMode() SKInterpolationMode
- func (k SKKeyframeSequence) RemoveKeyframeAtIndex(index uint)
- func (k SKKeyframeSequence) RemoveLastKeyframe()
- func (k SKKeyframeSequence) RepeatMode() SKRepeatMode
- func (k SKKeyframeSequence) SampleAtTime(time float64) objectivec.IObject
- func (k SKKeyframeSequence) SetInterpolationMode(value SKInterpolationMode)
- func (k SKKeyframeSequence) SetKeyframeTimeForIndex(time float64, index uint)
- func (k SKKeyframeSequence) SetKeyframeValueForIndex(value objectivec.IObject, index uint)
- func (k SKKeyframeSequence) SetKeyframeValueTimeForIndex(value objectivec.IObject, time float64, index uint)
- func (k SKKeyframeSequence) SetRepeatMode(value SKRepeatMode)
- type SKKeyframeSequenceClass
- type SKLabelHorizontalAlignmentMode
- type SKLabelNode
- func NewLabelNodeWithAttributedText(attributedText foundation.NSAttributedString) SKLabelNode
- func NewLabelNodeWithCoder(aDecoder foundation.INSCoder) SKLabelNode
- func NewLabelNodeWithFileNamed(filename string) SKLabelNode
- func NewLabelNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKLabelNode, error)
- func NewLabelNodeWithFontNamed(fontName string) SKLabelNode
- func NewLabelNodeWithText(text string) SKLabelNode
- func NewSKLabelNode() SKLabelNode
- func SKLabelNodeFromID(id objc.ID) SKLabelNode
- func (l SKLabelNode) AttributedText() foundation.NSAttributedString
- func (l SKLabelNode) Autorelease() SKLabelNode
- func (l SKLabelNode) BlendMode() SKBlendMode
- func (l SKLabelNode) Color() appkit.NSColor
- func (l SKLabelNode) ColorBlendFactor() float64
- func (l SKLabelNode) FontColor() appkit.NSColor
- func (l SKLabelNode) FontName() string
- func (l SKLabelNode) FontSize() float64
- func (l SKLabelNode) HorizontalAlignmentMode() SKLabelHorizontalAlignmentMode
- func (l SKLabelNode) Init() SKLabelNode
- func (l SKLabelNode) InitWithFontNamed(fontName string) SKLabelNode
- func (l SKLabelNode) LineBreakMode() appkit.NSLineBreakMode
- func (l SKLabelNode) NumberOfLines() int
- func (l SKLabelNode) PreferredMaxLayoutWidth() float64
- func (l SKLabelNode) SetAttributedText(value foundation.NSAttributedString)
- func (l SKLabelNode) SetBlendMode(value SKBlendMode)
- func (l SKLabelNode) SetColor(value appkit.NSColor)
- func (l SKLabelNode) SetColorBlendFactor(value float64)
- func (l SKLabelNode) SetFontColor(value appkit.NSColor)
- func (l SKLabelNode) SetFontName(value string)
- func (l SKLabelNode) SetFontSize(value float64)
- func (l SKLabelNode) SetHorizontalAlignmentMode(value SKLabelHorizontalAlignmentMode)
- func (l SKLabelNode) SetLineBreakMode(value appkit.NSLineBreakMode)
- func (l SKLabelNode) SetNumberOfLines(value int)
- func (l SKLabelNode) SetPreferredMaxLayoutWidth(value float64)
- func (l SKLabelNode) SetText(value string)
- func (l SKLabelNode) SetVerticalAlignmentMode(value SKLabelVerticalAlignmentMode)
- func (l SKLabelNode) Text() string
- func (l SKLabelNode) VerticalAlignmentMode() SKLabelVerticalAlignmentMode
- type SKLabelNodeClass
- type SKLabelVerticalAlignmentMode
- type SKLightNode
- func NewLightNodeWithCoder(aDecoder foundation.INSCoder) SKLightNode
- func NewLightNodeWithFileNamed(filename string) SKLightNode
- func NewLightNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKLightNode, error)
- func NewSKLightNode() SKLightNode
- func SKLightNodeFromID(id objc.ID) SKLightNode
- func (l SKLightNode) AmbientColor() appkit.NSColor
- func (l SKLightNode) Autorelease() SKLightNode
- func (l SKLightNode) CategoryBitMask() uint32
- func (l SKLightNode) Falloff() float64
- func (l SKLightNode) Init() SKLightNode
- func (l SKLightNode) IsEnabled() bool
- func (l SKLightNode) LightColor() appkit.NSColor
- func (l SKLightNode) SetAmbientColor(value appkit.NSColor)
- func (l SKLightNode) SetCategoryBitMask(value uint32)
- func (l SKLightNode) SetEnabled(value bool)
- func (l SKLightNode) SetFalloff(value float64)
- func (l SKLightNode) SetLightColor(value appkit.NSColor)
- func (l SKLightNode) SetShadowColor(value appkit.NSColor)
- func (l SKLightNode) ShadowColor() appkit.NSColor
- type SKLightNodeClass
- type SKMutableTexture
- func (m SKMutableTexture) Autorelease() SKMutableTexture
- func (m SKMutableTexture) Init() SKMutableTexture
- func (m SKMutableTexture) InitWithSize(size corefoundation.CGSize) SKMutableTexture
- func (m SKMutableTexture) InitWithSizePixelFormat(size corefoundation.CGSize, format int32) SKMutableTexture
- func (m SKMutableTexture) ModifyPixelDataWithBlock(block UnsafePointerUintptrHandler)
- type SKMutableTextureClass
- type SKNode
- func (n SKNode) AccessibilityChildren() foundation.INSArray
- func (n SKNode) AccessibilityFrame() corefoundation.CGRect
- func (n SKNode) AccessibilityHelp() string
- func (n SKNode) AccessibilityHitTest(point corefoundation.CGPoint) objectivec.IObject
- func (n SKNode) AccessibilityLabel() string
- func (n SKNode) AccessibilityParent() objectivec.IObject
- func (n SKNode) AccessibilityRole() string
- func (n SKNode) AccessibilityRoleDescription() string
- func (n SKNode) AccessibilitySubrole() string
- func (n SKNode) ActionForKey(key string) ISKAction
- func (n SKNode) AddChild(node ISKNode)
- func (n SKNode) Alpha() float64
- func (n SKNode) Autorelease() SKNode
- func (n SKNode) CalculateAccumulatedFrame() corefoundation.CGRect
- func (n SKNode) ChildNodeWithName(name string) ISKNode
- func (n SKNode) Children() []SKNode
- func (n SKNode) Constraints() []SKConstraint
- func (n SKNode) ContainsPoint(p corefoundation.CGPoint) bool
- func (n SKNode) ConvertPointFromNode(point corefoundation.CGPoint, node ISKNode) corefoundation.CGPoint
- func (n SKNode) ConvertPointToNode(point corefoundation.CGPoint, node ISKNode) corefoundation.CGPoint
- func (n SKNode) EncodeWithCoder(coder foundation.INSCoder)
- func (n SKNode) Entity() objectivec.IObject
- func (n SKNode) EnumerateChildNodesWithNameUsingBlock(name string, block SKNodeBoolHandler)
- func (n SKNode) Frame() corefoundation.CGRect
- func (n SKNode) HasActions() bool
- func (n SKNode) InParentHierarchy(parent ISKNode) bool
- func (n SKNode) Init() SKNode
- func (n SKNode) InitWithCoder(aDecoder foundation.INSCoder) SKNode
- func (n SKNode) InsertChildAtIndex(node ISKNode, index int)
- func (n SKNode) IntersectsNode(node ISKNode) bool
- func (n SKNode) IsAccessibilityElement() bool
- func (n SKNode) IsAccessibilityEnabled() bool
- func (n SKNode) IsEqualToNode(node ISKNode) bool
- func (n SKNode) IsHidden() bool
- func (n SKNode) IsPaused() bool
- func (n SKNode) IsUserInteractionEnabled() bool
- func (n SKNode) MoveToParent(parent ISKNode)
- func (n SKNode) Name() string
- func (n SKNode) NodeAtPoint(p corefoundation.CGPoint) ISKNode
- func (n SKNode) NodesAtPoint(p corefoundation.CGPoint) []SKNode
- func (n SKNode) ObjectForKeyedSubscript(name string) []SKNode
- func (n SKNode) Parent() ISKNode
- func (n SKNode) PhysicsBody() ISKPhysicsBody
- func (n SKNode) Position() corefoundation.CGPoint
- func (n SKNode) ReachConstraints() ISKReachConstraints
- func (n SKNode) RemoveActionForKey(key string)
- func (n SKNode) RemoveAllActions()
- func (n SKNode) RemoveAllChildren()
- func (n SKNode) RemoveChildrenInArray(nodes []SKNode)
- func (n SKNode) RemoveFromParent()
- func (n SKNode) RunAction(action ISKAction)
- func (n SKNode) RunActionCompletion(action ISKAction, block VoidHandler)
- func (n SKNode) RunActionCompletionSync(ctx context.Context, action ISKAction) error
- func (n SKNode) RunActionWithKey(action ISKAction, key string)
- func (n SKNode) Scene() ISKScene
- func (n SKNode) SetAccessibilityChildren(value foundation.INSArray)
- func (n SKNode) SetAccessibilityElement(value bool)
- func (n SKNode) SetAccessibilityEnabled(value bool)
- func (n SKNode) SetAccessibilityFrame(value corefoundation.CGRect)
- func (n SKNode) SetAccessibilityHelp(value string)
- func (n SKNode) SetAccessibilityLabel(value string)
- func (n SKNode) SetAccessibilityParent(value objectivec.IObject)
- func (n SKNode) SetAccessibilityRole(value string)
- func (n SKNode) SetAccessibilityRoleDescription(value string)
- func (n SKNode) SetAccessibilitySubrole(value string)
- func (n SKNode) SetAlpha(value float64)
- func (n SKNode) SetConstraints(value []SKConstraint)
- func (n SKNode) SetEntity(value objectivec.IObject)
- func (n SKNode) SetHidden(value bool)
- func (n SKNode) SetName(value string)
- func (n SKNode) SetPaused(value bool)
- func (n SKNode) SetPhysicsBody(value ISKPhysicsBody)
- func (n SKNode) SetPosition(value corefoundation.CGPoint)
- func (n SKNode) SetReachConstraints(value ISKReachConstraints)
- func (n SKNode) SetScale(scale float64)
- func (n SKNode) SetSpeed(value float64)
- func (n SKNode) SetUserData(value foundation.INSDictionary)
- func (n SKNode) SetUserInteractionEnabled(value bool)
- func (n SKNode) SetXScale(value float64)
- func (n SKNode) SetYScale(value float64)
- func (n SKNode) SetZPosition(value float64)
- func (n SKNode) SetZRotation(value float64)
- func (n SKNode) Speed() float64
- func (n SKNode) UserData() foundation.INSDictionary
- func (n SKNode) XScale() float64
- func (n SKNode) YScale() float64
- func (n SKNode) ZPosition() float64
- func (n SKNode) ZRotation() float64
- type SKNodeBoolHandler
- type SKNodeClass
- func (sc SKNodeClass) Alloc() SKNode
- func (sc SKNodeClass) Class() objc.Class
- func (_SKNodeClass SKNodeClass) ObstaclesFromNodeBounds(nodes []SKNode) []objectivec.IObject
- func (_SKNodeClass SKNodeClass) ObstaclesFromNodePhysicsBodies(nodes []SKNode) []objectivec.IObject
- func (_SKNodeClass SKNodeClass) ObstaclesFromSpriteTexturesAccuracy(sprites []SKNode, accuracy float32) []objectivec.IObject
- type SKNodeFocusBehavior
- type SKParticleRenderOrder
- type SKPhysicsBody
- func NewPhysicsBodyWithBodies(bodies []SKPhysicsBody) SKPhysicsBody
- func NewPhysicsBodyWithCircleOfRadius(r float64) SKPhysicsBody
- func NewPhysicsBodyWithCircleOfRadiusCenter(r float64, center corefoundation.CGPoint) SKPhysicsBody
- func NewPhysicsBodyWithEdgeChainFromPath(path coregraphics.CGPathRef) SKPhysicsBody
- func NewPhysicsBodyWithEdgeFromPointToPoint(p1 corefoundation.CGPoint, p2 corefoundation.CGPoint) SKPhysicsBody
- func NewPhysicsBodyWithEdgeLoopFromPath(path coregraphics.CGPathRef) SKPhysicsBody
- func NewPhysicsBodyWithEdgeLoopFromRect(rect corefoundation.CGRect) SKPhysicsBody
- func NewPhysicsBodyWithPolygonFromPath(path coregraphics.CGPathRef) SKPhysicsBody
- func NewPhysicsBodyWithRectangleOfSize(s corefoundation.CGSize) SKPhysicsBody
- func NewPhysicsBodyWithRectangleOfSizeCenter(s corefoundation.CGSize, center corefoundation.CGPoint) SKPhysicsBody
- func NewPhysicsBodyWithTextureAlphaThresholdSize(texture ISKTexture, alphaThreshold float32, size corefoundation.CGSize) SKPhysicsBody
- func NewPhysicsBodyWithTextureSize(texture ISKTexture, size corefoundation.CGSize) SKPhysicsBody
- func NewSKPhysicsBody() SKPhysicsBody
- func SKPhysicsBodyFromID(id objc.ID) SKPhysicsBody
- func (p SKPhysicsBody) AffectedByGravity() bool
- func (p SKPhysicsBody) AllContactedBodies() []SKPhysicsBody
- func (p SKPhysicsBody) AllowsRotation() bool
- func (p SKPhysicsBody) AngularDamping() float64
- func (p SKPhysicsBody) AngularVelocity() float64
- func (p SKPhysicsBody) ApplyAngularImpulse(impulse float64)
- func (p SKPhysicsBody) ApplyForce(force corefoundation.CGVector)
- func (p SKPhysicsBody) ApplyForceAtPoint(force corefoundation.CGVector, point corefoundation.CGPoint)
- func (p SKPhysicsBody) ApplyImpulse(impulse corefoundation.CGVector)
- func (p SKPhysicsBody) ApplyImpulseAtPoint(impulse corefoundation.CGVector, point corefoundation.CGPoint)
- func (p SKPhysicsBody) ApplyTorque(torque float64)
- func (p SKPhysicsBody) Area() float64
- func (p SKPhysicsBody) Autorelease() SKPhysicsBody
- func (p SKPhysicsBody) CategoryBitMask() uint32
- func (p SKPhysicsBody) Charge() float64
- func (p SKPhysicsBody) CollisionBitMask() uint32
- func (p SKPhysicsBody) ContactTestBitMask() uint32
- func (p SKPhysicsBody) Density() float64
- func (p SKPhysicsBody) EncodeWithCoder(coder foundation.INSCoder)
- func (p SKPhysicsBody) FieldBitMask() uint32
- func (p SKPhysicsBody) Friction() float64
- func (p SKPhysicsBody) Init() SKPhysicsBody
- func (p SKPhysicsBody) IsDynamic() bool
- func (p SKPhysicsBody) IsResting() bool
- func (p SKPhysicsBody) Joints() []SKPhysicsJoint
- func (p SKPhysicsBody) LinearDamping() float64
- func (p SKPhysicsBody) Mass() float64
- func (p SKPhysicsBody) Node() ISKNode
- func (p SKPhysicsBody) Pinned() bool
- func (p SKPhysicsBody) Restitution() float64
- func (p SKPhysicsBody) SetAffectedByGravity(value bool)
- func (p SKPhysicsBody) SetAllowsRotation(value bool)
- func (p SKPhysicsBody) SetAngularDamping(value float64)
- func (p SKPhysicsBody) SetAngularVelocity(value float64)
- func (p SKPhysicsBody) SetCategoryBitMask(value uint32)
- func (p SKPhysicsBody) SetCharge(value float64)
- func (p SKPhysicsBody) SetCollisionBitMask(value uint32)
- func (p SKPhysicsBody) SetContactTestBitMask(value uint32)
- func (p SKPhysicsBody) SetDensity(value float64)
- func (p SKPhysicsBody) SetDynamic(value bool)
- func (p SKPhysicsBody) SetFieldBitMask(value uint32)
- func (p SKPhysicsBody) SetFriction(value float64)
- func (p SKPhysicsBody) SetLinearDamping(value float64)
- func (p SKPhysicsBody) SetMass(value float64)
- func (p SKPhysicsBody) SetPinned(value bool)
- func (p SKPhysicsBody) SetResting(value bool)
- func (p SKPhysicsBody) SetRestitution(value float64)
- func (p SKPhysicsBody) SetUsesPreciseCollisionDetection(value bool)
- func (p SKPhysicsBody) SetVelocity(value corefoundation.CGVector)
- func (p SKPhysicsBody) UsesPreciseCollisionDetection() bool
- func (p SKPhysicsBody) Velocity() corefoundation.CGVector
- type SKPhysicsBodyBoolHandler
- type SKPhysicsBodyCGPointCGVectorBoolHandler
- type SKPhysicsBodyClass
- type SKPhysicsContact
- func (p SKPhysicsContact) Autorelease() SKPhysicsContact
- func (p SKPhysicsContact) BodyA() ISKPhysicsBody
- func (p SKPhysicsContact) BodyB() ISKPhysicsBody
- func (p SKPhysicsContact) CollisionImpulse() float64
- func (p SKPhysicsContact) ContactNormal() corefoundation.CGVector
- func (p SKPhysicsContact) ContactPoint() corefoundation.CGPoint
- func (p SKPhysicsContact) Init() SKPhysicsContact
- type SKPhysicsContactClass
- type SKPhysicsContactDelegate
- type SKPhysicsContactDelegateConfig
- type SKPhysicsContactDelegateObject
- type SKPhysicsJoint
- func (p SKPhysicsJoint) Autorelease() SKPhysicsJoint
- func (p SKPhysicsJoint) BodyA() ISKPhysicsBody
- func (p SKPhysicsJoint) BodyB() ISKPhysicsBody
- func (p SKPhysicsJoint) EncodeWithCoder(coder foundation.INSCoder)
- func (p SKPhysicsJoint) Init() SKPhysicsJoint
- func (p SKPhysicsJoint) ReactionForce() corefoundation.CGVector
- func (p SKPhysicsJoint) ReactionTorque() float64
- func (p SKPhysicsJoint) SetBodyA(value ISKPhysicsBody)
- func (p SKPhysicsJoint) SetBodyB(value ISKPhysicsBody)
- type SKPhysicsJointClass
- type SKPhysicsJointFixed
- type SKPhysicsJointFixedClass
- type SKPhysicsJointLimit
- type SKPhysicsJointLimitClass
- func (sc SKPhysicsJointLimitClass) Alloc() SKPhysicsJointLimit
- func (sc SKPhysicsJointLimitClass) Class() objc.Class
- func (_SKPhysicsJointLimitClass SKPhysicsJointLimitClass) JointWithBodyABodyBAnchorAAnchorB(bodyA ISKPhysicsBody, bodyB ISKPhysicsBody, anchorA corefoundation.CGPoint, ...) SKPhysicsJointLimit
- type SKPhysicsJointPin
- func (p SKPhysicsJointPin) Autorelease() SKPhysicsJointPin
- func (p SKPhysicsJointPin) FrictionTorque() float64
- func (p SKPhysicsJointPin) Init() SKPhysicsJointPin
- func (p SKPhysicsJointPin) LowerAngleLimit() float64
- func (p SKPhysicsJointPin) RotationSpeed() float64
- func (p SKPhysicsJointPin) SetFrictionTorque(value float64)
- func (p SKPhysicsJointPin) SetLowerAngleLimit(value float64)
- func (p SKPhysicsJointPin) SetRotationSpeed(value float64)
- func (p SKPhysicsJointPin) SetShouldEnableLimits(value bool)
- func (p SKPhysicsJointPin) SetUpperAngleLimit(value float64)
- func (p SKPhysicsJointPin) ShouldEnableLimits() bool
- func (p SKPhysicsJointPin) UpperAngleLimit() float64
- type SKPhysicsJointPinClass
- type SKPhysicsJointSliding
- func (p SKPhysicsJointSliding) Autorelease() SKPhysicsJointSliding
- func (p SKPhysicsJointSliding) Init() SKPhysicsJointSliding
- func (p SKPhysicsJointSliding) LowerDistanceLimit() float64
- func (p SKPhysicsJointSliding) SetLowerDistanceLimit(value float64)
- func (p SKPhysicsJointSliding) SetShouldEnableLimits(value bool)
- func (p SKPhysicsJointSliding) SetUpperDistanceLimit(value float64)
- func (p SKPhysicsJointSliding) ShouldEnableLimits() bool
- func (p SKPhysicsJointSliding) UpperDistanceLimit() float64
- type SKPhysicsJointSlidingClass
- func (sc SKPhysicsJointSlidingClass) Alloc() SKPhysicsJointSliding
- func (sc SKPhysicsJointSlidingClass) Class() objc.Class
- func (_SKPhysicsJointSlidingClass SKPhysicsJointSlidingClass) JointWithBodyABodyBAnchorAxis(bodyA ISKPhysicsBody, bodyB ISKPhysicsBody, anchor corefoundation.CGPoint, ...) SKPhysicsJointSliding
- type SKPhysicsJointSpring
- func (p SKPhysicsJointSpring) Autorelease() SKPhysicsJointSpring
- func (p SKPhysicsJointSpring) Damping() float64
- func (p SKPhysicsJointSpring) Frequency() float64
- func (p SKPhysicsJointSpring) Init() SKPhysicsJointSpring
- func (p SKPhysicsJointSpring) SetDamping(value float64)
- func (p SKPhysicsJointSpring) SetFrequency(value float64)
- type SKPhysicsJointSpringClass
- func (sc SKPhysicsJointSpringClass) Alloc() SKPhysicsJointSpring
- func (sc SKPhysicsJointSpringClass) Class() objc.Class
- func (_SKPhysicsJointSpringClass SKPhysicsJointSpringClass) JointWithBodyABodyBAnchorAAnchorB(bodyA ISKPhysicsBody, bodyB ISKPhysicsBody, anchorA corefoundation.CGPoint, ...) SKPhysicsJointSpring
- type SKPhysicsWorld
- func (p SKPhysicsWorld) AddJoint(joint ISKPhysicsJoint)
- func (p SKPhysicsWorld) Autorelease() SKPhysicsWorld
- func (p SKPhysicsWorld) BodyAlongRayStartEnd(start corefoundation.CGPoint, end corefoundation.CGPoint) ISKPhysicsBody
- func (p SKPhysicsWorld) BodyAtPoint(point corefoundation.CGPoint) ISKPhysicsBody
- func (p SKPhysicsWorld) BodyInRect(rect corefoundation.CGRect) ISKPhysicsBody
- func (p SKPhysicsWorld) ContactDelegate() SKPhysicsContactDelegate
- func (p SKPhysicsWorld) EncodeWithCoder(coder foundation.INSCoder)
- func (p SKPhysicsWorld) EnumerateBodiesAlongRayStartEndUsingBlock(start corefoundation.CGPoint, end corefoundation.CGPoint, ...)
- func (p SKPhysicsWorld) EnumerateBodiesAtPointUsingBlock(point corefoundation.CGPoint, block SKPhysicsBodyBoolHandler)
- func (p SKPhysicsWorld) EnumerateBodiesInRectUsingBlock(rect corefoundation.CGRect, block SKPhysicsBodyBoolHandler)
- func (p SKPhysicsWorld) Gravity() corefoundation.CGVector
- func (p SKPhysicsWorld) Init() SKPhysicsWorld
- func (p SKPhysicsWorld) RemoveAllJoints()
- func (p SKPhysicsWorld) RemoveJoint(joint ISKPhysicsJoint)
- func (p SKPhysicsWorld) SampleFieldsAt(position Vector_float3) Vector_float3
- func (p SKPhysicsWorld) SetContactDelegate(value SKPhysicsContactDelegate)
- func (p SKPhysicsWorld) SetGravity(value corefoundation.CGVector)
- func (p SKPhysicsWorld) SetSpeed(value float64)
- func (p SKPhysicsWorld) Speed() float64
- type SKPhysicsWorldClass
- type SKRange
- func NewRangeWithConstantValue(value float64) SKRange
- func NewRangeWithLowerLimit(lower float64) SKRange
- func NewRangeWithLowerLimitUpperLimit(lower float64, upper float64) SKRange
- func NewRangeWithUpperLimit(upper float64) SKRange
- func NewRangeWithValueVariance(value float64, variance float64) SKRange
- func NewSKRange() SKRange
- func SKRangeFromID(id objc.ID) SKRange
- func (r SKRange) Autorelease() SKRange
- func (r SKRange) EncodeWithCoder(coder foundation.INSCoder)
- func (r SKRange) Init() SKRange
- func (r SKRange) InitWithLowerLimitUpperLimit(lower float64, upper float64) SKRange
- func (r SKRange) LowerLimit() float64
- func (r SKRange) SetLowerLimit(value float64)
- func (r SKRange) SetUpperLimit(value float64)
- func (r SKRange) UpperLimit() float64
- type SKRangeClass
- type SKReachConstraints
- func (r SKReachConstraints) Autorelease() SKReachConstraints
- func (r SKReachConstraints) EncodeWithCoder(coder foundation.INSCoder)
- func (r SKReachConstraints) Init() SKReachConstraints
- func (r SKReachConstraints) InitWithLowerAngleLimitUpperAngleLimit(lowerAngleLimit float64, upperAngleLimit float64) SKReachConstraints
- func (r SKReachConstraints) LowerAngleLimit() float64
- func (r SKReachConstraints) SetLowerAngleLimit(value float64)
- func (r SKReachConstraints) SetUpperAngleLimit(value float64)
- func (r SKReachConstraints) UpperAngleLimit() float64
- type SKReachConstraintsClass
- type SKReferenceNode
- func NewReferenceNodeWithCoder(aDecoder foundation.INSCoder) SKReferenceNode
- func NewReferenceNodeWithFileNamed(fileName string) SKReferenceNode
- func NewReferenceNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKReferenceNode, error)
- func NewReferenceNodeWithURL(url foundation.NSURL) SKReferenceNode
- func NewSKReferenceNode() SKReferenceNode
- func SKReferenceNodeFromID(id objc.ID) SKReferenceNode
- func (r SKReferenceNode) Autorelease() SKReferenceNode
- func (r SKReferenceNode) DidLoadReferenceNode(node ISKNode)
- func (r SKReferenceNode) Init() SKReferenceNode
- func (r SKReferenceNode) InitWithFileNamed(fileName string) SKReferenceNode
- func (r SKReferenceNode) InitWithURL(url foundation.NSURL) SKReferenceNode
- func (r SKReferenceNode) ResolveReferenceNode()
- type SKReferenceNodeClass
- func (sc SKReferenceNodeClass) Alloc() SKReferenceNode
- func (sc SKReferenceNodeClass) Class() objc.Class
- func (_SKReferenceNodeClass SKReferenceNodeClass) ReferenceNodeWithFileNamed(fileName string) SKReferenceNode
- func (_SKReferenceNodeClass SKReferenceNodeClass) ReferenceNodeWithURL(referenceURL foundation.NSURL) SKReferenceNode
- type SKRegion
- func (r SKRegion) Autorelease() SKRegion
- func (r SKRegion) ContainsPoint(point corefoundation.CGPoint) bool
- func (r SKRegion) EncodeWithCoder(coder foundation.INSCoder)
- func (r SKRegion) Init() SKRegion
- func (r SKRegion) InitWithPath(path coregraphics.CGPathRef) SKRegion
- func (r SKRegion) InitWithRadius(radius float32) SKRegion
- func (r SKRegion) InitWithSize(size corefoundation.CGSize) SKRegion
- func (r SKRegion) InverseRegion() ISKRegion
- func (r SKRegion) Path() coregraphics.CGPathRef
- func (r SKRegion) RegionByDifferenceFromRegion(region ISKRegion) ISKRegion
- func (r SKRegion) RegionByIntersectionWithRegion(region ISKRegion) ISKRegion
- func (r SKRegion) RegionByUnionWithRegion(region ISKRegion) ISKRegion
- type SKRegionClass
- type SKRenderer
- func (r SKRenderer) Autorelease() SKRenderer
- func (r SKRenderer) IgnoresSiblingOrder() bool
- func (r SKRenderer) Init() SKRenderer
- func (r SKRenderer) RenderWithViewportCommandBufferRenderPassDescriptor(viewport corefoundation.CGRect, commandBuffer metal.MTLCommandBuffer, ...)
- func (r SKRenderer) RenderWithViewportRenderCommandEncoderRenderPassDescriptorCommandQueue(viewport corefoundation.CGRect, ...)
- func (r SKRenderer) Scene() ISKScene
- func (r SKRenderer) SetIgnoresSiblingOrder(value bool)
- func (r SKRenderer) SetScene(value ISKScene)
- func (r SKRenderer) SetShouldCullNonVisibleNodes(value bool)
- func (r SKRenderer) SetShowsDrawCount(value bool)
- func (r SKRenderer) SetShowsFields(value bool)
- func (r SKRenderer) SetShowsNodeCount(value bool)
- func (r SKRenderer) SetShowsPhysics(value bool)
- func (r SKRenderer) SetShowsQuadCount(value bool)
- func (r SKRenderer) ShouldCullNonVisibleNodes() bool
- func (r SKRenderer) ShowsDrawCount() bool
- func (r SKRenderer) ShowsFields() bool
- func (r SKRenderer) ShowsNodeCount() bool
- func (r SKRenderer) ShowsPhysics() bool
- func (r SKRenderer) ShowsQuadCount() bool
- func (r SKRenderer) UpdateAtTime(currentTime foundation.NSTimeInterval)
- type SKRendererClass
- type SKRepeatMode
- type SKScene
- func NewSKScene() SKScene
- func NewSceneNodeWithFileNamed(filename string) SKScene
- func NewSceneNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKScene, error)
- func NewSceneWithCoder(aDecoder foundation.INSCoder) SKScene
- func NewSceneWithSize(size corefoundation.CGSize) SKScene
- func SKSceneFromID(id objc.ID) SKScene
- func (s SKScene) AnchorPoint() corefoundation.CGPoint
- func (s SKScene) AudioEngine() avfaudio.AVAudioEngine
- func (s SKScene) Autorelease() SKScene
- func (s SKScene) BackgroundColor() appkit.NSColor
- func (s SKScene) Camera() ISKCameraNode
- func (s SKScene) ConvertPointFromView(point corefoundation.CGPoint) corefoundation.CGPoint
- func (s SKScene) ConvertPointToView(point corefoundation.CGPoint) corefoundation.CGPoint
- func (s SKScene) Delegate() SKSceneDelegate
- func (s SKScene) DidApplyConstraints()
- func (s SKScene) DidChangeSize(oldSize corefoundation.CGSize)
- func (s SKScene) DidEvaluateActions()
- func (s SKScene) DidFinishUpdate()
- func (s SKScene) DidMoveToView(view ISKView)
- func (s SKScene) DidSimulatePhysics()
- func (s SKScene) Init() SKScene
- func (s SKScene) InitWithSize(size corefoundation.CGSize) SKScene
- func (s SKScene) Listener() ISKNode
- func (s SKScene) PhysicsWorld() ISKPhysicsWorld
- func (s SKScene) ScaleMode() SKSceneScaleMode
- func (s SKScene) SceneDidLoad()
- func (s SKScene) SetAnchorPoint(value corefoundation.CGPoint)
- func (s SKScene) SetBackgroundColor(value appkit.NSColor)
- func (s SKScene) SetCamera(value ISKCameraNode)
- func (s SKScene) SetDelegate(value SKSceneDelegate)
- func (s SKScene) SetListener(value ISKNode)
- func (s SKScene) SetScaleMode(value SKSceneScaleMode)
- func (s SKScene) SetSize(value corefoundation.CGSize)
- func (s SKScene) Size() corefoundation.CGSize
- func (s SKScene) Update(currentTime foundation.NSTimeInterval)
- func (s SKScene) View() ISKView
- func (s SKScene) WillMoveFromView(view ISKView)
- type SKSceneClass
- type SKSceneDelegate
- type SKSceneDelegateConfig
- type SKSceneDelegateObject
- func (o SKSceneDelegateObject) BaseObject() objectivec.Object
- func (o SKSceneDelegateObject) DidApplyConstraintsForScene(scene ISKScene)
- func (o SKSceneDelegateObject) DidEvaluateActionsForScene(scene ISKScene)
- func (o SKSceneDelegateObject) DidFinishUpdateForScene(scene ISKScene)
- func (o SKSceneDelegateObject) DidSimulatePhysicsForScene(scene ISKScene)
- func (o SKSceneDelegateObject) UpdateForScene(currentTime foundation.NSTimeInterval, scene ISKScene)
- type SKSceneScaleMode
- type SKShader
- func (s SKShader) AddUniform(uniform ISKUniform)
- func (s SKShader) Attributes() []SKAttribute
- func (s SKShader) Autorelease() SKShader
- func (s SKShader) EncodeWithCoder(coder foundation.INSCoder)
- func (s SKShader) Init() SKShader
- func (s SKShader) InitWithSource(source string) SKShader
- func (s SKShader) InitWithSourceUniforms(source string, uniforms []SKUniform) SKShader
- func (s SKShader) RemoveUniformNamed(name string)
- func (s SKShader) SetAttributes(value []SKAttribute)
- func (s SKShader) SetSource(value string)
- func (s SKShader) SetUniforms(value []SKUniform)
- func (s SKShader) Source() string
- func (s SKShader) UniformNamed(name string) ISKUniform
- func (s SKShader) Uniforms() []SKUniform
- type SKShaderClass
- type SKShapeNode
- func NewSKShapeNode() SKShapeNode
- func NewShapeNodeWithCircleOfRadius(radius float64) SKShapeNode
- func NewShapeNodeWithCoder(aDecoder foundation.INSCoder) SKShapeNode
- func NewShapeNodeWithEllipseInRect(rect corefoundation.CGRect) SKShapeNode
- func NewShapeNodeWithEllipseOfSize(size corefoundation.CGSize) SKShapeNode
- func NewShapeNodeWithFileNamed(filename string) SKShapeNode
- func NewShapeNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKShapeNode, error)
- func NewShapeNodeWithPath(path coregraphics.CGPathRef) SKShapeNode
- func NewShapeNodeWithPathCentered(path coregraphics.CGPathRef, centered bool) SKShapeNode
- func NewShapeNodeWithPointsCount(points []corefoundation.CGPoint, numPoints uintptr) SKShapeNode
- func NewShapeNodeWithRect(rect corefoundation.CGRect) SKShapeNode
- func NewShapeNodeWithRectCornerRadius(rect corefoundation.CGRect, cornerRadius float64) SKShapeNode
- func NewShapeNodeWithRectOfSize(size corefoundation.CGSize) SKShapeNode
- func NewShapeNodeWithRectOfSizeCornerRadius(size corefoundation.CGSize, cornerRadius float64) SKShapeNode
- func NewShapeNodeWithSplinePointsCount(points []corefoundation.CGPoint, numPoints uintptr) SKShapeNode
- func SKShapeNodeFromID(id objc.ID) SKShapeNode
- func (s SKShapeNode) AttributeValues() foundation.INSDictionary
- func (s SKShapeNode) Autorelease() SKShapeNode
- func (s SKShapeNode) BlendMode() SKBlendMode
- func (s SKShapeNode) FillColor() appkit.NSColor
- func (s SKShapeNode) FillShader() ISKShader
- func (s SKShapeNode) FillTexture() ISKTexture
- func (s SKShapeNode) GlowWidth() float64
- func (s SKShapeNode) Init() SKShapeNode
- func (s SKShapeNode) IsAntialiased() bool
- func (s SKShapeNode) LineCap() int32
- func (s SKShapeNode) LineJoin() int32
- func (s SKShapeNode) LineLength() float64
- func (s SKShapeNode) LineWidth() float64
- func (s SKShapeNode) MiterLimit() float64
- func (s SKShapeNode) Path() coregraphics.CGPathRef
- func (s SKShapeNode) SetAntialiased(value bool)
- func (s SKShapeNode) SetAttributeValues(value foundation.INSDictionary)
- func (s SKShapeNode) SetBlendMode(value SKBlendMode)
- func (s SKShapeNode) SetFillColor(value appkit.NSColor)
- func (s SKShapeNode) SetFillShader(value ISKShader)
- func (s SKShapeNode) SetFillTexture(value ISKTexture)
- func (s SKShapeNode) SetGlowWidth(value float64)
- func (s SKShapeNode) SetLineCap(value int32)
- func (s SKShapeNode) SetLineJoin(value int32)
- func (s SKShapeNode) SetLineWidth(value float64)
- func (s SKShapeNode) SetMiterLimit(value float64)
- func (s SKShapeNode) SetPath(value coregraphics.CGPathRef)
- func (s SKShapeNode) SetStrokeColor(value appkit.NSColor)
- func (s SKShapeNode) SetStrokeShader(value ISKShader)
- func (s SKShapeNode) SetStrokeTexture(value ISKTexture)
- func (s SKShapeNode) SetValueForAttributeNamed(value ISKAttributeValue, key string)
- func (s SKShapeNode) StrokeColor() appkit.NSColor
- func (s SKShapeNode) StrokeShader() ISKShader
- func (s SKShapeNode) StrokeTexture() ISKTexture
- func (s SKShapeNode) ValueForAttributeNamed(key string) ISKAttributeValue
- type SKShapeNodeClass
- type SKSpriteNode
- func NewSKSpriteNode() SKSpriteNode
- func NewSpriteNodeWithCoder(aDecoder foundation.INSCoder) SKSpriteNode
- func NewSpriteNodeWithColorSize(color appkit.NSColor, size corefoundation.CGSize) SKSpriteNode
- func NewSpriteNodeWithFileNamed(filename string) SKSpriteNode
- func NewSpriteNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKSpriteNode, error)
- func NewSpriteNodeWithImageNamed(name string) SKSpriteNode
- func NewSpriteNodeWithImageNamedNormalMapped(name string, generateNormalMap bool) SKSpriteNode
- func NewSpriteNodeWithTexture(texture ISKTexture) SKSpriteNode
- func NewSpriteNodeWithTextureColorSize(texture ISKTexture, color appkit.NSColor, size corefoundation.CGSize) SKSpriteNode
- func NewSpriteNodeWithTextureNormalMap(texture ISKTexture, normalMap ISKTexture) SKSpriteNode
- func NewSpriteNodeWithTextureSize(texture ISKTexture, size corefoundation.CGSize) SKSpriteNode
- func SKSpriteNodeFromID(id objc.ID) SKSpriteNode
- func (s SKSpriteNode) AnchorPoint() corefoundation.CGPoint
- func (s SKSpriteNode) AttributeValues() foundation.INSDictionary
- func (s SKSpriteNode) Autorelease() SKSpriteNode
- func (s SKSpriteNode) BlendMode() SKBlendMode
- func (s SKSpriteNode) CenterRect() corefoundation.CGRect
- func (s SKSpriteNode) Color() appkit.NSColor
- func (s SKSpriteNode) ColorBlendFactor() float64
- func (s SKSpriteNode) Init() SKSpriteNode
- func (s SKSpriteNode) InitWithColorSize(color appkit.NSColor, size corefoundation.CGSize) SKSpriteNode
- func (s SKSpriteNode) InitWithImageNamed(name string) SKSpriteNode
- func (s SKSpriteNode) InitWithTexture(texture ISKTexture) SKSpriteNode
- func (s SKSpriteNode) InitWithTextureColorSize(texture ISKTexture, color appkit.NSColor, size corefoundation.CGSize) SKSpriteNode
- func (s SKSpriteNode) LightingBitMask() uint32
- func (s SKSpriteNode) NormalTexture() ISKTexture
- func (s SKSpriteNode) ScaleToSize(size corefoundation.CGSize)
- func (s SKSpriteNode) SetAnchorPoint(value corefoundation.CGPoint)
- func (s SKSpriteNode) SetAttributeValues(value foundation.INSDictionary)
- func (s SKSpriteNode) SetBlendMode(value SKBlendMode)
- func (s SKSpriteNode) SetCenterRect(value corefoundation.CGRect)
- func (s SKSpriteNode) SetColor(value appkit.NSColor)
- func (s SKSpriteNode) SetColorBlendFactor(value float64)
- func (s SKSpriteNode) SetLightingBitMask(value uint32)
- func (s SKSpriteNode) SetNormalTexture(value ISKTexture)
- func (s SKSpriteNode) SetShader(value ISKShader)
- func (s SKSpriteNode) SetShadowCastBitMask(value uint32)
- func (s SKSpriteNode) SetShadowedBitMask(value uint32)
- func (s SKSpriteNode) SetSize(value corefoundation.CGSize)
- func (o SKSpriteNode) SetSubdivisionLevels(value int)
- func (s SKSpriteNode) SetTexture(value ISKTexture)
- func (s SKSpriteNode) SetValueForAttributeNamed(value ISKAttributeValue, key string)
- func (o SKSpriteNode) SetWarpGeometry(value ISKWarpGeometry)
- func (s SKSpriteNode) Shader() ISKShader
- func (s SKSpriteNode) ShadowCastBitMask() uint32
- func (s SKSpriteNode) ShadowedBitMask() uint32
- func (s SKSpriteNode) Size() corefoundation.CGSize
- func (s SKSpriteNode) SubdivisionLevels() int
- func (s SKSpriteNode) Texture() ISKTexture
- func (s SKSpriteNode) ValueForAttributeNamed(key string) ISKAttributeValue
- func (s SKSpriteNode) WarpGeometry() ISKWarpGeometry
- type SKSpriteNodeClass
- type SKTexture
- func (t SKTexture) Autorelease() SKTexture
- func (t SKTexture) CGImage() coregraphics.CGImageRef
- func (t SKTexture) EncodeWithCoder(coder foundation.INSCoder)
- func (t SKTexture) FilteringMode() SKTextureFilteringMode
- func (t SKTexture) Init() SKTexture
- func (t SKTexture) Preload(ctx context.Context) error
- func (t SKTexture) PreloadWithCompletionHandler(completionHandler VoidHandler)
- func (t SKTexture) SetFilteringMode(value SKTextureFilteringMode)
- func (t SKTexture) SetUsesMipmaps(value bool)
- func (t SKTexture) Size() corefoundation.CGSize
- func (t SKTexture) TextureRect() corefoundation.CGRect
- func (t SKTexture) UsesMipmaps() bool
- type SKTextureAtlas
- func (t SKTextureAtlas) Autorelease() SKTextureAtlas
- func (t SKTextureAtlas) EncodeWithCoder(coder foundation.INSCoder)
- func (t SKTextureAtlas) Init() SKTextureAtlas
- func (t SKTextureAtlas) Preload(ctx context.Context) error
- func (t SKTextureAtlas) PreloadWithCompletionHandler(completionHandler VoidHandler)
- func (t SKTextureAtlas) TextureNamed(name string) ISKTexture
- func (t SKTextureAtlas) TextureNames() []string
- type SKTextureAtlasArrayErrorHandler
- type SKTextureAtlasClass
- func (sc SKTextureAtlasClass) Alloc() SKTextureAtlas
- func (sc SKTextureAtlasClass) Class() objc.Class
- func (_SKTextureAtlasClass SKTextureAtlasClass) PreloadTextureAtlasesNamedWithCompletionHandler(atlasNames []string, completionHandler SKTextureAtlasArrayErrorHandler)
- func (_SKTextureAtlasClass SKTextureAtlasClass) PreloadTextureAtlasesWithCompletionHandler(textureAtlases []SKTextureAtlas, completionHandler VoidHandler)
- type SKTextureClass
- type SKTextureFilteringMode
- type SKTileAdjacencyMask
- type SKTileDefinition
- func NewSKTileDefinition() SKTileDefinition
- func NewTileDefinitionWithTexture(texture ISKTexture) SKTileDefinition
- func NewTileDefinitionWithTextureNormalTextureSize(texture ISKTexture, normalTexture ISKTexture, size corefoundation.CGSize) SKTileDefinition
- func NewTileDefinitionWithTextureSize(texture ISKTexture, size corefoundation.CGSize) SKTileDefinition
- func NewTileDefinitionWithTexturesNormalTexturesSizeTimePerFrame(textures []SKTexture, normalTextures []SKTexture, size corefoundation.CGSize, ...) SKTileDefinition
- func NewTileDefinitionWithTexturesSizeTimePerFrame(textures []SKTexture, size corefoundation.CGSize, timePerFrame float64) SKTileDefinition
- func SKTileDefinitionFromID(id objc.ID) SKTileDefinition
- func (t SKTileDefinition) Autorelease() SKTileDefinition
- func (t SKTileDefinition) EncodeWithCoder(coder foundation.INSCoder)
- func (t SKTileDefinition) FlipHorizontally() bool
- func (t SKTileDefinition) FlipVertically() bool
- func (t SKTileDefinition) Init() SKTileDefinition
- func (t SKTileDefinition) InitWithTexture(texture ISKTexture) SKTileDefinition
- func (t SKTileDefinition) InitWithTextureNormalTextureSize(texture ISKTexture, normalTexture ISKTexture, size corefoundation.CGSize) SKTileDefinition
- func (t SKTileDefinition) InitWithTextureSize(texture ISKTexture, size corefoundation.CGSize) SKTileDefinition
- func (t SKTileDefinition) InitWithTexturesNormalTexturesSizeTimePerFrame(textures []SKTexture, normalTextures []SKTexture, size corefoundation.CGSize, ...) SKTileDefinition
- func (t SKTileDefinition) InitWithTexturesSizeTimePerFrame(textures []SKTexture, size corefoundation.CGSize, timePerFrame float64) SKTileDefinition
- func (t SKTileDefinition) Name() string
- func (t SKTileDefinition) NormalTextures() []SKTexture
- func (t SKTileDefinition) PlacementWeight() uint
- func (t SKTileDefinition) Rotation() SKTileDefinitionRotation
- func (t SKTileDefinition) SetFlipHorizontally(value bool)
- func (t SKTileDefinition) SetFlipVertically(value bool)
- func (t SKTileDefinition) SetName(value string)
- func (t SKTileDefinition) SetNormalTextures(value []SKTexture)
- func (t SKTileDefinition) SetPlacementWeight(value uint)
- func (t SKTileDefinition) SetRotation(value SKTileDefinitionRotation)
- func (t SKTileDefinition) SetSize(value corefoundation.CGSize)
- func (t SKTileDefinition) SetTextures(value []SKTexture)
- func (t SKTileDefinition) SetTimePerFrame(value float64)
- func (t SKTileDefinition) SetUserData(value foundation.INSDictionary)
- func (t SKTileDefinition) Size() corefoundation.CGSize
- func (t SKTileDefinition) Textures() []SKTexture
- func (t SKTileDefinition) TimePerFrame() float64
- func (t SKTileDefinition) UserData() foundation.INSDictionary
- type SKTileDefinitionClass
- type SKTileDefinitionRotation
- type SKTileGroup
- func (t SKTileGroup) Autorelease() SKTileGroup
- func (t SKTileGroup) EncodeWithCoder(coder foundation.INSCoder)
- func (t SKTileGroup) Init() SKTileGroup
- func (t SKTileGroup) InitWithRules(rules []SKTileGroupRule) SKTileGroup
- func (t SKTileGroup) InitWithTileDefinition(tileDefinition ISKTileDefinition) SKTileGroup
- func (t SKTileGroup) Name() string
- func (t SKTileGroup) Rules() []SKTileGroupRule
- func (t SKTileGroup) SetName(value string)
- func (t SKTileGroup) SetRules(value []SKTileGroupRule)
- type SKTileGroupClass
- type SKTileGroupRule
- func (t SKTileGroupRule) Adjacency() SKTileAdjacencyMask
- func (t SKTileGroupRule) Autorelease() SKTileGroupRule
- func (t SKTileGroupRule) EncodeWithCoder(coder foundation.INSCoder)
- func (t SKTileGroupRule) Init() SKTileGroupRule
- func (t SKTileGroupRule) InitWithAdjacencyTileDefinitions(adjacency SKTileAdjacencyMask, tileDefinitions []SKTileDefinition) SKTileGroupRule
- func (t SKTileGroupRule) Name() string
- func (t SKTileGroupRule) SetAdjacency(value SKTileAdjacencyMask)
- func (t SKTileGroupRule) SetName(value string)
- func (t SKTileGroupRule) SetTileDefinitions(value []SKTileDefinition)
- func (t SKTileGroupRule) TileDefinitions() []SKTileDefinition
- type SKTileGroupRuleClass
- type SKTileMapNode
- func NewSKTileMapNode() SKTileMapNode
- func NewTileMapNodeWithCoder(aDecoder foundation.INSCoder) SKTileMapNode
- func NewTileMapNodeWithFileNamed(filename string) SKTileMapNode
- func NewTileMapNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKTileMapNode, error)
- func SKTileMapNodeFromID(id objc.ID) SKTileMapNode
- func (t SKTileMapNode) AnchorPoint() corefoundation.CGPoint
- func (t SKTileMapNode) AttributeValues() foundation.INSDictionary
- func (t SKTileMapNode) Autorelease() SKTileMapNode
- func (t SKTileMapNode) BlendMode() SKBlendMode
- func (t SKTileMapNode) CenterOfTileAtColumnRow(column uint, row uint) corefoundation.CGPoint
- func (t SKTileMapNode) Color() appkit.NSColor
- func (t SKTileMapNode) ColorBlendFactor() float64
- func (t SKTileMapNode) EnableAutomapping() bool
- func (t SKTileMapNode) Init() SKTileMapNode
- func (t SKTileMapNode) LightingBitMask() uint32
- func (t SKTileMapNode) MapSize() corefoundation.CGSize
- func (t SKTileMapNode) NumberOfColumns() uint
- func (t SKTileMapNode) NumberOfRows() uint
- func (t SKTileMapNode) SetAnchorPoint(value corefoundation.CGPoint)
- func (t SKTileMapNode) SetAttributeValues(value foundation.INSDictionary)
- func (t SKTileMapNode) SetBlendMode(value SKBlendMode)
- func (t SKTileMapNode) SetColor(value appkit.NSColor)
- func (t SKTileMapNode) SetColorBlendFactor(value float64)
- func (t SKTileMapNode) SetEnableAutomapping(value bool)
- func (t SKTileMapNode) SetLightingBitMask(value uint32)
- func (t SKTileMapNode) SetNumberOfColumns(value uint)
- func (t SKTileMapNode) SetNumberOfRows(value uint)
- func (t SKTileMapNode) SetShader(value ISKShader)
- func (t SKTileMapNode) SetTileSet(value ISKTileSet)
- func (t SKTileMapNode) SetTileSize(value corefoundation.CGSize)
- func (t SKTileMapNode) SetValueForAttributeNamed(value ISKAttributeValue, key string)
- func (t SKTileMapNode) Shader() ISKShader
- func (t SKTileMapNode) TileColumnIndexFromPosition(position corefoundation.CGPoint) uint
- func (t SKTileMapNode) TileDefinitionAtColumnRow(column uint, row uint) ISKTileDefinition
- func (t SKTileMapNode) TileGroupAtColumnRow(column uint, row uint) ISKTileGroup
- func (t SKTileMapNode) TileRowIndexFromPosition(position corefoundation.CGPoint) uint
- func (t SKTileMapNode) TileSet() ISKTileSet
- func (t SKTileMapNode) TileSize() corefoundation.CGSize
- func (t SKTileMapNode) ValueForAttributeNamed(key string) ISKAttributeValue
- type SKTileMapNodeClass
- type SKTileSet
- func NewSKTileSet() SKTileSet
- func NewTileSetFromURL(url foundation.NSURL) SKTileSet
- func NewTileSetNamed(name string) SKTileSet
- func NewTileSetWithTileGroups(tileGroups []SKTileGroup) SKTileSet
- func NewTileSetWithTileGroupsTileSetType(tileGroups []SKTileGroup, tileSetType SKTileSetType) SKTileSet
- func SKTileSetFromID(id objc.ID) SKTileSet
- func (t SKTileSet) Autorelease() SKTileSet
- func (t SKTileSet) DefaultTileGroup() ISKTileGroup
- func (t SKTileSet) DefaultTileSize() corefoundation.CGSize
- func (t SKTileSet) EncodeWithCoder(coder foundation.INSCoder)
- func (t SKTileSet) Init() SKTileSet
- func (t SKTileSet) InitWithTileGroups(tileGroups []SKTileGroup) SKTileSet
- func (t SKTileSet) InitWithTileGroupsTileSetType(tileGroups []SKTileGroup, tileSetType SKTileSetType) SKTileSet
- func (t SKTileSet) Name() string
- func (t SKTileSet) SetDefaultTileGroup(value ISKTileGroup)
- func (t SKTileSet) SetDefaultTileSize(value corefoundation.CGSize)
- func (t SKTileSet) SetName(value string)
- func (t SKTileSet) SetTileGroups(value []SKTileGroup)
- func (t SKTileSet) SetType(value SKTileSetType)
- func (t SKTileSet) TileGroups() []SKTileGroup
- func (t SKTileSet) Type() SKTileSetType
- type SKTileSetClass
- type SKTileSetType
- type SKTransformNode
- func NewSKTransformNode() SKTransformNode
- func NewTransformNodeWithCoder(aDecoder foundation.INSCoder) SKTransformNode
- func NewTransformNodeWithFileNamed(filename string) SKTransformNode
- func NewTransformNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKTransformNode, error)
- func SKTransformNodeFromID(id objc.ID) SKTransformNode
- func (t SKTransformNode) Autorelease() SKTransformNode
- func (t SKTransformNode) EulerAngles() Vector_float3
- func (t SKTransformNode) Init() SKTransformNode
- func (t SKTransformNode) RotationMatrix() [3][4]float32
- func (t SKTransformNode) SetEulerAngles(euler Vector_float3)
- func (t SKTransformNode) SetRotationMatrix(rotationMatrix [3][4]float32)
- func (t SKTransformNode) SetXRotation(value float64)
- func (t SKTransformNode) SetYRotation(value float64)
- func (t SKTransformNode) XRotation() float64
- func (t SKTransformNode) YRotation() float64
- type SKTransformNodeClass
- type SKTransition
- func (t SKTransition) Autorelease() SKTransition
- func (t SKTransition) Init() SKTransition
- func (t SKTransition) PausesIncomingScene() bool
- func (t SKTransition) PausesOutgoingScene() bool
- func (t SKTransition) SetPausesIncomingScene(value bool)
- func (t SKTransition) SetPausesOutgoingScene(value bool)
- type SKTransitionClass
- func (sc SKTransitionClass) Alloc() SKTransition
- func (sc SKTransitionClass) Class() objc.Class
- func (_SKTransitionClass SKTransitionClass) CrossFadeWithDuration(sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) DoorsCloseHorizontalWithDuration(sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) DoorsCloseVerticalWithDuration(sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) DoorsOpenHorizontalWithDuration(sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) DoorsOpenVerticalWithDuration(sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) DoorwayWithDuration(sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) FadeWithColorDuration(color appkit.NSColor, sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) FadeWithDuration(sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) FlipHorizontalWithDuration(sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) FlipVerticalWithDuration(sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) MoveInWithDirectionDuration(direction SKTransitionDirection, sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) PushWithDirectionDuration(direction SKTransitionDirection, sec foundation.NSTimeInterval) SKTransition
- func (_SKTransitionClass SKTransitionClass) RevealWithDirectionDuration(direction SKTransitionDirection, sec foundation.NSTimeInterval) SKTransition
- type SKTransitionDirection
- type SKUniform
- func NewSKUniform() SKUniform
- func NewUniformWithName(name string) SKUniform
- func NewUniformWithNameFloat(name string, value float32) SKUniform
- func NewUniformWithNameMatrixFloat2x2(name string, value [2][2]float32) SKUniform
- func NewUniformWithNameMatrixFloat3x3(name string, value [3][4]float32) SKUniform
- func NewUniformWithNameMatrixFloat4x4(name string, value [4][4]float32) SKUniform
- func NewUniformWithNameTexture(name string, texture ISKTexture) SKUniform
- func NewUniformWithNameVectorFloat2(name string, value [2]float32) SKUniform
- func NewUniformWithNameVectorFloat3(name string, value Vector_float3) SKUniform
- func NewUniformWithNameVectorFloat4(name string, value [4]float32) SKUniform
- func SKUniformFromID(id objc.ID) SKUniform
- func (u SKUniform) Autorelease() SKUniform
- func (u SKUniform) EncodeWithCoder(coder foundation.INSCoder)
- func (u SKUniform) FloatValue() float32
- func (u SKUniform) Init() SKUniform
- func (u SKUniform) InitWithName(name string) SKUniform
- func (u SKUniform) InitWithNameFloat(name string, value float32) SKUniform
- func (u SKUniform) InitWithNameMatrixFloat2x2(name string, value [2][2]float32) SKUniform
- func (u SKUniform) InitWithNameMatrixFloat3x3(name string, value [3][4]float32) SKUniform
- func (u SKUniform) InitWithNameMatrixFloat4x4(name string, value [4][4]float32) SKUniform
- func (u SKUniform) InitWithNameTexture(name string, texture ISKTexture) SKUniform
- func (u SKUniform) InitWithNameVectorFloat2(name string, value [2]float32) SKUniform
- func (u SKUniform) InitWithNameVectorFloat3(name string, value Vector_float3) SKUniform
- func (u SKUniform) InitWithNameVectorFloat4(name string, value [4]float32) SKUniform
- func (u SKUniform) MatrixFloat2x2Value() [2][2]float32
- func (u SKUniform) MatrixFloat3x3Value() [3][4]float32
- func (u SKUniform) MatrixFloat4x4Value() [4][4]float32
- func (u SKUniform) Name() string
- func (u SKUniform) SetFloatValue(value float32)
- func (u SKUniform) SetMatrixFloat2x2Value(value [2][2]float32)
- func (u SKUniform) SetMatrixFloat3x3Value(value [3][4]float32)
- func (u SKUniform) SetMatrixFloat4x4Value(value [4][4]float32)
- func (u SKUniform) SetTextureValue(value ISKTexture)
- func (u SKUniform) SetVectorFloat2Value(value [2]float32)
- func (u SKUniform) SetVectorFloat3Value(value Vector_float3)
- func (u SKUniform) SetVectorFloat4Value(value [4]float32)
- func (u SKUniform) TextureValue() ISKTexture
- func (u SKUniform) UniformType() SKUniformType
- func (u SKUniform) VectorFloat2Value() [2]float32
- func (u SKUniform) VectorFloat3Value() Vector_float3
- func (u SKUniform) VectorFloat4Value() [4]float32
- type SKUniformClass
- type SKUniformType
- type SKVideoNode
- func NewSKVideoNode() SKVideoNode
- func NewVideoNodeWithAVPlayer(player objectivec.IObject) SKVideoNode
- func NewVideoNodeWithCoder(aDecoder foundation.INSCoder) SKVideoNode
- func NewVideoNodeWithFileNamed(videoFile string) SKVideoNode
- func NewVideoNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKVideoNode, error)
- func NewVideoNodeWithURL(url foundation.NSURL) SKVideoNode
- func SKVideoNodeFromID(id objc.ID) SKVideoNode
- func (v SKVideoNode) AnchorPoint() corefoundation.CGPoint
- func (v SKVideoNode) Autorelease() SKVideoNode
- func (v SKVideoNode) Init() SKVideoNode
- func (v SKVideoNode) InitWithAVPlayer(player objectivec.IObject) SKVideoNode
- func (v SKVideoNode) InitWithFileNamed(videoFile string) SKVideoNode
- func (v SKVideoNode) InitWithURL(url foundation.NSURL) SKVideoNode
- func (v SKVideoNode) Pause()
- func (v SKVideoNode) Play()
- func (v SKVideoNode) SetAnchorPoint(value corefoundation.CGPoint)
- func (v SKVideoNode) SetSize(value corefoundation.CGSize)
- func (v SKVideoNode) Size() corefoundation.CGSize
- type SKVideoNodeClass
- type SKView
- func (v SKView) AllowsTransparency() bool
- func (v SKView) Autorelease() SKView
- func (v SKView) ConvertPointFromScene(point corefoundation.CGPoint, scene ISKScene) corefoundation.CGPoint
- func (v SKView) ConvertPointToScene(point corefoundation.CGPoint, scene ISKScene) corefoundation.CGPoint
- func (v SKView) Delegate() objectivec.Object
- func (v SKView) DisableDepthStencilBuffer() bool
- func (v SKView) IgnoresSiblingOrder() bool
- func (v SKView) Init() SKView
- func (v SKView) IsAsynchronous() bool
- func (v SKView) IsPaused() bool
- func (v SKView) PreferredFramesPerSecond() int
- func (v SKView) PresentScene(scene ISKScene)
- func (v SKView) PresentSceneTransition(scene ISKScene, transition ISKTransition)
- func (v SKView) Scene() ISKScene
- func (v SKView) SetAllowsTransparency(value bool)
- func (v SKView) SetAsynchronous(value bool)
- func (v SKView) SetDelegate(value objectivec.Object)
- func (v SKView) SetDisableDepthStencilBuffer(value bool)
- func (v SKView) SetIgnoresSiblingOrder(value bool)
- func (v SKView) SetPaused(value bool)
- func (v SKView) SetPreferredFramesPerSecond(value int)
- func (v SKView) SetShouldCullNonVisibleNodes(value bool)
- func (v SKView) SetShowsDrawCount(value bool)
- func (v SKView) SetShowsFPS(value bool)
- func (v SKView) SetShowsFields(value bool)
- func (v SKView) SetShowsNodeCount(value bool)
- func (v SKView) SetShowsPhysics(value bool)
- func (v SKView) SetShowsQuadCount(value bool)
- func (v SKView) ShouldCullNonVisibleNodes() bool
- func (v SKView) ShowsDrawCount() bool
- func (v SKView) ShowsFPS() bool
- func (v SKView) ShowsFields() bool
- func (v SKView) ShowsNodeCount() bool
- func (v SKView) ShowsPhysics() bool
- func (v SKView) ShowsQuadCount() bool
- func (v SKView) TextureFromNode(node ISKNode) ISKTexture
- func (v SKView) TextureFromNodeCrop(node ISKNode, crop corefoundation.CGRect) ISKTexture
- type SKViewClass
- type SKViewDelegate
- type SKViewDelegateConfig
- type SKViewDelegateObject
- type SKWarpGeometry
- type SKWarpGeometryClass
- type SKWarpGeometryGrid
- func (w SKWarpGeometryGrid) Autorelease() SKWarpGeometryGrid
- func (w SKWarpGeometryGrid) DestPositionAtIndex(index int) [2]float32
- func (w SKWarpGeometryGrid) Init() SKWarpGeometryGrid
- func (w SKWarpGeometryGrid) NumberOfColumns() int
- func (w SKWarpGeometryGrid) NumberOfRows() int
- func (w SKWarpGeometryGrid) SourcePositionAtIndex(index int) [2]float32
- func (w SKWarpGeometryGrid) VertexCount() int
- type SKWarpGeometryGridClass
- type SKWarpable
- type SKWarpableObject
- type UnsafePointerUintptrHandler
- type VectorFloat3
- type Vector_float3
- type VoidHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFloat32Float32Block ¶
func NewFloat32Float32Block(handler Float32Float32Handler) (objc.ID, func())
NewFloat32Float32Block wraps a Go Float32Float32Handler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
- [SKFieldNode.CustomFieldWithEvaluationBlock]
func NewSKActionTimingFunctionBlock ¶
func NewSKActionTimingFunctionBlock(handler SKActionTimingFunction) (objc.ID, func())
NewSKActionTimingFunctionBlock wraps a Go SKActionTimingFunction as an Objective-C block. The caller must defer the returned cleanup function.
func NewSKNodeBoolBlock ¶
func NewSKNodeBoolBlock(handler SKNodeBoolHandler) (objc.ID, func())
NewSKNodeBoolBlock wraps a Go SKNodeBoolHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewSKPhysicsBodyBoolBlock ¶
func NewSKPhysicsBodyBoolBlock(handler SKPhysicsBodyBoolHandler) (objc.ID, func())
NewSKPhysicsBodyBoolBlock wraps a Go SKPhysicsBodyBoolHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewSKPhysicsBodyCGPointCGVectorBoolBlock ¶
func NewSKPhysicsBodyCGPointCGVectorBoolBlock(handler SKPhysicsBodyCGPointCGVectorBoolHandler) (objc.ID, func())
NewSKPhysicsBodyCGPointCGVectorBoolBlock wraps a Go SKPhysicsBodyCGPointCGVectorBoolHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewSKTextureAtlasArrayErrorBlock ¶
func NewSKTextureAtlasArrayErrorBlock(handler SKTextureAtlasArrayErrorHandler) (objc.ID, func())
NewSKTextureAtlasArrayErrorBlock wraps a Go SKTextureAtlasArrayErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
- [SKTextureAtlas.PreloadTextureAtlasesNamedWithCompletionHandler]
func NewUnsafePointerUintptrBlock ¶
func NewUnsafePointerUintptrBlock(handler UnsafePointerUintptrHandler) (objc.ID, func())
NewUnsafePointerUintptrBlock wraps a Go UnsafePointerUintptrHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewVoidBlock ¶
func NewVoidBlock(handler VoidHandler) (objc.ID, func())
NewVoidBlock wraps a Go VoidHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
- SKNode.RunActionCompletion
- [SKTexture.PreloadTexturesWithCompletionHandler]
- SKTexture.PreloadWithCompletionHandler
- [SKTextureAtlas.PreloadTextureAtlasesWithCompletionHandler]
- SKTextureAtlas.PreloadWithCompletionHandler
Types ¶
type Float32Float32Handler ¶
Float32Float32Handler handles A custom block to be executed when a physics body is affected by the field.
Used by:
- [SKFieldNode.CustomFieldWithEvaluationBlock]
type ISKAction ¶
type ISKAction interface {
objectivec.IObject
// The duration required to complete an action.
Duration() foundation.NSTimeInterval
SetDuration(value foundation.NSTimeInterval)
// A setting that controls the speed curve of an animation.
TimingMode() SKActionTimingMode
SetTimingMode(value SKActionTimingMode)
// A block used to customize the timing function.
TimingFunction() Float32Float32Handler
SetTimingFunction(value Float32Float32Handler)
// A speed factor that modifies how fast an action runs.
Speed() float64
SetSpeed(value float64)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKAction class.
Controlling Action Timing ¶
- ISKAction.Duration: The duration required to complete an action.
- ISKAction.SetDuration
- ISKAction.TimingMode: A setting that controls the speed curve of an animation.
- ISKAction.SetTimingMode
- ISKAction.TimingFunction: A block used to customize the timing function.
- ISKAction.SetTimingFunction
- ISKAction.Speed: A speed factor that modifies how fast an action runs.
- ISKAction.SetSpeed
See: https://developer.apple.com/documentation/SpriteKit/SKAction
type ISKAttribute ¶
type ISKAttribute interface {
objectivec.IObject
// Creates and initializes a new attribute object of a specified type with a name that can be referenced within the shader.
InitWithNameType(name string, type_ SKAttributeType) SKAttribute
// The receiver’s name
Name() string
// The data type of the attribute’s value.
Type() SKAttributeType
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKAttribute class.
Initializers ¶
- ISKAttribute.InitWithNameType: Creates and initializes a new attribute object of a specified type with a name that can be referenced within the shader.
Instance Properties ¶
- ISKAttribute.Name: The receiver’s name
- ISKAttribute.Type: The data type of the attribute’s value.
See: https://developer.apple.com/documentation/SpriteKit/SKAttribute
type ISKAttributeValue ¶
type ISKAttributeValue interface {
objectivec.IObject
// The receiver’s floating point value.
FloatValue() float32
SetFloatValue(value float32)
// The receiver’s value as a vector of two floating-point numbers.
VectorFloat2Value() [2]float32
SetVectorFloat2Value(value [2]float32)
// The receiver’s value as a vector of three floating point numbers.
VectorFloat3Value() Vector_float3
SetVectorFloat3Value(value Vector_float3)
// The receiver’s value as a vector of four floating point numbers.
VectorFloat4Value() [4]float32
SetVectorFloat4Value(value [4]float32)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKAttributeValue class.
Instance Properties ¶
- ISKAttributeValue.FloatValue: The receiver’s floating point value.
- ISKAttributeValue.SetFloatValue
- ISKAttributeValue.VectorFloat2Value: The receiver’s value as a vector of two floating-point numbers.
- ISKAttributeValue.SetVectorFloat2Value
- ISKAttributeValue.VectorFloat3Value: The receiver’s value as a vector of three floating point numbers.
- ISKAttributeValue.SetVectorFloat3Value
- ISKAttributeValue.VectorFloat4Value: The receiver’s value as a vector of four floating point numbers.
- ISKAttributeValue.SetVectorFloat4Value
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeValue
type ISKAudioNode ¶
type ISKAudioNode interface {
ISKNode
// Initializes an audio node from an AVFoundation audio node.
InitWithAVAudioNode(node avfaudio.AVAudioNode) SKAudioNode
// Initializes an audio node from an audio asset with the specified filename.
InitWithFileNamed(name string) SKAudioNode
// Initializes an audio node from an audio asset with the specified URL.
InitWithURL(url foundation.NSURL) SKAudioNode
// The audio node’s current audio asset.
AvAudioNode() avfaudio.AVAudioNode
SetAvAudioNode(value avfaudio.AVAudioNode)
// A Boolean property that indicates whether the node’s audio is altered based on the position of the node.
IsPositional() bool
SetPositional(value bool)
// A Boolean value that indicates whether the audio should play in a loop when the node is added to the scene.
AutoplayLooped() bool
SetAutoplayLooped(value bool)
}
An interface definition for the SKAudioNode class.
Initializing Audio Nodes ¶
- ISKAudioNode.InitWithAVAudioNode: Initializes an audio node from an AVFoundation audio node.
- ISKAudioNode.InitWithFileNamed: Initializes an audio node from an audio asset with the specified filename.
- ISKAudioNode.InitWithURL: Initializes an audio node from an audio asset with the specified URL.
Configuring Audio Nodes ¶
- ISKAudioNode.AvAudioNode: The audio node’s current audio asset.
- ISKAudioNode.SetAvAudioNode
- ISKAudioNode.IsPositional: A Boolean property that indicates whether the node’s audio is altered based on the position of the node.
- ISKAudioNode.SetPositional
- ISKAudioNode.AutoplayLooped: A Boolean value that indicates whether the audio should play in a loop when the node is added to the scene.
- ISKAudioNode.SetAutoplayLooped
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode
type ISKCameraNode ¶
type ISKCameraNode interface {
ISKNode
// Finds nodes that are visible in the camera’s viewport.
ContainedNodeSet() foundation.INSSet
// Checks to see if a node is visible in the camera’s viewport.
ContainsNode(node ISKNode) bool
}
An interface definition for the SKCameraNode class.
Node Visibility ¶
- ISKCameraNode.ContainedNodeSet: Finds nodes that are visible in the camera’s viewport.
- ISKCameraNode.ContainsNode: Checks to see if a node is visible in the camera’s viewport.
See: https://developer.apple.com/documentation/SpriteKit/SKCameraNode
type ISKConstraint ¶
type ISKConstraint interface {
objectivec.IObject
// The node whose coordinate system should be used to apply the constraint.
ReferenceNode() ISKNode
SetReferenceNode(value ISKNode)
// A Boolean value that specifies whether the constraint is applied.
Enabled() bool
SetEnabled(value bool)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKConstraint class.
Controlling the Coordinate System Where a Constraint is Applied ¶
- ISKConstraint.ReferenceNode: The node whose coordinate system should be used to apply the constraint.
- ISKConstraint.SetReferenceNode
Enabling and Disabling a Constraint ¶
- ISKConstraint.Enabled: A Boolean value that specifies whether the constraint is applied.
- ISKConstraint.SetEnabled
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint
type ISKCropNode ¶
type ISKCropNode interface {
ISKNode
// The node used to determine the crop node’s mask.
MaskNode() ISKNode
SetMaskNode(value ISKNode)
}
An interface definition for the SKCropNode class.
Setting the Mask Filter ¶
- ISKCropNode.MaskNode: The node used to determine the crop node’s mask.
- ISKCropNode.SetMaskNode
See: https://developer.apple.com/documentation/SpriteKit/SKCropNode
type ISKEffectNode ¶
type ISKEffectNode interface {
ISKNode
// The Core Image filter to apply.
Filter() coreimage.CIFilter
SetFilter(value coreimage.CIFilter)
// A Boolean value that determines whether the effect node applies the filter to its children as they are drawn.
ShouldEnableEffects() bool
SetShouldEnableEffects(value bool)
// A Boolean value that determines whether the effect node automatically sets the filter’s image center.
ShouldCenterFilter() bool
SetShouldCenterFilter(value bool)
// A custom shader that is called when the effect node is blended into the parent’s framebuffer.
Shader() ISKShader
SetShader(value ISKShader)
// The values of each attribute associated with the node’s attached shader.
AttributeValues() foundation.INSDictionary
SetAttributeValues(value foundation.INSDictionary)
// Sets an attribute value for an attached shader.
SetValueForAttributeNamed(value ISKAttributeValue, key string)
// Gets the value of a shader attribute.
ValueForAttributeNamed(key string) ISKAttributeValue
// A Boolean value that indicates whether the results of rendering the child nodes should be cached.
ShouldRasterize() bool
SetShouldRasterize(value bool)
// The blend mode used to draw the node’s contents into its parent’s framebuffer.
BlendMode() SKBlendMode
SetBlendMode(value SKBlendMode)
// The maximum number of subdivision iterations used to generate the final vertices.
SubdivisionLevels() int
// The warp geometry used to define the distortion.
WarpGeometry() ISKWarpGeometry
}
An interface definition for the SKEffectNode class.
Applying Core Image Filters with an Effect Node ¶
- ISKEffectNode.Filter: The Core Image filter to apply.
- ISKEffectNode.SetFilter
- ISKEffectNode.ShouldEnableEffects: A Boolean value that determines whether the effect node applies the filter to its children as they are drawn.
- ISKEffectNode.SetShouldEnableEffects
- ISKEffectNode.ShouldCenterFilter: A Boolean value that determines whether the effect node automatically sets the filter’s image center.
- ISKEffectNode.SetShouldCenterFilter
Applying a Shader with an Effect Node ¶
- ISKEffectNode.Shader: A custom shader that is called when the effect node is blended into the parent’s framebuffer.
- ISKEffectNode.SetShader
- ISKEffectNode.AttributeValues: The values of each attribute associated with the node’s attached shader.
- ISKEffectNode.SetAttributeValues
- ISKEffectNode.SetValueForAttributeNamed: Sets an attribute value for an attached shader.
- ISKEffectNode.ValueForAttributeNamed: Gets the value of a shader attribute.
Flattening an Effect Node’s Child Tree for Performance Improvement ¶
- ISKEffectNode.ShouldRasterize: A Boolean value that indicates whether the results of rendering the child nodes should be cached.
- ISKEffectNode.SetShouldRasterize
Configuring Alpha Blending ¶
- ISKEffectNode.BlendMode: The blend mode used to draw the node’s contents into its parent’s framebuffer.
- ISKEffectNode.SetBlendMode
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode
type ISKEmitterNode ¶
type ISKEmitterNode interface {
ISKNode
// The target node that renders the emitter’s particles.
TargetNode() ISKNode
SetTargetNode(value ISKNode)
// Advances the emitter particle simulation.
AdvanceSimulationTime(sec foundation.NSTimeInterval)
// Removes all existing particles and restarts the simulation.
ResetSimulation()
// The rate at which new particles are created.
ParticleBirthRate() float64
SetParticleBirthRate(value float64)
// The number of particles the emitter should emit before stopping.
NumParticlesToEmit() uint
SetNumParticlesToEmit(value uint)
// The order in which the emitter’s particles are rendered.
ParticleRenderOrder() SKParticleRenderOrder
SetParticleRenderOrder(value SKParticleRenderOrder)
// The average lifetime of a particle, in seconds.
ParticleLifetime() float64
SetParticleLifetime(value float64)
// The range of allowed random values for a particle’s lifetime.
ParticleLifetimeRange() float64
SetParticleLifetimeRange(value float64)
// The average starting position for a particle.
ParticlePosition() corefoundation.CGPoint
SetParticlePosition(value corefoundation.CGPoint)
// The range of allowed random values for a particle’s position.
ParticlePositionRange() corefoundation.CGVector
SetParticlePositionRange(value corefoundation.CGVector)
// The average starting depth of a particle.
ParticleZPosition() float64
SetParticleZPosition(value float64)
// The average initial speed of a new particle, in points per second.
ParticleSpeed() float64
SetParticleSpeed(value float64)
// The range of allowed random values for a particle’s initial speed.
ParticleSpeedRange() float64
SetParticleSpeedRange(value float64)
// The average initial direction of a particle, expressed as an angle in radians.
EmissionAngle() float64
SetEmissionAngle(value float64)
// The range of allowed random values for a particle’s initial direction, expressed as an angle in radians.
EmissionAngleRange() float64
SetEmissionAngleRange(value float64)
// The acceleration to apply to a particle’s horizontal velocity.
XAcceleration() float64
SetXAcceleration(value float64)
// The acceleration to apply to a particle’s vertical velocity.
YAcceleration() float64
SetYAcceleration(value float64)
// The average initial rotation of a particle, expressed as an angle in radians.
ParticleRotation() float64
SetParticleRotation(value float64)
// The range of allowed random values for a particle’s initial rotation, expressed as an angle in radians.
ParticleRotationRange() float64
SetParticleRotationRange(value float64)
// The speed at which a particle rotates, expressed in radians per second.
ParticleRotationSpeed() float64
SetParticleRotationSpeed(value float64)
// The average initial scale factor of a particle.
ParticleScale() float64
SetParticleScale(value float64)
// The range of allowed random values for a particle’s initial scale.
ParticleScaleRange() float64
SetParticleScaleRange(value float64)
// The rate at which a particle’s scale factor changes per second.
ParticleScaleSpeed() float64
SetParticleScaleSpeed(value float64)
// The sequence used to specify the scale factor of a particle over its lifetime.
ParticleScaleSequence() ISKKeyframeSequence
SetParticleScaleSequence(value ISKKeyframeSequence)
// The texture to use to render a particle.
ParticleTexture() ISKTexture
SetParticleTexture(value ISKTexture)
// The starting size of each particle.
ParticleSize() corefoundation.CGSize
SetParticleSize(value corefoundation.CGSize)
// The sequence used to specify the color components of a particle over its lifetime.
ParticleColorSequence() ISKKeyframeSequence
SetParticleColorSequence(value ISKKeyframeSequence)
// The average initial color for a particle.
ParticleColor() appkit.NSColor
SetParticleColor(value appkit.NSColor)
// The range of allowed random values for the alpha component of a particle’s initial color.
ParticleColorAlphaRange() float64
SetParticleColorAlphaRange(value float64)
// The range of allowed random values for the blue component of a particle’s initial color.
ParticleColorBlueRange() float64
SetParticleColorBlueRange(value float64)
// The range of allowed random values for the green component of a particle’s initial color.
ParticleColorGreenRange() float64
SetParticleColorGreenRange(value float64)
// The range of allowed random values for the red component of a particle’s initial color.
ParticleColorRedRange() float64
SetParticleColorRedRange(value float64)
// The rate at which the alpha component of a particle’s color changes per second.
ParticleColorAlphaSpeed() float64
SetParticleColorAlphaSpeed(value float64)
// The rate at which the blue component of a particle’s color changes per second.
ParticleColorBlueSpeed() float64
SetParticleColorBlueSpeed(value float64)
// The rate at which the green component of a particle’s color changes per second.
ParticleColorGreenSpeed() float64
SetParticleColorGreenSpeed(value float64)
// The rate at which the red component of a particle’s color changes per second.
ParticleColorRedSpeed() float64
SetParticleColorRedSpeed(value float64)
// The sequence used to specify the color blend factor of a particle over its lifetime.
ParticleColorBlendFactorSequence() ISKKeyframeSequence
SetParticleColorBlendFactorSequence(value ISKKeyframeSequence)
// The average starting value for the color blend factor.
ParticleColorBlendFactor() float64
SetParticleColorBlendFactor(value float64)
// The range of allowed random values for a particle’s starting color blend factor.
ParticleColorBlendFactorRange() float64
SetParticleColorBlendFactorRange(value float64)
// The rate at which the color blend factor changes per second.
ParticleColorBlendFactorSpeed() float64
SetParticleColorBlendFactorSpeed(value float64)
// The blending mode used to blend particles into the framebuffer.
ParticleBlendMode() SKBlendMode
SetParticleBlendMode(value SKBlendMode)
// The sequence used to specify the alpha value of a particle over its lifetime.
ParticleAlphaSequence() ISKKeyframeSequence
SetParticleAlphaSequence(value ISKKeyframeSequence)
// The average starting alpha value for a particle.
ParticleAlpha() float64
SetParticleAlpha(value float64)
// The range of allowed random values for a particle’s starting alpha value.
ParticleAlphaRange() float64
SetParticleAlphaRange(value float64)
// The rate at which the alpha value of a particle changes per second.
ParticleAlphaSpeed() float64
SetParticleAlphaSpeed(value float64)
// An action executed by new particles.
ParticleAction() ISKAction
SetParticleAction(value ISKAction)
// A mask that defines which categories of physics fields can exert forces on the particles.
FieldBitMask() uint32
SetFieldBitMask(value uint32)
// A custom shader used to determine how particles are rendered.
Shader() ISKShader
SetShader(value ISKShader)
// The values of each attribute associated with the node’s attached shader.
AttributeValues() foundation.INSDictionary
SetAttributeValues(value foundation.INSDictionary)
// Sets an attribute value for an attached shader.
SetValueForAttributeNamed(value ISKAttributeValue, key string)
// Gets the value of a shader attribute.
ValueForAttributeNamed(key string) ISKAttributeValue
}
An interface definition for the SKEmitterNode class.
Choosing Which Node in the Scene Emits Particles ¶
- ISKEmitterNode.TargetNode: The target node that renders the emitter’s particles.
- ISKEmitterNode.SetTargetNode
Controlling When Particles Are Created ¶
- ISKEmitterNode.AdvanceSimulationTime: Advances the emitter particle simulation.
- ISKEmitterNode.ResetSimulation: Removes all existing particles and restarts the simulation.
- ISKEmitterNode.ParticleBirthRate: The rate at which new particles are created.
- ISKEmitterNode.SetParticleBirthRate
- ISKEmitterNode.NumParticlesToEmit: The number of particles the emitter should emit before stopping.
- ISKEmitterNode.SetNumParticlesToEmit
Controlling the Rendering Order of an Emitter’s Particles ¶
- ISKEmitterNode.ParticleRenderOrder: The order in which the emitter’s particles are rendered.
- ISKEmitterNode.SetParticleRenderOrder
Controlling Particle Lifetime ¶
- ISKEmitterNode.ParticleLifetime: The average lifetime of a particle, in seconds.
- ISKEmitterNode.SetParticleLifetime
- ISKEmitterNode.ParticleLifetimeRange: The range of allowed random values for a particle’s lifetime.
- ISKEmitterNode.SetParticleLifetimeRange
Controlling Particle Position ¶
- ISKEmitterNode.ParticlePosition: The average starting position for a particle.
- ISKEmitterNode.SetParticlePosition
- ISKEmitterNode.ParticlePositionRange: The range of allowed random values for a particle’s position.
- ISKEmitterNode.SetParticlePositionRange
- ISKEmitterNode.ParticleZPosition: The average starting depth of a particle.
- ISKEmitterNode.SetParticleZPosition
Controlling Particle Velocity and Acceleration ¶
- ISKEmitterNode.ParticleSpeed: The average initial speed of a new particle, in points per second.
- ISKEmitterNode.SetParticleSpeed
- ISKEmitterNode.ParticleSpeedRange: The range of allowed random values for a particle’s initial speed.
- ISKEmitterNode.SetParticleSpeedRange
- ISKEmitterNode.EmissionAngle: The average initial direction of a particle, expressed as an angle in radians.
- ISKEmitterNode.SetEmissionAngle
- ISKEmitterNode.EmissionAngleRange: The range of allowed random values for a particle’s initial direction, expressed as an angle in radians.
- ISKEmitterNode.SetEmissionAngleRange
- ISKEmitterNode.XAcceleration: The acceleration to apply to a particle’s horizontal velocity.
- ISKEmitterNode.SetXAcceleration
- ISKEmitterNode.YAcceleration: The acceleration to apply to a particle’s vertical velocity.
- ISKEmitterNode.SetYAcceleration
Adjusting a Particle’s Rotation ¶
- ISKEmitterNode.ParticleRotation: The average initial rotation of a particle, expressed as an angle in radians.
- ISKEmitterNode.SetParticleRotation
- ISKEmitterNode.ParticleRotationRange: The range of allowed random values for a particle’s initial rotation, expressed as an angle in radians.
- ISKEmitterNode.SetParticleRotationRange
- ISKEmitterNode.ParticleRotationSpeed: The speed at which a particle rotates, expressed in radians per second.
- ISKEmitterNode.SetParticleRotationSpeed
Scaling Particles by a Factor ¶
- ISKEmitterNode.ParticleScale: The average initial scale factor of a particle.
- ISKEmitterNode.SetParticleScale
- ISKEmitterNode.ParticleScaleRange: The range of allowed random values for a particle’s initial scale.
- ISKEmitterNode.SetParticleScaleRange
- ISKEmitterNode.ParticleScaleSpeed: The rate at which a particle’s scale factor changes per second.
- ISKEmitterNode.SetParticleScaleSpeed
- ISKEmitterNode.ParticleScaleSequence: The sequence used to specify the scale factor of a particle over its lifetime.
- ISKEmitterNode.SetParticleScaleSequence
Changing a Particle’s Source Image and Size ¶
- ISKEmitterNode.ParticleTexture: The texture to use to render a particle.
- ISKEmitterNode.SetParticleTexture
- ISKEmitterNode.ParticleSize: The starting size of each particle.
- ISKEmitterNode.SetParticleSize
Configuring Particle Color ¶
- ISKEmitterNode.ParticleColorSequence: The sequence used to specify the color components of a particle over its lifetime.
- ISKEmitterNode.SetParticleColorSequence
- ISKEmitterNode.ParticleColor: The average initial color for a particle.
- ISKEmitterNode.SetParticleColor
- ISKEmitterNode.ParticleColorAlphaRange: The range of allowed random values for the alpha component of a particle’s initial color.
- ISKEmitterNode.SetParticleColorAlphaRange
- ISKEmitterNode.ParticleColorBlueRange: The range of allowed random values for the blue component of a particle’s initial color.
- ISKEmitterNode.SetParticleColorBlueRange
- ISKEmitterNode.ParticleColorGreenRange: The range of allowed random values for the green component of a particle’s initial color.
- ISKEmitterNode.SetParticleColorGreenRange
- ISKEmitterNode.ParticleColorRedRange: The range of allowed random values for the red component of a particle’s initial color.
- ISKEmitterNode.SetParticleColorRedRange
- ISKEmitterNode.ParticleColorAlphaSpeed: The rate at which the alpha component of a particle’s color changes per second.
- ISKEmitterNode.SetParticleColorAlphaSpeed
- ISKEmitterNode.ParticleColorBlueSpeed: The rate at which the blue component of a particle’s color changes per second.
- ISKEmitterNode.SetParticleColorBlueSpeed
- ISKEmitterNode.ParticleColorGreenSpeed: The rate at which the green component of a particle’s color changes per second.
- ISKEmitterNode.SetParticleColorGreenSpeed
- ISKEmitterNode.ParticleColorRedSpeed: The rate at which the red component of a particle’s color changes per second.
- ISKEmitterNode.SetParticleColorRedSpeed
Controlling How the Texture is Blended with Particle Color ¶
- ISKEmitterNode.ParticleColorBlendFactorSequence: The sequence used to specify the color blend factor of a particle over its lifetime.
- ISKEmitterNode.SetParticleColorBlendFactorSequence
- ISKEmitterNode.ParticleColorBlendFactor: The average starting value for the color blend factor.
- ISKEmitterNode.SetParticleColorBlendFactor
- ISKEmitterNode.ParticleColorBlendFactorRange: The range of allowed random values for a particle’s starting color blend factor.
- ISKEmitterNode.SetParticleColorBlendFactorRange
- ISKEmitterNode.ParticleColorBlendFactorSpeed: The rate at which the color blend factor changes per second.
- ISKEmitterNode.SetParticleColorBlendFactorSpeed
Blending Particles with the Framebuffer ¶
- ISKEmitterNode.ParticleBlendMode: The blending mode used to blend particles into the framebuffer.
- ISKEmitterNode.SetParticleBlendMode
- ISKEmitterNode.ParticleAlphaSequence: The sequence used to specify the alpha value of a particle over its lifetime.
- ISKEmitterNode.SetParticleAlphaSequence
- ISKEmitterNode.ParticleAlpha: The average starting alpha value for a particle.
- ISKEmitterNode.SetParticleAlpha
- ISKEmitterNode.ParticleAlphaRange: The range of allowed random values for a particle’s starting alpha value.
- ISKEmitterNode.SetParticleAlphaRange
- ISKEmitterNode.ParticleAlphaSpeed: The rate at which the alpha value of a particle changes per second.
- ISKEmitterNode.SetParticleAlphaSpeed
Animating Particles ¶
- ISKEmitterNode.ParticleAction: An action executed by new particles.
- ISKEmitterNode.SetParticleAction
Applying Physics Fields to the Particles ¶
- ISKEmitterNode.FieldBitMask: A mask that defines which categories of physics fields can exert forces on the particles.
- ISKEmitterNode.SetFieldBitMask
Taking Full Control of Particle Drawing with a Shader ¶
- ISKEmitterNode.Shader: A custom shader used to determine how particles are rendered.
- ISKEmitterNode.SetShader
- ISKEmitterNode.AttributeValues: The values of each attribute associated with the node’s attached shader.
- ISKEmitterNode.SetAttributeValues
- ISKEmitterNode.SetValueForAttributeNamed: Sets an attribute value for an attached shader.
- ISKEmitterNode.ValueForAttributeNamed: Gets the value of a shader attribute.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode
type ISKFieldNode ¶
type ISKFieldNode interface {
ISKNode
// A Boolean value that indicates whether the field is active.
IsEnabled() bool
SetEnabled(value bool)
// A Boolean value that indicates whether the field node should override all other field nodes that might otherwise affect physics bodies.
IsExclusive() bool
SetExclusive(value bool)
// The area (relative to the node’s origin) that the field affects.
Region() ISKRegion
SetRegion(value ISKRegion)
// The minimum value for distance-based effects.
MinimumRadius() float32
SetMinimumRadius(value float32)
// A mask that defines which categories this field belongs to.
CategoryBitMask() uint32
SetCategoryBitMask(value uint32)
// The strength of the field.
Strength() float32
SetStrength(value float32)
// The exponent that defines the rate of decay for the strength of the field as the distance increases between the node and the physics body being affected.
Falloff() float32
SetFalloff(value float32)
// The rate at which a noise or turbulence field node changes.
AnimationSpeed() float32
SetAnimationSpeed(value float32)
// The smoothness of the noise used to generate the forces.
Smoothness() float32
SetSmoothness(value float32)
// The direction of a velocity field node.
Direction() Vector_float3
SetDirection(value Vector_float3)
// A normal texture that specifies the velocities at different points in a velocity field node.
Texture() ISKTexture
SetTexture(value ISKTexture)
}
An interface definition for the SKFieldNode class.
Determining Which Physics Bodies Are Affected by the Field ¶
- ISKFieldNode.IsEnabled: A Boolean value that indicates whether the field is active.
- ISKFieldNode.SetEnabled
- ISKFieldNode.IsExclusive: A Boolean value that indicates whether the field node should override all other field nodes that might otherwise affect physics bodies.
- ISKFieldNode.SetExclusive
- ISKFieldNode.Region: The area (relative to the node’s origin) that the field affects.
- ISKFieldNode.SetRegion
- ISKFieldNode.MinimumRadius: The minimum value for distance-based effects.
- ISKFieldNode.SetMinimumRadius
- ISKFieldNode.CategoryBitMask: A mask that defines which categories this field belongs to.
- ISKFieldNode.SetCategoryBitMask
Configuring the Strength of the Field ¶
- ISKFieldNode.Strength: The strength of the field.
- ISKFieldNode.SetStrength
- ISKFieldNode.Falloff: The exponent that defines the rate of decay for the strength of the field as the distance increases between the node and the physics body being affected.
- ISKFieldNode.SetFalloff
Configuring Other Field Properties ¶
- ISKFieldNode.AnimationSpeed: The rate at which a noise or turbulence field node changes.
- ISKFieldNode.SetAnimationSpeed
- ISKFieldNode.Smoothness: The smoothness of the noise used to generate the forces.
- ISKFieldNode.SetSmoothness
- ISKFieldNode.Direction: The direction of a velocity field node.
- ISKFieldNode.SetDirection
- ISKFieldNode.Texture: A normal texture that specifies the velocities at different points in a velocity field node.
- ISKFieldNode.SetTexture
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode
type ISKKeyframeSequence ¶
type ISKKeyframeSequence interface {
objectivec.IObject
// Initializes a keyframe sequence with an initial set of values and times.
InitWithKeyframeValuesTimes(values foundation.INSArray, times []foundation.NSNumber) SKKeyframeSequence
// Initializes a new keyframe sequence.
InitWithCapacity(numItems uint) SKKeyframeSequence
InitWithCoder(aDecoder foundation.INSCoder) SKKeyframeSequence
// Adds a keyframe to the sequence.
AddKeyframeValueTime(value objectivec.IObject, time float64)
// Removes a keyframe from the sequence.
RemoveKeyframeAtIndex(index uint)
// Removes the last value in the sequence.
RemoveLastKeyframe()
// Changes the time for a specific keyframe.
SetKeyframeTimeForIndex(time float64, index uint)
// Changes the value for a specific keyframe.
SetKeyframeValueForIndex(value objectivec.IObject, index uint)
// Replaces a keyframe in the sequence with a new keyframe.
SetKeyframeValueTimeForIndex(value objectivec.IObject, time float64, index uint)
// Calculates the sample at a particular time.
SampleAtTime(time float64) objectivec.IObject
// The number of keyframes in the sequence.
Count() uint
// Gets the time for a keyframe in the sequence.
GetKeyframeTimeForIndex(index uint) float64
// Gets the value for a keyframe in the sequence.
GetKeyframeValueForIndex(index uint) objectivec.IObject
// The mode used to determine how values for times between the keyframes are calculated.
InterpolationMode() SKInterpolationMode
SetInterpolationMode(value SKInterpolationMode)
// The mode used to determine how the keyframe sequence repeats.
RepeatMode() SKRepeatMode
SetRepeatMode(value SKRepeatMode)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKKeyframeSequence class.
First Steps ¶
- ISKKeyframeSequence.InitWithKeyframeValuesTimes: Initializes a keyframe sequence with an initial set of values and times.
- ISKKeyframeSequence.InitWithCapacity: Initializes a new keyframe sequence.
- ISKKeyframeSequence.InitWithCoder
Sequence Building ¶
- ISKKeyframeSequence.AddKeyframeValueTime: Adds a keyframe to the sequence.
- ISKKeyframeSequence.RemoveKeyframeAtIndex: Removes a keyframe from the sequence.
- ISKKeyframeSequence.RemoveLastKeyframe: Removes the last value in the sequence.
- ISKKeyframeSequence.SetKeyframeTimeForIndex: Changes the time for a specific keyframe.
- ISKKeyframeSequence.SetKeyframeValueForIndex: Changes the value for a specific keyframe.
- ISKKeyframeSequence.SetKeyframeValueTimeForIndex: Replaces a keyframe in the sequence with a new keyframe.
Sequence Running ¶
- ISKKeyframeSequence.SampleAtTime: Calculates the sample at a particular time.
Sequence Information ¶
- ISKKeyframeSequence.Count: The number of keyframes in the sequence.
- ISKKeyframeSequence.GetKeyframeTimeForIndex: Gets the time for a keyframe in the sequence.
- ISKKeyframeSequence.GetKeyframeValueForIndex: Gets the value for a keyframe in the sequence.
Interpolation Modifiers ¶
- ISKKeyframeSequence.InterpolationMode: The mode used to determine how values for times between the keyframes are calculated.
- ISKKeyframeSequence.SetInterpolationMode
- ISKKeyframeSequence.RepeatMode: The mode used to determine how the keyframe sequence repeats.
- ISKKeyframeSequence.SetRepeatMode
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence
type ISKLabelNode ¶
type ISKLabelNode interface {
ISKNode
// Initializes a new label object with a specified font.
InitWithFontNamed(fontName string) SKLabelNode
// The string that the label node displays.
Text() string
SetText(value string)
// The attributed string displayed by the label.
AttributedText() foundation.NSAttributedString
SetAttributedText(value foundation.NSAttributedString)
// The color of the label.
FontColor() appkit.NSColor
SetFontColor(value appkit.NSColor)
// The font used for the text in the label.
FontName() string
SetFontName(value string)
// The size of the font used in the label.
FontSize() float64
SetFontSize(value float64)
// The vertical position of the text within the node.
VerticalAlignmentMode() SKLabelVerticalAlignmentMode
SetVerticalAlignmentMode(value SKLabelVerticalAlignmentMode)
// The horizontal position of the text within the node.
HorizontalAlignmentMode() SKLabelHorizontalAlignmentMode
SetHorizontalAlignmentMode(value SKLabelHorizontalAlignmentMode)
// The width, in screen points, after which line-break mode should be applied.
PreferredMaxLayoutWidth() float64
SetPreferredMaxLayoutWidth(value float64)
// Determines the line-break mode for multiple lines.
LineBreakMode() appkit.NSLineBreakMode
SetLineBreakMode(value appkit.NSLineBreakMode)
// Determines the number of lines to draw.
NumberOfLines() int
SetNumberOfLines(value int)
// An alternative to the font color that can be used for animations.
Color() appkit.NSColor
SetColor(value appkit.NSColor)
// A floating-point value that describes how the color is blended with the font color.
ColorBlendFactor() float64
SetColorBlendFactor(value float64)
// The blend mode used to draw the label into the parent’s framebuffer.
BlendMode() SKBlendMode
SetBlendMode(value SKBlendMode)
}
An interface definition for the SKLabelNode class.
Creating a Label ¶
- ISKLabelNode.InitWithFontNamed: Initializes a new label object with a specified font.
Setting a Label’s Text ¶
- ISKLabelNode.Text: The string that the label node displays.
- ISKLabelNode.SetText
- ISKLabelNode.AttributedText: The attributed string displayed by the label.
- ISKLabelNode.SetAttributedText
Specifying a Label’s Font ¶
- ISKLabelNode.FontColor: The color of the label.
- ISKLabelNode.SetFontColor
- ISKLabelNode.FontName: The font used for the text in the label.
- ISKLabelNode.SetFontName
- ISKLabelNode.FontSize: The size of the font used in the label.
- ISKLabelNode.SetFontSize
Controlling a Label’s Alignment ¶
- ISKLabelNode.VerticalAlignmentMode: The vertical position of the text within the node.
- ISKLabelNode.SetVerticalAlignmentMode
- ISKLabelNode.HorizontalAlignmentMode: The horizontal position of the text within the node.
- ISKLabelNode.SetHorizontalAlignmentMode
Defining a Label’s Line-Breaking Behavior ¶
- ISKLabelNode.PreferredMaxLayoutWidth: The width, in screen points, after which line-break mode should be applied.
- ISKLabelNode.SetPreferredMaxLayoutWidth
- ISKLabelNode.LineBreakMode: Determines the line-break mode for multiple lines.
- ISKLabelNode.SetLineBreakMode
- ISKLabelNode.NumberOfLines: Determines the number of lines to draw.
- ISKLabelNode.SetNumberOfLines
Colorizing a Label ¶
- ISKLabelNode.Color: An alternative to the font color that can be used for animations.
- ISKLabelNode.SetColor
- ISKLabelNode.ColorBlendFactor: A floating-point value that describes how the color is blended with the font color.
- ISKLabelNode.SetColorBlendFactor
Configuring Alpha Blending ¶
- ISKLabelNode.BlendMode: The blend mode used to draw the label into the parent’s framebuffer.
- ISKLabelNode.SetBlendMode
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode
type ISKLightNode ¶
type ISKLightNode interface {
ISKNode
// A Boolean value that indicates whether the node is casting light.
IsEnabled() bool
SetEnabled(value bool)
// A mask that defines which categories this light belongs to.
CategoryBitMask() uint32
SetCategoryBitMask(value uint32)
// The ambient color of the light.
AmbientColor() appkit.NSColor
SetAmbientColor(value appkit.NSColor)
// The diffuse and specular color of the light source.
LightColor() appkit.NSColor
SetLightColor(value appkit.NSColor)
// The color of any shadow cast by a sprite.
ShadowColor() appkit.NSColor
SetShadowColor(value appkit.NSColor)
// The exponent for the rate of decay of the light source.
Falloff() float64
SetFalloff(value float64)
}
An interface definition for the SKLightNode class.
Determining Whether a Light Node Is Active ¶
- ISKLightNode.IsEnabled: A Boolean value that indicates whether the node is casting light.
- ISKLightNode.SetEnabled
- ISKLightNode.CategoryBitMask: A mask that defines which categories this light belongs to.
- ISKLightNode.SetCategoryBitMask
Configuring the Lighting Properties ¶
- ISKLightNode.AmbientColor: The ambient color of the light.
- ISKLightNode.SetAmbientColor
- ISKLightNode.LightColor: The diffuse and specular color of the light source.
- ISKLightNode.SetLightColor
- ISKLightNode.ShadowColor: The color of any shadow cast by a sprite.
- ISKLightNode.SetShadowColor
- ISKLightNode.Falloff: The exponent for the rate of decay of the light source.
- ISKLightNode.SetFalloff
See: https://developer.apple.com/documentation/SpriteKit/SKLightNode
type ISKMutableTexture ¶
type ISKMutableTexture interface {
ISKTexture
// Initializes an empty texture with a specific size and format.
InitWithSizePixelFormat(size corefoundation.CGSize, format int32) SKMutableTexture
// Initializes an empty texture with a specific size.
InitWithSize(size corefoundation.CGSize) SKMutableTexture
// Modifies the contents of a mutable texture.
ModifyPixelDataWithBlock(block UnsafePointerUintptrHandler)
}
An interface definition for the SKMutableTexture class.
Creating an Empty Mutable Texture ¶
- ISKMutableTexture.InitWithSizePixelFormat: Initializes an empty texture with a specific size and format.
- ISKMutableTexture.InitWithSize: Initializes an empty texture with a specific size.
Modifying a Mutable Texture’s Contents ¶
- ISKMutableTexture.ModifyPixelDataWithBlock: Modifies the contents of a mutable texture.
See: https://developer.apple.com/documentation/SpriteKit/SKMutableTexture
type ISKNode ¶
type ISKNode interface {
objectivec.IObject
// Called when a node is initialized from an .sks file.
InitWithCoder(aDecoder foundation.INSCoder) SKNode
// The position of the node in its parent’s coordinate system.
Position() corefoundation.CGPoint
SetPosition(value corefoundation.CGPoint)
// A rectangle in the parent’s coordinate system that contains the node’s content, ignoring the node’s children.
Frame() corefoundation.CGRect
// Returns a rectangle in the parent’s coordinate system that contains the position and size of itself and all child nodes.
CalculateAccumulatedFrame() corefoundation.CGRect
// The height of the node relative to its parent.
ZPosition() float64
SetZPosition(value float64)
// The Euler rotation about the z axis (in radians).
ZRotation() float64
SetZRotation(value float64)
// Sets the [xScale](<https://developer.apple.com/documentation/SpriteKit/SKNode/xScale>) and [yScale](<https://developer.apple.com/documentation/SpriteKit/SKNode/yScale>) properties of the node.
SetScale(scale float64)
// A scaling factor that multiplies the width of a node and its children.
XScale() float64
SetXScale(value float64)
// A scaling factor that multiplies the height of a node and its children.
YScale() float64
SetYScale(value float64)
// The scene node that contains this node.
Scene() ISKScene
// The node’s parent node.
Parent() ISKNode
// The node’s children.
Children() []SKNode
// Adds a node to the end of the receiver’s list of child nodes.
AddChild(node ISKNode)
// Inserts a node into a specific position in the receiver’s list of child nodes.
InsertChildAtIndex(node ISKNode, index int)
// Compares the parameter node to the receiving node.
IsEqualToNode(node ISKNode) bool
// Moves the node to a new parent node in the scene.
MoveToParent(parent ISKNode)
// Removes the receiving node from its parent.
RemoveFromParent()
// Removes all of the node’s children.
RemoveAllChildren()
// Removes a list of children from the receiving node.
RemoveChildrenInArray(nodes []SKNode)
// Returns a Boolean value that indicates whether the node is a descendant of the target node.
InParentHierarchy(parent ISKNode) bool
// The node’s assignable name.
Name() string
SetName(value string)
// Searches the children of the receiving node for a node with a specific name.
ChildNodeWithName(name string) ISKNode
// Searches the children of the receiving node to perform processing for nodes that share a name.
EnumerateChildNodesWithNameUsingBlock(name string, block SKNodeBoolHandler)
// Returns an array of nodes that match the name parameter.
ObjectForKeyedSubscript(name string) []SKNode
// The transparency value applied to the node’s contents.
Alpha() float64
SetAlpha(value float64)
// A Boolean value that determines whether a node and its descendants are rendered.
IsHidden() bool
SetHidden(value bool)
// Adds an action to the list of actions executed by the node.
RunAction(action ISKAction)
// Adds an action to the list of actions executed by the node and schedules the argument block to be run upon completion of the action.
RunActionCompletion(action ISKAction, block VoidHandler)
// Adds an identifiable action to the list of actions executed by the node.
RunActionWithKey(action ISKAction, key string)
// A speed modifier applied to all actions executed by a node and its descendants.
Speed() float64
SetSpeed(value float64)
// A Boolean value that determines whether actions on the node and its descendants are processed.
IsPaused() bool
SetPaused(value bool)
// Returns an action associated with a specific key.
ActionForKey(key string) ISKAction
// Returns a Boolean value that indicates whether the node is executing actions.
HasActions() bool
// Ends and removes all actions from the node.
RemoveAllActions()
// Removes an action associated with a specific key.
RemoveActionForKey(key string)
// The physics body associated with the node.
PhysicsBody() ISKPhysicsBody
SetPhysicsBody(value ISKPhysicsBody)
// A list of constraints to apply to the node.
Constraints() []SKConstraint
SetConstraints(value []SKConstraint)
// The reach constraints to apply to the node when executing a reach action.
ReachConstraints() ISKReachConstraints
SetReachConstraints(value ISKReachConstraints)
// Returns a Boolean value that indicates whether this node intersects the specified node.
IntersectsNode(node ISKNode) bool
// The GameplayKit entity this node represents.
Entity() objectivec.IObject
SetEntity(value objectivec.IObject)
// A Boolean value that indicates whether the node receives touch events.
IsUserInteractionEnabled() bool
SetUserInteractionEnabled(value bool)
// Returns a Boolean value that indicates whether a point lies inside the parent’s coordinate system.
ContainsPoint(p corefoundation.CGPoint) bool
// Returns the deepest visible descendant that intersects a point.
NodeAtPoint(p corefoundation.CGPoint) ISKNode
// Returns an array of all visible descendants that intersect a point.
NodesAtPoint(p corefoundation.CGPoint) []SKNode
// Converts a point from the coordinate system of another node in the node tree to the coordinate system of this node.
ConvertPointFromNode(point corefoundation.CGPoint, node ISKNode) corefoundation.CGPoint
// Converts a point in this node’s coordinate system to the coordinate system of another node in the node tree.
ConvertPointToNode(point corefoundation.CGPoint, node ISKNode) corefoundation.CGPoint
// A dictionary containing arbitrary data.
UserData() foundation.INSDictionary
SetUserData(value foundation.INSDictionary)
// An array of user interface elements that represent children of this element.
AccessibilityChildren() foundation.INSArray
SetAccessibilityChildren(value foundation.INSArray)
// The size of this user interface element, in screen points.
AccessibilityFrame() corefoundation.CGRect
SetAccessibilityFrame(value corefoundation.CGRect)
// The help description of this user interface element; for example, the text shown in a tooltip.
AccessibilityHelp() string
SetAccessibilityHelp(value string)
// A short description of this user interface element.
AccessibilityLabel() string
SetAccessibilityLabel(value string)
// The user interface element that contains this element.
AccessibilityParent() objectivec.IObject
SetAccessibilityParent(value objectivec.IObject)
// A string value describing the user interface element type; for example, a button.
AccessibilityRole() string
SetAccessibilityRole(value string)
// A string value describing the user interface element name and type; for example, the Buy button.
AccessibilityRoleDescription() string
SetAccessibilityRoleDescription(value string)
// A string that defines this user interface element’s subrole; for example, a full-screen button.
AccessibilitySubrole() string
SetAccessibilitySubrole(value string)
// A toggle you implement to indicate to the system whether this user interface element should be exposed to the user.
IsAccessibilityElement() bool
SetAccessibilityElement(value bool)
// A toggle you implement to indicate to the system whether this user interface element should respond to user input.
IsAccessibilityEnabled() bool
SetAccessibilityEnabled(value bool)
// Returns the frontmost user interface element in the element hierarchy.
AccessibilityHitTest(point corefoundation.CGPoint) objectivec.IObject
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKNode class.
First Steps ¶
- ISKNode.InitWithCoder: Called when a node is initialized from an .sks file.
Positioning Content in a Scene ¶
- ISKNode.Position: The position of the node in its parent’s coordinate system.
- ISKNode.SetPosition
Querying the Content Size ¶
- ISKNode.Frame: A rectangle in the parent’s coordinate system that contains the node’s content, ignoring the node’s children.
- ISKNode.CalculateAccumulatedFrame: Returns a rectangle in the parent’s coordinate system that contains the position and size of itself and all child nodes.
Configuring Draw Order ¶
- ISKNode.ZPosition: The height of the node relative to its parent.
- ISKNode.SetZPosition
Scaling and Rotating ¶
- ISKNode.ZRotation: The Euler rotation about the z axis (in radians).
- ISKNode.SetZRotation
- ISKNode.SetScale: Sets the [xScale](<https://developer.apple.com/documentation/SpriteKit/SKNode/xScale>) and [yScale](<https://developer.apple.com/documentation/SpriteKit/SKNode/yScale>) properties of the node.
- ISKNode.XScale: A scaling factor that multiplies the width of a node and its children.
- ISKNode.SetXScale
- ISKNode.YScale: A scaling factor that multiplies the height of a node and its children.
- ISKNode.SetYScale
Accessing Related Nodes ¶
- ISKNode.Scene: The scene node that contains this node.
- ISKNode.Parent: The node’s parent node.
- ISKNode.Children: The node’s children.
Modifying the Node Tree ¶
- ISKNode.AddChild: Adds a node to the end of the receiver’s list of child nodes.
- ISKNode.InsertChildAtIndex: Inserts a node into a specific position in the receiver’s list of child nodes.
- ISKNode.IsEqualToNode: Compares the parameter node to the receiving node.
- ISKNode.MoveToParent: Moves the node to a new parent node in the scene.
- ISKNode.RemoveFromParent: Removes the receiving node from its parent.
- ISKNode.RemoveAllChildren: Removes all of the node’s children.
- ISKNode.RemoveChildrenInArray: Removes a list of children from the receiving node.
- ISKNode.InParentHierarchy: Returns a Boolean value that indicates whether the node is a descendant of the target node.
Accessing Nodes by Name ¶
- ISKNode.Name: The node’s assignable name.
- ISKNode.SetName
- ISKNode.ChildNodeWithName: Searches the children of the receiving node for a node with a specific name.
- ISKNode.EnumerateChildNodesWithNameUsingBlock: Searches the children of the receiving node to perform processing for nodes that share a name.
- ISKNode.ObjectForKeyedSubscript: Returns an array of nodes that match the name parameter.
Altering Node Visibility ¶
- ISKNode.Alpha: The transparency value applied to the node’s contents.
- ISKNode.SetAlpha
- ISKNode.IsHidden: A Boolean value that determines whether a node and its descendants are rendered.
- ISKNode.SetHidden
Running Actions ¶
- ISKNode.RunAction: Adds an action to the list of actions executed by the node.
- ISKNode.RunActionCompletion: Adds an action to the list of actions executed by the node and schedules the argument block to be run upon completion of the action.
- ISKNode.RunActionWithKey: Adds an identifiable action to the list of actions executed by the node.
- ISKNode.Speed: A speed modifier applied to all actions executed by a node and its descendants.
- ISKNode.SetSpeed
- ISKNode.IsPaused: A Boolean value that determines whether actions on the node and its descendants are processed.
- ISKNode.SetPaused
- ISKNode.ActionForKey: Returns an action associated with a specific key.
- ISKNode.HasActions: Returns a Boolean value that indicates whether the node is executing actions.
- ISKNode.RemoveAllActions: Ends and removes all actions from the node.
- ISKNode.RemoveActionForKey: Removes an action associated with a specific key.
Adding Physics Behaviors ¶
- ISKNode.PhysicsBody: The physics body associated with the node.
- ISKNode.SetPhysicsBody
Constraining Node Position or Rotation ¶
- ISKNode.Constraints: A list of constraints to apply to the node.
- ISKNode.SetConstraints
- ISKNode.ReachConstraints: The reach constraints to apply to the node when executing a reach action.
- ISKNode.SetReachConstraints
Detecting Collisions Manually ¶
- ISKNode.IntersectsNode: Returns a Boolean value that indicates whether this node intersects the specified node.
Adding GameplayKit Behaviors ¶
- ISKNode.Entity: The GameplayKit entity this node represents.
- ISKNode.SetEntity
Handling User Input ¶
- ISKNode.IsUserInteractionEnabled: A Boolean value that indicates whether the node receives touch events.
- ISKNode.SetUserInteractionEnabled
Hit Testing ¶
- ISKNode.ContainsPoint: Returns a Boolean value that indicates whether a point lies inside the parent’s coordinate system.
- ISKNode.NodeAtPoint: Returns the deepest visible descendant that intersects a point.
- ISKNode.NodesAtPoint: Returns an array of all visible descendants that intersect a point.
Converting Between Coordinate Systems of Different Nodes ¶
- ISKNode.ConvertPointFromNode: Converts a point from the coordinate system of another node in the node tree to the coordinate system of this node.
- ISKNode.ConvertPointToNode: Converts a point in this node’s coordinate system to the coordinate system of another node in the node tree.
Adding Custom Data Without Subclassing ¶
- ISKNode.UserData: A dictionary containing arbitrary data.
- ISKNode.SetUserData
Providing Accessibility ¶
- ISKNode.AccessibilityChildren: An array of user interface elements that represent children of this element.
- ISKNode.SetAccessibilityChildren
- ISKNode.AccessibilityFrame: The size of this user interface element, in screen points.
- ISKNode.SetAccessibilityFrame
- ISKNode.AccessibilityHelp: The help description of this user interface element; for example, the text shown in a tooltip.
- ISKNode.SetAccessibilityHelp
- ISKNode.AccessibilityLabel: A short description of this user interface element.
- ISKNode.SetAccessibilityLabel
- ISKNode.AccessibilityParent: The user interface element that contains this element.
- ISKNode.SetAccessibilityParent
- ISKNode.AccessibilityRole: A string value describing the user interface element type; for example, a button.
- ISKNode.SetAccessibilityRole
- ISKNode.AccessibilityRoleDescription: A string value describing the user interface element name and type; for example, the Buy button.
- ISKNode.SetAccessibilityRoleDescription
- ISKNode.AccessibilitySubrole: A string that defines this user interface element’s subrole; for example, a full-screen button.
- ISKNode.SetAccessibilitySubrole
- ISKNode.IsAccessibilityElement: A toggle you implement to indicate to the system whether this user interface element should be exposed to the user.
- ISKNode.SetAccessibilityElement
- ISKNode.IsAccessibilityEnabled: A toggle you implement to indicate to the system whether this user interface element should respond to user input.
- ISKNode.SetAccessibilityEnabled
- ISKNode.AccessibilityHitTest: Returns the frontmost user interface element in the element hierarchy.
See: https://developer.apple.com/documentation/SpriteKit/SKNode
type ISKPhysicsBody ¶
type ISKPhysicsBody interface {
objectivec.IObject
// A Boolean value that indicates whether this physics body is affected by the physics world’s gravity.
AffectedByGravity() bool
SetAffectedByGravity(value bool)
// A Boolean value that indicates whether the physics body is affected by angular forces and impulses applied to it.
AllowsRotation() bool
SetAllowsRotation(value bool)
// A Boolean value that indicates whether the physics body is moved by the physics simulation.
IsDynamic() bool
SetDynamic(value bool)
// The mass of the body, in kilograms.
Mass() float64
SetMass(value float64)
// The density of the object, in kilograms per square meter.
Density() float64
SetDensity(value float64)
// The area covered by the body.
Area() float64
// The roughness of the surface of the physics body.
Friction() float64
SetFriction(value float64)
// The bounciness of the physics body.
Restitution() float64
SetRestitution(value float64)
// A property that reduces the body’s linear velocity.
LinearDamping() float64
SetLinearDamping(value float64)
// A property that reduces the body’s rotational velocity.
AngularDamping() float64
SetAngularDamping(value float64)
// A mask that defines which categories this physics body belongs to.
CategoryBitMask() uint32
SetCategoryBitMask(value uint32)
// A mask that defines which categories of physics bodies can collide with this physics body.
CollisionBitMask() uint32
SetCollisionBitMask(value uint32)
// A Boolean value that determines whether the physics world uses an iterative collision detection algorithm.
UsesPreciseCollisionDetection() bool
SetUsesPreciseCollisionDetection(value bool)
// A mask that defines which categories of physics bodies cause intersection notifications with this physics body.
ContactTestBitMask() uint32
SetContactTestBitMask(value uint32)
// The physics bodies that this physics body is in contact with.
AllContactedBodies() []SKPhysicsBody
// Applies a force to the center of gravity of a physics body.
ApplyForce(force corefoundation.CGVector)
// Applies torque to an object.
ApplyTorque(torque float64)
// Applies a force to a specific point of a physics body.
ApplyForceAtPoint(force corefoundation.CGVector, point corefoundation.CGPoint)
// Applies an impulse to the center of gravity of a physics body.
ApplyImpulse(impulse corefoundation.CGVector)
// Applies an impulse that imparts angular momentum to an object.
ApplyAngularImpulse(impulse float64)
// Applies an impulse to a specific point of a physics body.
ApplyImpulseAtPoint(impulse corefoundation.CGVector, point corefoundation.CGPoint)
// The physics body’s velocity vector, measured in meters per second.
Velocity() corefoundation.CGVector
SetVelocity(value corefoundation.CGVector)
// The physics body’s angular speed.
AngularVelocity() float64
SetAngularVelocity(value float64)
// A Boolean property that indicates whether the object is at rest within the physics simulation.
IsResting() bool
SetResting(value bool)
// The node that this body is connected to.
Node() ISKNode
// The joints connected to this physics body.
Joints() []SKPhysicsJoint
// A mask that defines which categories of physics fields can exert forces on this physics body.
FieldBitMask() uint32
SetFieldBitMask(value uint32)
// The electrical charge of the physics body.
Charge() float64
SetCharge(value float64)
// A Boolean value that indicates whether the physics body’s node is pinned to its parent node.
Pinned() bool
SetPinned(value bool)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKPhysicsBody class.
Defining How Forces Affect a Physics Body ¶
- ISKPhysicsBody.AffectedByGravity: A Boolean value that indicates whether this physics body is affected by the physics world’s gravity.
- ISKPhysicsBody.SetAffectedByGravity
- ISKPhysicsBody.AllowsRotation: A Boolean value that indicates whether the physics body is affected by angular forces and impulses applied to it.
- ISKPhysicsBody.SetAllowsRotation
- ISKPhysicsBody.IsDynamic: A Boolean value that indicates whether the physics body is moved by the physics simulation.
- ISKPhysicsBody.SetDynamic
Defining a Physics Body’s Physical Properties ¶
- ISKPhysicsBody.Mass: The mass of the body, in kilograms.
- ISKPhysicsBody.SetMass
- ISKPhysicsBody.Density: The density of the object, in kilograms per square meter.
- ISKPhysicsBody.SetDensity
- ISKPhysicsBody.Area: The area covered by the body.
- ISKPhysicsBody.Friction: The roughness of the surface of the physics body.
- ISKPhysicsBody.SetFriction
- ISKPhysicsBody.Restitution: The bounciness of the physics body.
- ISKPhysicsBody.SetRestitution
- ISKPhysicsBody.LinearDamping: A property that reduces the body’s linear velocity.
- ISKPhysicsBody.SetLinearDamping
- ISKPhysicsBody.AngularDamping: A property that reduces the body’s rotational velocity.
- ISKPhysicsBody.SetAngularDamping
Working with Collisions and Contacts ¶
- ISKPhysicsBody.CategoryBitMask: A mask that defines which categories this physics body belongs to.
- ISKPhysicsBody.SetCategoryBitMask
- ISKPhysicsBody.CollisionBitMask: A mask that defines which categories of physics bodies can collide with this physics body.
- ISKPhysicsBody.SetCollisionBitMask
- ISKPhysicsBody.UsesPreciseCollisionDetection: A Boolean value that determines whether the physics world uses an iterative collision detection algorithm.
- ISKPhysicsBody.SetUsesPreciseCollisionDetection
- ISKPhysicsBody.ContactTestBitMask: A mask that defines which categories of physics bodies cause intersection notifications with this physics body.
- ISKPhysicsBody.SetContactTestBitMask
- ISKPhysicsBody.AllContactedBodies: The physics bodies that this physics body is in contact with.
Applying Forces and Impulses to a Physics Body ¶
- ISKPhysicsBody.ApplyForce: Applies a force to the center of gravity of a physics body.
- ISKPhysicsBody.ApplyTorque: Applies torque to an object.
- ISKPhysicsBody.ApplyForceAtPoint: Applies a force to a specific point of a physics body.
- ISKPhysicsBody.ApplyImpulse: Applies an impulse to the center of gravity of a physics body.
- ISKPhysicsBody.ApplyAngularImpulse: Applies an impulse that imparts angular momentum to an object.
- ISKPhysicsBody.ApplyImpulseAtPoint: Applies an impulse to a specific point of a physics body.
Inspecting a Physics Body’s Position and Velocity ¶
- ISKPhysicsBody.Velocity: The physics body’s velocity vector, measured in meters per second.
- ISKPhysicsBody.SetVelocity
- ISKPhysicsBody.AngularVelocity: The physics body’s angular speed.
- ISKPhysicsBody.SetAngularVelocity
- ISKPhysicsBody.IsResting: A Boolean property that indicates whether the object is at rest within the physics simulation.
- ISKPhysicsBody.SetResting
Reading a Physics Body’s Node ¶
- ISKPhysicsBody.Node: The node that this body is connected to.
Determining Which Joints Are Connected to a Physics Body ¶
- ISKPhysicsBody.Joints: The joints connected to this physics body.
Interacting with Physics Fields ¶
- ISKPhysicsBody.FieldBitMask: A mask that defines which categories of physics fields can exert forces on this physics body.
- ISKPhysicsBody.SetFieldBitMask
- ISKPhysicsBody.Charge: The electrical charge of the physics body.
- ISKPhysicsBody.SetCharge
Pinning a Physics Body to a Node’s Parent ¶
- ISKPhysicsBody.Pinned: A Boolean value that indicates whether the physics body’s node is pinned to its parent node.
- ISKPhysicsBody.SetPinned
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody
type ISKPhysicsContact ¶
type ISKPhysicsContact interface {
objectivec.IObject
// The first body in the contact.
BodyA() ISKPhysicsBody
// The second body in the contact.
BodyB() ISKPhysicsBody
// The contact point between the two physics bodies, in scene coordinates.
ContactPoint() corefoundation.CGPoint
// The impulse that specifies how hard these two bodies struck each other in Newton-seconds.
CollisionImpulse() float64
// The normal vector specifying the direction of the collision.
ContactNormal() corefoundation.CGVector
}
An interface definition for the SKPhysicsContact class.
Inspecting the Contact Properties ¶
- ISKPhysicsContact.BodyA: The first body in the contact.
- ISKPhysicsContact.BodyB: The second body in the contact.
- ISKPhysicsContact.ContactPoint: The contact point between the two physics bodies, in scene coordinates.
- ISKPhysicsContact.CollisionImpulse: The impulse that specifies how hard these two bodies struck each other in Newton-seconds.
- ISKPhysicsContact.ContactNormal: The normal vector specifying the direction of the collision.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsContact
type ISKPhysicsJoint ¶
type ISKPhysicsJoint interface {
objectivec.IObject
// The first body connected by the joint.
BodyA() ISKPhysicsBody
SetBodyA(value ISKPhysicsBody)
// The second body connected by the joint.
BodyB() ISKPhysicsBody
SetBodyB(value ISKPhysicsBody)
// The instantaneous reaction force, in newtons, currently being directed at the anchor point.
ReactionForce() corefoundation.CGVector
// Instantaneous reaction torque, in newton-meters, currently being directed at the anchor point.
ReactionTorque() float64
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKPhysicsJoint class.
Accessing or Setting a Joint’s Bodies ¶
- ISKPhysicsJoint.BodyA: The first body connected by the joint.
- ISKPhysicsJoint.SetBodyA
- ISKPhysicsJoint.BodyB: The second body connected by the joint.
- ISKPhysicsJoint.SetBodyB
Reading the Stress and Speed that Are Currently Applied to a Joint ¶
- ISKPhysicsJoint.ReactionForce: The instantaneous reaction force, in newtons, currently being directed at the anchor point.
- ISKPhysicsJoint.ReactionTorque: Instantaneous reaction torque, in newton-meters, currently being directed at the anchor point.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJoint
type ISKPhysicsJointFixed ¶
type ISKPhysicsJointFixed interface {
ISKPhysicsJoint
}
An interface definition for the SKPhysicsJointFixed class.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointFixed
type ISKPhysicsJointLimit ¶
type ISKPhysicsJointLimit interface {
ISKPhysicsJoint
// The maximum distance allowed between the two physics bodies connected by the limit joint.
MaxLength() float64
SetMaxLength(value float64)
}
An interface definition for the SKPhysicsJointLimit class.
Configuring a Limit Joint ¶
- ISKPhysicsJointLimit.MaxLength: The maximum distance allowed between the two physics bodies connected by the limit joint.
- ISKPhysicsJointLimit.SetMaxLength
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointLimit
type ISKPhysicsJointPin ¶
type ISKPhysicsJointPin interface {
ISKPhysicsJoint
// The speed, in radians per second, at which the physics bodies are driven around the pin joint.
RotationSpeed() float64
SetRotationSpeed(value float64)
// A Boolean value that indicates whether the pin joint’s rotation is limited to a specific range of values.
ShouldEnableLimits() bool
SetShouldEnableLimits(value bool)
// The smallest angle allowed for the pin joint, in radians.
LowerAngleLimit() float64
SetLowerAngleLimit(value float64)
// The largest angle allowed for the pin joint, in radians.
UpperAngleLimit() float64
SetUpperAngleLimit(value float64)
// The resistance applied by the pin joint to spinning around the anchor point.
FrictionTorque() float64
SetFrictionTorque(value float64)
}
An interface definition for the SKPhysicsJointPin class.
Configuring a Pin Joint ¶
- ISKPhysicsJointPin.RotationSpeed: The speed, in radians per second, at which the physics bodies are driven around the pin joint.
- ISKPhysicsJointPin.SetRotationSpeed
- ISKPhysicsJointPin.ShouldEnableLimits: A Boolean value that indicates whether the pin joint’s rotation is limited to a specific range of values.
- ISKPhysicsJointPin.SetShouldEnableLimits
- ISKPhysicsJointPin.LowerAngleLimit: The smallest angle allowed for the pin joint, in radians.
- ISKPhysicsJointPin.SetLowerAngleLimit
- ISKPhysicsJointPin.UpperAngleLimit: The largest angle allowed for the pin joint, in radians.
- ISKPhysicsJointPin.SetUpperAngleLimit
- ISKPhysicsJointPin.FrictionTorque: The resistance applied by the pin joint to spinning around the anchor point.
- ISKPhysicsJointPin.SetFrictionTorque
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointPin
type ISKPhysicsJointSliding ¶
type ISKPhysicsJointSliding interface {
ISKPhysicsJoint
// A Boolean value that indicates whether the sliding joint is restricted so that the objects may only slide a finite distance from the initial anchor point.
ShouldEnableLimits() bool
SetShouldEnableLimits(value bool)
// The smallest distance allowed for the sliding joint.
LowerDistanceLimit() float64
SetLowerDistanceLimit(value float64)
// The largest distance allowed for the sliding joint.
UpperDistanceLimit() float64
SetUpperDistanceLimit(value float64)
}
An interface definition for the SKPhysicsJointSliding class.
Configuring a Sliding Joint ¶
- ISKPhysicsJointSliding.ShouldEnableLimits: A Boolean value that indicates whether the sliding joint is restricted so that the objects may only slide a finite distance from the initial anchor point.
- ISKPhysicsJointSliding.SetShouldEnableLimits
- ISKPhysicsJointSliding.LowerDistanceLimit: The smallest distance allowed for the sliding joint.
- ISKPhysicsJointSliding.SetLowerDistanceLimit
- ISKPhysicsJointSliding.UpperDistanceLimit: The largest distance allowed for the sliding joint.
- ISKPhysicsJointSliding.SetUpperDistanceLimit
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointSliding
type ISKPhysicsJointSpring ¶
type ISKPhysicsJointSpring interface {
ISKPhysicsJoint
// Defines how the spring’s motion should be damped due to the forces of friction.
Damping() float64
SetDamping(value float64)
// Defines the frequency or stiffness characteristics of the spring.
Frequency() float64
SetFrequency(value float64)
}
An interface definition for the SKPhysicsJointSpring class.
Configuring a Spring Joint ¶
- ISKPhysicsJointSpring.Damping: Defines how the spring’s motion should be damped due to the forces of friction.
- ISKPhysicsJointSpring.SetDamping
- ISKPhysicsJointSpring.Frequency: Defines the frequency or stiffness characteristics of the spring.
- ISKPhysicsJointSpring.SetFrequency
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointSpring
type ISKPhysicsWorld ¶
type ISKPhysicsWorld interface {
objectivec.IObject
// A vector that specifies the gravitational acceleration applied to physics bodies in the physics world.
Gravity() corefoundation.CGVector
SetGravity(value corefoundation.CGVector)
// The rate at which the simulation executes.
Speed() float64
SetSpeed(value float64)
// Adds a joint to the physics world.
AddJoint(joint ISKPhysicsJoint)
// Removes all joints from the physics world.
RemoveAllJoints()
// Removes a specific joint from the physics world.
RemoveJoint(joint ISKPhysicsJoint)
// A delegate that is called when two physics bodies come in contact with each other.
ContactDelegate() SKPhysicsContactDelegate
SetContactDelegate(value SKPhysicsContactDelegate)
// Searches for the first physics body that intersects a ray.
BodyAlongRayStartEnd(start corefoundation.CGPoint, end corefoundation.CGPoint) ISKPhysicsBody
// Searches for the first physics body that contains a point.
BodyAtPoint(point corefoundation.CGPoint) ISKPhysicsBody
// Searches for the first physics body that intersects the specified rectangle.
BodyInRect(rect corefoundation.CGRect) ISKPhysicsBody
// Enumerates all the physics bodies in the scene that intersect a ray.
EnumerateBodiesAlongRayStartEndUsingBlock(start corefoundation.CGPoint, end corefoundation.CGPoint, block SKPhysicsBodyCGPointCGVectorBoolHandler)
// Enumerates all the physics bodies in the scene that contain a point.
EnumerateBodiesAtPointUsingBlock(point corefoundation.CGPoint, block SKPhysicsBodyBoolHandler)
// Enumerates all the physics bodies in the scene that intersect the specified rectangle.
EnumerateBodiesInRectUsingBlock(rect corefoundation.CGRect, block SKPhysicsBodyBoolHandler)
// Samples all of the field nodes in the scene and returns the summation of their forces at that point.
SampleFieldsAt(position Vector_float3) Vector_float3
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKPhysicsWorld class.
Configuring the Physics World ¶
- ISKPhysicsWorld.Gravity: A vector that specifies the gravitational acceleration applied to physics bodies in the physics world.
- ISKPhysicsWorld.SetGravity
- ISKPhysicsWorld.Speed: The rate at which the simulation executes.
- ISKPhysicsWorld.SetSpeed
Joining Physics Bodies with Joints ¶
- ISKPhysicsWorld.AddJoint: Adds a joint to the physics world.
- ISKPhysicsWorld.RemoveAllJoints: Removes all joints from the physics world.
- ISKPhysicsWorld.RemoveJoint: Removes a specific joint from the physics world.
Detecting Collisions ¶
- ISKPhysicsWorld.ContactDelegate: A delegate that is called when two physics bodies come in contact with each other.
- ISKPhysicsWorld.SetContactDelegate
Searching the Scene for Physics Bodies ¶
- ISKPhysicsWorld.BodyAlongRayStartEnd: Searches for the first physics body that intersects a ray.
- ISKPhysicsWorld.BodyAtPoint: Searches for the first physics body that contains a point.
- ISKPhysicsWorld.BodyInRect: Searches for the first physics body that intersects the specified rectangle.
- ISKPhysicsWorld.EnumerateBodiesAlongRayStartEndUsingBlock: Enumerates all the physics bodies in the scene that intersect a ray.
- ISKPhysicsWorld.EnumerateBodiesAtPointUsingBlock: Enumerates all the physics bodies in the scene that contain a point.
- ISKPhysicsWorld.EnumerateBodiesInRectUsingBlock: Enumerates all the physics bodies in the scene that intersect the specified rectangle.
Sampling Physics Fields ¶
- ISKPhysicsWorld.SampleFieldsAt: Samples all of the field nodes in the scene and returns the summation of their forces at that point.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld
type ISKRange ¶
type ISKRange interface {
objectivec.IObject
// Initializes a new range object.
InitWithLowerLimitUpperLimit(lower float64, upper float64) SKRange
// The minimum possible value.
LowerLimit() float64
SetLowerLimit(value float64)
// The maximum possible value.
UpperLimit() float64
SetUpperLimit(value float64)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKRange class.
Creating a Range Object ¶
- ISKRange.InitWithLowerLimitUpperLimit: Initializes a new range object.
Inspecting a Range Object’s Limits ¶
- ISKRange.LowerLimit: The minimum possible value.
- ISKRange.SetLowerLimit
- ISKRange.UpperLimit: The maximum possible value.
- ISKRange.SetUpperLimit
See: https://developer.apple.com/documentation/SpriteKit/SKRange
type ISKReachConstraints ¶
type ISKReachConstraints interface {
objectivec.IObject
// Initializes a new reach constraint object.
InitWithLowerAngleLimitUpperAngleLimit(lowerAngleLimit float64, upperAngleLimit float64) SKReachConstraints
// The minimum angle that the node can have after it is rotated by a reach event.
LowerAngleLimit() float64
SetLowerAngleLimit(value float64)
// The maximum angle that the node can have after it is rotated by a reach event.
UpperAngleLimit() float64
SetUpperAngleLimit(value float64)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKReachConstraints class.
Working with Reach Constraints ¶
- ISKReachConstraints.InitWithLowerAngleLimitUpperAngleLimit: Initializes a new reach constraint object.
- ISKReachConstraints.LowerAngleLimit: The minimum angle that the node can have after it is rotated by a reach event.
- ISKReachConstraints.SetLowerAngleLimit
- ISKReachConstraints.UpperAngleLimit: The maximum angle that the node can have after it is rotated by a reach event.
- ISKReachConstraints.SetUpperAngleLimit
See: https://developer.apple.com/documentation/SpriteKit/SKReachConstraints
type ISKReferenceNode ¶
type ISKReferenceNode interface {
ISKNode
// Initializes a reference node from a URL.
InitWithURL(url foundation.NSURL) SKReferenceNode
// Initializes a reference node from a file in the app’s main bundle.
InitWithFileNamed(fileName string) SKReferenceNode
// Loads the reference node’s content and adds it as a new child node.
ResolveReferenceNode()
// A method called by SpriteKit after the reference node’s contents are loaded.
DidLoadReferenceNode(node ISKNode)
}
An interface definition for the SKReferenceNode class.
Initializers ¶
- ISKReferenceNode.InitWithURL: Initializes a reference node from a URL.
- ISKReferenceNode.InitWithFileNamed: Initializes a reference node from a file in the app’s main bundle.
Regenerating ¶
- ISKReferenceNode.ResolveReferenceNode: Loads the reference node’s content and adds it as a new child node.
Loading Callback ¶
- ISKReferenceNode.DidLoadReferenceNode: A method called by SpriteKit after the reference node’s contents are loaded.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode
type ISKRegion ¶
type ISKRegion interface {
objectivec.IObject
// Initializes a new region with a rectangular area.
InitWithSize(size corefoundation.CGSize) SKRegion
// Initializes a new region with a circular area.
InitWithRadius(radius float32) SKRegion
// Initializes a new region using a Core Graphics path.
InitWithPath(path coregraphics.CGPathRef) SKRegion
// Returns a new region that is the mathematical inverse of an existing region.
InverseRegion() ISKRegion
// Returns a new region created by subtracting the contents of another region from this region.
RegionByDifferenceFromRegion(region ISKRegion) ISKRegion
// Returns a new region created by intersecting the contents of this region with another region.
RegionByIntersectionWithRegion(region ISKRegion) ISKRegion
// Returns a new region created by combining the contents of this region with another region.
RegionByUnionWithRegion(region ISKRegion) ISKRegion
// Returns a Core Graphics path that defines the region.
Path() coregraphics.CGPathRef
// Returns a Boolean value that indicates whether a particular point is contained in the region.
ContainsPoint(point corefoundation.CGPoint) bool
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKRegion class.
Creating and Initializing Region Objects ¶
- ISKRegion.InitWithSize: Initializes a new region with a rectangular area.
- ISKRegion.InitWithRadius: Initializes a new region with a circular area.
- ISKRegion.InitWithPath: Initializes a new region using a Core Graphics path.
- ISKRegion.InverseRegion: Returns a new region that is the mathematical inverse of an existing region.
- ISKRegion.RegionByDifferenceFromRegion: Returns a new region created by subtracting the contents of another region from this region.
- ISKRegion.RegionByIntersectionWithRegion: Returns a new region created by intersecting the contents of this region with another region.
- ISKRegion.RegionByUnionWithRegion: Returns a new region created by combining the contents of this region with another region.
Interacting with a Region ¶
- ISKRegion.Path: Returns a Core Graphics path that defines the region.
- ISKRegion.ContainsPoint: Returns a Boolean value that indicates whether a particular point is contained in the region.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion
type ISKRenderer ¶
type ISKRenderer interface {
objectivec.IObject
// The scene this renderer will draw into the Metal command buffer.
Scene() ISKScene
SetScene(value ISKScene)
RenderWithViewportCommandBufferRenderPassDescriptor(viewport corefoundation.CGRect, commandBuffer metal.MTLCommandBuffer, renderPassDescriptor metal.MTLRenderPassDescriptor)
RenderWithViewportRenderCommandEncoderRenderPassDescriptorCommandQueue(viewport corefoundation.CGRect, renderCommandEncoder metal.MTLRenderCommandEncoder, renderPassDescriptor metal.MTLRenderPassDescriptor, commandQueue metal.MTLCommandQueue)
UpdateAtTime(currentTime foundation.NSTimeInterval)
IgnoresSiblingOrder() bool
SetIgnoresSiblingOrder(value bool)
ShouldCullNonVisibleNodes() bool
SetShouldCullNonVisibleNodes(value bool)
// A Boolean value that indicates whether the view displays an overlay that shows physics bodies that are visible in the scene.
ShowsNodeCount() bool
SetShowsNodeCount(value bool)
// A Boolean value that indicates whether the view displays the number of drawing passes it needed to render the view.
ShowsDrawCount() bool
SetShowsDrawCount(value bool)
// A Boolean value that indicates whether the view displays the number of rectangles used to render the scene.
ShowsQuadCount() bool
SetShowsQuadCount(value bool)
// A Boolean value that indicates whether the view displays physics-related debugging information.
ShowsPhysics() bool
SetShowsPhysics(value bool)
// A Boolean value that indicates whether the view displays information about physics fields in the scene.
ShowsFields() bool
SetShowsFields(value bool)
}
An interface definition for the SKRenderer class.
First Steps ¶
- ISKRenderer.Scene: The scene this renderer will draw into the Metal command buffer.
- ISKRenderer.SetScene
Rendering the Scene ¶
- ISKRenderer.RenderWithViewportCommandBufferRenderPassDescriptor
- ISKRenderer.RenderWithViewportRenderCommandEncoderRenderPassDescriptorCommandQueue
Driving the Scene’s Update Cycle ¶
Configuring Performance Related Toggles ¶
- ISKRenderer.IgnoresSiblingOrder
- ISKRenderer.SetIgnoresSiblingOrder
- ISKRenderer.ShouldCullNonVisibleNodes
- ISKRenderer.SetShouldCullNonVisibleNodes
Enabling Visual Statistics for Debugging ¶
- ISKRenderer.ShowsNodeCount: A Boolean value that indicates whether the view displays an overlay that shows physics bodies that are visible in the scene.
- ISKRenderer.SetShowsNodeCount
- ISKRenderer.ShowsDrawCount: A Boolean value that indicates whether the view displays the number of drawing passes it needed to render the view.
- ISKRenderer.SetShowsDrawCount
- ISKRenderer.ShowsQuadCount: A Boolean value that indicates whether the view displays the number of rectangles used to render the scene.
- ISKRenderer.SetShowsQuadCount
- ISKRenderer.ShowsPhysics: A Boolean value that indicates whether the view displays physics-related debugging information.
- ISKRenderer.SetShowsPhysics
- ISKRenderer.ShowsFields: A Boolean value that indicates whether the view displays information about physics fields in the scene.
- ISKRenderer.SetShowsFields
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer
type ISKScene ¶
type ISKScene interface {
ISKEffectNode
// Initializes a new scene object.
InitWithSize(size corefoundation.CGSize) SKScene
// The dimensions of the scene, in points.
Size() corefoundation.CGSize
SetSize(value corefoundation.CGSize)
// A setting that defines how the scene is mapped to the view that presents it.
ScaleMode() SKSceneScaleMode
SetScaleMode(value SKSceneScaleMode)
// The camera node in the scene that determines what part of the scene’s coordinate space is visible in the view.
Camera() ISKCameraNode
SetCamera(value ISKCameraNode)
// The point in the view’s frame that corresponds to the scene’s origin.
AnchorPoint() corefoundation.CGPoint
SetAnchorPoint(value corefoundation.CGPoint)
// Tells you when the scene is presented.
SceneDidLoad()
// Tells you when the scene’s size has changed.
DidChangeSize(oldSize corefoundation.CGSize)
// Tells you when the scene is about to be removed from a view.
WillMoveFromView(view ISKView)
// Tells you when the scene is presented by a view.
DidMoveToView(view ISKView)
// Tells your app to perform any app-specific logic to update your scene.
Update(currentTime foundation.NSTimeInterval)
// Tells your app to peform any necessary logic after scene actions are evaluated.
DidEvaluateActions()
// Tells your app to peform any necessary logic after physics simulations are performed.
DidSimulatePhysics()
// Tells your app to peform any necessary logic after constraints are applied.
DidApplyConstraints()
// Tells your app to peform any necessary logic after the scene has finished all of the steps required to process animations.
DidFinishUpdate()
// A delegate to be called during the animation loop.
Delegate() SKSceneDelegate
SetDelegate(value SKSceneDelegate)
// The view that is currently presenting the scene.
View() ISKView
// The background color of the scene.
BackgroundColor() appkit.NSColor
SetBackgroundColor(value appkit.NSColor)
// The physics simulation associated with the scene.
PhysicsWorld() ISKPhysicsWorld
// A node used to determine the position of the listener for positional audio in the scene.
Listener() ISKNode
SetListener(value ISKNode)
// The AVFoundation audio engine used to play audio from audio nodes contained in the scene.
AudioEngine() avfaudio.AVAudioEngine
// Converts a point from view coordinates to scene coordinates.
ConvertPointFromView(point corefoundation.CGPoint) corefoundation.CGPoint
// Converts a point from scene coordinates to view coordinates.
ConvertPointToView(point corefoundation.CGPoint) corefoundation.CGPoint
}
An interface definition for the SKScene class.
Creating a Scene Programmatically ¶
- ISKScene.InitWithSize: Initializes a new scene object.
- ISKScene.Size: The dimensions of the scene, in points.
- ISKScene.SetSize
Stretching Content to Fit the View ¶
- ISKScene.ScaleMode: A setting that defines how the scene is mapped to the view that presents it.
- ISKScene.SetScaleMode
Configuring the Viewport ¶
- ISKScene.Camera: The camera node in the scene that determines what part of the scene’s coordinate space is visible in the view.
- ISKScene.SetCamera
- ISKScene.AnchorPoint: The point in the view’s frame that corresponds to the scene’s origin.
- ISKScene.SetAnchorPoint
Responding to Loading and Resizing Events ¶
- ISKScene.SceneDidLoad: Tells you when the scene is presented.
- ISKScene.DidChangeSize: Tells you when the scene’s size has changed.
- ISKScene.WillMoveFromView: Tells you when the scene is about to be removed from a view.
- ISKScene.DidMoveToView: Tells you when the scene is presented by a view.
Responding to Frame-Cycle Events ¶
- ISKScene.Update: Tells your app to perform any app-specific logic to update your scene.
- ISKScene.DidEvaluateActions: Tells your app to peform any necessary logic after scene actions are evaluated.
- ISKScene.DidSimulatePhysics: Tells your app to peform any necessary logic after physics simulations are performed.
- ISKScene.DidApplyConstraints: Tells your app to peform any necessary logic after constraints are applied.
- ISKScene.DidFinishUpdate: Tells your app to peform any necessary logic after the scene has finished all of the steps required to process animations.
Configuring a Delegate ¶
- ISKScene.Delegate: A delegate to be called during the animation loop.
- ISKScene.SetDelegate
Setting the Background Appearance ¶
- ISKScene.View: The view that is currently presenting the scene.
- ISKScene.BackgroundColor: The background color of the scene.
- ISKScene.SetBackgroundColor
Configuring Physics Properties ¶
- ISKScene.PhysicsWorld: The physics simulation associated with the scene.
Adding Positional Audio ¶
- ISKScene.Listener: A node used to determine the position of the listener for positional audio in the scene.
- ISKScene.SetListener
- ISKScene.AudioEngine: The AVFoundation audio engine used to play audio from audio nodes contained in the scene.
Converting Between Coordinate Systems ¶
- ISKScene.ConvertPointFromView: Converts a point from view coordinates to scene coordinates.
- ISKScene.ConvertPointToView: Converts a point from scene coordinates to view coordinates.
See: https://developer.apple.com/documentation/SpriteKit/SKScene
type ISKShader ¶
type ISKShader interface {
objectivec.IObject
// Initializes a new shader object using the specified source and uniform data.
InitWithSourceUniforms(source string, uniforms []SKUniform) SKShader
// Initializes a new shader object using the specified source code.
InitWithSource(source string) SKShader
// Adds a uniform to the shader.
AddUniform(uniform ISKUniform)
// Removes a uniform from the shader.
RemoveUniformNamed(name string)
// The list of uniforms associated with the shader.
Uniforms() []SKUniform
SetUniforms(value []SKUniform)
// Returns the uniform object corresponding to a particular uniform variable.
UniformNamed(name string) ISKUniform
// The list of attributes associated with the shader.
Attributes() []SKAttribute
SetAttributes(value []SKAttribute)
// The source code for the shader.
Source() string
SetSource(value string)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKShader class.
Creating a Shader ¶
- ISKShader.InitWithSourceUniforms: Initializes a new shader object using the specified source and uniform data.
- ISKShader.InitWithSource: Initializes a new shader object using the specified source code.
Providing Uniform Data to a Shader ¶
- ISKShader.AddUniform: Adds a uniform to the shader.
- ISKShader.RemoveUniformNamed: Removes a uniform from the shader.
- ISKShader.Uniforms: The list of uniforms associated with the shader.
- ISKShader.SetUniforms
- ISKShader.UniformNamed: Returns the uniform object corresponding to a particular uniform variable.
Providing Attribute Data to a Shader ¶
- ISKShader.Attributes: The list of attributes associated with the shader.
- ISKShader.SetAttributes
Accessing or Setting a Shader’s Source Code ¶
- ISKShader.Source: The source code for the shader.
- ISKShader.SetSource
See: https://developer.apple.com/documentation/SpriteKit/SKShader
type ISKShapeNode ¶
type ISKShapeNode interface {
ISKNode
// The path that defines the shape.
Path() coregraphics.CGPathRef
SetPath(value coregraphics.CGPathRef)
// The color used to fill the shape.
FillColor() appkit.NSColor
SetFillColor(value appkit.NSColor)
// The texture used to fill the shape.
FillTexture() ISKTexture
SetFillTexture(value ISKTexture)
// The width used to stroke the path.
LineWidth() float64
SetLineWidth(value float64)
// The color used to stroke the shape.
StrokeColor() appkit.NSColor
SetStrokeColor(value appkit.NSColor)
// The texture used to stroke the shape.
StrokeTexture() ISKTexture
SetStrokeTexture(value ISKTexture)
// A glow that extends outward from the stroked line.
GlowWidth() float64
SetGlowWidth(value float64)
// The style used to render the endpoints of the stroked portion of the shape node.
LineCap() int32
SetLineCap(value int32)
// The junction type used when the stroked portion of the shape node is rendered.
LineJoin() int32
SetLineJoin(value int32)
// The miter limit to use when the line is stroked using a miter join style.
MiterLimit() float64
SetMiterLimit(value float64)
// A Boolean value that determines whether the stroked path is smoothed when drawn.
IsAntialiased() bool
SetAntialiased(value bool)
// The blend mode used to blend the shape into the parent’s framebuffer.
BlendMode() SKBlendMode
SetBlendMode(value SKBlendMode)
// The length of the line defined by the shape node.
LineLength() float64
// A custom shader used to determine the color of the stroked portion of the shape node.
StrokeShader() ISKShader
SetStrokeShader(value ISKShader)
// A custom shader used to determine the color of the filled portion of the shape node.
FillShader() ISKShader
SetFillShader(value ISKShader)
// The values of each attribute associated with the node’s attached shader.
AttributeValues() foundation.INSDictionary
SetAttributeValues(value foundation.INSDictionary)
// Sets an attribute value for an attached shader.
SetValueForAttributeNamed(value ISKAttributeValue, key string)
// The value of a shader attribute.
ValueForAttributeNamed(key string) ISKAttributeValue
}
An interface definition for the SKShapeNode class.
Creating a Shape from a Path ¶
- ISKShapeNode.Path: The path that defines the shape.
- ISKShapeNode.SetPath
Filling a Shape ¶
- ISKShapeNode.FillColor: The color used to fill the shape.
- ISKShapeNode.SetFillColor
- ISKShapeNode.FillTexture: The texture used to fill the shape.
- ISKShapeNode.SetFillTexture
Stroking a Shape ¶
- ISKShapeNode.LineWidth: The width used to stroke the path.
- ISKShapeNode.SetLineWidth
- ISKShapeNode.StrokeColor: The color used to stroke the shape.
- ISKShapeNode.SetStrokeColor
- ISKShapeNode.StrokeTexture: The texture used to stroke the shape.
- ISKShapeNode.SetStrokeTexture
- ISKShapeNode.GlowWidth: A glow that extends outward from the stroked line.
- ISKShapeNode.SetGlowWidth
- ISKShapeNode.LineCap: The style used to render the endpoints of the stroked portion of the shape node.
- ISKShapeNode.SetLineCap
- ISKShapeNode.LineJoin: The junction type used when the stroked portion of the shape node is rendered.
- ISKShapeNode.SetLineJoin
- ISKShapeNode.MiterLimit: The miter limit to use when the line is stroked using a miter join style.
- ISKShapeNode.SetMiterLimit
- ISKShapeNode.IsAntialiased: A Boolean value that determines whether the stroked path is smoothed when drawn.
- ISKShapeNode.SetAntialiased
Configuring Alpha Blending ¶
- ISKShapeNode.BlendMode: The blend mode used to blend the shape into the parent’s framebuffer.
- ISKShapeNode.SetBlendMode
Controlling or Animating Sroke Length ¶
- ISKShapeNode.LineLength: The length of the line defined by the shape node.
Customizing Stroking or Fill Drawing ¶
- ISKShapeNode.StrokeShader: A custom shader used to determine the color of the stroked portion of the shape node.
- ISKShapeNode.SetStrokeShader
- ISKShapeNode.FillShader: A custom shader used to determine the color of the filled portion of the shape node.
- ISKShapeNode.SetFillShader
- ISKShapeNode.AttributeValues: The values of each attribute associated with the node’s attached shader.
- ISKShapeNode.SetAttributeValues
- ISKShapeNode.SetValueForAttributeNamed: Sets an attribute value for an attached shader.
- ISKShapeNode.ValueForAttributeNamed: The value of a shader attribute.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode
type ISKSpriteNode ¶
type ISKSpriteNode interface {
ISKNode
// Initializes a textured sprite using an image file.
InitWithImageNamed(name string) SKSpriteNode
// Initializes a textured sprite using an existing texture object.
InitWithTexture(texture ISKTexture) SKSpriteNode
// Initializes a textured sprite in color using an existing texture object.
InitWithTextureColorSize(texture ISKTexture, color appkit.NSColor, size corefoundation.CGSize) SKSpriteNode
// The texture used to draw the sprite.
Texture() ISKTexture
SetTexture(value ISKTexture)
// Initializes a single-color sprite node.
InitWithColorSize(color appkit.NSColor, size corefoundation.CGSize) SKSpriteNode
// The dimensions of the sprite, in points.
Size() corefoundation.CGSize
SetSize(value corefoundation.CGSize)
// Scales the sprite node to a specified size.
ScaleToSize(size corefoundation.CGSize)
// Defines the point in the sprite that corresponds to the node’s position.
AnchorPoint() corefoundation.CGPoint
SetAnchorPoint(value corefoundation.CGPoint)
// Enable nine-part stretching of the sprite’s texture.
CenterRect() corefoundation.CGRect
SetCenterRect(value corefoundation.CGRect)
// The sprite’s color.
Color() appkit.NSColor
SetColor(value appkit.NSColor)
// A floating-point value that describes how the color is blended with the sprite’s texture.
ColorBlendFactor() float64
SetColorBlendFactor(value float64)
// The blend mode used to draw the sprite into the parent’s framebuffer.
BlendMode() SKBlendMode
SetBlendMode(value SKBlendMode)
// A mask that defines how this sprite is lit by light nodes in the scene.
LightingBitMask() uint32
SetLightingBitMask(value uint32)
// A mask that defines which lights add shadows to the sprite.
ShadowedBitMask() uint32
SetShadowedBitMask(value uint32)
// A mask that defines which lights are occluded by this sprite.
ShadowCastBitMask() uint32
SetShadowCastBitMask(value uint32)
// A texture that specifies the normal map for the sprite.
NormalTexture() ISKTexture
SetNormalTexture(value ISKTexture)
// A text file that defines code that does custom per-pixel drawing or colorization.
Shader() ISKShader
SetShader(value ISKShader)
// The values of each attribute associated with the node’s attached shader.
AttributeValues() foundation.INSDictionary
SetAttributeValues(value foundation.INSDictionary)
// Sets an attribute value for an attached shader.
SetValueForAttributeNamed(value ISKAttributeValue, key string)
// Sets the value of a shader attribute.
ValueForAttributeNamed(key string) ISKAttributeValue
// The maximum number of subdivision iterations used to generate the final vertices.
SubdivisionLevels() int
// The warp geometry used to define the distortion.
WarpGeometry() ISKWarpGeometry
}
An interface definition for the SKSpriteNode class.
Creating a Sprite from an Image Filename ¶
- ISKSpriteNode.InitWithImageNamed: Initializes a textured sprite using an image file.
Creating a Sprite from a Texture ¶
- ISKSpriteNode.InitWithTexture: Initializes a textured sprite using an existing texture object.
- ISKSpriteNode.InitWithTextureColorSize: Initializes a textured sprite in color using an existing texture object.
- ISKSpriteNode.Texture: The texture used to draw the sprite.
- ISKSpriteNode.SetTexture
Creating a Solid-Color Sprite ¶
- ISKSpriteNode.InitWithColorSize: Initializes a single-color sprite node.
Setting a Sprite’s Size and Position ¶
- ISKSpriteNode.Size: The dimensions of the sprite, in points.
- ISKSpriteNode.SetSize
- ISKSpriteNode.ScaleToSize: Scales the sprite node to a specified size.
- ISKSpriteNode.AnchorPoint: Defines the point in the sprite that corresponds to the node’s position.
- ISKSpriteNode.SetAnchorPoint
Scaling a Sprite in Nine Parts ¶
- ISKSpriteNode.CenterRect: Enable nine-part stretching of the sprite’s texture.
- ISKSpriteNode.SetCenterRect
Tinting a Sprite ¶
- ISKSpriteNode.Color: The sprite’s color.
- ISKSpriteNode.SetColor
- ISKSpriteNode.ColorBlendFactor: A floating-point value that describes how the color is blended with the sprite’s texture.
- ISKSpriteNode.SetColorBlendFactor
Configuring Alpha Blendling ¶
- ISKSpriteNode.BlendMode: The blend mode used to draw the sprite into the parent’s framebuffer.
- ISKSpriteNode.SetBlendMode
Lighting a Sprite ¶
- ISKSpriteNode.LightingBitMask: A mask that defines how this sprite is lit by light nodes in the scene.
- ISKSpriteNode.SetLightingBitMask
- ISKSpriteNode.ShadowedBitMask: A mask that defines which lights add shadows to the sprite.
- ISKSpriteNode.SetShadowedBitMask
- ISKSpriteNode.ShadowCastBitMask: A mask that defines which lights are occluded by this sprite.
- ISKSpriteNode.SetShadowCastBitMask
- ISKSpriteNode.NormalTexture: A texture that specifies the normal map for the sprite.
- ISKSpriteNode.SetNormalTexture
Adding a Custom Shader to a Sprite ¶
- ISKSpriteNode.Shader: A text file that defines code that does custom per-pixel drawing or colorization.
- ISKSpriteNode.SetShader
- ISKSpriteNode.AttributeValues: The values of each attribute associated with the node’s attached shader.
- ISKSpriteNode.SetAttributeValues
- ISKSpriteNode.SetValueForAttributeNamed: Sets an attribute value for an attached shader.
- ISKSpriteNode.ValueForAttributeNamed: Sets the value of a shader attribute.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode
type ISKTexture ¶
type ISKTexture interface {
objectivec.IObject
// Gets the size of the texture.
Size() corefoundation.CGSize
// Gets a rectangle that defines the portion of the texture used to render its image.
TextureRect() corefoundation.CGRect
// The filtering mode used when the size of a sprite drawn with the texture is not drawn at the texture’s native size.
FilteringMode() SKTextureFilteringMode
SetFilteringMode(value SKTextureFilteringMode)
// A Boolean value that indicates whether the texture attempts to generate mipmaps.
UsesMipmaps() bool
SetUsesMipmaps(value bool)
// Returns the texture’s image data as a Quartz 2D image.
CGImage() coregraphics.CGImageRef
// Load texture data into memory, calling a completion handler after the task completes.
PreloadWithCompletionHandler(completionHandler VoidHandler)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKTexture class.
Reading a Texture’s Size and Optional Source Location ¶
- ISKTexture.Size: Gets the size of the texture.
- ISKTexture.TextureRect: Gets a rectangle that defines the portion of the texture used to render its image.
Configuring a Texture’s Behavior for Scaling ¶
- ISKTexture.FilteringMode: The filtering mode used when the size of a sprite drawn with the texture is not drawn at the texture’s native size.
- ISKTexture.SetFilteringMode
- ISKTexture.UsesMipmaps: A Boolean value that indicates whether the texture attempts to generate mipmaps.
- ISKTexture.SetUsesMipmaps
Getting a Texture’s Underlying Image ¶
- ISKTexture.CGImage: Returns the texture’s image data as a Quartz 2D image.
Preloading a Texture for Performance ¶
- ISKTexture.PreloadWithCompletionHandler: Load texture data into memory, calling a completion handler after the task completes.
See: https://developer.apple.com/documentation/SpriteKit/SKTexture
type ISKTextureAtlas ¶
type ISKTextureAtlas interface {
objectivec.IObject
// Creates a texture from data stored in the texture atlas.
TextureNamed(name string) ISKTexture
// Loads an atlas object’s textures into memory, calling a completion handler after the task completes.
PreloadWithCompletionHandler(completionHandler VoidHandler)
// The names of the texture images stored in the atlas.
TextureNames() []string
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKTextureAtlas class.
Accessing Textures ¶
- ISKTextureAtlas.TextureNamed: Creates a texture from data stored in the texture atlas.
Preloading Textures ¶
- ISKTextureAtlas.PreloadWithCompletionHandler: Loads an atlas object’s textures into memory, calling a completion handler after the task completes.
Reading Source Image Filenames ¶
- ISKTextureAtlas.TextureNames: The names of the texture images stored in the atlas.
See: https://developer.apple.com/documentation/SpriteKit/SKTextureAtlas
type ISKTileDefinition ¶
type ISKTileDefinition interface {
objectivec.IObject
// Initializes a new tile definition with a single texture.
InitWithTexture(texture ISKTexture) SKTileDefinition
// Initializes a new tile definition with a single texture and separate normal texture for simulating 3D lighting.
InitWithTextureNormalTextureSize(texture ISKTexture, normalTexture ISKTexture, size corefoundation.CGSize) SKTileDefinition
// Initializes a new tile definition of a specified size with a single texture.
InitWithTextureSize(texture ISKTexture, size corefoundation.CGSize) SKTileDefinition
// Initializes a new tile definition with arrays of textures and normal textures for animation.
InitWithTexturesNormalTexturesSizeTimePerFrame(textures []SKTexture, normalTextures []SKTexture, size corefoundation.CGSize, timePerFrame float64) SKTileDefinition
// Initializes a new tile definition with an array of textures for animation.
InitWithTexturesSizeTimePerFrame(textures []SKTexture, size corefoundation.CGSize, timePerFrame float64) SKTileDefinition
// A Boolean that flips the definition’s image vertically.
FlipHorizontally() bool
SetFlipHorizontally(value bool)
// A Boolean that flips the definition’s image horizontally.
FlipVertically() bool
SetFlipVertically(value bool)
// The rotation of the tile definition in 90˚ increments.
Rotation() SKTileDefinitionRotation
SetRotation(value SKTileDefinitionRotation)
// An array of [SKTexture](<https://developer.apple.com/documentation/SpriteKit/SKTexture>) objects that defines the tile definition object’s content.
Textures() []SKTexture
SetTextures(value []SKTexture)
// An array of [SKTexture](<https://developer.apple.com/documentation/SpriteKit/SKTexture>) objects used to generate the normals for the tile to simulate 3D lighting.
NormalTextures() []SKTexture
SetNormalTextures(value []SKTexture)
// The duration, in seconds, that each texture in the textures array is displayed before switching to the next texture in the sequence.
TimePerFrame() float64
SetTimePerFrame(value float64)
// A dictionary containing arbitrary data.
UserData() foundation.INSDictionary
SetUserData(value foundation.INSDictionary)
// A name associated with the tile definition.
Name() string
SetName(value string)
// The placement weight of the tile definition.
PlacementWeight() uint
SetPlacementWeight(value uint)
// The size of the tile definition in points.
Size() corefoundation.CGSize
SetSize(value corefoundation.CGSize)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKTileDefinition class.
Creating a Tile with a Texture ¶
- ISKTileDefinition.InitWithTexture: Initializes a new tile definition with a single texture.
Creating a Tile with a Normal Texture ¶
- ISKTileDefinition.InitWithTextureNormalTextureSize: Initializes a new tile definition with a single texture and separate normal texture for simulating 3D lighting.
Creating a Tile with a Size ¶
- ISKTileDefinition.InitWithTextureSize: Initializes a new tile definition of a specified size with a single texture.
Creating an Animated Tile ¶
- ISKTileDefinition.InitWithTexturesNormalTexturesSizeTimePerFrame: Initializes a new tile definition with arrays of textures and normal textures for animation.
- ISKTileDefinition.InitWithTexturesSizeTimePerFrame: Initializes a new tile definition with an array of textures for animation.
Flipping a Tile Vertically or Horizontally ¶
- ISKTileDefinition.FlipHorizontally: A Boolean that flips the definition’s image vertically.
- ISKTileDefinition.SetFlipHorizontally
- ISKTileDefinition.FlipVertically: A Boolean that flips the definition’s image horizontally.
- ISKTileDefinition.SetFlipVertically
Rotating a Tile ¶
- ISKTileDefinition.Rotation: The rotation of the tile definition in 90˚ increments.
- ISKTileDefinition.SetRotation
Configure Animated Tile Properties ¶
- ISKTileDefinition.Textures: An array of SKTexture(<https://developer.apple.com/documentation/SpriteKit/SKTexture>) objects that defines the tile definition object’s content.
- ISKTileDefinition.SetTextures
- ISKTileDefinition.NormalTextures: An array of SKTexture(<https://developer.apple.com/documentation/SpriteKit/SKTexture>) objects used to generate the normals for the tile to simulate 3D lighting.
- ISKTileDefinition.SetNormalTextures
- ISKTileDefinition.TimePerFrame: The duration, in seconds, that each texture in the textures array is displayed before switching to the next texture in the sequence.
- ISKTileDefinition.SetTimePerFrame
Reading or Adding a Tile’s Custom Data ¶
- ISKTileDefinition.UserData: A dictionary containing arbitrary data.
- ISKTileDefinition.SetUserData
Reading or Adjusting a Tile’s Instance Properties ¶
- ISKTileDefinition.Name: A name associated with the tile definition.
- ISKTileDefinition.SetName
- ISKTileDefinition.PlacementWeight: The placement weight of the tile definition.
- ISKTileDefinition.SetPlacementWeight
- ISKTileDefinition.Size: The size of the tile definition in points.
- ISKTileDefinition.SetSize
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition
type ISKTileGroup ¶
type ISKTileGroup interface {
objectivec.IObject
// Creates and initializes a simple tile group with a single tile definition.
InitWithTileDefinition(tileDefinition ISKTileDefinition) SKTileGroup
// Creates and initializes a tile group with the specified tile group rules.
InitWithRules(rules []SKTileGroupRule) SKTileGroup
// The receiver’s name.
Name() string
SetName(value string)
// An array of [SKTileGroupRule](<https://developer.apple.com/documentation/SpriteKit/SKTileGroupRule>) objects that the tile group uses to determine tile placement.
Rules() []SKTileGroupRule
SetRules(value []SKTileGroupRule)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKTileGroup class.
Creating Tile Groups ¶
- ISKTileGroup.InitWithTileDefinition: Creates and initializes a simple tile group with a single tile definition.
- ISKTileGroup.InitWithRules: Creates and initializes a tile group with the specified tile group rules.
Accessing or Setting a Tile Group’s Properties ¶
- ISKTileGroup.Name: The receiver’s name.
- ISKTileGroup.SetName
- ISKTileGroup.Rules: An array of SKTileGroupRule(<https://developer.apple.com/documentation/SpriteKit/SKTileGroupRule>) objects that the tile group uses to determine tile placement.
- ISKTileGroup.SetRules
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroup
type ISKTileGroupRule ¶
type ISKTileGroupRule interface {
objectivec.IObject
// Initializes a new tile group rule with adjacency rules and tile definitions.
InitWithAdjacencyTileDefinitions(adjacency SKTileAdjacencyMask, tileDefinitions []SKTileDefinition) SKTileGroupRule
// The adjacency requirement for this rule.
Adjacency() SKTileAdjacencyMask
SetAdjacency(value SKTileAdjacencyMask)
// A name associated with the tile group rule.
Name() string
SetName(value string)
// The tile definitions used for this rule.
TileDefinitions() []SKTileDefinition
SetTileDefinitions(value []SKTileDefinition)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKTileGroupRule class.
Creating a Tile Group Rule ¶
- ISKTileGroupRule.InitWithAdjacencyTileDefinitions: Initializes a new tile group rule with adjacency rules and tile definitions.
Accessing or Setting Tile Group Rule Properties ¶
- ISKTileGroupRule.Adjacency: The adjacency requirement for this rule.
- ISKTileGroupRule.SetAdjacency
- ISKTileGroupRule.Name: A name associated with the tile group rule.
- ISKTileGroupRule.SetName
- ISKTileGroupRule.TileDefinitions: The tile definitions used for this rule.
- ISKTileGroupRule.SetTileDefinitions
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroupRule
type ISKTileMapNode ¶
type ISKTileMapNode interface {
ISKNode
// Defines the point in the tile map that corresponds to its [position](<https://developer.apple.com/documentation/SpriteKit/SKNode/position>).
AnchorPoint() corefoundation.CGPoint
SetAnchorPoint(value corefoundation.CGPoint)
// The size of each tile in points.
TileSize() corefoundation.CGSize
SetTileSize(value corefoundation.CGSize)
// The tile set being used by this tile map. The tile map object can only display tiles that exist in this set.
TileSet() ISKTileSet
SetTileSet(value ISKTileSet)
// The number of columns in the tile map
NumberOfColumns() uint
SetNumberOfColumns(value uint)
// The number of rows in the tile map.
NumberOfRows() uint
SetNumberOfRows(value uint)
CenterOfTileAtColumnRow(column uint, row uint) corefoundation.CGPoint
TileColumnIndexFromPosition(position corefoundation.CGPoint) uint
TileDefinitionAtColumnRow(column uint, row uint) ISKTileDefinition
TileGroupAtColumnRow(column uint, row uint) ISKTileGroup
// Returns the tile map node object’s tile row index for the specified position in points.
TileRowIndexFromPosition(position corefoundation.CGPoint) uint
// The overall size of the tile map.
MapSize() corefoundation.CGSize
// The base color for the tile map. The influence of the color over the tile map node’s textures is controlled by [colorBlendFactor](<https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/colorBlendFactor>).
Color() appkit.NSColor
SetColor(value appkit.NSColor)
// Controls the blending between the texture and the tile map object’s [color](<https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/color>). Values are clamped between zero and one where zero has no color blending and one has the maximum color blending.
ColorBlendFactor() float64
SetColorBlendFactor(value float64)
// A mask that defines how the tile map is lit by light nodes in the scene.
LightingBitMask() uint32
SetLightingBitMask(value uint32)
// Defines the blend mode to use when compositing the tile map over other nodes.
BlendMode() SKBlendMode
SetBlendMode(value SKBlendMode)
// Defines a shader which is applied to each tile of the tile map.
Shader() ISKShader
SetShader(value ISKShader)
// The values of each attribute associated with the node’s attached shader.
AttributeValues() foundation.INSDictionary
SetAttributeValues(value foundation.INSDictionary)
// Sets an attribute value for an attached shader.
SetValueForAttributeNamed(value ISKAttributeValue, key string)
// The value of a shader attribute.
ValueForAttributeNamed(key string) ISKAttributeValue
// When creating a tile map node programmatically, specifies whether the tile map uses automapping behavior like the scene editor.
EnableAutomapping() bool
SetEnableAutomapping(value bool)
}
An interface definition for the SKTileMapNode class.
Controlling a Tile Map’s On-Screen Position Relative to its Origin ¶
- ISKTileMapNode.AnchorPoint: Defines the point in the tile map that corresponds to its [position](<https://developer.apple.com/documentation/SpriteKit/SKNode/position>).
- ISKTileMapNode.SetAnchorPoint
Reading or Manually Configuring the Tile Map’s Size ¶
- ISKTileMapNode.TileSize: The size of each tile in points.
- ISKTileMapNode.SetTileSize
- ISKTileMapNode.TileSet: The tile set being used by this tile map. The tile map object can only display tiles that exist in this set.
- ISKTileMapNode.SetTileSet
- ISKTileMapNode.NumberOfColumns: The number of columns in the tile map
- ISKTileMapNode.SetNumberOfColumns
- ISKTileMapNode.NumberOfRows: The number of rows in the tile map.
- ISKTileMapNode.SetNumberOfRows
Querying the Tile Map’s Properties ¶
- ISKTileMapNode.CenterOfTileAtColumnRow
- ISKTileMapNode.TileColumnIndexFromPosition
- ISKTileMapNode.TileDefinitionAtColumnRow
- ISKTileMapNode.TileGroupAtColumnRow
- ISKTileMapNode.TileRowIndexFromPosition: Returns the tile map node object’s tile row index for the specified position in points.
- ISKTileMapNode.MapSize: The overall size of the tile map.
Tinting a Tile Map ¶
- ISKTileMapNode.Color: The base color for the tile map. The influence of the color over the tile map node’s textures is controlled by [colorBlendFactor](<https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/colorBlendFactor>).
- ISKTileMapNode.SetColor
- ISKTileMapNode.ColorBlendFactor: Controls the blending between the texture and the tile map object’s [color](<https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/color>). Values are clamped between zero and one where zero has no color blending and one has the maximum color blending.
- ISKTileMapNode.SetColorBlendFactor
Lighting a Tile Map ¶
- ISKTileMapNode.LightingBitMask: A mask that defines how the tile map is lit by light nodes in the scene.
- ISKTileMapNode.SetLightingBitMask
Configuring How Alpha Values Blend the Sprite ¶
- ISKTileMapNode.BlendMode: Defines the blend mode to use when compositing the tile map over other nodes.
- ISKTileMapNode.SetBlendMode
Working with Custom Shaders ¶
- ISKTileMapNode.Shader: Defines a shader which is applied to each tile of the tile map.
- ISKTileMapNode.SetShader
- ISKTileMapNode.AttributeValues: The values of each attribute associated with the node’s attached shader.
- ISKTileMapNode.SetAttributeValues
- ISKTileMapNode.SetValueForAttributeNamed: Sets an attribute value for an attached shader.
- ISKTileMapNode.ValueForAttributeNamed: The value of a shader attribute.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode
type ISKTileSet ¶
type ISKTileSet interface {
objectivec.IObject
// Initializes a new tile set with an array of tile groups and rectangular grid layout.
InitWithTileGroups(tileGroups []SKTileGroup) SKTileSet
// Initializes a new tile set with an array of tile groups and specified layout.
InitWithTileGroupsTileSetType(tileGroups []SKTileGroup, tileSetType SKTileSetType) SKTileSet
// The tile set’s default tile group.
DefaultTileGroup() ISKTileGroup
SetDefaultTileGroup(value ISKTileGroup)
// The tile set’s default tile size.
DefaultTileSize() corefoundation.CGSize
SetDefaultTileSize(value corefoundation.CGSize)
// A name associated with the tile set.
Name() string
SetName(value string)
// The tile set’s array of tile group objects.
TileGroups() []SKTileGroup
SetTileGroups(value []SKTileGroup)
// The tile set’s type.
Type() SKTileSetType
SetType(value SKTileSetType)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKTileSet class.
Creating a Tile Set Programmatically ¶
- ISKTileSet.InitWithTileGroups: Initializes a new tile set with an array of tile groups and rectangular grid layout.
- ISKTileSet.InitWithTileGroupsTileSetType: Initializes a new tile set with an array of tile groups and specified layout.
Accessing or Reading a Tile Set’s Properties ¶
- ISKTileSet.DefaultTileGroup: The tile set’s default tile group.
- ISKTileSet.SetDefaultTileGroup
- ISKTileSet.DefaultTileSize: The tile set’s default tile size.
- ISKTileSet.SetDefaultTileSize
- ISKTileSet.Name: A name associated with the tile set.
- ISKTileSet.SetName
- ISKTileSet.TileGroups: The tile set’s array of tile group objects.
- ISKTileSet.SetTileGroups
- ISKTileSet.Type: The tile set’s type.
- ISKTileSet.SetType
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet
type ISKTransformNode ¶
type ISKTransformNode interface {
ISKNode
XRotation() float64
SetXRotation(value float64)
YRotation() float64
SetYRotation(value float64)
SetEulerAngles(euler Vector_float3)
SetRotationMatrix(rotationMatrix [3][4]float32)
EulerAngles() Vector_float3
RotationMatrix() [3][4]float32
}
An interface definition for the SKTransformNode class.
Rotating Child Nodes ¶
- ISKTransformNode.XRotation
- ISKTransformNode.SetXRotation
- ISKTransformNode.YRotation
- ISKTransformNode.SetYRotation
- ISKTransformNode.SetEulerAngles
- ISKTransformNode.SetRotationMatrix
Reading the Current Rotation ¶
See: https://developer.apple.com/documentation/SpriteKit/SKTransformNode
type ISKTransition ¶
type ISKTransition interface {
objectivec.IObject
// A Boolean value that determines whether the incoming scene is paused during the transition.
PausesIncomingScene() bool
SetPausesIncomingScene(value bool)
// A Boolean value that determines whether the outgoing scene is paused during the transition.
PausesOutgoingScene() bool
SetPausesOutgoingScene(value bool)
}
An interface definition for the SKTransition class.
Pausing ¶
- ISKTransition.PausesIncomingScene: A Boolean value that determines whether the incoming scene is paused during the transition.
- ISKTransition.SetPausesIncomingScene
- ISKTransition.PausesOutgoingScene: A Boolean value that determines whether the outgoing scene is paused during the transition.
- ISKTransition.SetPausesOutgoingScene
See: https://developer.apple.com/documentation/SpriteKit/SKTransition
type ISKUniform ¶
type ISKUniform interface {
objectivec.IObject
// Initializes a new uniform object.
InitWithName(name string) SKUniform
// Initializes a new uniform object that holds a floating-point number.
InitWithNameFloat(name string, value float32) SKUniform
// Initializes a new uniform object that holds a reference to a texture.
InitWithNameTexture(name string, texture ISKTexture) SKUniform
// The uniform’s name.
Name() string
// The uniform object’s data type.
UniformType() SKUniformType
// The receiver’s value as a floating-point value.
FloatValue() float32
SetFloatValue(value float32)
// The receiver’s value as a SpriteKit texture.
TextureValue() ISKTexture
SetTextureValue(value ISKTexture)
InitWithNameMatrixFloat2x2(name string, value [2][2]float32) SKUniform
InitWithNameMatrixFloat3x3(name string, value [3][4]float32) SKUniform
InitWithNameMatrixFloat4x4(name string, value [4][4]float32) SKUniform
InitWithNameVectorFloat2(name string, value [2]float32) SKUniform
InitWithNameVectorFloat3(name string, value Vector_float3) SKUniform
InitWithNameVectorFloat4(name string, value [4]float32) SKUniform
MatrixFloat2x2Value() [2][2]float32
SetMatrixFloat2x2Value(value [2][2]float32)
MatrixFloat3x3Value() [3][4]float32
SetMatrixFloat3x3Value(value [3][4]float32)
MatrixFloat4x4Value() [4][4]float32
SetMatrixFloat4x4Value(value [4][4]float32)
VectorFloat2Value() [2]float32
SetVectorFloat2Value(value [2]float32)
VectorFloat3Value() Vector_float3
SetVectorFloat3Value(value Vector_float3)
VectorFloat4Value() [4]float32
SetVectorFloat4Value(value [4]float32)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKUniform class.
Creating and Initializing Uniform Objects ¶
- ISKUniform.InitWithName: Initializes a new uniform object.
- ISKUniform.InitWithNameFloat: Initializes a new uniform object that holds a floating-point number.
- ISKUniform.InitWithNameTexture: Initializes a new uniform object that holds a reference to a texture.
Reading Information About a Uniform ¶
- ISKUniform.Name: The uniform’s name.
- ISKUniform.UniformType: The uniform object’s data type.
Reading and Writing an Uniform Object’s Value ¶
- ISKUniform.FloatValue: The receiver’s value as a floating-point value.
- ISKUniform.SetFloatValue
- ISKUniform.TextureValue: The receiver’s value as a SpriteKit texture.
- ISKUniform.SetTextureValue
Initializers ¶
- ISKUniform.InitWithNameMatrixFloat2x2
- ISKUniform.InitWithNameMatrixFloat3x3
- ISKUniform.InitWithNameMatrixFloat4x4
- ISKUniform.InitWithNameVectorFloat2
- ISKUniform.InitWithNameVectorFloat3
- ISKUniform.InitWithNameVectorFloat4
Instance Properties ¶
- ISKUniform.MatrixFloat2x2Value
- ISKUniform.SetMatrixFloat2x2Value
- ISKUniform.MatrixFloat3x3Value
- ISKUniform.SetMatrixFloat3x3Value
- ISKUniform.MatrixFloat4x4Value
- ISKUniform.SetMatrixFloat4x4Value
- ISKUniform.VectorFloat2Value
- ISKUniform.SetVectorFloat2Value
- ISKUniform.VectorFloat3Value
- ISKUniform.SetVectorFloat3Value
- ISKUniform.VectorFloat4Value
- ISKUniform.SetVectorFloat4Value
See: https://developer.apple.com/documentation/SpriteKit/SKUniform
type ISKVideoNode ¶
type ISKVideoNode interface {
ISKNode
// Initializes a video node using an existing [AVPlayer](<https://developer.apple.com/documentation/AVFoundation/AVPlayer>) object.
InitWithAVPlayer(player objectivec.IObject) SKVideoNode
// Initializes a video node using a video file stored in the app bundle.
InitWithFileNamed(videoFile string) SKVideoNode
// Initializes a video node using a URL.
InitWithURL(url foundation.NSURL) SKVideoNode
// The point in the sprite that corresponds to the node’s position.
AnchorPoint() corefoundation.CGPoint
SetAnchorPoint(value corefoundation.CGPoint)
// The dimensions of the video node, in points.
Size() corefoundation.CGSize
SetSize(value corefoundation.CGSize)
// Starts video playback.
Play()
// Pauses video playback.
Pause()
}
An interface definition for the SKVideoNode class.
Creating a Video Node ¶
- ISKVideoNode.InitWithAVPlayer: Initializes a video node using an existing [AVPlayer](<https://developer.apple.com/documentation/AVFoundation/AVPlayer>) object.
- ISKVideoNode.InitWithFileNamed: Initializes a video node using a video file stored in the app bundle.
- ISKVideoNode.InitWithURL: Initializes a video node using a URL.
Setting the Video Node’s Visual Properties ¶
- ISKVideoNode.AnchorPoint: The point in the sprite that corresponds to the node’s position.
- ISKVideoNode.SetAnchorPoint
- ISKVideoNode.Size: The dimensions of the video node, in points.
- ISKVideoNode.SetSize
Controlling Video Playback ¶
- ISKVideoNode.Play: Starts video playback.
- ISKVideoNode.Pause: Pauses video playback.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode
type ISKView ¶
type ISKView interface {
appkit.INSView
// The scene currently presented by this view.
Scene() ISKScene
// Presents a scene.
PresentScene(scene ISKScene)
// Transitions from the current scene to a new scene.
PresentSceneTransition(scene ISKScene, transition ISKTransition)
// A Boolean value that indicates whether the view’s scene animations are paused.
IsPaused() bool
SetPaused(value bool)
// The animation frame rate that the view uses to render its scene.
PreferredFramesPerSecond() int
SetPreferredFramesPerSecond(value int)
// A delegate that allows dynamic control of the view’s render rate.
Delegate() objectivec.Object
SetDelegate(value objectivec.Object)
// A Boolean value that indicates whether parent-child and sibling relationships affect the rendering order of nodes in the scene.
IgnoresSiblingOrder() bool
SetIgnoresSiblingOrder(value bool)
// A Boolean value that indicates whether the view automatically culls non-visible nodes from the rendering tree.
ShouldCullNonVisibleNodes() bool
SetShouldCullNonVisibleNodes(value bool)
// A Boolean property that indicates whether the view is rendered using transparency.
AllowsTransparency() bool
SetAllowsTransparency(value bool)
// A Boolean value that indicates whether the content is rendered asynchronously.
IsAsynchronous() bool
SetAsynchronous(value bool)
// A Boolean value that indicates whether the view displays a frame rate indicator.
ShowsFPS() bool
SetShowsFPS(value bool)
// A Boolean value that indicates whether the view displays an overlay that shows physics bodies that are visible in the scene.
ShowsNodeCount() bool
SetShowsNodeCount(value bool)
// A Boolean value that indicates whether the view displays the number of drawing passes it needed to render the view.
ShowsDrawCount() bool
SetShowsDrawCount(value bool)
// A Boolean value that indicates whether the view displays the number of rectangles used to render the scene.
ShowsQuadCount() bool
SetShowsQuadCount(value bool)
// A Boolean value that indicates whether the view displays physics-related debugging information.
ShowsPhysics() bool
SetShowsPhysics(value bool)
// A Boolean value that indicates whether the view displays information about physics fields in the scene.
ShowsFields() bool
SetShowsFields(value bool)
// Converts a point from scene coordinates to view coordinates.
ConvertPointFromScene(point corefoundation.CGPoint, scene ISKScene) corefoundation.CGPoint
// Converts a point from view coordinates to scene coordinates.
ConvertPointToScene(point corefoundation.CGPoint, scene ISKScene) corefoundation.CGPoint
// Renders a portion of a node’s contents and returns the rendered image as a texture.
TextureFromNodeCrop(node ISKNode, crop corefoundation.CGRect) ISKTexture
// Renders the contents of a node tree and returns the rendered image as a texture.
TextureFromNode(node ISKNode) ISKTexture
DisableDepthStencilBuffer() bool
SetDisableDepthStencilBuffer(value bool)
}
An interface definition for the SKView class.
Displaying a Scene ¶
- ISKView.Scene: The scene currently presented by this view.
- ISKView.PresentScene: Presents a scene.
- ISKView.PresentSceneTransition: Transitions from the current scene to a new scene.
Controlling the Timing of a Scene’s Rendering ¶
- ISKView.IsPaused: A Boolean value that indicates whether the view’s scene animations are paused.
- ISKView.SetPaused
- ISKView.PreferredFramesPerSecond: The animation frame rate that the view uses to render its scene.
- ISKView.SetPreferredFramesPerSecond
- ISKView.Delegate: A delegate that allows dynamic control of the view’s render rate.
- ISKView.SetDelegate
Configuring Performance Related Toggles ¶
- ISKView.IgnoresSiblingOrder: A Boolean value that indicates whether parent-child and sibling relationships affect the rendering order of nodes in the scene.
- ISKView.SetIgnoresSiblingOrder
- ISKView.ShouldCullNonVisibleNodes: A Boolean value that indicates whether the view automatically culls non-visible nodes from the rendering tree.
- ISKView.SetShouldCullNonVisibleNodes
- ISKView.AllowsTransparency: A Boolean property that indicates whether the view is rendered using transparency.
- ISKView.SetAllowsTransparency
- ISKView.IsAsynchronous: A Boolean value that indicates whether the content is rendered asynchronously.
- ISKView.SetAsynchronous
Enabling Visual Statistics for Debugging ¶
- ISKView.ShowsFPS: A Boolean value that indicates whether the view displays a frame rate indicator.
- ISKView.SetShowsFPS
- ISKView.ShowsNodeCount: A Boolean value that indicates whether the view displays an overlay that shows physics bodies that are visible in the scene.
- ISKView.SetShowsNodeCount
- ISKView.ShowsDrawCount: A Boolean value that indicates whether the view displays the number of drawing passes it needed to render the view.
- ISKView.SetShowsDrawCount
- ISKView.ShowsQuadCount: A Boolean value that indicates whether the view displays the number of rectangles used to render the scene.
- ISKView.SetShowsQuadCount
- ISKView.ShowsPhysics: A Boolean value that indicates whether the view displays physics-related debugging information.
- ISKView.SetShowsPhysics
- ISKView.ShowsFields: A Boolean value that indicates whether the view displays information about physics fields in the scene.
- ISKView.SetShowsFields
Converting Between View and Scene Coordinates ¶
- ISKView.ConvertPointFromScene: Converts a point from scene coordinates to view coordinates.
- ISKView.ConvertPointToScene: Converts a point from view coordinates to scene coordinates.
Snapshotting Nodes to a Texture ¶
- ISKView.TextureFromNodeCrop: Renders a portion of a node’s contents and returns the rendered image as a texture.
- ISKView.TextureFromNode: Renders the contents of a node tree and returns the rendered image as a texture.
Instance Properties ¶
See: https://developer.apple.com/documentation/SpriteKit/SKView
type ISKWarpGeometry ¶
type ISKWarpGeometry interface {
objectivec.IObject
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the SKWarpGeometry class.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometry
type ISKWarpGeometryGrid ¶
type ISKWarpGeometryGrid interface {
ISKWarpGeometry
// The object’s number of columns.
NumberOfColumns() int
// The object’s number of rows.
NumberOfRows() int
// The object’s total number of vertices.
VertexCount() int
// Returns the destination position of a vertex.
DestPositionAtIndex(index int) [2]float32
// Returns the source position of a vertex.
SourcePositionAtIndex(index int) [2]float32
}
An interface definition for the SKWarpGeometryGrid class.
Accessing or Setting Warp Geometry Grid Size ¶
- ISKWarpGeometryGrid.NumberOfColumns: The object’s number of columns.
- ISKWarpGeometryGrid.NumberOfRows: The object’s number of rows.
- ISKWarpGeometryGrid.VertexCount: The object’s total number of vertices.
Accessing or Setting Grid Vertices ¶
- ISKWarpGeometryGrid.DestPositionAtIndex: Returns the destination position of a vertex.
- ISKWarpGeometryGrid.SourcePositionAtIndex: Returns the source position of a vertex.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometryGrid
type SKAction ¶
type SKAction struct {
objectivec.Object
}
An object that is run by a node to change its structure or content.
Overview ¶
SKAction is an animation that is executed by a node in the scene. Actions are used to change a node in some way (like move its position over time), but you can also use actions to change the scene, like doing a fadeout. When the scene processes its nodes, the actions associated with those nodes are processed.
Controlling Action Timing ¶
- SKAction.Duration: The duration required to complete an action.
- SKAction.SetDuration
- SKAction.TimingMode: A setting that controls the speed curve of an animation.
- SKAction.SetTimingMode
- SKAction.TimingFunction: A block used to customize the timing function.
- SKAction.SetTimingFunction
- SKAction.Speed: A speed factor that modifies how fast an action runs.
- SKAction.SetSpeed
See: https://developer.apple.com/documentation/SpriteKit/SKAction
func SKActionFromID ¶
SKActionFromID constructs a SKAction from an objc.ID.
An object that is run by a node to change its structure or content.
func (SKAction) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (SKAction) Duration ¶
func (a SKAction) Duration() foundation.NSTimeInterval
The duration required to complete an action.
Discussion ¶
This is the expected duration of an action’s animation. The actual time an action takes to complete is modified by the SKAction.Speed property of the action and the SKNode.Speed property of the node on which it executes.
See: https://developer.apple.com/documentation/SpriteKit/SKAction/duration
func (SKAction) EncodeWithCoder ¶
func (a SKAction) EncodeWithCoder(coder foundation.INSCoder)
func (SKAction) SetDuration ¶
func (a SKAction) SetDuration(value foundation.NSTimeInterval)
func (SKAction) SetTimingFunction ¶
func (a SKAction) SetTimingFunction(value Float32Float32Handler)
func (SKAction) SetTimingMode ¶
func (a SKAction) SetTimingMode(value SKActionTimingMode)
func (SKAction) Speed ¶
A speed factor that modifies how fast an action runs.
Discussion ¶
The speed factor adjusts how fast an action’s animation runs. For example, a speed factor of `2.0` means the animation runs twice as fast.
See: https://developer.apple.com/documentation/SpriteKit/SKAction/speed
func (SKAction) TimingFunction ¶
func (a SKAction) TimingFunction() Float32Float32Handler
A block used to customize the timing function.
Discussion ¶
If a timing function is provided, after the normal timing mode is applied, the result is sent to the timing function. The return SKActionTimingFunction value of the timing function determines the actual time used to perform the animation.
The following code shows how you can create a custom timing function using simd_smoothstep(_:_:_:) interpolation:
If the above code is combined with a vertical linear move action, the path taken by a node running this action describes the curve illustrated below:
[media-2759776]
See: https://developer.apple.com/documentation/SpriteKit/SKAction/timingFunction
func (SKAction) TimingMode ¶
func (a SKAction) TimingMode() SKActionTimingMode
A setting that controls the speed curve of an animation.
Discussion ¶
The possible values for this property are listed in SKActionTimingMode. The default value is SKActionTimingMode.linear.
See: https://developer.apple.com/documentation/SpriteKit/SKAction/timingMode
type SKActionClass ¶
type SKActionClass struct {
// contains filtered or unexported fields
}
func GetSKActionClass ¶
func GetSKActionClass() SKActionClass
GetSKActionClass returns the class object for SKAction.
func (SKActionClass) Alloc ¶
func (sc SKActionClass) Alloc() SKAction
Alloc allocates memory for a new instance of the class.
func (SKActionClass) Class ¶
func (sc SKActionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKActionTimingFunction ¶
SKActionTimingFunction is the signature for the custom timing block.
See: https://developer.apple.com/documentation/SpriteKit/SKActionTimingFunction
type SKActionTimingMode ¶
type SKActionTimingMode int
See: https://developer.apple.com/documentation/SpriteKit/SKActionTimingMode
const ( // SKActionTimingEaseIn: Specifies ease-in pacing. SKActionTimingEaseIn SKActionTimingMode = 1 // SKActionTimingEaseInEaseOut: Specifies ease-in ease-out pacing. SKActionTimingEaseInEaseOut SKActionTimingMode = 3 // SKActionTimingEaseOut: Specifies ease-out pacing. SKActionTimingEaseOut SKActionTimingMode = 2 // SKActionTimingLinear: Specifies linear pacing. SKActionTimingLinear SKActionTimingMode = 0 )
func (SKActionTimingMode) String ¶
func (e SKActionTimingMode) String() string
type SKAttribute ¶
type SKAttribute struct {
objectivec.Object
}
A specification for dynamic per-node data used with a custom shader.
Overview ¶
To define an attribute for your shader, you create an SKAttribute object with a unique name and data type, which is a SKAttributeType enum. After creating an SKShader object, custom attributes are added to its SKShader.Attributes array. Attribute values are set on the parent node with setValue(_:forAttribute:) and can change for each execution of a shader without the need for recompilation.
The following listing shows how you can use an attribute to pass the size of a sprite into a shader using an attribute. In this example, `a_sprite_size` is available as a global `vec2` within the GLSL code.
Listing 1. Passing an attribute to a shader.
Initializers ¶
- SKAttribute.InitWithNameType: Creates and initializes a new attribute object of a specified type with a name that can be referenced within the shader.
Instance Properties ¶
- SKAttribute.Name: The receiver’s name
- SKAttribute.Type: The data type of the attribute’s value.
See: https://developer.apple.com/documentation/SpriteKit/SKAttribute
func NewAttributeWithNameType ¶
func NewAttributeWithNameType(name string, type_ SKAttributeType) SKAttribute
Creates and initializes a new attribute object of a specified type with a name that can be referenced within the shader.
name: The name of the attribute.
type: The type of the attribute.
Return Value ¶
A new attribute object.
Discussion ¶
Attribute names are typically named with a preceding “a” and an underscore. The following code shows how to initialize an attribute named `a_frequency` which is of type SKAttributeType.float.
See: https://developer.apple.com/documentation/SpriteKit/SKAttribute/init(name:type:)
func NewSKAttribute ¶
func NewSKAttribute() SKAttribute
NewSKAttribute creates a new SKAttribute instance.
func SKAttributeFromID ¶
func SKAttributeFromID(id objc.ID) SKAttribute
SKAttributeFromID constructs a SKAttribute from an objc.ID.
A specification for dynamic per-node data used with a custom shader.
func (SKAttribute) Autorelease ¶
func (a SKAttribute) Autorelease() SKAttribute
Autorelease adds the receiver to the current autorelease pool.
func (SKAttribute) EncodeWithCoder ¶
func (a SKAttribute) EncodeWithCoder(coder foundation.INSCoder)
func (SKAttribute) InitWithNameType ¶
func (a SKAttribute) InitWithNameType(name string, type_ SKAttributeType) SKAttribute
Creates and initializes a new attribute object of a specified type with a name that can be referenced within the shader.
name: The name of the attribute.
type: The type of the attribute.
Return Value ¶
A new attribute object.
Discussion ¶
Attribute names are typically named with a preceding “a” and an underscore. The following code shows how to initialize an attribute named `a_frequency` which is of type SKAttributeType.float.
See: https://developer.apple.com/documentation/SpriteKit/SKAttribute/init(name:type:)
func (SKAttribute) Name ¶
func (a SKAttribute) Name() string
The receiver’s name
See: https://developer.apple.com/documentation/SpriteKit/SKAttribute/name
func (SKAttribute) Type ¶
func (a SKAttribute) Type() SKAttributeType
The data type of the attribute’s value.
See: https://developer.apple.com/documentation/SpriteKit/SKAttribute/type
type SKAttributeClass ¶
type SKAttributeClass struct {
// contains filtered or unexported fields
}
func GetSKAttributeClass ¶
func GetSKAttributeClass() SKAttributeClass
GetSKAttributeClass returns the class object for SKAttribute.
func (SKAttributeClass) Alloc ¶
func (sc SKAttributeClass) Alloc() SKAttribute
Alloc allocates memory for a new instance of the class.
func (SKAttributeClass) Class ¶
func (sc SKAttributeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKAttributeType ¶
type SKAttributeType int
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeType
const ( SKAttributeTypeFloat SKAttributeType = 1 SKAttributeTypeHalfFloat SKAttributeType = 5 SKAttributeTypeNone SKAttributeType = 0 SKAttributeTypeVectorFloat2 SKAttributeType = 2 SKAttributeTypeVectorFloat3 SKAttributeType = 3 SKAttributeTypeVectorFloat4 SKAttributeType = 4 SKAttributeTypeVectorHalfFloat2 SKAttributeType = 6 SKAttributeTypeVectorHalfFloat3 SKAttributeType = 7 SKAttributeTypeVectorHalfFloat4 SKAttributeType = 8 )
func (SKAttributeType) String ¶
func (e SKAttributeType) String() string
type SKAttributeValue ¶
type SKAttributeValue struct {
objectivec.Object
}
A container for dynamic shader data associated with a node.
Overview ¶
SpriteKit nodes that are rendered with a custom shader can use SKAttributeValue objects to pass dynamic values which can change without requiring that shader to be recompiled. An attribute value is passed to a shader using a node’s setValue(_:forAttribute:) method using the relevant attribute’s name. For example, given a shader with a SKAttributeType.float attribute named `a_radius`:
Listing 1. Creating an attribute
The following code sets the value of this attribute to `10` and passes it to a SKSpriteNode object’s shader:
Listing 2. Setting an attribute value
The attribute, `a_radius`, is available as a global floating-point variable within the shader code.
Using this technique, a single shader can be shared across many nodes and each nodes can supply its own attributes. This approach is an alternative to using SKUniform objects which would require a recompilation for each distinct set of parameters.
Instance Properties ¶
- SKAttributeValue.FloatValue: The receiver’s floating point value.
- SKAttributeValue.SetFloatValue
- SKAttributeValue.VectorFloat2Value: The receiver’s value as a vector of two floating-point numbers.
- SKAttributeValue.SetVectorFloat2Value
- SKAttributeValue.VectorFloat3Value: The receiver’s value as a vector of three floating point numbers.
- SKAttributeValue.SetVectorFloat3Value
- SKAttributeValue.VectorFloat4Value: The receiver’s value as a vector of four floating point numbers.
- SKAttributeValue.SetVectorFloat4Value
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeValue
func NewAttributeValueWithFloat ¶
func NewAttributeValueWithFloat(value float32) SKAttributeValue
Creates and initializes a new attribute value object that holds a floating point number.
value: The floating point value for the new attribute value.
Return Value ¶
A new attribute value object.
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeValue/init(float:)
func NewAttributeValueWithVectorFloat2 ¶
func NewAttributeValueWithVectorFloat2(value [2]float32) SKAttributeValue
Creates and initializes a new attribute value object that holds a vector of two floating point numbers.
value: The vector of two point values for the new attribute value.
Return Value ¶
A new attribute value object.
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeValue/init(vectorFloat2:)
func NewAttributeValueWithVectorFloat3 ¶
func NewAttributeValueWithVectorFloat3(value Vector_float3) SKAttributeValue
Creates and initializes a new attribute value object that holds a vector of three floating point numbers.
value: The vector of three point values for the new attribute value.
Return Value ¶
A new attribute value object.
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeValue/init(vectorFloat3:)
func NewAttributeValueWithVectorFloat4 ¶
func NewAttributeValueWithVectorFloat4(value [4]float32) SKAttributeValue
Creates and initializes a new attribute value object that holds a vector of four floating point numbers.
value: The vector of four point values for the new attribute value.
Return Value ¶
A new attribute value object.
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeValue/init(vectorFloat4:)
func NewSKAttributeValue ¶
func NewSKAttributeValue() SKAttributeValue
NewSKAttributeValue creates a new SKAttributeValue instance.
func SKAttributeValueFromID ¶
func SKAttributeValueFromID(id objc.ID) SKAttributeValue
SKAttributeValueFromID constructs a SKAttributeValue from an objc.ID.
A container for dynamic shader data associated with a node.
func (SKAttributeValue) Autorelease ¶
func (a SKAttributeValue) Autorelease() SKAttributeValue
Autorelease adds the receiver to the current autorelease pool.
func (SKAttributeValue) EncodeWithCoder ¶
func (a SKAttributeValue) EncodeWithCoder(coder foundation.INSCoder)
func (SKAttributeValue) FloatValue ¶
func (a SKAttributeValue) FloatValue() float32
The receiver’s floating point value.
Discussion ¶
If the receiver’s original value is a vector, SKAttributeValue.FloatValue is the first element of the vector.
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeValue/floatValue
func (SKAttributeValue) Init ¶
func (a SKAttributeValue) Init() SKAttributeValue
Init initializes the instance.
func (SKAttributeValue) SetFloatValue ¶
func (a SKAttributeValue) SetFloatValue(value float32)
func (SKAttributeValue) SetVectorFloat2Value ¶
func (a SKAttributeValue) SetVectorFloat2Value(value [2]float32)
func (SKAttributeValue) SetVectorFloat3Value ¶
func (a SKAttributeValue) SetVectorFloat3Value(value Vector_float3)
func (SKAttributeValue) SetVectorFloat4Value ¶
func (a SKAttributeValue) SetVectorFloat4Value(value [4]float32)
func (SKAttributeValue) VectorFloat2Value ¶
func (a SKAttributeValue) VectorFloat2Value() [2]float32
The receiver’s value as a vector of two floating-point numbers.
Discussion ¶
If the receiver’s original value is a floating-point number, the second item of the vector is set to 0. If the receiver’s original value is a vector of more than two items, the additional items are truncated.
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeValue/vectorFloat2Value
func (SKAttributeValue) VectorFloat3Value ¶
func (a SKAttributeValue) VectorFloat3Value() Vector_float3
The receiver’s value as a vector of three floating point numbers.
Discussion ¶
If the receiver’s original value is a floating-point number or a vector_float2, the empty items in the vector are set to 0. If the receiver’s original value is a vector_float4, the last item is truncated.
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeValue/vectorFloat3Value
func (SKAttributeValue) VectorFloat4Value ¶
func (a SKAttributeValue) VectorFloat4Value() [4]float32
The receiver’s value as a vector of four floating point numbers.
Discussion ¶
If the receiver’s original value is a floating-point number of a vector with a count less than four, the empty items in the vector are set to 0.
See: https://developer.apple.com/documentation/SpriteKit/SKAttributeValue/vectorFloat4Value
type SKAttributeValueClass ¶
type SKAttributeValueClass struct {
// contains filtered or unexported fields
}
func GetSKAttributeValueClass ¶
func GetSKAttributeValueClass() SKAttributeValueClass
GetSKAttributeValueClass returns the class object for SKAttributeValue.
func (SKAttributeValueClass) Alloc ¶
func (sc SKAttributeValueClass) Alloc() SKAttributeValue
Alloc allocates memory for a new instance of the class.
func (SKAttributeValueClass) Class ¶
func (sc SKAttributeValueClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKAudioNode ¶
type SKAudioNode struct {
SKNode
}
A node that plays audio.
Overview ¶
A SKAudioNode object is used to add an audio to a scene. The sounds are played automatically using AVFoundation, and the node can optionally add 3D spatial audio effects to the audio when it is played.
The currently presented SKScene object mixes the audio from nodes in the scene based on parameters defined in the AVAudio3DMixing protocol. A scene’s SKScene.AudioEngine property allows overall control of volume and playback.
By default, SKAudioNode objects are positional, i.e. their [SKAudioNode.Positional] property is set to true. If you add an audio node to a scene with a SKScene.Listener set, SpriteKit will set the stereo balance and the volume based on the relative positions of the two nodes.
You can explicitly set the volume or stereo balance to an audio node by running actions on it.
SpriteKit includes actions that reduce an audio node’s volume by changing either its occlusion or obstruction. The difference between these actions is that occlusion affects both the direct and reverb paths of the sound while obstruction only affects the direct path. The change volume action offers absolute control over an audio node’s volume.
You can manually set the stereo balance of an audio node with a stereo pan action.
Special effects, such as speeding up or slowing down audio by changing the playback rate and adding reverb are also available as audio actions.
To learn more about audio actions, see Controlling the Audio of a Node in Action Initializers.
Initializing Audio Nodes ¶
- SKAudioNode.InitWithAVAudioNode: Initializes an audio node from an AVFoundation audio node.
- SKAudioNode.InitWithFileNamed: Initializes an audio node from an audio asset with the specified filename.
- SKAudioNode.InitWithURL: Initializes an audio node from an audio asset with the specified URL.
Configuring Audio Nodes ¶
- SKAudioNode.AvAudioNode: The audio node’s current audio asset.
- SKAudioNode.SetAvAudioNode
- SKAudioNode.IsPositional: A Boolean property that indicates whether the node’s audio is altered based on the position of the node.
- SKAudioNode.SetPositional
- SKAudioNode.AutoplayLooped: A Boolean value that indicates whether the audio should play in a loop when the node is added to the scene.
- SKAudioNode.SetAutoplayLooped
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode
func NewAudioNodeWithAVAudioNode ¶
func NewAudioNodeWithAVAudioNode(node avfaudio.AVAudioNode) SKAudioNode
Initializes an audio node from an AVFoundation audio node.
node: An AVAudioNode object that holds an AVAudioEngine sound graph from a single sound source or URL.
Return Value ¶
A newly initialized audio node.
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode/init(avAudioNode:)
func NewAudioNodeWithCoder ¶
func NewAudioNodeWithCoder(aDecoder foundation.INSCoder) SKAudioNode
Tells you when to initialize an audio node that has been unarchived.
Discussion ¶
Do not call this initializer directly; it’s called by the system when you should initialize an audio node that has been unarchived.
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode/init(coder:)
func NewAudioNodeWithFileNamed ¶
func NewAudioNodeWithFileNamed(name string) SKAudioNode
Initializes an audio node from an audio asset with the specified filename.
name: A file containing an AVAudioNode.
Return Value ¶
A newly initialized audio node.
Discussion ¶
The named file containing the audio asset must reside within the main bundle.
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode/init(fileNamed:)
func NewAudioNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewAudioNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKAudioNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewAudioNodeWithURL ¶
func NewAudioNodeWithURL(url foundation.NSURL) SKAudioNode
Initializes an audio node from an audio asset with the specified URL.
url: The URL of an audio file.
Return Value ¶
A newly initialized audio node.
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode/init(url:)
func NewSKAudioNode ¶
func NewSKAudioNode() SKAudioNode
NewSKAudioNode creates a new SKAudioNode instance.
func SKAudioNodeFromID ¶
func SKAudioNodeFromID(id objc.ID) SKAudioNode
SKAudioNodeFromID constructs a SKAudioNode from an objc.ID.
A node that plays audio.
func (SKAudioNode) AutoplayLooped ¶
func (a SKAudioNode) AutoplayLooped() bool
A Boolean value that indicates whether the audio should play in a loop when the node is added to the scene.
Discussion ¶
If the property value is true, then the audio starts playing as soon as the node is added to the scene, and repeats after it completes. If false, then the audio node’s content never plays automatically. It must be explicitly scheduled using the scene’s audio engine. The default value is true.
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode/autoplayLooped
func (SKAudioNode) Autorelease ¶
func (a SKAudioNode) Autorelease() SKAudioNode
Autorelease adds the receiver to the current autorelease pool.
func (SKAudioNode) AvAudioNode ¶
func (a SKAudioNode) AvAudioNode() avfaudio.AVAudioNode
The audio node’s current audio asset.
Discussion ¶
The AV audio node must refer to an AVAudioEngine sound graph from a single sound source or URL.
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode/avAudioNode
func (SKAudioNode) InitWithAVAudioNode ¶
func (a SKAudioNode) InitWithAVAudioNode(node avfaudio.AVAudioNode) SKAudioNode
Initializes an audio node from an AVFoundation audio node.
node: An AVAudioNode object that holds an AVAudioEngine sound graph from a single sound source or URL.
Return Value ¶
A newly initialized audio node.
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode/init(avAudioNode:)
func (SKAudioNode) InitWithFileNamed ¶
func (a SKAudioNode) InitWithFileNamed(name string) SKAudioNode
Initializes an audio node from an audio asset with the specified filename.
name: A file containing an AVAudioNode.
Return Value ¶
A newly initialized audio node.
Discussion ¶
The named file containing the audio asset must reside within the main bundle.
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode/init(fileNamed:)
func (SKAudioNode) InitWithURL ¶
func (a SKAudioNode) InitWithURL(url foundation.NSURL) SKAudioNode
Initializes an audio node from an audio asset with the specified URL.
url: The URL of an audio file.
Return Value ¶
A newly initialized audio node.
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode/init(url:)
func (SKAudioNode) IsPositional ¶
func (a SKAudioNode) IsPositional() bool
A Boolean property that indicates whether the node’s audio is altered based on the position of the node.
Discussion ¶
If true, the audio mixer considers the position and velocity of the SKAudioNode relative to scene’s current SKScene.Listener node. The mixer applies distance attenuation, doppler shift, and pan effects to the sound. If false, then the sound is played normally. The default value is true.
See: https://developer.apple.com/documentation/SpriteKit/SKAudioNode/isPositional
func (SKAudioNode) SetAutoplayLooped ¶
func (a SKAudioNode) SetAutoplayLooped(value bool)
func (SKAudioNode) SetAvAudioNode ¶
func (a SKAudioNode) SetAvAudioNode(value avfaudio.AVAudioNode)
func (SKAudioNode) SetPositional ¶
func (a SKAudioNode) SetPositional(value bool)
type SKAudioNodeClass ¶
type SKAudioNodeClass struct {
// contains filtered or unexported fields
}
func GetSKAudioNodeClass ¶
func GetSKAudioNodeClass() SKAudioNodeClass
GetSKAudioNodeClass returns the class object for SKAudioNode.
func (SKAudioNodeClass) Alloc ¶
func (sc SKAudioNodeClass) Alloc() SKAudioNode
Alloc allocates memory for a new instance of the class.
func (SKAudioNodeClass) Class ¶
func (sc SKAudioNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKBlendMode ¶
type SKBlendMode int
See: https://developer.apple.com/documentation/SpriteKit/SKBlendMode
const ( // SKBlendModeAdd: The source and destination colors are added together. SKBlendModeAdd SKBlendMode = 1 // SKBlendModeAlpha: The source and destination colors are blended by multiplying the source alpha value. SKBlendModeAlpha SKBlendMode = 0 // SKBlendModeMultiply: The source color is multiplied by the destination color. SKBlendModeMultiply SKBlendMode = 3 SKBlendModeMultiplyAlpha SKBlendMode = 7 // SKBlendModeMultiplyX2: The source color is multiplied by the destination color and then doubled. SKBlendModeMultiplyX2 SKBlendMode = 4 // SKBlendModeReplace: The source color replaces the destination color. SKBlendModeReplace SKBlendMode = 6 // SKBlendModeScreen: The source color is added to the destination color times the inverted source color. SKBlendModeScreen SKBlendMode = 5 // SKBlendModeSubtract: The source color is subtracted from the destination color. SKBlendModeSubtract SKBlendMode = 2 )
func (SKBlendMode) String ¶
func (e SKBlendMode) String() string
type SKCameraNode ¶
type SKCameraNode struct {
SKNode
}
A node that determines which parts of the scene are visible within a view.
Overview ¶
If you don’t use a camera in your scene, you control the visible portion of a scene using its SKScene.AnchorPoint property.
Node Visibility ¶
- SKCameraNode.ContainedNodeSet: Finds nodes that are visible in the camera’s viewport.
- SKCameraNode.ContainsNode: Checks to see if a node is visible in the camera’s viewport.
See: https://developer.apple.com/documentation/SpriteKit/SKCameraNode
func NewCameraNodeWithCoder ¶
func NewCameraNodeWithCoder(aDecoder foundation.INSCoder) SKCameraNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewCameraNodeWithFileNamed ¶
func NewCameraNodeWithFileNamed(filename string) SKCameraNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewCameraNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewCameraNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKCameraNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewSKCameraNode ¶
func NewSKCameraNode() SKCameraNode
NewSKCameraNode creates a new SKCameraNode instance.
func SKCameraNodeFromID ¶
func SKCameraNodeFromID(id objc.ID) SKCameraNode
SKCameraNodeFromID constructs a SKCameraNode from an objc.ID.
A node that determines which parts of the scene are visible within a view.
func (SKCameraNode) Autorelease ¶
func (c SKCameraNode) Autorelease() SKCameraNode
Autorelease adds the receiver to the current autorelease pool.
func (SKCameraNode) ContainedNodeSet ¶
func (c SKCameraNode) ContainedNodeSet() foundation.INSSet
Finds nodes that are visible in the camera’s viewport.
Return Value ¶
The set of nodes that are in the same scene as the camera and contained in the camera’s viewport.
Discussion ¶
The camera must be part of a scene’s node hierarchy and the scene must be presented in an view.
See: https://developer.apple.com/documentation/SpriteKit/SKCameraNode/containedNodeSet()
func (SKCameraNode) ContainsNode ¶
func (c SKCameraNode) ContainsNode(node ISKNode) bool
Checks to see if a node is visible in the camera’s viewport.
node: An SKNode object.
Return Value ¶
true if the node in the same scene and inside the camera’s viewport; otherwise false.
Discussion ¶
The camera must be part of a scene’s node hierarchy and the scene must be presented in an view.
See: https://developer.apple.com/documentation/SpriteKit/SKCameraNode/contains(_:)
type SKCameraNodeClass ¶
type SKCameraNodeClass struct {
// contains filtered or unexported fields
}
func GetSKCameraNodeClass ¶
func GetSKCameraNodeClass() SKCameraNodeClass
GetSKCameraNodeClass returns the class object for SKCameraNode.
func (SKCameraNodeClass) Alloc ¶
func (sc SKCameraNodeClass) Alloc() SKCameraNode
Alloc allocates memory for a new instance of the class.
func (SKCameraNodeClass) Class ¶
func (sc SKCameraNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKConstraint ¶
type SKConstraint struct {
objectivec.Object
}
A specification for constraining a node’s position or rotation.
Overview ¶
An SKConstraint object describes a mathematical constraint on a node’s position or orientation. You attach constraints to nodes; after a scene processes any actions and physics interactions, it applies constraints attached to nodes in its node tree. Use constraints to ensure that certain relationships are true before the system renders a scene. For example, you might use a constraint to:
- Change a node’s SKNode.ZRotation property so that it always points at another node or a position in the scene. - Keep a node within a specified distance of another node or a point in the scene. - Keep a node inside a specified rectangle. - Restrict the SKNode.ZRotation property of a node so that it has a more limited rotation range of motion.
To use constraints, create an NSArray object that contains one or more constraint objects and assign the array to a node’s SKNode.Constraints property. When the system evaluates a scene, it executes the constraints on a node in the order they appear in the SKNode.Constraints array.
You can’t change a constraint after you create it. However, you can selectively disable or enable a constraint by setting its SKConstraint.Enabled property. You can also use the SKConstraint.ReferenceNode property to convert positions to the referenced coordinate system before applying the constraint.
Controlling the Coordinate System Where a Constraint is Applied ¶
- SKConstraint.ReferenceNode: The node whose coordinate system should be used to apply the constraint.
- SKConstraint.SetReferenceNode
Enabling and Disabling a Constraint ¶
- SKConstraint.Enabled: A Boolean value that specifies whether the constraint is applied.
- SKConstraint.SetEnabled
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint
func NewSKConstraint ¶
func NewSKConstraint() SKConstraint
NewSKConstraint creates a new SKConstraint instance.
func SKConstraintFromID ¶
func SKConstraintFromID(id objc.ID) SKConstraint
SKConstraintFromID constructs a SKConstraint from an objc.ID.
A specification for constraining a node’s position or rotation.
func (SKConstraint) Autorelease ¶
func (c SKConstraint) Autorelease() SKConstraint
Autorelease adds the receiver to the current autorelease pool.
func (SKConstraint) Enabled ¶
func (c SKConstraint) Enabled() bool
A Boolean value that specifies whether the constraint is applied.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/enabled
func (SKConstraint) EncodeWithCoder ¶
func (c SKConstraint) EncodeWithCoder(coder foundation.INSCoder)
func (SKConstraint) ReferenceNode ¶
func (c SKConstraint) ReferenceNode() ISKNode
The node whose coordinate system should be used to apply the constraint.
Discussion ¶
The default value is `nil`, meaning that the coordinate system of the node’s parent is used to apply the constraint. If another node is specified, all positions are converted into this node’s coordinate system before the constraint is applied.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/referenceNode
func (SKConstraint) SetEnabled ¶
func (c SKConstraint) SetEnabled(value bool)
func (SKConstraint) SetReferenceNode ¶
func (c SKConstraint) SetReferenceNode(value ISKNode)
type SKConstraintClass ¶
type SKConstraintClass struct {
// contains filtered or unexported fields
}
func GetSKConstraintClass ¶
func GetSKConstraintClass() SKConstraintClass
GetSKConstraintClass returns the class object for SKConstraint.
func (SKConstraintClass) Alloc ¶
func (sc SKConstraintClass) Alloc() SKConstraint
Alloc allocates memory for a new instance of the class.
func (SKConstraintClass) Class ¶
func (sc SKConstraintClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKConstraintClass) DistanceToNode ¶
func (_SKConstraintClass SKConstraintClass) DistanceToNode(range_ ISKRange, node ISKNode) SKConstraint
Creates a constraint that keeps a node within a certain distance of another node.
range: The range of allowed distances between the two nodes.
node: The target node used to calculate the distance.
Return Value ¶
A new constraint.
Discussion ¶
Distance constraints constrain a node to a specified distance range of another node or a point and can be used for effects such a simulating flocking around a node, repulsive fields and trails. Supplying a distance constraint with a range with a lower limit, an upper limit or both results in very different behaviors:
[Table data omitted]
Each time when constraints are applied, a line is projected between the node’s position and the target node’s position. The distance between the two points is calculated, and if it lies outside the specified range, the node is pushed or pulled along this line until it lies within the range.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/distance(_:to:)-6507j
func (SKConstraintClass) DistanceToPoint ¶
func (_SKConstraintClass SKConstraintClass) DistanceToPoint(range_ ISKRange, point corefoundation.CGPoint) SKConstraint
Creates a constraint that keeps a node within a certain distance of a point.
range: The range of allowed distances between the node and the point.
point: A point in the coordinate system of the node’s parent that is used to calculate the distance.
Return Value ¶
A new constraint.
Discussion ¶
Each time when constraints are applied, a line is projected between the node’s position and the target point. The distance between the two points is calculated, and if it lies outside the specified range, the node is pushed or pulled along this line until it lies within the range.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/distance(_:to:)-7yk7n
func (SKConstraintClass) DistanceToPointInNode ¶
func (_SKConstraintClass SKConstraintClass) DistanceToPointInNode(range_ ISKRange, point corefoundation.CGPoint, node ISKNode) SKConstraint
Creates a constraint that keeps a node within a certain distance of a point in another node’s coordinate system.
range: The range of allowed distances.
point: The point to use as the target point.
node: The node whose coordinate system the point is specified in.
Return Value ¶
A new constraint.
Discussion ¶
Each time when constraints are applied, a line is projected between the node’s position and the target point. The distance between the two points is calculated, and if it lies outside the specified range, the node is pushed or pulled along this line until it lies within the range.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/distance(_:to:in:)
func (SKConstraintClass) OrientToNodeOffset ¶
func (_SKConstraintClass SKConstraintClass) OrientToNodeOffset(node ISKNode, radians ISKRange) SKConstraint
Creates a constraint that forces a node to rotate to face another node.
node: The node that should be used to orient the node that this constraint is attached to.
radians: An offset that is added to the SKNode.ZRotation value after it is calculated.
Return Value ¶
A new constraint.
Discussion ¶
Each time when constraints are applied, a new angle is calculated so that a line projected at this angle would point at the other node’s origin. This angle is added to the values specified in the `radians` property to create a new range. Finally, the node’s SKNode.ZRotation value is clamped to fit inside this range.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/orient(to:offset:)-1h1tw
func (SKConstraintClass) OrientToPointInNodeOffset ¶
func (_SKConstraintClass SKConstraintClass) OrientToPointInNodeOffset(point corefoundation.CGPoint, node ISKNode, radians ISKRange) SKConstraint
Creates a constraint that forces a node to rotate to face a point in another node’s coordinate system.
point: A point in the `node` parameter’s coordinate system.
node: The node whose coordinate system the point is specified in.
radians: An offset that is added to the SKNode.ZRotation value after it is calculated.
Return Value ¶
A new constraint.
Discussion ¶
Each time when constraints are applied, a new angle is calculated so that a line projected at this angle would point at the target point. This angle is added to the values specified in the `radians` property to create a new range. Finally, the node’s SKNode.ZRotation value is clamped to fit inside this range.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/orient(to:in:offset:)
func (SKConstraintClass) OrientToPointOffset ¶
func (_SKConstraintClass SKConstraintClass) OrientToPointOffset(point corefoundation.CGPoint, radians ISKRange) SKConstraint
Creates a constraint that forces a node to rotate to face a fixed point.
point: A point in the node’s parent’s coordinate system.
radians: An offset that is added to the SKNode.ZRotation value after it is calculated.
Return Value ¶
A new constraint.
Discussion ¶
Each time when constraints are applied, a new angle is calculated so that a line projected at this angle would point at the target point. This angle is added to the values specified in the `radians` property to create a new range. Finally, the node’s SKNode.ZRotation value is clamped to fit inside this range.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/orient(to:offset:)-9lq3h
func (SKConstraintClass) PositionX ¶
func (_SKConstraintClass SKConstraintClass) PositionX(range_ ISKRange) SKConstraint
Creates a constraint that restricts the x-coordinate of a node’s position.
range: The range to restrict the coordinate to.
Return Value ¶
A new constraint.
Discussion ¶
Each time constraints are applied, the x-coordinate of the node’s SKNode.Position property is clamped so that it lies inside the specified range.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/positionX(_:)
func (SKConstraintClass) PositionXY ¶
func (_SKConstraintClass SKConstraintClass) PositionXY(xRange ISKRange, yRange ISKRange) SKConstraint
Creates a constraint that restricts both coordinates of a node’s position.
xRange: The range to restrict the x-coordinate to.
yRange: The range to restrict the y-coordinate to.
Return Value ¶
A new constraint.
Discussion ¶
Each time constraints are applied, the node’s SKNode.Position property is clamped so that both coordinates lie inside the specified ranges.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/positionX(_:y:)
func (SKConstraintClass) PositionY ¶
func (_SKConstraintClass SKConstraintClass) PositionY(range_ ISKRange) SKConstraint
Creates a constraint that restricts the y-coordinate of a node’s position.
range: The range to restrict the coordinate to.
Return Value ¶
A new constraint.
Discussion ¶
Each time when constraints are applied, the y-coordinate of the node’s SKNode.Position property is clamped so that it lies inside the specified range.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/positionY(_:)
func (SKConstraintClass) ZRotation ¶
func (_SKConstraintClass SKConstraintClass) ZRotation(zRange ISKRange) SKConstraint
Creates a constraint that limits the orientation of a node.
zRange: A range value that specifies the minimum and maximum values of the node’s SKNode.ZRotation property.
Return Value ¶
A new constraint.
Discussion ¶
Each time when constraints are applied, the node’s SKNode.ZRotation property is clamped so that it is within the specified range.
See: https://developer.apple.com/documentation/SpriteKit/SKConstraint/zRotation(_:)
type SKCropNode ¶
type SKCropNode struct {
SKNode
}
A node that masks pixels drawn by its children so that only some pixels are seen.
Overview ¶
SKCropNode is a container node that you use to crop other nodes in the scene. You add other nodes to a crop node and set the crop node’s SKCropNode.MaskNode property. For example, here are some ways you might specify a mask:
- An untextured sprite that limits content to a rectangular portion of the scene. - A textured sprite that works as a precise per-pixel mask. - A collection of child nodes that form a unique shape.
You can animate the shape or contents of the mask to implement interesting effects such as hiding or revealing.
Setting the Mask Filter ¶
- SKCropNode.MaskNode: The node used to determine the crop node’s mask.
- SKCropNode.SetMaskNode
See: https://developer.apple.com/documentation/SpriteKit/SKCropNode
func NewCropNodeWithCoder ¶
func NewCropNodeWithCoder(aDecoder foundation.INSCoder) SKCropNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewCropNodeWithFileNamed ¶
func NewCropNodeWithFileNamed(filename string) SKCropNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewCropNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewCropNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKCropNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewSKCropNode ¶
func NewSKCropNode() SKCropNode
NewSKCropNode creates a new SKCropNode instance.
func SKCropNodeFromID ¶
func SKCropNodeFromID(id objc.ID) SKCropNode
SKCropNodeFromID constructs a SKCropNode from an objc.ID.
A node that masks pixels drawn by its children so that only some pixels are seen.
func (SKCropNode) Autorelease ¶
func (c SKCropNode) Autorelease() SKCropNode
Autorelease adds the receiver to the current autorelease pool.
func (SKCropNode) MaskNode ¶
func (c SKCropNode) MaskNode() ISKNode
The node used to determine the crop node’s mask.
Discussion ¶
The node supplied to the crop node must not be a child of another node; however, it may have children of its own.
When the crop node’s contents are rendered, the crop node first draws its mask into a private buffer. Then, it renders its children. When rendering its children, each pixel is verified against the corresponding pixel in the mask. If the pixel in the mask has an alpha value of less than 0.05, the image pixel is masked out. Any pixel not rendered by the mask node is automatically masked out.
The default value of this property is `nil`, which indicates that the child nodes should not be cropped.
See: https://developer.apple.com/documentation/SpriteKit/SKCropNode/maskNode
func (SKCropNode) SetMaskNode ¶
func (c SKCropNode) SetMaskNode(value ISKNode)
type SKCropNodeClass ¶
type SKCropNodeClass struct {
// contains filtered or unexported fields
}
func GetSKCropNodeClass ¶
func GetSKCropNodeClass() SKCropNodeClass
GetSKCropNodeClass returns the class object for SKCropNode.
func (SKCropNodeClass) Alloc ¶
func (sc SKCropNodeClass) Alloc() SKCropNode
Alloc allocates memory for a new instance of the class.
func (SKCropNodeClass) Class ¶
func (sc SKCropNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKEffectNode ¶
type SKEffectNode struct {
SKNode
}
A node that renders its children into a separate buffer, optionally applying an effect, before drawing the final result.
Overview ¶
An SKEffectNode object renders its children into a buffer and optionally applies a Core Image filter to this rendered output. Because effect nodes conform to SKWarpable, you can also use them to apply distortions to nodes that don’t implement the protocol, such as shape and video nodes. Use effect nodes to incorporate sophisticated special effects into a scene or to cache the contents of a static subtree for faster rendering performance.
Each time a new frame is rendered using the effect node, the effect node follows these steps:
- It draws its children into a private framebuffer. - It applies a Core Image effect to the private framebuffer. This stage is optional; see the SKEffectNode.Filter and SKEffectNode.ShouldEnableEffects properties. - It blends the contents of its private framebuffer into its parent’s framebuffer, using one of the standard sprite blend modes. - It discards its private framebuffer. This step is optional; see the SKEffectNode.ShouldRasterize property.
Applying Core Image Filters with an Effect Node ¶
- SKEffectNode.Filter: The Core Image filter to apply.
- SKEffectNode.SetFilter
- SKEffectNode.ShouldEnableEffects: A Boolean value that determines whether the effect node applies the filter to its children as they are drawn.
- SKEffectNode.SetShouldEnableEffects
- SKEffectNode.ShouldCenterFilter: A Boolean value that determines whether the effect node automatically sets the filter’s image center.
- SKEffectNode.SetShouldCenterFilter
Applying a Shader with an Effect Node ¶
- SKEffectNode.Shader: A custom shader that is called when the effect node is blended into the parent’s framebuffer.
- SKEffectNode.SetShader
- SKEffectNode.AttributeValues: The values of each attribute associated with the node’s attached shader.
- SKEffectNode.SetAttributeValues
- SKEffectNode.SetValueForAttributeNamed: Sets an attribute value for an attached shader.
- SKEffectNode.ValueForAttributeNamed: Gets the value of a shader attribute.
Flattening an Effect Node’s Child Tree for Performance Improvement ¶
- SKEffectNode.ShouldRasterize: A Boolean value that indicates whether the results of rendering the child nodes should be cached.
- SKEffectNode.SetShouldRasterize
Configuring Alpha Blending ¶
- SKEffectNode.BlendMode: The blend mode used to draw the node’s contents into its parent’s framebuffer.
- SKEffectNode.SetBlendMode
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode
func NewEffectNodeWithCoder ¶
func NewEffectNodeWithCoder(aDecoder foundation.INSCoder) SKEffectNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewEffectNodeWithFileNamed ¶
func NewEffectNodeWithFileNamed(filename string) SKEffectNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewEffectNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewEffectNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKEffectNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewSKEffectNode ¶
func NewSKEffectNode() SKEffectNode
NewSKEffectNode creates a new SKEffectNode instance.
func SKEffectNodeFromID ¶
func SKEffectNodeFromID(id objc.ID) SKEffectNode
SKEffectNodeFromID constructs a SKEffectNode from an objc.ID.
A node that renders its children into a separate buffer, optionally applying an effect, before drawing the final result.
func (SKEffectNode) AttributeValues ¶
func (e SKEffectNode) AttributeValues() foundation.INSDictionary
The values of each attribute associated with the node’s attached shader.
Discussion ¶
All nodes have their own copy of an attribute value and therefore the attribute values can be different per-node across the same SKShader. If instead you need all nodes to share the same value, use SKUniform. Uniforms can change values every frame, but uniforms cannot vary per-node like attributes can.
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode/attributeValues
func (SKEffectNode) Autorelease ¶
func (e SKEffectNode) Autorelease() SKEffectNode
Autorelease adds the receiver to the current autorelease pool.
func (SKEffectNode) BlendMode ¶
func (e SKEffectNode) BlendMode() SKBlendMode
The blend mode used to draw the node’s contents into its parent’s framebuffer.
Discussion ¶
The default value is SKBlendMode.alpha.
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode/blendMode
func (SKEffectNode) Filter ¶
func (e SKEffectNode) Filter() coreimage.CIFilter
The Core Image filter to apply.
Discussion ¶
The Core Image filter must have a single `inputImage` parameter and produce a single `outputImage` parameter. The default value is `nil`. If the value is `nil` and the effect node is enabled, no filtering takes place. However, its children are still rendered in a separate pass and blended to the parent’s framebuffer.
If you wish to use a Core Image filter that doesn’t have an `inputImage` parameter, such as a sunbeams generator, you can subclass CIFilter and add an `inputImage` property. The input image’s extent can be used to define properties such as radius on the filter. The following code creates a filter based on CISunbeamsGenerator which can be used as an effect node’s filter:
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode/filter
func (SKEffectNode) SetAttributeValues ¶
func (e SKEffectNode) SetAttributeValues(value foundation.INSDictionary)
func (SKEffectNode) SetBlendMode ¶
func (e SKEffectNode) SetBlendMode(value SKBlendMode)
func (SKEffectNode) SetFilter ¶
func (e SKEffectNode) SetFilter(value coreimage.CIFilter)
func (SKEffectNode) SetShader ¶
func (e SKEffectNode) SetShader(value ISKShader)
func (SKEffectNode) SetShouldCenterFilter ¶
func (e SKEffectNode) SetShouldCenterFilter(value bool)
func (SKEffectNode) SetShouldEnableEffects ¶
func (e SKEffectNode) SetShouldEnableEffects(value bool)
func (SKEffectNode) SetShouldRasterize ¶
func (e SKEffectNode) SetShouldRasterize(value bool)
func (SKEffectNode) SetSubdivisionLevels ¶
func (o SKEffectNode) SetSubdivisionLevels(value int)
The maximum number of subdivision iterations used to generate the final vertices.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/subdivisionLevels
func (SKEffectNode) SetValueForAttributeNamed ¶
func (e SKEffectNode) SetValueForAttributeNamed(value ISKAttributeValue, key string)
Sets an attribute value for an attached shader.
value: An attribute value object containing the scalar or vector value to set in the attached shader.
key: The attribute name.
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode/setValue(_:forAttribute:)
func (SKEffectNode) SetWarpGeometry ¶
func (o SKEffectNode) SetWarpGeometry(value ISKWarpGeometry)
The warp geometry used to define the distortion.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/warpGeometry
func (SKEffectNode) Shader ¶
func (e SKEffectNode) Shader() ISKShader
A custom shader that is called when the effect node is blended into the parent’s framebuffer.
Discussion ¶
The default value is `nil`, meaning that default blending behavior executes. If a shader is specified, it is called when the rasterized image is blended into the parent’s framebuffer.
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode/shader
func (SKEffectNode) ShouldCenterFilter ¶
func (e SKEffectNode) ShouldCenterFilter() bool
A Boolean value that determines whether the effect node automatically sets the filter’s image center.
Discussion ¶
If the value of this property is true and the filter has an `inputCenter` parameter, the effect node automatically sets the filter’s input center to the effect node’s origin. The default value is true.
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode/shouldCenterFilter
func (SKEffectNode) ShouldEnableEffects ¶
func (e SKEffectNode) ShouldEnableEffects() bool
A Boolean value that determines whether the effect node applies the filter to its children as they are drawn.
Discussion ¶
If the value of this property is true, the effect node applies the filter and blends the results. If the value is false, the effect node is ignored and its children are rendered normally. The default value is false.
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode/shouldEnableEffects
func (SKEffectNode) ShouldRasterize ¶
func (e SKEffectNode) ShouldRasterize() bool
A Boolean value that indicates whether the results of rendering the child nodes should be cached.
Discussion ¶
If the value of this property is true, the effect node caches the filtered image for use in future frames. If the value is false, then SpriteKit discards the rendered image and redraws it from scratch the next time the node is rendered. The default value is false. Caching the rendered image uses more memory and may take more time to render. However, if the effect node’s descendants rarely change, caching can improve performance.
When caching is enabled, changes to the effect node’s children trigger updates to the cached image in the next frame of animation. However, changing the filter’s properties does not.
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode/shouldRasterize
func (SKEffectNode) SubdivisionLevels ¶
func (e SKEffectNode) SubdivisionLevels() int
The maximum number of subdivision iterations used to generate the final vertices.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/subdivisionLevels
func (SKEffectNode) ValueForAttributeNamed ¶
func (e SKEffectNode) ValueForAttributeNamed(key string) ISKAttributeValue
Gets the value of a shader attribute.
key: The attribute name.
Return Value ¶
An attribute value object containing the scalar or vector value or `nil` if no such attribute exists.
See: https://developer.apple.com/documentation/SpriteKit/SKEffectNode/value(forAttributeNamed:)
func (SKEffectNode) WarpGeometry ¶
func (e SKEffectNode) WarpGeometry() ISKWarpGeometry
The warp geometry used to define the distortion.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/warpGeometry
type SKEffectNodeClass ¶
type SKEffectNodeClass struct {
// contains filtered or unexported fields
}
func GetSKEffectNodeClass ¶
func GetSKEffectNodeClass() SKEffectNodeClass
GetSKEffectNodeClass returns the class object for SKEffectNode.
func (SKEffectNodeClass) Alloc ¶
func (sc SKEffectNodeClass) Alloc() SKEffectNode
Alloc allocates memory for a new instance of the class.
func (SKEffectNodeClass) Class ¶
func (sc SKEffectNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKEmitterNode ¶
type SKEmitterNode struct {
SKNode
}
A source of various particle effects.
Overview ¶
A SKEmitterNode object is a node that automatically creates and renders small particle sprites. Particles are privately owned by SpriteKit—your game cannot access the generated sprites. For example, you cannot add physics shapes to particles. Emitter nodes are often used to create smoke, fire, sparks, and other particle effects. A particle is similar to an SKSpriteNode object; it renders a textured or untextured image that is sized, colorized, and blended into the scene. However, particles differ from sprites in two important ways:
- A particle’s texture is always stretched uniformly. - Particles are not represented by objects in SpriteKit. This means you cannot perform node-related tasks on particles, nor can you associate physics bodies with particles to make them interact with other content. Although there is no visible class representing particles added by the emitter node, you can think of a particle as having properties like any other object.
Particles are purely visual objects, and their behavior is entirely defined by the emitter node that created them. The emitter node contains many properties to control the behavior of the particles it generates, including:
- The birth rate and lifetime of the particle. You can also specify the order in which the particles are rendered and the maximum number of particles that are created before the emitter turns itself off. - The starting values of the particle, including its position, orientation, color, and size. You can choose to have these starting values randomized. - The changes to apply to the particle over its lifetime. Typically, these are specified as a rate of change over time. For example, you might specify that a particle rotates at a particular rate, in radians per second. The emitter automatically updates the particle data for each frame. In most cases, you can also create more sophisticated behaviors using keyframe sequences. For example, you might specify a keyframe sequence for a particle so that it starts out small, scales up to a larger size, then shrinks before dying.
Choosing Which Node in the Scene Emits Particles ¶
- SKEmitterNode.TargetNode: The target node that renders the emitter’s particles.
- SKEmitterNode.SetTargetNode
Controlling When Particles Are Created ¶
- SKEmitterNode.AdvanceSimulationTime: Advances the emitter particle simulation.
- SKEmitterNode.ResetSimulation: Removes all existing particles and restarts the simulation.
- SKEmitterNode.ParticleBirthRate: The rate at which new particles are created.
- SKEmitterNode.SetParticleBirthRate
- SKEmitterNode.NumParticlesToEmit: The number of particles the emitter should emit before stopping.
- SKEmitterNode.SetNumParticlesToEmit
Controlling the Rendering Order of an Emitter’s Particles ¶
- SKEmitterNode.ParticleRenderOrder: The order in which the emitter’s particles are rendered.
- SKEmitterNode.SetParticleRenderOrder
Controlling Particle Lifetime ¶
- SKEmitterNode.ParticleLifetime: The average lifetime of a particle, in seconds.
- SKEmitterNode.SetParticleLifetime
- SKEmitterNode.ParticleLifetimeRange: The range of allowed random values for a particle’s lifetime.
- SKEmitterNode.SetParticleLifetimeRange
Controlling Particle Position ¶
- SKEmitterNode.ParticlePosition: The average starting position for a particle.
- SKEmitterNode.SetParticlePosition
- SKEmitterNode.ParticlePositionRange: The range of allowed random values for a particle’s position.
- SKEmitterNode.SetParticlePositionRange
- SKEmitterNode.ParticleZPosition: The average starting depth of a particle.
- SKEmitterNode.SetParticleZPosition
Controlling Particle Velocity and Acceleration ¶
- SKEmitterNode.ParticleSpeed: The average initial speed of a new particle, in points per second.
- SKEmitterNode.SetParticleSpeed
- SKEmitterNode.ParticleSpeedRange: The range of allowed random values for a particle’s initial speed.
- SKEmitterNode.SetParticleSpeedRange
- SKEmitterNode.EmissionAngle: The average initial direction of a particle, expressed as an angle in radians.
- SKEmitterNode.SetEmissionAngle
- SKEmitterNode.EmissionAngleRange: The range of allowed random values for a particle’s initial direction, expressed as an angle in radians.
- SKEmitterNode.SetEmissionAngleRange
- SKEmitterNode.XAcceleration: The acceleration to apply to a particle’s horizontal velocity.
- SKEmitterNode.SetXAcceleration
- SKEmitterNode.YAcceleration: The acceleration to apply to a particle’s vertical velocity.
- SKEmitterNode.SetYAcceleration
Adjusting a Particle’s Rotation ¶
- SKEmitterNode.ParticleRotation: The average initial rotation of a particle, expressed as an angle in radians.
- SKEmitterNode.SetParticleRotation
- SKEmitterNode.ParticleRotationRange: The range of allowed random values for a particle’s initial rotation, expressed as an angle in radians.
- SKEmitterNode.SetParticleRotationRange
- SKEmitterNode.ParticleRotationSpeed: The speed at which a particle rotates, expressed in radians per second.
- SKEmitterNode.SetParticleRotationSpeed
Scaling Particles by a Factor ¶
- SKEmitterNode.ParticleScale: The average initial scale factor of a particle.
- SKEmitterNode.SetParticleScale
- SKEmitterNode.ParticleScaleRange: The range of allowed random values for a particle’s initial scale.
- SKEmitterNode.SetParticleScaleRange
- SKEmitterNode.ParticleScaleSpeed: The rate at which a particle’s scale factor changes per second.
- SKEmitterNode.SetParticleScaleSpeed
- SKEmitterNode.ParticleScaleSequence: The sequence used to specify the scale factor of a particle over its lifetime.
- SKEmitterNode.SetParticleScaleSequence
Changing a Particle’s Source Image and Size ¶
- SKEmitterNode.ParticleTexture: The texture to use to render a particle.
- SKEmitterNode.SetParticleTexture
- SKEmitterNode.ParticleSize: The starting size of each particle.
- SKEmitterNode.SetParticleSize
Configuring Particle Color ¶
- SKEmitterNode.ParticleColorSequence: The sequence used to specify the color components of a particle over its lifetime.
- SKEmitterNode.SetParticleColorSequence
- SKEmitterNode.ParticleColor: The average initial color for a particle.
- SKEmitterNode.SetParticleColor
- SKEmitterNode.ParticleColorAlphaRange: The range of allowed random values for the alpha component of a particle’s initial color.
- SKEmitterNode.SetParticleColorAlphaRange
- SKEmitterNode.ParticleColorBlueRange: The range of allowed random values for the blue component of a particle’s initial color.
- SKEmitterNode.SetParticleColorBlueRange
- SKEmitterNode.ParticleColorGreenRange: The range of allowed random values for the green component of a particle’s initial color.
- SKEmitterNode.SetParticleColorGreenRange
- SKEmitterNode.ParticleColorRedRange: The range of allowed random values for the red component of a particle’s initial color.
- SKEmitterNode.SetParticleColorRedRange
- SKEmitterNode.ParticleColorAlphaSpeed: The rate at which the alpha component of a particle’s color changes per second.
- SKEmitterNode.SetParticleColorAlphaSpeed
- SKEmitterNode.ParticleColorBlueSpeed: The rate at which the blue component of a particle’s color changes per second.
- SKEmitterNode.SetParticleColorBlueSpeed
- SKEmitterNode.ParticleColorGreenSpeed: The rate at which the green component of a particle’s color changes per second.
- SKEmitterNode.SetParticleColorGreenSpeed
- SKEmitterNode.ParticleColorRedSpeed: The rate at which the red component of a particle’s color changes per second.
- SKEmitterNode.SetParticleColorRedSpeed
Controlling How the Texture is Blended with Particle Color ¶
- SKEmitterNode.ParticleColorBlendFactorSequence: The sequence used to specify the color blend factor of a particle over its lifetime.
- SKEmitterNode.SetParticleColorBlendFactorSequence
- SKEmitterNode.ParticleColorBlendFactor: The average starting value for the color blend factor.
- SKEmitterNode.SetParticleColorBlendFactor
- SKEmitterNode.ParticleColorBlendFactorRange: The range of allowed random values for a particle’s starting color blend factor.
- SKEmitterNode.SetParticleColorBlendFactorRange
- SKEmitterNode.ParticleColorBlendFactorSpeed: The rate at which the color blend factor changes per second.
- SKEmitterNode.SetParticleColorBlendFactorSpeed
Blending Particles with the Framebuffer ¶
- SKEmitterNode.ParticleBlendMode: The blending mode used to blend particles into the framebuffer.
- SKEmitterNode.SetParticleBlendMode
- SKEmitterNode.ParticleAlphaSequence: The sequence used to specify the alpha value of a particle over its lifetime.
- SKEmitterNode.SetParticleAlphaSequence
- SKEmitterNode.ParticleAlpha: The average starting alpha value for a particle.
- SKEmitterNode.SetParticleAlpha
- SKEmitterNode.ParticleAlphaRange: The range of allowed random values for a particle’s starting alpha value.
- SKEmitterNode.SetParticleAlphaRange
- SKEmitterNode.ParticleAlphaSpeed: The rate at which the alpha value of a particle changes per second.
- SKEmitterNode.SetParticleAlphaSpeed
Animating Particles ¶
- SKEmitterNode.ParticleAction: An action executed by new particles.
- SKEmitterNode.SetParticleAction
Applying Physics Fields to the Particles ¶
- SKEmitterNode.FieldBitMask: A mask that defines which categories of physics fields can exert forces on the particles.
- SKEmitterNode.SetFieldBitMask
Taking Full Control of Particle Drawing with a Shader ¶
- SKEmitterNode.Shader: A custom shader used to determine how particles are rendered.
- SKEmitterNode.SetShader
- SKEmitterNode.AttributeValues: The values of each attribute associated with the node’s attached shader.
- SKEmitterNode.SetAttributeValues
- SKEmitterNode.SetValueForAttributeNamed: Sets an attribute value for an attached shader.
- SKEmitterNode.ValueForAttributeNamed: Gets the value of a shader attribute.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode
func NewEmitterNodeWithCoder ¶
func NewEmitterNodeWithCoder(aDecoder foundation.INSCoder) SKEmitterNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewEmitterNodeWithFileNamed ¶
func NewEmitterNodeWithFileNamed(filename string) SKEmitterNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewEmitterNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewEmitterNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKEmitterNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewSKEmitterNode ¶
func NewSKEmitterNode() SKEmitterNode
NewSKEmitterNode creates a new SKEmitterNode instance.
func SKEmitterNodeFromID ¶
func SKEmitterNodeFromID(id objc.ID) SKEmitterNode
SKEmitterNodeFromID constructs a SKEmitterNode from an objc.ID.
A source of various particle effects.
func (SKEmitterNode) AdvanceSimulationTime ¶
func (e SKEmitterNode) AdvanceSimulationTime(sec foundation.NSTimeInterval)
Advances the emitter particle simulation.
sec: The number of seconds to simulate.
Discussion ¶
Once added to a scene, an emitter node automatically creates new particles in new animation frames. This method allows you to artificially advance a running emitter’s simulation, causing it to generate new particles and advance any existing particles. The most common use for this method is to prepopulate an emitter node with particles after it is first added to a scene.
If an emitter is paused, either directly or by one of its parent nodes being paused, SKEmitterNode.AdvanceSimulationTime has no effect. Listing 1 shows how to advance an emitter object while it is paused, by temporarily toggling its [SKNode.Paused] property while advancing the simulation.
Listing 1. Temporarily unpausing an emitter to advance simulation time
Note that the [SKNode.Paused] property is inherited from a node’s parents, so even if the emitter hasn’t been explicitly paused but, for example, the scene has, this code will still work.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/advanceSimulationTime(_:)
func (SKEmitterNode) AttributeValues ¶
func (e SKEmitterNode) AttributeValues() foundation.INSDictionary
The values of each attribute associated with the node’s attached shader.
Discussion ¶
All nodes have their own copy of an attribute value and therefore the attribute values can be different per-node across the same SKShader. If instead you need all nodes to share the same value, use SKUniform. Uniforms can change values every frame, but uniforms cannot vary per-node like attributes can.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/attributeValues
func (SKEmitterNode) Autorelease ¶
func (e SKEmitterNode) Autorelease() SKEmitterNode
Autorelease adds the receiver to the current autorelease pool.
func (SKEmitterNode) EmissionAngle ¶
func (e SKEmitterNode) EmissionAngle() float64
The average initial direction of a particle, expressed as an angle in radians.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/emissionAngle
func (SKEmitterNode) EmissionAngleRange ¶
func (e SKEmitterNode) EmissionAngleRange() float64
The range of allowed random values for a particle’s initial direction, expressed as an angle in radians.
Discussion ¶
The default value is `0.0`. If non-zero, the emission angle of each particle is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/emissionAngleRange
func (SKEmitterNode) FieldBitMask ¶
func (e SKEmitterNode) FieldBitMask() uint32
A mask that defines which categories of physics fields can exert forces on the particles.
Discussion ¶
When a particle is inside the region of a SKFieldNode object, that field node’s SKFieldNode.CategoryBitMask property is compared to the emitter’s SKEmitterNode.FieldBitMask property by performing a logical AND operation. If the result is a non-zero value, then the field node’s effect is applied to the particle as if it had a physics body. The physics body is assumed to have a SKPhysicsBody.Mass of `1.0` and a SKPhysicsBody.Charge of `1.0`
The default value is `0x00000000` (all bits cleared).
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/fieldBitMask
func (SKEmitterNode) Init ¶
func (e SKEmitterNode) Init() SKEmitterNode
Init initializes the instance.
func (SKEmitterNode) NumParticlesToEmit ¶
func (e SKEmitterNode) NumParticlesToEmit() uint
The number of particles the emitter should emit before stopping.
Discussion ¶
The default value is `0`, which indicates that emitter creates an endless stream of particles. If a non-zero value is provided, then the emitter stops generating particles after it has created the specified number of particles.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/numParticlesToEmit
func (SKEmitterNode) ParticleAction ¶
func (e SKEmitterNode) ParticleAction() ISKAction
An action executed by new particles.
Discussion ¶
Although you do not have direct access to the particles created by SpriteKit, you can specify an action that all particles execute. Whenever a new particle is created, the emitter tells the particle to run that action. You can use actions to create very sophisticated behaviors.
For the purpose of using actions on particles, you can treat the particle as if it were a normal node. This means you can perform other interesting tricks, such as animating the particle’s textures.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleAction
func (SKEmitterNode) ParticleAlpha ¶
func (e SKEmitterNode) ParticleAlpha() float64
The average starting alpha value for a particle.
Discussion ¶
The particle alpha value is equivalent to the SKNode.Alpha property of the SKNode class. The alpha component of the color that results from the texture and color blending state is multiplied by a particle’s alpha value. The resulting particle color is then blended with the parent’s framebuffer. The default value is `1.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleAlpha
func (SKEmitterNode) ParticleAlphaRange ¶
func (e SKEmitterNode) ParticleAlphaRange() float64
The range of allowed random values for a particle’s starting alpha value.
Discussion ¶
The default value is `0.0`. If non-zero, the initial alpha value of each particle is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleAlphaRange
func (SKEmitterNode) ParticleAlphaSequence ¶
func (e SKEmitterNode) ParticleAlphaSequence() ISKKeyframeSequence
The sequence used to specify the alpha value of a particle over its lifetime.
Discussion ¶
The default value is `nil`. If a non-`nil` value is specified, then the SKEmitterNode.ParticleAlpha, SKEmitterNode.ParticleAlphaRange, and SKEmitterNode.ParticleAlphaSpeed properties are ignored. Instead, the sequence is used to specify the alpha value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleAlphaSequence
func (SKEmitterNode) ParticleAlphaSpeed ¶
func (e SKEmitterNode) ParticleAlphaSpeed() float64
The rate at which the alpha value of a particle changes per second.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleAlphaSpeed
func (SKEmitterNode) ParticleBirthRate ¶
func (e SKEmitterNode) ParticleBirthRate() float64
The rate at which new particles are created.
Discussion ¶
The number of particles generated by the emitter every second. The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleBirthRate
func (SKEmitterNode) ParticleBlendMode ¶
func (e SKEmitterNode) ParticleBlendMode() SKBlendMode
The blending mode used to blend particles into the framebuffer.
Discussion ¶
The default value is SKBlendMode.alpha.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleBlendMode
func (SKEmitterNode) ParticleColor ¶
func (e SKEmitterNode) ParticleColor() appkit.NSColor
The average initial color for a particle.
Discussion ¶
The default value is `[SKColor clearColor]`.
A particle’s color is blended with the texture using its blend color factor. See SKEmitterNode.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColor
func (SKEmitterNode) ParticleColorAlphaRange ¶
func (e SKEmitterNode) ParticleColorAlphaRange() float64
The range of allowed random values for the alpha component of a particle’s initial color.
Discussion ¶
The default value is `0.0`. If non-zero, the starting alpha component of a particle’s color is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorAlphaRange
func (SKEmitterNode) ParticleColorAlphaSpeed ¶
func (e SKEmitterNode) ParticleColorAlphaSpeed() float64
The rate at which the alpha component of a particle’s color changes per second.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorAlphaSpeed
func (SKEmitterNode) ParticleColorBlendFactor ¶
func (e SKEmitterNode) ParticleColorBlendFactor() float64
The average starting value for the color blend factor.
Discussion ¶
The default value is `0.0`, which means that the texture is used as is, ignoring the particle’s color. Otherwise, the texture is blended with the color. The maximum value is `1.0`, which means the particle renders with a full-tint color.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorBlendFactor
func (SKEmitterNode) ParticleColorBlendFactorRange ¶
func (e SKEmitterNode) ParticleColorBlendFactorRange() float64
The range of allowed random values for a particle’s starting color blend factor.
Discussion ¶
The default value is `0.0`. If non-zero, the initial color blend factor of each particle is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorBlendFactorRange
func (SKEmitterNode) ParticleColorBlendFactorSequence ¶
func (e SKEmitterNode) ParticleColorBlendFactorSequence() ISKKeyframeSequence
The sequence used to specify the color blend factor of a particle over its lifetime.
Discussion ¶
The default value is `nil`. If a non-`nil` value is specified, then the SKEmitterNode.ParticleColorBlendFactor, SKEmitterNode.ParticleColorBlendFactorRange, and SKEmitterNode.ParticleColorBlendFactorSpeed properties are ignored. Instead, the sequence is used to specify the color blend factor.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorBlendFactorSequence
func (SKEmitterNode) ParticleColorBlendFactorSpeed ¶
func (e SKEmitterNode) ParticleColorBlendFactorSpeed() float64
The rate at which the color blend factor changes per second.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorBlendFactorSpeed
func (SKEmitterNode) ParticleColorBlueRange ¶
func (e SKEmitterNode) ParticleColorBlueRange() float64
The range of allowed random values for the blue component of a particle’s initial color.
Discussion ¶
The default value is `0.0`. If non-zero, the starting blue component of a particle’s color is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorBlueRange
func (SKEmitterNode) ParticleColorBlueSpeed ¶
func (e SKEmitterNode) ParticleColorBlueSpeed() float64
The rate at which the blue component of a particle’s color changes per second.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorBlueSpeed
func (SKEmitterNode) ParticleColorGreenRange ¶
func (e SKEmitterNode) ParticleColorGreenRange() float64
The range of allowed random values for the green component of a particle’s initial color.
Discussion ¶
The default value is `0.0`. If non-zero, the starting green component of a particle’s color is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorGreenRange
func (SKEmitterNode) ParticleColorGreenSpeed ¶
func (e SKEmitterNode) ParticleColorGreenSpeed() float64
The rate at which the green component of a particle’s color changes per second.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorGreenSpeed
func (SKEmitterNode) ParticleColorRedRange ¶
func (e SKEmitterNode) ParticleColorRedRange() float64
The range of allowed random values for the red component of a particle’s initial color.
Discussion ¶
The default value is `0.0`. If non-zero, the starting red component of a particle’s color is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorRedRange
func (SKEmitterNode) ParticleColorRedSpeed ¶
func (e SKEmitterNode) ParticleColorRedSpeed() float64
The rate at which the red component of a particle’s color changes per second.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorRedSpeed
func (SKEmitterNode) ParticleColorSequence ¶
func (e SKEmitterNode) ParticleColorSequence() ISKKeyframeSequence
The sequence used to specify the color components of a particle over its lifetime.
Discussion ¶
The default value is `nil`. If a non-`nil` value is specified, then the SKEmitterNode.ParticleColor, SKEmitterNode.ParticleColorAlphaRange, SKEmitterNode.ParticleColorRedRange, SKEmitterNode.ParticleColorGreenRange, SKEmitterNode.ParticleColorBlueRange, SKEmitterNode.ParticleColorAlphaSpeed, SKEmitterNode.ParticleColorRedSpeed, SKEmitterNode.ParticleColorGreenSpeed, and SKEmitterNode.ParticleColorBlueSpeed properties are ignored. Instead, the sequence is used to specify the particle color.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleColorSequence
func (SKEmitterNode) ParticleLifetime ¶
func (e SKEmitterNode) ParticleLifetime() float64
The average lifetime of a particle, in seconds.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleLifetime
func (SKEmitterNode) ParticleLifetimeRange ¶
func (e SKEmitterNode) ParticleLifetimeRange() float64
The range of allowed random values for a particle’s lifetime.
Discussion ¶
The default value is `0.0`. If non-zero, the lifetime of each particle is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleLifetimeRange
func (SKEmitterNode) ParticlePosition ¶
func (e SKEmitterNode) ParticlePosition() corefoundation.CGPoint
The average starting position for a particle.
Discussion ¶
The default value is `(0.0,0.0)`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particlePosition
func (SKEmitterNode) ParticlePositionRange ¶
func (e SKEmitterNode) ParticlePositionRange() corefoundation.CGVector
The range of allowed random values for a particle’s position.
Discussion ¶
The default value is `(0.0,0.0)`. If a component is non-zero, the same component of a particle’s position is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particlePositionRange
func (SKEmitterNode) ParticleRenderOrder ¶
func (e SKEmitterNode) ParticleRenderOrder() SKParticleRenderOrder
The order in which the emitter’s particles are rendered.
Discussion ¶
The default value is SKParticleRenderOrder.oldestLast.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleRenderOrder
func (SKEmitterNode) ParticleRotation ¶
func (e SKEmitterNode) ParticleRotation() float64
The average initial rotation of a particle, expressed as an angle in radians.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleRotation
func (SKEmitterNode) ParticleRotationRange ¶
func (e SKEmitterNode) ParticleRotationRange() float64
The range of allowed random values for a particle’s initial rotation, expressed as an angle in radians.
Discussion ¶
The default value is `0.0`. If non-zero, the initial rotation of each particle is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleRotationRange
func (SKEmitterNode) ParticleRotationSpeed ¶
func (e SKEmitterNode) ParticleRotationSpeed() float64
The speed at which a particle rotates, expressed in radians per second.
Discussion ¶
This is uniform for all particles generated by the emitter. The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleRotationSpeed
func (SKEmitterNode) ParticleScale ¶
func (e SKEmitterNode) ParticleScale() float64
The average initial scale factor of a particle.
Discussion ¶
The default value is `1.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleScale
func (SKEmitterNode) ParticleScaleRange ¶
func (e SKEmitterNode) ParticleScaleRange() float64
The range of allowed random values for a particle’s initial scale.
Discussion ¶
The default value is `0.0`. If non-zero, the initial scale of each particle is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleScaleRange
func (SKEmitterNode) ParticleScaleSequence ¶
func (e SKEmitterNode) ParticleScaleSequence() ISKKeyframeSequence
The sequence used to specify the scale factor of a particle over its lifetime.
Discussion ¶
The default value is `nil`. If a non-`nil` value is specified, then the SKEmitterNode.ParticleScale, SKEmitterNode.ParticleScaleRange, and SKEmitterNode.ParticleScaleSpeed properties are ignored. Instead, the sequence is used to specify the scale factor.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleScaleSequence
func (SKEmitterNode) ParticleScaleSpeed ¶
func (e SKEmitterNode) ParticleScaleSpeed() float64
The rate at which a particle’s scale factor changes per second.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleScaleSpeed
func (SKEmitterNode) ParticleSize ¶
func (e SKEmitterNode) ParticleSize() corefoundation.CGSize
The starting size of each particle.
Discussion ¶
The default value is CGSizeZero. If set to the default, the size of the texture stored in the SKEmitterNode.ParticleTexture property is used to determine the size of a particle. If a texture has not been assigned, you must set this property to a non-empty size.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleSize
func (SKEmitterNode) ParticleSpeed ¶
func (e SKEmitterNode) ParticleSpeed() float64
The average initial speed of a new particle, in points per second.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleSpeed
func (SKEmitterNode) ParticleSpeedRange ¶
func (e SKEmitterNode) ParticleSpeedRange() float64
The range of allowed random values for a particle’s initial speed.
Discussion ¶
The default value is `0.0`. If non-zero, the speed of each particle is randomly determined and may vary by plus or minus half of the range value.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleSpeedRange
func (SKEmitterNode) ParticleTexture ¶
func (e SKEmitterNode) ParticleTexture() ISKTexture
The texture to use to render a particle.
Discussion ¶
A particle is rendered as if it were a SKSpriteNode object. The default value is `nil`, which means a single-color rectangle is used to draw the particle. If a non-`nil` value is specified, then the texture is colorized and used to draw particles.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleTexture
func (SKEmitterNode) ParticleZPosition ¶
func (e SKEmitterNode) ParticleZPosition() float64
The average starting depth of a particle.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/particleZPosition
func (SKEmitterNode) ResetSimulation ¶
func (e SKEmitterNode) ResetSimulation()
Removes all existing particles and restarts the simulation.
Discussion ¶
Resetting the simulation clears the internal state of the simulation.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/resetSimulation()
func (SKEmitterNode) SetAttributeValues ¶
func (e SKEmitterNode) SetAttributeValues(value foundation.INSDictionary)
func (SKEmitterNode) SetEmissionAngle ¶
func (e SKEmitterNode) SetEmissionAngle(value float64)
func (SKEmitterNode) SetEmissionAngleRange ¶
func (e SKEmitterNode) SetEmissionAngleRange(value float64)
func (SKEmitterNode) SetFieldBitMask ¶
func (e SKEmitterNode) SetFieldBitMask(value uint32)
func (SKEmitterNode) SetNumParticlesToEmit ¶
func (e SKEmitterNode) SetNumParticlesToEmit(value uint)
func (SKEmitterNode) SetParticleAction ¶
func (e SKEmitterNode) SetParticleAction(value ISKAction)
func (SKEmitterNode) SetParticleAlpha ¶
func (e SKEmitterNode) SetParticleAlpha(value float64)
func (SKEmitterNode) SetParticleAlphaRange ¶
func (e SKEmitterNode) SetParticleAlphaRange(value float64)
func (SKEmitterNode) SetParticleAlphaSequence ¶
func (e SKEmitterNode) SetParticleAlphaSequence(value ISKKeyframeSequence)
func (SKEmitterNode) SetParticleAlphaSpeed ¶
func (e SKEmitterNode) SetParticleAlphaSpeed(value float64)
func (SKEmitterNode) SetParticleBirthRate ¶
func (e SKEmitterNode) SetParticleBirthRate(value float64)
func (SKEmitterNode) SetParticleBlendMode ¶
func (e SKEmitterNode) SetParticleBlendMode(value SKBlendMode)
func (SKEmitterNode) SetParticleColor ¶
func (e SKEmitterNode) SetParticleColor(value appkit.NSColor)
func (SKEmitterNode) SetParticleColorAlphaRange ¶
func (e SKEmitterNode) SetParticleColorAlphaRange(value float64)
func (SKEmitterNode) SetParticleColorAlphaSpeed ¶
func (e SKEmitterNode) SetParticleColorAlphaSpeed(value float64)
func (SKEmitterNode) SetParticleColorBlendFactor ¶
func (e SKEmitterNode) SetParticleColorBlendFactor(value float64)
func (SKEmitterNode) SetParticleColorBlendFactorRange ¶
func (e SKEmitterNode) SetParticleColorBlendFactorRange(value float64)
func (SKEmitterNode) SetParticleColorBlendFactorSequence ¶
func (e SKEmitterNode) SetParticleColorBlendFactorSequence(value ISKKeyframeSequence)
func (SKEmitterNode) SetParticleColorBlendFactorSpeed ¶
func (e SKEmitterNode) SetParticleColorBlendFactorSpeed(value float64)
func (SKEmitterNode) SetParticleColorBlueRange ¶
func (e SKEmitterNode) SetParticleColorBlueRange(value float64)
func (SKEmitterNode) SetParticleColorBlueSpeed ¶
func (e SKEmitterNode) SetParticleColorBlueSpeed(value float64)
func (SKEmitterNode) SetParticleColorGreenRange ¶
func (e SKEmitterNode) SetParticleColorGreenRange(value float64)
func (SKEmitterNode) SetParticleColorGreenSpeed ¶
func (e SKEmitterNode) SetParticleColorGreenSpeed(value float64)
func (SKEmitterNode) SetParticleColorRedRange ¶
func (e SKEmitterNode) SetParticleColorRedRange(value float64)
func (SKEmitterNode) SetParticleColorRedSpeed ¶
func (e SKEmitterNode) SetParticleColorRedSpeed(value float64)
func (SKEmitterNode) SetParticleColorSequence ¶
func (e SKEmitterNode) SetParticleColorSequence(value ISKKeyframeSequence)
func (SKEmitterNode) SetParticleLifetime ¶
func (e SKEmitterNode) SetParticleLifetime(value float64)
func (SKEmitterNode) SetParticleLifetimeRange ¶
func (e SKEmitterNode) SetParticleLifetimeRange(value float64)
func (SKEmitterNode) SetParticlePosition ¶
func (e SKEmitterNode) SetParticlePosition(value corefoundation.CGPoint)
func (SKEmitterNode) SetParticlePositionRange ¶
func (e SKEmitterNode) SetParticlePositionRange(value corefoundation.CGVector)
func (SKEmitterNode) SetParticleRenderOrder ¶
func (e SKEmitterNode) SetParticleRenderOrder(value SKParticleRenderOrder)
func (SKEmitterNode) SetParticleRotation ¶
func (e SKEmitterNode) SetParticleRotation(value float64)
func (SKEmitterNode) SetParticleRotationRange ¶
func (e SKEmitterNode) SetParticleRotationRange(value float64)
func (SKEmitterNode) SetParticleRotationSpeed ¶
func (e SKEmitterNode) SetParticleRotationSpeed(value float64)
func (SKEmitterNode) SetParticleScale ¶
func (e SKEmitterNode) SetParticleScale(value float64)
func (SKEmitterNode) SetParticleScaleRange ¶
func (e SKEmitterNode) SetParticleScaleRange(value float64)
func (SKEmitterNode) SetParticleScaleSequence ¶
func (e SKEmitterNode) SetParticleScaleSequence(value ISKKeyframeSequence)
func (SKEmitterNode) SetParticleScaleSpeed ¶
func (e SKEmitterNode) SetParticleScaleSpeed(value float64)
func (SKEmitterNode) SetParticleSize ¶
func (e SKEmitterNode) SetParticleSize(value corefoundation.CGSize)
func (SKEmitterNode) SetParticleSpeed ¶
func (e SKEmitterNode) SetParticleSpeed(value float64)
func (SKEmitterNode) SetParticleSpeedRange ¶
func (e SKEmitterNode) SetParticleSpeedRange(value float64)
func (SKEmitterNode) SetParticleTexture ¶
func (e SKEmitterNode) SetParticleTexture(value ISKTexture)
func (SKEmitterNode) SetParticleZPosition ¶
func (e SKEmitterNode) SetParticleZPosition(value float64)
func (SKEmitterNode) SetShader ¶
func (e SKEmitterNode) SetShader(value ISKShader)
func (SKEmitterNode) SetTargetNode ¶
func (e SKEmitterNode) SetTargetNode(value ISKNode)
func (SKEmitterNode) SetValueForAttributeNamed ¶
func (e SKEmitterNode) SetValueForAttributeNamed(value ISKAttributeValue, key string)
Sets an attribute value for an attached shader.
value: An attribute value object containing the scalar or vector value to set in the attached shader.
key: The attribute name.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/setValue(_:forAttribute:)
func (SKEmitterNode) SetXAcceleration ¶
func (e SKEmitterNode) SetXAcceleration(value float64)
func (SKEmitterNode) SetYAcceleration ¶
func (e SKEmitterNode) SetYAcceleration(value float64)
func (SKEmitterNode) Shader ¶
func (e SKEmitterNode) Shader() ISKShader
A custom shader used to determine how particles are rendered.
Discussion ¶
The default value is `nil`. If a shader is specified, then the shader is used to determine the output colors for any of the emitter’s particles.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/shader
func (SKEmitterNode) TargetNode ¶
func (e SKEmitterNode) TargetNode() ISKNode
The target node that renders the emitter’s particles.
Discussion ¶
The default value is `nil`, which means that particles are treated as if they were children of the emitter node. In future frames of animation, the particle positions are affected by the emitter node’s properties. If you specify a different target node, the initial properties of new particles are calculated based on the emitter node’s properties, but in future frames of animation the particles are treated as if they were children of the target node.
For example, assume you have an emitter node as a child of the scene node and the node is being rotated by changing its SKNode.ZRotation property. The behavior of the emitter node changes based on the value of the target node:
- If the SKEmitterNode.TargetNode property is `nil`, then the positions of both previously generated and new particles are rotated. - If the SKEmitterNode.TargetNode property points to the scene node, then new particles are adjusted when the emitter node rotates, but previously generated particles are not.
By spawning the particles inside the scene node, they have behavior independent of the emitter’s properties.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/targetNode
func (SKEmitterNode) ValueForAttributeNamed ¶
func (e SKEmitterNode) ValueForAttributeNamed(key string) ISKAttributeValue
Gets the value of a shader attribute.
key: The attribute name.
Return Value ¶
An attribute value object containing the scalar or vector value or `nil` if no such attribute exists.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/value(forAttributeNamed:)
func (SKEmitterNode) XAcceleration ¶
func (e SKEmitterNode) XAcceleration() float64
The acceleration to apply to a particle’s horizontal velocity.
Discussion ¶
This property is useful for simulating wind, gravity and other effects. It is uniformly applied to all particles generated by the emitter.
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/xAcceleration
func (SKEmitterNode) YAcceleration ¶
func (e SKEmitterNode) YAcceleration() float64
The acceleration to apply to a particle’s vertical velocity.
Discussion ¶
This property is useful for simulating wind, gravity and other effects. It is uniformly applied to all particles generated by the emitter.
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKEmitterNode/yAcceleration
type SKEmitterNodeClass ¶
type SKEmitterNodeClass struct {
// contains filtered or unexported fields
}
func GetSKEmitterNodeClass ¶
func GetSKEmitterNodeClass() SKEmitterNodeClass
GetSKEmitterNodeClass returns the class object for SKEmitterNode.
func (SKEmitterNodeClass) Alloc ¶
func (sc SKEmitterNodeClass) Alloc() SKEmitterNode
Alloc allocates memory for a new instance of the class.
func (SKEmitterNodeClass) Class ¶
func (sc SKEmitterNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKFieldForceEvaluator ¶
SKFieldForceEvaluator is the definition for a custom block that processes a single physics body’s interaction with the field.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldForceEvaluator
type SKFieldNode ¶
type SKFieldNode struct {
SKNode
}
A node that applies physics effects to nearby nodes.
Overview ¶
There are many different kinds of field nodes that can be created, each with different effects. The SKFieldNode section lists the field types you can create using SpriteKit, including a type that allows you to apply custom forces to physics bodies. Instantiate the appropriate kind of field node and then add it to the scene’s node tree.
When the scene simulates physics effects, a field node applies its effect to a physics body so long as the following are true:
- The field node is in the scene’s node tree. - The field node’s [SKFieldNode.Enabled] property is true. - The physics body is attached to a node that is in the scene’s node tree. - The physics body is located inside the field node’s region (see SKFieldNode.Region). - The physics body is not located inside the region of another field node whose [SKFieldNode.Exclusive] property is set to true. - A logical AND operation between the field node’s SKFieldNode.CategoryBitMask property and the physics body’s SKPhysicsBody.FieldBitMask property results in a nonzero value.
Determining Which Physics Bodies Are Affected by the Field ¶
- SKFieldNode.IsEnabled: A Boolean value that indicates whether the field is active.
- SKFieldNode.SetEnabled
- SKFieldNode.IsExclusive: A Boolean value that indicates whether the field node should override all other field nodes that might otherwise affect physics bodies.
- SKFieldNode.SetExclusive
- SKFieldNode.Region: The area (relative to the node’s origin) that the field affects.
- SKFieldNode.SetRegion
- SKFieldNode.MinimumRadius: The minimum value for distance-based effects.
- SKFieldNode.SetMinimumRadius
- SKFieldNode.CategoryBitMask: A mask that defines which categories this field belongs to.
- SKFieldNode.SetCategoryBitMask
Configuring the Strength of the Field ¶
- SKFieldNode.Strength: The strength of the field.
- SKFieldNode.SetStrength
- SKFieldNode.Falloff: The exponent that defines the rate of decay for the strength of the field as the distance increases between the node and the physics body being affected.
- SKFieldNode.SetFalloff
Configuring Other Field Properties ¶
- SKFieldNode.AnimationSpeed: The rate at which a noise or turbulence field node changes.
- SKFieldNode.SetAnimationSpeed
- SKFieldNode.Smoothness: The smoothness of the noise used to generate the forces.
- SKFieldNode.SetSmoothness
- SKFieldNode.Direction: The direction of a velocity field node.
- SKFieldNode.SetDirection
- SKFieldNode.Texture: A normal texture that specifies the velocities at different points in a velocity field node.
- SKFieldNode.SetTexture
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode
func NewFieldNodeWithCoder ¶
func NewFieldNodeWithCoder(aDecoder foundation.INSCoder) SKFieldNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewFieldNodeWithFileNamed ¶
func NewFieldNodeWithFileNamed(filename string) SKFieldNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewFieldNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewFieldNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKFieldNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewSKFieldNode ¶
func NewSKFieldNode() SKFieldNode
NewSKFieldNode creates a new SKFieldNode instance.
func SKFieldNodeFromID ¶
func SKFieldNodeFromID(id objc.ID) SKFieldNode
SKFieldNodeFromID constructs a SKFieldNode from an objc.ID.
A node that applies physics effects to nearby nodes.
func (SKFieldNode) AnimationSpeed ¶
func (f SKFieldNode) AnimationSpeed() float32
The rate at which a noise or turbulence field node changes.
Discussion ¶
A value of `0.0` means that the field should not animate at all.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/animationSpeed
func (SKFieldNode) Autorelease ¶
func (f SKFieldNode) Autorelease() SKFieldNode
Autorelease adds the receiver to the current autorelease pool.
func (SKFieldNode) CategoryBitMask ¶
func (f SKFieldNode) CategoryBitMask() uint32
A mask that defines which categories this field belongs to.
Discussion ¶
Every field in a scene can be assigned to up to 32 different categories, each corresponding to a bit in the bit mask. The mask values are not predetermined by Sprite Kit. You define the mask values that are used in your game. The field node’s SKFieldNode.CategoryBitMask property is compared to a physics body’s SKPhysicsBody.FieldBitMask property using a logical AND operation. If the result is nonzero, the field is applied to the physics body.
The default value is `0xFFFFFFFF` (all bits set).
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/categoryBitMask
func (SKFieldNode) Direction ¶
func (f SKFieldNode) Direction() Vector_float3
The direction of a velocity field node.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/direction
func (SKFieldNode) Falloff ¶
func (f SKFieldNode) Falloff() float32
The exponent that defines the rate of decay for the strength of the field as the distance increases between the node and the physics body being affected.
Discussion ¶
When the force of a field node is calculated, the force is multiplied by `pow(distance - minRadius, -falloff)`. The default falloff value is `0`, which indicates that no attenuation takes place. Some types of field nodes ignore the falloff parameter entirely, while others change the default value to something that is more logical for that type of field node.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/falloff
func (SKFieldNode) IsEnabled ¶
func (f SKFieldNode) IsEnabled() bool
A Boolean value that indicates whether the field is active.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/isEnabled
func (SKFieldNode) IsExclusive ¶
func (f SKFieldNode) IsExclusive() bool
A Boolean value that indicates whether the field node should override all other field nodes that might otherwise affect physics bodies.
Discussion ¶
If the value is set to true and a physics body is within this field’s region, all other field nodes that might otherwise affect this body are ignored. The default value is false.
If you set this property to true on multiple field nodes within a scene, their regions should not overlap. If they do, the results are undefined.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/isExclusive
func (SKFieldNode) MinimumRadius ¶
func (f SKFieldNode) MinimumRadius() float32
The minimum value for distance-based effects.
Discussion ¶
When the distance between the node and a physics body is calculated, any distance shorter than the value stored in the SKFieldNode.MinimumRadius property is treated as if it is equal to it. The default value is a very small (but nonzero) value.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/minimumRadius
func (SKFieldNode) Region ¶
func (f SKFieldNode) Region() ISKRegion
The area (relative to the node’s origin) that the field affects.
Discussion ¶
A field node applies its effect to all physics bodies that are partially or completely inside its region. The default value is a region of infinite size.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/region
func (SKFieldNode) SetAnimationSpeed ¶
func (f SKFieldNode) SetAnimationSpeed(value float32)
func (SKFieldNode) SetCategoryBitMask ¶
func (f SKFieldNode) SetCategoryBitMask(value uint32)
func (SKFieldNode) SetDirection ¶
func (f SKFieldNode) SetDirection(value Vector_float3)
func (SKFieldNode) SetEnabled ¶
func (f SKFieldNode) SetEnabled(value bool)
func (SKFieldNode) SetExclusive ¶
func (f SKFieldNode) SetExclusive(value bool)
func (SKFieldNode) SetFalloff ¶
func (f SKFieldNode) SetFalloff(value float32)
func (SKFieldNode) SetMinimumRadius ¶
func (f SKFieldNode) SetMinimumRadius(value float32)
func (SKFieldNode) SetRegion ¶
func (f SKFieldNode) SetRegion(value ISKRegion)
func (SKFieldNode) SetSmoothness ¶
func (f SKFieldNode) SetSmoothness(value float32)
func (SKFieldNode) SetStrength ¶
func (f SKFieldNode) SetStrength(value float32)
func (SKFieldNode) SetTexture ¶
func (f SKFieldNode) SetTexture(value ISKTexture)
func (SKFieldNode) Smoothness ¶
func (f SKFieldNode) Smoothness() float32
The smoothness of the noise used to generate the forces.
Discussion ¶
This parameter should be a value between `0.0` and `1.0`, where `1.0` represents a uniform smoothness.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/smoothness
func (SKFieldNode) Strength ¶
func (f SKFieldNode) Strength() float32
The strength of the field.
Discussion ¶
The default value is `1.0`. There’s no specific unit of measurement for this property because the actual effect is dependent on the kind of field node being created. In practice, the best approach is to experiment with different field strengths and use them to determine the proper value empirically.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/strength
func (SKFieldNode) Texture ¶
func (f SKFieldNode) Texture() ISKTexture
A normal texture that specifies the velocities at different points in a velocity field node.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/texture
type SKFieldNodeClass ¶
type SKFieldNodeClass struct {
// contains filtered or unexported fields
}
func GetSKFieldNodeClass ¶
func GetSKFieldNodeClass() SKFieldNodeClass
GetSKFieldNodeClass returns the class object for SKFieldNode.
func (SKFieldNodeClass) Alloc ¶
func (sc SKFieldNodeClass) Alloc() SKFieldNode
Alloc allocates memory for a new instance of the class.
func (SKFieldNodeClass) Class ¶
func (sc SKFieldNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKFieldNodeClass) CustomFieldWithEvaluationBlock ¶
func (_SKFieldNodeClass SKFieldNodeClass) CustomFieldWithEvaluationBlock(block Float32Float32Handler) SKFieldNode
Creates a field node that calculates and applies a custom force to the physics body.
block: A custom block to be executed when a physics body is affected by the field. Your block should calculate and return the force to be applied to the body.
Return Value ¶
A new custom field node.
Discussion ¶
The value returned by the custom block is a vector for an impulse force which is applied to the physics body being evaluated for that frame. Only the `x` and `y` components of the return value are used by SpriteKit, the `z` component is ignored.
The values passed into the block by the `position` and `velocity` arguments measured in meters: if you need to convert them into points — as used by SpriteKit — multiply the values by 150.
The following code shows how to create a custom field to emulate drag. The block returns the negative of the square root of the velocity of the physics body. This decelerates a physics body passing through the SKFieldNode object’s region.
Listing 1. Creating a custom drag field
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/customField(evaluationBlock:)
func (SKFieldNodeClass) DragField ¶
func (_SKFieldNodeClass SKFieldNodeClass) DragField() SKFieldNode
Creates a field node that applies a force that resists the motion of physics bodies.
Return Value ¶
A new drag field node.
Discussion ¶
The force is applied in the opposite direction of the physics body’s SKPhysicsBody.Velocity property and has a magnitude proportional to the field’s SKFieldNode.Strength property and the physics body’s speed. This field models Stoke’s Law.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/dragField()
func (SKFieldNodeClass) ElectricField ¶
func (_SKFieldNodeClass SKFieldNodeClass) ElectricField() SKFieldNode
Creates a field node that applies an electrical force proportional to the electrical charge of physics bodies.
Return Value ¶
A new electric field node.
Discussion ¶
The force points toward the field node’s position and has a magnitude proportional to the field’s SKFieldNode.Strength property and the physics body’s SKPhysicsBody.Charge property. This field models the first part of the Lorentz equation:
F = qE
Where F equals force, q equals charge, and E equals electric field.
The SKFieldNode.Falloff property of an electrical field node is set by default to `2`.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/electricField()
func (SKFieldNodeClass) LinearGravityFieldWithVector ¶
func (_SKFieldNodeClass SKFieldNodeClass) LinearGravityFieldWithVector(direction Vector_float3) SKFieldNode
Creates a field node that accelerates physics bodies in a specific direction.
direction: The direction and magnitude of the gravitational force. The values represent the acceleration of the field in meters per second squared. For example, to simulate earth’s gravity, specify `(0, -9.8, 0)`. The `z` component on the vector is ignored.
Return Value ¶
A new linear gravity field node.
Discussion ¶
If the field node is rotated, the direction of its gravity field is also rotated. The calculated force is proportional to the physics body’s mass (meaning that the acceleration applied to all affected physics bodies is a constant).
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/linearGravityField(withVector:)
func (SKFieldNodeClass) MagneticField ¶
func (_SKFieldNodeClass SKFieldNodeClass) MagneticField() SKFieldNode
Creates a field node that applies a magnetic force based on the velocity and electrical charge of the physics bodies.
Return Value ¶
A new magnetic field node.
Discussion ¶
The force generated by this field is directed on a line that is determined by calculating the cross-product between the direction of the the physics body’s SKPhysicsBody.Velocity property and a line traced between the field node and the physics body. This field models the second part of the Lorentz equation:
F = qvB
Where F equals force, q equals charge, v equals velocity, B equals magnetic field and E equals electric field.
The force has a magnitude proportional to the field’s SKFieldNode.Strength property and the physics body’s SKPhysicsBody.Charge and SKPhysicsBody.Velocity properties. Therefore, physics bodies that are either stationary or with a charge of zero will not be affected by a magnetic field. Magnetic fields with a negative strength value impart a clockwise spin on the physics bodies they affect, while a positive strength give a clockwise spin.The SKFieldNode.Falloff property of a magnetic field node is set by default to `2`.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/magneticField()
func (SKFieldNodeClass) NoiseFieldWithSmoothnessAnimationSpeed ¶
func (_SKFieldNodeClass SKFieldNodeClass) NoiseFieldWithSmoothnessAnimationSpeed(smoothness float64, speed float64) SKFieldNode
Creates a field node that applies a randomized acceleration to physics bodies.
smoothness: The smoothness of the noise used to generate the forces. This parameter should be a value between `0.0` and `1.0`, where `1.0` represents a uniform smoothness.
speed: The speed at which the noise field should change. A value of `0.0` means that the field should not animate at all.
Return Value ¶
A new noise field node.
Discussion ¶
Use a noise field to simulate effects such as fireflies or snow.
The acceleration is proportional to the field strength in a pseudo-random direction. The calculated force is proportional to the physics body’s mass (meaning that the acceleration applied to all affected physics bodies is a constant).
func (SKFieldNodeClass) RadialGravityField ¶
func (_SKFieldNodeClass SKFieldNodeClass) RadialGravityField() SKFieldNode
Creates a field node that accelerates physics bodies toward the field node.
Return Value ¶
A new radial gravity field node.
Discussion ¶
The strength of the field measures the acceleration of the field in meters per second squared. A positive number indicates that the body is accelerating toward the field node. The calculated force is proportional to the physics body’s mass (meaning that the acceleration applied to all affected physics bodies is a constant). The SKFieldNode.Falloff property of a radial gravity field node is set by default to `2`.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/radialGravityField()
func (SKFieldNodeClass) SpringField ¶
func (_SKFieldNodeClass SKFieldNodeClass) SpringField() SKFieldNode
Creates a field node that applies a spring-like force that pulls physics bodies toward the field node.
Return Value ¶
A new spring field node.
Discussion ¶
The strength of the field measures the strength of the spring. A positive number indicates that the body is accelerating toward the field node. The SKFieldNode.Falloff property of a spring field node is set by default to `-1`.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/springField()
func (SKFieldNodeClass) TurbulenceFieldWithSmoothnessAnimationSpeed ¶
func (_SKFieldNodeClass SKFieldNodeClass) TurbulenceFieldWithSmoothnessAnimationSpeed(smoothness float64, speed float64) SKFieldNode
Creates a field node that applies a randomized acceleration to physics bodies.
smoothness: The smoothness of the noise used to generate the forces. This parameter should be a value between `0.0` and `1.0`, where `1.0` represents a uniform smoothness.
speed: The speed at which the noise field should change. A value of `0.0` means that the field should not animate at all.
Return Value ¶
A new turbulence field node.
Discussion ¶
The acceleration’s magnitude is proportional to a body’s velocity.
func (SKFieldNodeClass) VelocityFieldWithTexture ¶
func (_SKFieldNodeClass SKFieldNodeClass) VelocityFieldWithTexture(velocityTexture ISKTexture) SKFieldNode
Creates a field node that sets the velocity of physics bodies that enter the node’s area based on the pixel values of a texture.
velocityTexture: A normal texture used to specify the velocities at different points in the field.
Return Value ¶
A new velocity field node.
Discussion ¶
When a physics body is affected, its new velocity in each frame is calculated by performing a texture lookup (treating the value as a normal vector) and then multiplying that vector by the strength of the field. The field has an implicit size (region) equal to the size of the texture; physics bodies outside this area are unaffected by the field node.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/velocityField(with:)
func (SKFieldNodeClass) VelocityFieldWithVector ¶
func (_SKFieldNodeClass SKFieldNodeClass) VelocityFieldWithVector(direction Vector_float3) SKFieldNode
Creates a field node that gives physics bodies a constant velocity.
direction: The velocity that any affected physics bodies will have. The `z` component on the vector is ignored.
Return Value ¶
A new velocity field node.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/velocityField(withVector:)
func (SKFieldNodeClass) VortexField ¶
func (_SKFieldNodeClass SKFieldNodeClass) VortexField() SKFieldNode
Creates a field node that applies a perpendicular force to physics bodies.
Return Value ¶
A new vortex field node.
Discussion ¶
The strength of the field measures the acceleration of the field in meters per second squared (meaning that similar to gravity, all physics bodies are affected equally). The physics body is accelerated along the perpendicular of the line between the field node’s position and the position of the physics body. A positive field strength indicates the body is accelerated in a counter-clockwise direction. The SKFieldNode.Falloff property of a vortex field node is set by default to `2`.
See: https://developer.apple.com/documentation/SpriteKit/SKFieldNode/vortexField()
type SKInterpolationMode ¶
type SKInterpolationMode int
See: https://developer.apple.com/documentation/SpriteKit/SKInterpolationMode
const ( // SKInterpolationModeLinear: Values between two keyframes are interpolated linearly. SKInterpolationModeLinear SKInterpolationMode = 1 // SKInterpolationModeSpline: Values between two keyframes using a spline curve. SKInterpolationModeSpline SKInterpolationMode = 2 // SKInterpolationModeStep: Values between two keyframes are not interpolated. SKInterpolationModeStep SKInterpolationMode = 3 )
func (SKInterpolationMode) String ¶
func (e SKInterpolationMode) String() string
type SKKeyframeSequence ¶
type SKKeyframeSequence struct {
objectivec.Object
}
An object that performs interpolation between values specified at different times (keyframes).
Overview ¶
The primary use for an SKKeyframeSequence object is to animate properties on particles emitted by an SKEmitterNode object, but it can also be used for your general interpolation needs across a discrete set of inputs.
When a keyframe sequence is used with an emitter node, particles determine their values by sampling the keyframe sequence. The sequence replaces the normal simulation performed by the emitter node.
First Steps ¶
- SKKeyframeSequence.InitWithKeyframeValuesTimes: Initializes a keyframe sequence with an initial set of values and times.
- SKKeyframeSequence.InitWithCapacity: Initializes a new keyframe sequence.
- SKKeyframeSequence.InitWithCoder
Sequence Building ¶
- SKKeyframeSequence.AddKeyframeValueTime: Adds a keyframe to the sequence.
- SKKeyframeSequence.RemoveKeyframeAtIndex: Removes a keyframe from the sequence.
- SKKeyframeSequence.RemoveLastKeyframe: Removes the last value in the sequence.
- SKKeyframeSequence.SetKeyframeTimeForIndex: Changes the time for a specific keyframe.
- SKKeyframeSequence.SetKeyframeValueForIndex: Changes the value for a specific keyframe.
- SKKeyframeSequence.SetKeyframeValueTimeForIndex: Replaces a keyframe in the sequence with a new keyframe.
Sequence Running ¶
- SKKeyframeSequence.SampleAtTime: Calculates the sample at a particular time.
Sequence Information ¶
- SKKeyframeSequence.Count: The number of keyframes in the sequence.
- SKKeyframeSequence.GetKeyframeTimeForIndex: Gets the time for a keyframe in the sequence.
- SKKeyframeSequence.GetKeyframeValueForIndex: Gets the value for a keyframe in the sequence.
Interpolation Modifiers ¶
- SKKeyframeSequence.InterpolationMode: The mode used to determine how values for times between the keyframes are calculated.
- SKKeyframeSequence.SetInterpolationMode
- SKKeyframeSequence.RepeatMode: The mode used to determine how the keyframe sequence repeats.
- SKKeyframeSequence.SetRepeatMode
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence
func NewKeyframeSequenceWithCapacity ¶
func NewKeyframeSequenceWithCapacity(numItems uint) SKKeyframeSequence
Initializes a new keyframe sequence.
numItems: The initial capacity of the new sequence.
Return Value ¶
A newly initialized empty sequence.
Discussion ¶
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/init(capacity:)
func NewKeyframeSequenceWithCoder ¶
func NewKeyframeSequenceWithCoder(aDecoder foundation.INSCoder) SKKeyframeSequence
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/init(coder:)
func NewKeyframeSequenceWithKeyframeValuesTimes ¶
func NewKeyframeSequenceWithKeyframeValuesTimes(values foundation.INSArray, times []foundation.NSNumber) SKKeyframeSequence
Initializes a keyframe sequence with an initial set of values and times.
values: An array of value objects that define the keyframe values for the sequence.
times: An array of NSNumber objects containing floating-point values that specify the time values for the keyframes.
Return Value ¶
A newly initialized sequence.
Discussion ¶
The two arrays must have an identical number of elements. The keyframes in the new sequence are stored in the same order as the input arrays.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/init(keyframeValues:times:)
func NewSKKeyframeSequence ¶
func NewSKKeyframeSequence() SKKeyframeSequence
NewSKKeyframeSequence creates a new SKKeyframeSequence instance.
func SKKeyframeSequenceFromID ¶
func SKKeyframeSequenceFromID(id objc.ID) SKKeyframeSequence
SKKeyframeSequenceFromID constructs a SKKeyframeSequence from an objc.ID.
An object that performs interpolation between values specified at different times (keyframes).
func (SKKeyframeSequence) AddKeyframeValueTime ¶
func (k SKKeyframeSequence) AddKeyframeValueTime(value objectivec.IObject, time float64)
Adds a keyframe to the sequence.
value: An object that defines the value to add. It must have the same class as other value objects stored in the sequence.
time: The corresponding time.
Discussion ¶
The new keyframe is appended to the end of the array.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/addKeyframeValue(_:time:)
func (SKKeyframeSequence) Autorelease ¶
func (k SKKeyframeSequence) Autorelease() SKKeyframeSequence
Autorelease adds the receiver to the current autorelease pool.
func (SKKeyframeSequence) Count ¶
func (k SKKeyframeSequence) Count() uint
The number of keyframes in the sequence.
Return Value ¶
The number of keyframes in the sequence.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/count()
func (SKKeyframeSequence) EncodeWithCoder ¶
func (k SKKeyframeSequence) EncodeWithCoder(coder foundation.INSCoder)
func (SKKeyframeSequence) GetKeyframeTimeForIndex ¶
func (k SKKeyframeSequence) GetKeyframeTimeForIndex(index uint) float64
Gets the time for a keyframe in the sequence.
index: The index of the keyframe.
Return Value ¶
The time value for the keyframe.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/getKeyframeTime(for:)
func (SKKeyframeSequence) GetKeyframeValueForIndex ¶
func (k SKKeyframeSequence) GetKeyframeValueForIndex(index uint) objectivec.IObject
Gets the value for a keyframe in the sequence.
index: The index of the keyframe.
Return Value ¶
The value object for the keyframe.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/getKeyframeValue(for:)
func (SKKeyframeSequence) Init ¶
func (k SKKeyframeSequence) Init() SKKeyframeSequence
Init initializes the instance.
func (SKKeyframeSequence) InitWithCapacity ¶
func (k SKKeyframeSequence) InitWithCapacity(numItems uint) SKKeyframeSequence
Initializes a new keyframe sequence.
numItems: The initial capacity of the new sequence.
Return Value ¶
A newly initialized empty sequence.
Discussion ¶
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/init(capacity:)
func (SKKeyframeSequence) InitWithCoder ¶
func (k SKKeyframeSequence) InitWithCoder(aDecoder foundation.INSCoder) SKKeyframeSequence
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/init(coder:)
func (SKKeyframeSequence) InitWithKeyframeValuesTimes ¶
func (k SKKeyframeSequence) InitWithKeyframeValuesTimes(values foundation.INSArray, times []foundation.NSNumber) SKKeyframeSequence
Initializes a keyframe sequence with an initial set of values and times.
values: An array of value objects that define the keyframe values for the sequence.
times: An array of NSNumber objects containing floating-point values that specify the time values for the keyframes.
Return Value ¶
A newly initialized sequence.
Discussion ¶
The two arrays must have an identical number of elements. The keyframes in the new sequence are stored in the same order as the input arrays.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/init(keyframeValues:times:)
func (SKKeyframeSequence) InterpolationMode ¶
func (k SKKeyframeSequence) InterpolationMode() SKInterpolationMode
The mode used to determine how values for times between the keyframes are calculated.
Discussion ¶
The possible values are defined in SKInterpolationMode. The default value is SKInterpolationMode.linear.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/interpolationMode
func (SKKeyframeSequence) RemoveKeyframeAtIndex ¶
func (k SKKeyframeSequence) RemoveKeyframeAtIndex(index uint)
Removes a keyframe from the sequence.
index: The index of the keyframe value to remove.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/removeKeyframe(at:)
func (SKKeyframeSequence) RemoveLastKeyframe ¶
func (k SKKeyframeSequence) RemoveLastKeyframe()
Removes the last value in the sequence.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/removeLastKeyframe()
func (SKKeyframeSequence) RepeatMode ¶
func (k SKKeyframeSequence) RepeatMode() SKRepeatMode
The mode used to determine how the keyframe sequence repeats.
Discussion ¶
The possible values are defined in SKRepeatMode. The default value is SKRepeatMode.clamp.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/repeatMode
func (SKKeyframeSequence) SampleAtTime ¶
func (k SKKeyframeSequence) SampleAtTime(time float64) objectivec.IObject
Calculates the sample at a particular time.
time: The time value to sample.
Return Value ¶
An object that contains the interpolated sample. The class of this object matches the class of the values stored in the keyframe sequence — either an NSNumber or an [SKColor].
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/sample(atTime:)
func (SKKeyframeSequence) SetInterpolationMode ¶
func (k SKKeyframeSequence) SetInterpolationMode(value SKInterpolationMode)
func (SKKeyframeSequence) SetKeyframeTimeForIndex ¶
func (k SKKeyframeSequence) SetKeyframeTimeForIndex(time float64, index uint)
Changes the time for a specific keyframe.
time: The new time value for the keyframe.
index: The index of the keyframe to change.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/setKeyframeTime(_:for:)
func (SKKeyframeSequence) SetKeyframeValueForIndex ¶
func (k SKKeyframeSequence) SetKeyframeValueForIndex(value objectivec.IObject, index uint)
Changes the value for a specific keyframe.
value: The new value for the keyframe.
index: The index of the keyframe to change.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/setKeyframeValue(_:for:)
func (SKKeyframeSequence) SetKeyframeValueTimeForIndex ¶
func (k SKKeyframeSequence) SetKeyframeValueTimeForIndex(value objectivec.IObject, time float64, index uint)
Replaces a keyframe in the sequence with a new keyframe.
value: The new value for the keyframe.
time: The new time for the keyframe.
index: The index of the keyframe to change.
See: https://developer.apple.com/documentation/SpriteKit/SKKeyframeSequence/setKeyframeValue(_:time:for:)
func (SKKeyframeSequence) SetRepeatMode ¶
func (k SKKeyframeSequence) SetRepeatMode(value SKRepeatMode)
type SKKeyframeSequenceClass ¶
type SKKeyframeSequenceClass struct {
// contains filtered or unexported fields
}
func GetSKKeyframeSequenceClass ¶
func GetSKKeyframeSequenceClass() SKKeyframeSequenceClass
GetSKKeyframeSequenceClass returns the class object for SKKeyframeSequence.
func (SKKeyframeSequenceClass) Alloc ¶
func (sc SKKeyframeSequenceClass) Alloc() SKKeyframeSequence
Alloc allocates memory for a new instance of the class.
func (SKKeyframeSequenceClass) Class ¶
func (sc SKKeyframeSequenceClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKLabelHorizontalAlignmentMode ¶
type SKLabelHorizontalAlignmentMode int
See: https://developer.apple.com/documentation/SpriteKit/SKLabelHorizontalAlignmentMode
const ( // SKLabelHorizontalAlignmentModeCenter: Centers the text horizontally on the node’s origin. SKLabelHorizontalAlignmentModeCenter SKLabelHorizontalAlignmentMode = 0 // SKLabelHorizontalAlignmentModeLeft: Positions the text so that the left side of the text is on the node’s origin. SKLabelHorizontalAlignmentModeLeft SKLabelHorizontalAlignmentMode = 1 // SKLabelHorizontalAlignmentModeRight: Positions the text so that the right side of the text is on the node’s origin. SKLabelHorizontalAlignmentModeRight SKLabelHorizontalAlignmentMode = 2 )
func (SKLabelHorizontalAlignmentMode) String ¶
func (e SKLabelHorizontalAlignmentMode) String() string
type SKLabelNode ¶
type SKLabelNode struct {
SKNode
}
A graphical element that draws text.
Overview ¶
SKLabelNode allows you to render text in your scene. You can define a custom style using properties such as SKLabelNode.FontName and SKLabelNode.FontColor, or configure the look of your text with an NSAttributedString.
Creating a Label ¶
- SKLabelNode.InitWithFontNamed: Initializes a new label object with a specified font.
Setting a Label’s Text ¶
- SKLabelNode.Text: The string that the label node displays.
- SKLabelNode.SetText
- SKLabelNode.AttributedText: The attributed string displayed by the label.
- SKLabelNode.SetAttributedText
Specifying a Label’s Font ¶
- SKLabelNode.FontColor: The color of the label.
- SKLabelNode.SetFontColor
- SKLabelNode.FontName: The font used for the text in the label.
- SKLabelNode.SetFontName
- SKLabelNode.FontSize: The size of the font used in the label.
- SKLabelNode.SetFontSize
Controlling a Label’s Alignment ¶
- SKLabelNode.VerticalAlignmentMode: The vertical position of the text within the node.
- SKLabelNode.SetVerticalAlignmentMode
- SKLabelNode.HorizontalAlignmentMode: The horizontal position of the text within the node.
- SKLabelNode.SetHorizontalAlignmentMode
Defining a Label’s Line-Breaking Behavior ¶
- SKLabelNode.PreferredMaxLayoutWidth: The width, in screen points, after which line-break mode should be applied.
- SKLabelNode.SetPreferredMaxLayoutWidth
- SKLabelNode.LineBreakMode: Determines the line-break mode for multiple lines.
- SKLabelNode.SetLineBreakMode
- SKLabelNode.NumberOfLines: Determines the number of lines to draw.
- SKLabelNode.SetNumberOfLines
Colorizing a Label ¶
- SKLabelNode.Color: An alternative to the font color that can be used for animations.
- SKLabelNode.SetColor
- SKLabelNode.ColorBlendFactor: A floating-point value that describes how the color is blended with the font color.
- SKLabelNode.SetColorBlendFactor
Configuring Alpha Blending ¶
- SKLabelNode.BlendMode: The blend mode used to draw the label into the parent’s framebuffer.
- SKLabelNode.SetBlendMode
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode
func NewLabelNodeWithAttributedText ¶
func NewLabelNodeWithAttributedText(attributedText foundation.NSAttributedString) SKLabelNode
Initializes a new label object with an attributed text string.
attributedText: The attributed string from which to initialize the label.
Return Value ¶
A lable initialized from attributed text.
Discussion ¶
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/init(attributedText:)
func NewLabelNodeWithCoder ¶
func NewLabelNodeWithCoder(aDecoder foundation.INSCoder) SKLabelNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewLabelNodeWithFileNamed ¶
func NewLabelNodeWithFileNamed(filename string) SKLabelNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewLabelNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewLabelNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKLabelNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewLabelNodeWithFontNamed ¶
func NewLabelNodeWithFontNamed(fontName string) SKLabelNode
Initializes a new label object with a specified font.
fontName: The name of the font used by the label.
Return Value ¶
An initialized label object.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/init(fontNamed:)
func NewLabelNodeWithText ¶
func NewLabelNodeWithText(text string) SKLabelNode
Initializes a new label object with a text string.
text: The text to use to initialize the label node.
Return Value ¶
An initialized label object.
Discussion ¶
The label node’s font is set to Helvetica Neue Ultra Light, 32 point.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/init(text:)
func NewSKLabelNode ¶
func NewSKLabelNode() SKLabelNode
NewSKLabelNode creates a new SKLabelNode instance.
func SKLabelNodeFromID ¶
func SKLabelNodeFromID(id objc.ID) SKLabelNode
SKLabelNodeFromID constructs a SKLabelNode from an objc.ID.
A graphical element that draws text.
func (SKLabelNode) AttributedText ¶
func (l SKLabelNode) AttributedText() foundation.NSAttributedString
The attributed string displayed by the label.
Discussion ¶
The following properties are ignored if attributedText is defined:
[Table data omitted]
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/attributedText
func (SKLabelNode) Autorelease ¶
func (l SKLabelNode) Autorelease() SKLabelNode
Autorelease adds the receiver to the current autorelease pool.
func (SKLabelNode) BlendMode ¶
func (l SKLabelNode) BlendMode() SKBlendMode
The blend mode used to draw the label into the parent’s framebuffer.
Discussion ¶
The default value is SKBlendMode.alpha.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/blendMode
func (SKLabelNode) Color ¶
func (l SKLabelNode) Color() appkit.NSColor
An alternative to the font color that can be used for animations.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/color
func (SKLabelNode) ColorBlendFactor ¶
func (l SKLabelNode) ColorBlendFactor() float64
A floating-point value that describes how the color is blended with the font color.
Discussion ¶
The value must be a number between `0.0` and `1.0`, inclusive. The default value (`0.0`) indicates that the color property is ignored and that the label’s font color should be used unmodified. For values greater than `0.0`, the font color is blended with the blend color, with the maximum value of 1.0 determining that the font color is 100% of the blend color.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/colorBlendFactor
func (SKLabelNode) FontColor ¶
func (l SKLabelNode) FontColor() appkit.NSColor
The color of the label.
Discussion ¶
The default color is white.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/fontColor
func (SKLabelNode) FontName ¶
func (l SKLabelNode) FontName() string
The font used for the text in the label.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/fontName
func (SKLabelNode) FontSize ¶
func (l SKLabelNode) FontSize() float64
The size of the font used in the label.
Discussion ¶
The default font size is 32 points.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/fontSize
func (SKLabelNode) HorizontalAlignmentMode ¶
func (l SKLabelNode) HorizontalAlignmentMode() SKLabelHorizontalAlignmentMode
The horizontal position of the text within the node.
Discussion ¶
The possible values for this property are listed in SKLabelHorizontalAlignmentMode. The default value of this property is SKLabelHorizontalAlignmentMode.center.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/horizontalAlignmentMode
func (SKLabelNode) InitWithFontNamed ¶
func (l SKLabelNode) InitWithFontNamed(fontName string) SKLabelNode
Initializes a new label object with a specified font.
fontName: The name of the font used by the label.
Return Value ¶
An initialized label object.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/init(fontNamed:)
func (SKLabelNode) LineBreakMode ¶
func (l SKLabelNode) LineBreakMode() appkit.NSLineBreakMode
Determines the line-break mode for multiple lines.
Discussion ¶
The default value is NSLineBreakByTruncatingTail.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/lineBreakMode
func (SKLabelNode) NumberOfLines ¶
func (l SKLabelNode) NumberOfLines() int
Determines the number of lines to draw.
Discussion ¶
The default value is 1 (a single line). A value of 0 in interpreted as an unlimited number of lines. If the height of the text reaches the number of lines, the text will be truncated using the line break mode.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/numberOfLines
func (SKLabelNode) PreferredMaxLayoutWidth ¶
func (l SKLabelNode) PreferredMaxLayoutWidth() float64
The width, in screen points, after which line-break mode should be applied.
Discussion ¶
The default value is 0, which means that line break mode will not be applied.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/preferredMaxLayoutWidth
func (SKLabelNode) SetAttributedText ¶
func (l SKLabelNode) SetAttributedText(value foundation.NSAttributedString)
func (SKLabelNode) SetBlendMode ¶
func (l SKLabelNode) SetBlendMode(value SKBlendMode)
func (SKLabelNode) SetColor ¶
func (l SKLabelNode) SetColor(value appkit.NSColor)
func (SKLabelNode) SetColorBlendFactor ¶
func (l SKLabelNode) SetColorBlendFactor(value float64)
func (SKLabelNode) SetFontColor ¶
func (l SKLabelNode) SetFontColor(value appkit.NSColor)
func (SKLabelNode) SetFontName ¶
func (l SKLabelNode) SetFontName(value string)
func (SKLabelNode) SetFontSize ¶
func (l SKLabelNode) SetFontSize(value float64)
func (SKLabelNode) SetHorizontalAlignmentMode ¶
func (l SKLabelNode) SetHorizontalAlignmentMode(value SKLabelHorizontalAlignmentMode)
func (SKLabelNode) SetLineBreakMode ¶
func (l SKLabelNode) SetLineBreakMode(value appkit.NSLineBreakMode)
func (SKLabelNode) SetNumberOfLines ¶
func (l SKLabelNode) SetNumberOfLines(value int)
func (SKLabelNode) SetPreferredMaxLayoutWidth ¶
func (l SKLabelNode) SetPreferredMaxLayoutWidth(value float64)
func (SKLabelNode) SetText ¶
func (l SKLabelNode) SetText(value string)
func (SKLabelNode) SetVerticalAlignmentMode ¶
func (l SKLabelNode) SetVerticalAlignmentMode(value SKLabelVerticalAlignmentMode)
func (SKLabelNode) Text ¶
func (l SKLabelNode) Text() string
The string that the label node displays.
Discussion ¶
This property is ignored if attributedText is defined.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/text
func (SKLabelNode) VerticalAlignmentMode ¶
func (l SKLabelNode) VerticalAlignmentMode() SKLabelVerticalAlignmentMode
The vertical position of the text within the node.
Discussion ¶
The possible values for this property are listed in SKLabelVerticalAlignmentMode. The default value of this property is SKLabelVerticalAlignmentMode.baseline.
See: https://developer.apple.com/documentation/SpriteKit/SKLabelNode/verticalAlignmentMode
type SKLabelNodeClass ¶
type SKLabelNodeClass struct {
// contains filtered or unexported fields
}
func GetSKLabelNodeClass ¶
func GetSKLabelNodeClass() SKLabelNodeClass
GetSKLabelNodeClass returns the class object for SKLabelNode.
func (SKLabelNodeClass) Alloc ¶
func (sc SKLabelNodeClass) Alloc() SKLabelNode
Alloc allocates memory for a new instance of the class.
func (SKLabelNodeClass) Class ¶
func (sc SKLabelNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKLabelVerticalAlignmentMode ¶
type SKLabelVerticalAlignmentMode int
See: https://developer.apple.com/documentation/SpriteKit/SKLabelVerticalAlignmentMode
const ( // SKLabelVerticalAlignmentModeBaseline: Positions the text so that the font’s baseline lies on the node’s origin. SKLabelVerticalAlignmentModeBaseline SKLabelVerticalAlignmentMode = 0 // SKLabelVerticalAlignmentModeBottom: Positions the text so that the bottom of the text is on the node’s origin. SKLabelVerticalAlignmentModeBottom SKLabelVerticalAlignmentMode = 3 // SKLabelVerticalAlignmentModeCenter: Centers the text vertically on the node’s origin. SKLabelVerticalAlignmentModeCenter SKLabelVerticalAlignmentMode = 1 // SKLabelVerticalAlignmentModeTop: Positions the text so that the top of the text is on the node’s origin. SKLabelVerticalAlignmentModeTop SKLabelVerticalAlignmentMode = 2 )
func (SKLabelVerticalAlignmentMode) String ¶
func (e SKLabelVerticalAlignmentMode) String() string
type SKLightNode ¶
type SKLightNode struct {
SKNode
}
A node that lights surrounding nodes.
Overview ¶
To use lighting, add a light node to the scene. Because lights are nodes, they can be moved or perform actions just like other nodes. However, light nodes are invisible except through their effects on sprite nodes configured to interact with them. When a sprite node is affected by a light, the lighting properties of the light node and the lighting properties of the sprite node determine what is rendered. Lighting may affect how unrelated portions of the scene are rendered. For example, if a sprite is configured to cast a shadow, the shadow is rendered on top of other content.
An SKLightNode object and an SKSpriteNode object add lighting to the scene if all of the following are true:
- The light node and the sprite node are both in the scene. - The light node’s [SKLightNode.Enabled] property is true. - The light node’s SKLightNode.CategoryBitMask property and one of the sprite’s lighting masks are logically combined using an AND operation, and the result is a nonzero number.
SKLightNode describes the different kinds of effects that can be generated by a light, based on which mask is being tested on the sprite.
[Table data omitted]
If any of the criteria are not met, the sprite is considered unlit and is rendered using the default behavior.
Determining Whether a Light Node Is Active ¶
- SKLightNode.IsEnabled: A Boolean value that indicates whether the node is casting light.
- SKLightNode.SetEnabled
- SKLightNode.CategoryBitMask: A mask that defines which categories this light belongs to.
- SKLightNode.SetCategoryBitMask
Configuring the Lighting Properties ¶
- SKLightNode.AmbientColor: The ambient color of the light.
- SKLightNode.SetAmbientColor
- SKLightNode.LightColor: The diffuse and specular color of the light source.
- SKLightNode.SetLightColor
- SKLightNode.ShadowColor: The color of any shadow cast by a sprite.
- SKLightNode.SetShadowColor
- SKLightNode.Falloff: The exponent for the rate of decay of the light source.
- SKLightNode.SetFalloff
See: https://developer.apple.com/documentation/SpriteKit/SKLightNode
func NewLightNodeWithCoder ¶
func NewLightNodeWithCoder(aDecoder foundation.INSCoder) SKLightNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewLightNodeWithFileNamed ¶
func NewLightNodeWithFileNamed(filename string) SKLightNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewLightNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewLightNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKLightNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewSKLightNode ¶
func NewSKLightNode() SKLightNode
NewSKLightNode creates a new SKLightNode instance.
func SKLightNodeFromID ¶
func SKLightNodeFromID(id objc.ID) SKLightNode
SKLightNodeFromID constructs a SKLightNode from an objc.ID.
A node that lights surrounding nodes.
func (SKLightNode) AmbientColor ¶
func (l SKLightNode) AmbientColor() appkit.NSColor
The ambient color of the light.
Discussion ¶
The alpha value of the color is ignored. The default color is black, meaning that the light does not have an ambient component. The ambient component of the light is not affected by the light’s SKLightNode.Falloff property, nor is it affected by any normal map (SKSpriteNode.NormalTexture) on the sprite node.
See: https://developer.apple.com/documentation/SpriteKit/SKLightNode/ambientColor
func (SKLightNode) Autorelease ¶
func (l SKLightNode) Autorelease() SKLightNode
Autorelease adds the receiver to the current autorelease pool.
func (SKLightNode) CategoryBitMask ¶
func (l SKLightNode) CategoryBitMask() uint32
A mask that defines which categories this light belongs to.
Discussion ¶
Every light in a scene can be assigned to up to 32 different categories, each corresponding to a bit in the bit mask. SpriteKit does not predefine any lighting categories, so it is up to you to define which values are used in your game. When a scene is rendered, a light’s SKLightNode.CategoryBitMask property is compared to each sprite node’s SKSpriteNode.LightingBitMask, SKSpriteNode.ShadowCastBitMask, and SKSpriteNode.ShadowedBitMask properties to determine whether that sprite interacts with the light.
The default value is `0x00000001`.
See: https://developer.apple.com/documentation/SpriteKit/SKLightNode/categoryBitMask
func (SKLightNode) Falloff ¶
func (l SKLightNode) Falloff() float64
The exponent for the rate of decay of the light source.
Discussion ¶
The default value is `1.0`, which means the light decays linearly with distance. The value must be a positive number less than or equal to `1.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKLightNode/falloff
func (SKLightNode) IsEnabled ¶
func (l SKLightNode) IsEnabled() bool
A Boolean value that indicates whether the node is casting light.
Discussion ¶
If the value is true, the light is enabled and affects sprite nodes in the scene. The default is true.
See: https://developer.apple.com/documentation/SpriteKit/SKLightNode/isEnabled
func (SKLightNode) LightColor ¶
func (l SKLightNode) LightColor() appkit.NSColor
The diffuse and specular color of the light source.
Discussion ¶
The default value is white.
If you are using custom shaders, you can substitute an SKUniform object instead.
See: https://developer.apple.com/documentation/SpriteKit/SKLightNode/lightColor
func (SKLightNode) SetAmbientColor ¶
func (l SKLightNode) SetAmbientColor(value appkit.NSColor)
func (SKLightNode) SetCategoryBitMask ¶
func (l SKLightNode) SetCategoryBitMask(value uint32)
func (SKLightNode) SetEnabled ¶
func (l SKLightNode) SetEnabled(value bool)
func (SKLightNode) SetFalloff ¶
func (l SKLightNode) SetFalloff(value float64)
func (SKLightNode) SetLightColor ¶
func (l SKLightNode) SetLightColor(value appkit.NSColor)
func (SKLightNode) SetShadowColor ¶
func (l SKLightNode) SetShadowColor(value appkit.NSColor)
func (SKLightNode) ShadowColor ¶
func (l SKLightNode) ShadowColor() appkit.NSColor
The color of any shadow cast by a sprite.
Discussion ¶
The default color is black with an opacity (alpha) of `0.5`.
When lighting is calculated, shadows are created as if a ray was cast out from the light node’s position. If a sprite casts a shadow, the rays are blocked when they intersect with the sprite’s physics body. Otherwise, the sprite’s texture is used to generate a mask, and any pixel in the sprite node’s texture that has an alpha value that is nonzero blocks the light.
Shadows may be cast on content that is rendered prior to the sprite, even if that content does not otherwise interact with the light.
See: https://developer.apple.com/documentation/SpriteKit/SKLightNode/shadowColor
type SKLightNodeClass ¶
type SKLightNodeClass struct {
// contains filtered or unexported fields
}
func GetSKLightNodeClass ¶
func GetSKLightNodeClass() SKLightNodeClass
GetSKLightNodeClass returns the class object for SKLightNode.
func (SKLightNodeClass) Alloc ¶
func (sc SKLightNodeClass) Alloc() SKLightNode
Alloc allocates memory for a new instance of the class.
func (SKLightNodeClass) Class ¶
func (sc SKLightNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKMutableTexture ¶
type SKMutableTexture struct {
SKTexture
}
A texture whose contents can be dynamically updated.
Overview ¶
Normally, SpriteKit textures (SKTexture objects) are static, meaning that once created, their contents cannot be changed. This is important because a static image can be more efficiently managed inside the graphics hardware. However, sometimes you need to be able to update the contents of a texture dynamically. In this case, you should use a mutable texture. Because there is a performance penalty for updating the texture’s contents, consider other options first. For example, you can render a texture in hardware using the SKView.TextureFromNode method and a node tree.
To use this class, create a mutable texture using either one of its creation methods or those of its superclass. Then, when you need to update the mutable texture object’s contents, call the SKMutableTexture.ModifyPixelDataWithBlock method. Your block is called with the location of the texture in memory. Your block should update this texture and then return.
Creating an Empty Mutable Texture ¶
- SKMutableTexture.InitWithSizePixelFormat: Initializes an empty texture with a specific size and format.
- SKMutableTexture.InitWithSize: Initializes an empty texture with a specific size.
Modifying a Mutable Texture’s Contents ¶
- SKMutableTexture.ModifyPixelDataWithBlock: Modifies the contents of a mutable texture.
See: https://developer.apple.com/documentation/SpriteKit/SKMutableTexture
func NewMutableTextureWithSize ¶
func NewMutableTextureWithSize(size corefoundation.CGSize) SKMutableTexture
Initializes an empty texture with a specific size.
size: The size of the texture, in pixels.
Return Value ¶
An empty mutable texture.
Discussion ¶
You must call the SKMutableTexture.ModifyPixelDataWithBlock method at least once before using this texture.
See: https://developer.apple.com/documentation/SpriteKit/SKMutableTexture/init(size:)
func NewMutableTextureWithSizePixelFormat ¶
func NewMutableTextureWithSizePixelFormat(size corefoundation.CGSize, format int32) SKMutableTexture
Initializes an empty texture with a specific size and format.
size: The size of the texture, in pixels.
format: A Core Video format code. Three codes are supported: kCVPixelFormatType_32RGBA, kCVPixelFormatType_64RGBAHalf, and kCVPixelFormatType_128RGBAFloat for byte, half-float, and float components respectively.
Return Value ¶
An empty mutable texture.
Discussion ¶
You must call the SKMutableTexture.ModifyPixelDataWithBlock method at least once before using this texture.
See: https://developer.apple.com/documentation/SpriteKit/SKMutableTexture/init(size:pixelFormat:)
func NewSKMutableTexture ¶
func NewSKMutableTexture() SKMutableTexture
NewSKMutableTexture creates a new SKMutableTexture instance.
func SKMutableTextureFromID ¶
func SKMutableTextureFromID(id objc.ID) SKMutableTexture
SKMutableTextureFromID constructs a SKMutableTexture from an objc.ID.
A texture whose contents can be dynamically updated.
func (SKMutableTexture) Autorelease ¶
func (m SKMutableTexture) Autorelease() SKMutableTexture
Autorelease adds the receiver to the current autorelease pool.
func (SKMutableTexture) Init ¶
func (m SKMutableTexture) Init() SKMutableTexture
Init initializes the instance.
func (SKMutableTexture) InitWithSize ¶
func (m SKMutableTexture) InitWithSize(size corefoundation.CGSize) SKMutableTexture
Initializes an empty texture with a specific size.
size: The size of the texture, in pixels.
Return Value ¶
An empty mutable texture.
Discussion ¶
You must call the SKMutableTexture.ModifyPixelDataWithBlock method at least once before using this texture.
See: https://developer.apple.com/documentation/SpriteKit/SKMutableTexture/init(size:)
func (SKMutableTexture) InitWithSizePixelFormat ¶
func (m SKMutableTexture) InitWithSizePixelFormat(size corefoundation.CGSize, format int32) SKMutableTexture
Initializes an empty texture with a specific size and format.
size: The size of the texture, in pixels.
format: A Core Video format code. Three codes are supported: kCVPixelFormatType_32RGBA, kCVPixelFormatType_64RGBAHalf, and kCVPixelFormatType_128RGBAFloat for byte, half-float, and float components respectively.
Return Value ¶
An empty mutable texture.
Discussion ¶
You must call the SKMutableTexture.ModifyPixelDataWithBlock method at least once before using this texture.
See: https://developer.apple.com/documentation/SpriteKit/SKMutableTexture/init(size:pixelFormat:)
func (SKMutableTexture) ModifyPixelDataWithBlock ¶
func (m SKMutableTexture) ModifyPixelDataWithBlock(block UnsafePointerUintptrHandler)
Modifies the contents of a mutable texture.
block: A block to be called when the texture can be safely modified. The block takes the following parameters:
pixelData: A pointer to the start of the current texture data. lengthInBytes: The length of the texture data in bytes.
Discussion ¶
The contents of the texture can be modified only at specific times when the graphics hardware permits it. When this method is called, it schedules a new background task to update the texture and then returns. Your block is called when the texture can be modified. Your block is called on an arbitrary queue. Your block should modify the texture’s contents and then return.
The texture bytes are assumed to be stored as tightly packed 32 bpp, 8bpc (unsigned integer) RGBA pixel data. The color components you provide should have already been multiplied by the alpha value.
See: https://developer.apple.com/documentation/SpriteKit/SKMutableTexture/modifyPixelData(_:)
type SKMutableTextureClass ¶
type SKMutableTextureClass struct {
// contains filtered or unexported fields
}
func GetSKMutableTextureClass ¶
func GetSKMutableTextureClass() SKMutableTextureClass
GetSKMutableTextureClass returns the class object for SKMutableTexture.
func (SKMutableTextureClass) Alloc ¶
func (sc SKMutableTextureClass) Alloc() SKMutableTexture
Alloc allocates memory for a new instance of the class.
func (SKMutableTextureClass) Class ¶
func (sc SKMutableTextureClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKNode ¶
type SKNode struct {
objectivec.Object
}
The base class of all SpriteKit nodes.
Overview ¶
SKNode provides base properties for its subclasses and it can be used as a container or layout tool for other nodes. For example, you might add a collection of nodes as children to an SKNode that all move together within the scene; because nodes inherit the properties of their parent, changing the parent node’s SKNode.Position propagates the change to its children as well.
SKNode does not draw any content itself. Its visual counterparts are listed in Nodes that Draw in Nodes for Scene Building.
First Steps ¶
- SKNode.InitWithCoder: Called when a node is initialized from an .sks file.
Positioning Content in a Scene ¶
- SKNode.Position: The position of the node in its parent’s coordinate system.
- SKNode.SetPosition
Querying the Content Size ¶
- SKNode.Frame: A rectangle in the parent’s coordinate system that contains the node’s content, ignoring the node’s children.
- SKNode.CalculateAccumulatedFrame: Returns a rectangle in the parent’s coordinate system that contains the position and size of itself and all child nodes.
Configuring Draw Order ¶
- SKNode.ZPosition: The height of the node relative to its parent.
- SKNode.SetZPosition
Scaling and Rotating ¶
- SKNode.ZRotation: The Euler rotation about the z axis (in radians).
- SKNode.SetZRotation
- SKNode.SetScale: Sets the [xScale](<https://developer.apple.com/documentation/SpriteKit/SKNode/xScale>) and [yScale](<https://developer.apple.com/documentation/SpriteKit/SKNode/yScale>) properties of the node.
- SKNode.XScale: A scaling factor that multiplies the width of a node and its children.
- SKNode.SetXScale
- SKNode.YScale: A scaling factor that multiplies the height of a node and its children.
- SKNode.SetYScale
Accessing Related Nodes ¶
- SKNode.Scene: The scene node that contains this node.
- SKNode.Parent: The node’s parent node.
- SKNode.Children: The node’s children.
Modifying the Node Tree ¶
- SKNode.AddChild: Adds a node to the end of the receiver’s list of child nodes.
- SKNode.InsertChildAtIndex: Inserts a node into a specific position in the receiver’s list of child nodes.
- SKNode.IsEqualToNode: Compares the parameter node to the receiving node.
- SKNode.MoveToParent: Moves the node to a new parent node in the scene.
- SKNode.RemoveFromParent: Removes the receiving node from its parent.
- SKNode.RemoveAllChildren: Removes all of the node’s children.
- SKNode.RemoveChildrenInArray: Removes a list of children from the receiving node.
- SKNode.InParentHierarchy: Returns a Boolean value that indicates whether the node is a descendant of the target node.
Accessing Nodes by Name ¶
- SKNode.Name: The node’s assignable name.
- SKNode.SetName
- SKNode.ChildNodeWithName: Searches the children of the receiving node for a node with a specific name.
- SKNode.EnumerateChildNodesWithNameUsingBlock: Searches the children of the receiving node to perform processing for nodes that share a name.
- SKNode.ObjectForKeyedSubscript: Returns an array of nodes that match the name parameter.
Altering Node Visibility ¶
- SKNode.Alpha: The transparency value applied to the node’s contents.
- SKNode.SetAlpha
- SKNode.IsHidden: A Boolean value that determines whether a node and its descendants are rendered.
- SKNode.SetHidden
Running Actions ¶
- SKNode.RunAction: Adds an action to the list of actions executed by the node.
- SKNode.RunActionCompletion: Adds an action to the list of actions executed by the node and schedules the argument block to be run upon completion of the action.
- SKNode.RunActionWithKey: Adds an identifiable action to the list of actions executed by the node.
- SKNode.Speed: A speed modifier applied to all actions executed by a node and its descendants.
- SKNode.SetSpeed
- SKNode.IsPaused: A Boolean value that determines whether actions on the node and its descendants are processed.
- SKNode.SetPaused
- SKNode.ActionForKey: Returns an action associated with a specific key.
- SKNode.HasActions: Returns a Boolean value that indicates whether the node is executing actions.
- SKNode.RemoveAllActions: Ends and removes all actions from the node.
- SKNode.RemoveActionForKey: Removes an action associated with a specific key.
Adding Physics Behaviors ¶
- SKNode.PhysicsBody: The physics body associated with the node.
- SKNode.SetPhysicsBody
Constraining Node Position or Rotation ¶
- SKNode.Constraints: A list of constraints to apply to the node.
- SKNode.SetConstraints
- SKNode.ReachConstraints: The reach constraints to apply to the node when executing a reach action.
- SKNode.SetReachConstraints
Detecting Collisions Manually ¶
- SKNode.IntersectsNode: Returns a Boolean value that indicates whether this node intersects the specified node.
Adding GameplayKit Behaviors ¶
- SKNode.Entity: The GameplayKit entity this node represents.
- SKNode.SetEntity
Handling User Input ¶
- SKNode.IsUserInteractionEnabled: A Boolean value that indicates whether the node receives touch events.
- SKNode.SetUserInteractionEnabled
Hit Testing ¶
- SKNode.ContainsPoint: Returns a Boolean value that indicates whether a point lies inside the parent’s coordinate system.
- SKNode.NodeAtPoint: Returns the deepest visible descendant that intersects a point.
- SKNode.NodesAtPoint: Returns an array of all visible descendants that intersect a point.
Converting Between Coordinate Systems of Different Nodes ¶
- SKNode.ConvertPointFromNode: Converts a point from the coordinate system of another node in the node tree to the coordinate system of this node.
- SKNode.ConvertPointToNode: Converts a point in this node’s coordinate system to the coordinate system of another node in the node tree.
Adding Custom Data Without Subclassing ¶
- SKNode.UserData: A dictionary containing arbitrary data.
- SKNode.SetUserData
Providing Accessibility ¶
- SKNode.AccessibilityChildren: An array of user interface elements that represent children of this element.
- SKNode.SetAccessibilityChildren
- SKNode.AccessibilityFrame: The size of this user interface element, in screen points.
- SKNode.SetAccessibilityFrame
- SKNode.AccessibilityHelp: The help description of this user interface element; for example, the text shown in a tooltip.
- SKNode.SetAccessibilityHelp
- SKNode.AccessibilityLabel: A short description of this user interface element.
- SKNode.SetAccessibilityLabel
- SKNode.AccessibilityParent: The user interface element that contains this element.
- SKNode.SetAccessibilityParent
- SKNode.AccessibilityRole: A string value describing the user interface element type; for example, a button.
- SKNode.SetAccessibilityRole
- SKNode.AccessibilityRoleDescription: A string value describing the user interface element name and type; for example, the Buy button.
- SKNode.SetAccessibilityRoleDescription
- SKNode.AccessibilitySubrole: A string that defines this user interface element’s subrole; for example, a full-screen button.
- SKNode.SetAccessibilitySubrole
- SKNode.IsAccessibilityElement: A toggle you implement to indicate to the system whether this user interface element should be exposed to the user.
- SKNode.SetAccessibilityElement
- SKNode.IsAccessibilityEnabled: A toggle you implement to indicate to the system whether this user interface element should respond to user input.
- SKNode.SetAccessibilityEnabled
- SKNode.AccessibilityHitTest: Returns the frontmost user interface element in the element hierarchy.
See: https://developer.apple.com/documentation/SpriteKit/SKNode
func NewNodeWithCoder ¶
func NewNodeWithCoder(aDecoder foundation.INSCoder) SKNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewNodeWithFileNamed ¶
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func SKNodeFromID ¶
SKNodeFromID constructs a SKNode from an objc.ID.
The base class of all SpriteKit nodes.
func (SKNode) AccessibilityChildren ¶
func (n SKNode) AccessibilityChildren() foundation.INSArray
An array of user interface elements that represent children of this element.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/accessibilityChildren
func (SKNode) AccessibilityFrame ¶
func (n SKNode) AccessibilityFrame() corefoundation.CGRect
The size of this user interface element, in screen points.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/accessibilityFrame
func (SKNode) AccessibilityHelp ¶
The help description of this user interface element; for example, the text shown in a tooltip.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/accessibilityHelp
func (SKNode) AccessibilityHitTest ¶
func (n SKNode) AccessibilityHitTest(point corefoundation.CGPoint) objectivec.IObject
Returns the frontmost user interface element in the element hierarchy.
point: Relative to the bottom-left of the screen, in screen points, and guaranteed to lie within the receiver.
Discussion ¶
Override this method to implement your own, deeper hit testing within a user interface element.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/accessibilityHitTest(_:)
func (SKNode) AccessibilityLabel ¶
A short description of this user interface element.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/accessibilityLabel
func (SKNode) AccessibilityParent ¶
func (n SKNode) AccessibilityParent() objectivec.IObject
The user interface element that contains this element.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/accessibilityParent
func (SKNode) AccessibilityRole ¶
A string value describing the user interface element type; for example, a button.
Discussion ¶
See Roles for more information.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/accessibilityRole
func (SKNode) AccessibilityRoleDescription ¶
A string value describing the user interface element name and type; for example, the Buy button.
Discussion ¶
See Roles for more information.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/accessibilityRoleDescription
func (SKNode) AccessibilitySubrole ¶
A string that defines this user interface element’s subrole; for example, a full-screen button.
Discussion ¶
See [Subroles] for more information.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/accessibilitySubrole
func (SKNode) ActionForKey ¶
Returns an action associated with a specific key.
key: A string that uniquely identifies an action.
Return Value ¶
If an action exists that matches the key, the action object is returned. Otherwise, `nil` is returned.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/action(forKey:)
func (SKNode) AddChild ¶
Adds a node to the end of the receiver’s list of child nodes.
node: The node to add. The node must not already have a parent.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/addChild(_:)
func (SKNode) Alpha ¶
The transparency value applied to the node’s contents.
Discussion ¶
The default value is `1.0`.
The SKNode class does not perform drawing, but many of its subclasses do. When a node or any of its descendants are drawn, the alpha component of each pixel is multiplied by the node’s SKNode.Alpha property and then clamped to the range `0.0`-`1.0`. This modified alpha value is used to blend the pixel into the framebuffer. Subclasses that render content define properties that determine the blending operations used in conjunction with the alpha value to blend pixels into the parent’s framebuffer.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/alpha
func (SKNode) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (SKNode) CalculateAccumulatedFrame ¶
func (n SKNode) CalculateAccumulatedFrame() corefoundation.CGRect
Returns a rectangle in the parent’s coordinate system that contains the position and size of itself and all child nodes.
Discussion ¶
The frame takes into the account the cumulative effect of the SKNode.XScale, SKNode.YScale, and SKNode.ZRotation properties of each node in the subtree.
Listing 1 shows, in Swift, how SKNode.CalculateAccumulatedFrame can be used display the bounding box of a shape node. The child node, although smaller than its parent, is rotated by 30° so that its bounds extend beyond its parent’s bounds. After `childNode` has been added to `parentNode`, a further shape node, `boundingBoxNode`, is created with its size based on the accumulated frame of parentNode.
Listing 1. Displaying the accumulated frame of a shape node
The figure below shows the result of Listing 1 with `parentNode` rendered in blue, `childNode` rendered in red and the `boundingBoxNode` rendered with a dashed line.
[media-2793217]
See: https://developer.apple.com/documentation/SpriteKit/SKNode/calculateAccumulatedFrame()
func (SKNode) ChildNodeWithName ¶
Searches the children of the receiving node for a node with a specific name.
name: The name to search for. This may be either the literal name of the node or a customized search string. See `Searching the Node Tree`.
Return Value ¶
If a node object with that name is found, the method returns the node object. Otherwise, it returns `nil`.
Discussion ¶
If more than one child share the same name, the first node discovered is returned.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/childNode(withName:)
func (SKNode) Children ¶
The node’s children.
Discussion ¶
The objects in this array are all SKNode objects.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/children
func (SKNode) Constraints ¶
func (n SKNode) Constraints() []SKConstraint
A list of constraints to apply to the node.
Discussion ¶
Assign an array of SKConstraint objects to the node. The scene processes these constraints before the scene is rendered. The constraints are processed in array order. If multiple nodes in the node tree have constraints, there is no guaranteed order that the nodes are processed in.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/constraints
func (SKNode) ContainsPoint ¶
func (n SKNode) ContainsPoint(p corefoundation.CGPoint) bool
Returns a Boolean value that indicates whether a point lies inside the parent’s coordinate system.
p: A [CGPoint] to test against.
Return Value ¶
true if the point lies inside the parent’s coordinate system; otherwise false.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/contains(_:)
func (SKNode) ConvertPointFromNode ¶
func (n SKNode) ConvertPointFromNode(point corefoundation.CGPoint, node ISKNode) corefoundation.CGPoint
Converts a point from the coordinate system of another node in the node tree to the coordinate system of this node.
point: A point in the other node’s coordinate system.
node: Another node in the same node tree as this node.
Return Value ¶
The same point converted to this node’s coordinate system.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/convert(_:from:)
func (SKNode) ConvertPointToNode ¶
func (n SKNode) ConvertPointToNode(point corefoundation.CGPoint, node ISKNode) corefoundation.CGPoint
Converts a point in this node’s coordinate system to the coordinate system of another node in the node tree.
point: A point in this node’s coordinate system.
node: Another node in the same node tree as this node.
Return Value ¶
The same point converted to the other node’s coordinate system.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/convert(_:to:)
func (SKNode) EncodeWithCoder ¶
func (n SKNode) EncodeWithCoder(coder foundation.INSCoder)
func (SKNode) Entity ¶
func (n SKNode) Entity() objectivec.IObject
The GameplayKit entity this node represents.
Discussion ¶
The Entity-Component architecture in the GameplayKit framework is a way to more easily manage complex object graphs in your game. For more information on this architecture, read Entities and Components in GameplayKit Programming Guide.
When you add entities (and their components) to a scene in the Xcode SpriteKit Scene Editor, Xcode automatically archive those entities alongside the SpriteKit scene content. Use the GKScene class to load the SpriteKit scene with its associated GameplayKit objects. Each entity associated with a SpriteKit node has a GKSKNodeComponent object that manages the relationship between the node and the GKEntity object it represents.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/entity
func (SKNode) EnumerateChildNodesWithNameUsingBlock ¶
func (n SKNode) EnumerateChildNodesWithNameUsingBlock(name string, block SKNodeBoolHandler)
Searches the children of the receiving node to perform processing for nodes that share a name.
name: The name to search for. This may be either the literal name of the node or a customized search string. See `Searching the Node Tree`.
block: A block to execute on nodes that match the `name` parameter. The block has the signature `(` SKNode `, ` UnsafeMutablePointer `)`.
Discussion ¶
This method enumerates the child array in order, searching for nodes whose names match the search parameter. The block is called once for each node that matches the name parameter.
The following Swift code shows how you could enumerate through the child nodes of a scene with a name containing the string `yellow`. Each matching node is hidden until the enumeration finds a node that also contains the string `triangle`. When this node is reached, `stop` is set to true and the processing stops.
Listing 1. Enumerating child nodes
You can also search by class name using SKNode.EnumerateChildNodesWithNameUsingBlock. However, for custom classes, you need to specify the fully annotated class name (i.e. the project name followed by the class name). The following Swift code shows a custom class, [SpaceshipNode], based on SKSpriteNode, and created in a project named [SpaceGame]. The first search fails to return an instance of [SpaceshipNode] added as a child of `parentNode`:
Listing 2. Enumerating child nodes
See: https://developer.apple.com/documentation/SpriteKit/SKNode/enumerateChildNodes(withName:using:)
func (SKNode) Frame ¶
func (n SKNode) Frame() corefoundation.CGRect
A rectangle in the parent’s coordinate system that contains the node’s content, ignoring the node’s children.
Discussion ¶
The frame is the smallest rectangle that contains the node’s content, taking into account the node’s SKNode.XScale, SKNode.YScale, and SKNode.ZRotation properties.
Since SKNode does not draw content of its own, its frame size is arbitrary; it’s the visual subclasses of SKNode that do draw that define the frame’s size with a meaningful value that encloses its visual content.
To get a rect that encloses all the child nodes of an SKNode parent object, use SKNode.CalculateAccumulatedFrame.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/frame
func (SKNode) HasActions ¶
Returns a Boolean value that indicates whether the node is executing actions.
Return Value ¶
true if the node has any executing actions; otherwise false.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/hasActions()
func (SKNode) InParentHierarchy ¶
Returns a Boolean value that indicates whether the node is a descendant of the target node.
parent: An SKNode object to test against.
Return Value ¶
true if the node is a descendant of the `parent` node; otherwise false.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/inParentHierarchy(_:)
func (SKNode) InitWithCoder ¶
func (n SKNode) InitWithCoder(aDecoder foundation.INSCoder) SKNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func (SKNode) InsertChildAtIndex ¶
Inserts a node into a specific position in the receiver’s list of child nodes.
node: The node to add. The node must not already have a parent.
index: The position in the array to insert the node.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/insertChild(_:at:)
func (SKNode) IntersectsNode ¶
Returns a Boolean value that indicates whether this node intersects the specified node.
node: Another node in the same node tree.
Return Value ¶
true if the two nodes intersect; otherwise false.
Discussion ¶
The two nodes are considered to intersect if their frames intersect. The children of both nodes are ignored in this test.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/intersects(_:)
func (SKNode) IsAccessibilityElement ¶
A toggle you implement to indicate to the system whether this user interface element should be exposed to the user.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/isAccessibilityElement
func (SKNode) IsAccessibilityEnabled ¶
A toggle you implement to indicate to the system whether this user interface element should respond to user input.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/isAccessibilityEnabled
func (SKNode) IsEqualToNode ¶
Compares the parameter node to the receiving node.
node: The node to compare to the receiving node.
Return Value ¶
true if the node is a descendant of the `parent` node; otherwise false.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/isEqual(to:)
func (SKNode) IsHidden ¶
A Boolean value that determines whether a node and its descendants are rendered.
Discussion ¶
When hidden, a node and its descendants are not rendered. However, they still exist in the scene and continue to interact in other ways. For example, the node’s actions still run and the node can still be intersected with other nodes. The default value is false.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/isHidden
func (SKNode) IsPaused ¶
A Boolean value that determines whether actions on the node and its descendants are processed.
Discussion ¶
If the value is true, the node (and all of its descendants) are skipped when a scene processes actions.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/isPaused
func (SKNode) IsUserInteractionEnabled ¶
A Boolean value that indicates whether the node receives touch events.
Discussion ¶
The default value is false.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/isUserInteractionEnabled
func (SKNode) MoveToParent ¶
Moves the node to a new parent node in the scene.
parent: An SKNode object to move the receiver to. This node must be in the same scene as the node’s current parent.
Discussion ¶
The node maintains its current position in scene coordinates.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/move(toParent:)
func (SKNode) Name ¶
The node’s assignable name.
Discussion ¶
This property is used to identify a node in other parts of your game logic. For example, you might use this name as part of collision testing. You can also search for nodes in a tree by their name.
When choosing a name for a node, decide whether each node gets a unique name or whether some nodes will share a common name. If you give the node a unique name, you can find the node later by calling the SKNode.ChildNodeWithName method. If a name is shared by multiple nodes, the name usually means that these are all a similar object type in your game. In this case, you can iterate over those objects by calling the SKNode.EnumerateChildNodesWithNameUsingBlock method.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/name
func (SKNode) NodeAtPoint ¶
func (n SKNode) NodeAtPoint(p corefoundation.CGPoint) ISKNode
Returns the deepest visible descendant that intersects a point.
p: A point in the node’s coordinate system.
Return Value ¶
A descendant in the subtree that intersects the point, or the receiver if no nodes intersect the point. Only nodes that have an [SKNode.Hidden] of `false` and an SKNode.Alpha greater that zero are returned. If multiple descendants intersect the point, the deepest node in the tree is returned. If multiple nodes are at the same level, the intersecting node with the largest z position is returned.
Discussion ¶
A point is considered to be in a node if it lies inside the rectangle returned by the SKNode.CalculateAccumulatedFrame method.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/atPoint(_:)
func (SKNode) NodesAtPoint ¶
func (n SKNode) NodesAtPoint(p corefoundation.CGPoint) []SKNode
Returns an array of all visible descendants that intersect a point.
p: A point in the node’s coordinate system.
Return Value ¶
An array of all SKNode objects in the subtree that intersect the point. Only nodes that have an [SKNode.Hidden] of `false` and an SKNode.Alpha greater that zero are included in the returned array. If no nodes intersect the point, an empty array is returned.
Discussion ¶
A point is considered to be in a node if it lies inside the rectangle returned by the SKNode.CalculateAccumulatedFrame method.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/nodes(at:)
func (SKNode) ObjectForKeyedSubscript ¶
Returns an array of nodes that match the name parameter.
name: The name to search for. This may be either the literal name of the node or a customized search string. See `Searching the Node Tree`.
Return Value ¶
An array of SKNode objects that match the name. If no matching nodes are found, an empty array is returned.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/subscript(_:)
func (SKNode) Parent ¶
The node’s parent node.
Discussion ¶
If the node is not in a node tree, the value is `nil`.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/parent
func (SKNode) PhysicsBody ¶
func (n SKNode) PhysicsBody() ISKPhysicsBody
The physics body associated with the node.
Discussion ¶
The default value is `nil`, which indicates that the node does not participate in the physics simulation at all. If a physics body is provided, when the scene’s physics are simulated, the physics body updates the node’s position and rotates the node.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/physicsBody
func (SKNode) Position ¶
func (n SKNode) Position() corefoundation.CGPoint
The position of the node in its parent’s coordinate system.
Discussion ¶
The default value is `(0.0,0.0)`.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/position
func (SKNode) ReachConstraints ¶
func (n SKNode) ReachConstraints() ISKReachConstraints
The reach constraints to apply to the node when executing a reach action.
Discussion ¶
To use inverse kinematics, create a new SKReachConstraints object and assign it to this property. When a reach action calculates the new positions of this node, the possible values for this node are restricted to the constraints defined by this object. For more information on the inverse kinematic actions, see SKAction.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/reachConstraints
func (SKNode) RemoveActionForKey ¶
Removes an action associated with a specific key.
key: A string that uniquely identifies an action.
Discussion ¶
If an action is found that matches the key, it is removed from the node.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/removeAction(forKey:)
func (SKNode) RemoveAllActions ¶
func (n SKNode) RemoveAllActions()
Ends and removes all actions from the node.
Discussion ¶
When an action is removed from the node, any remaining animation the action would perform is skipped; however, previous changes are not reverted. It is possible that an action may make a final change to the scene when removed; if so, it is documented for the specific action in SKAction.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/removeAllActions()
func (SKNode) RemoveAllChildren ¶
func (n SKNode) RemoveAllChildren()
Removes all of the node’s children.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/removeAllChildren()
func (SKNode) RemoveChildrenInArray ¶
Removes a list of children from the receiving node.
nodes: An array of SKNode objects that are all children of the receiving node.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/removeChildren(in:)
func (SKNode) RemoveFromParent ¶
func (n SKNode) RemoveFromParent()
Removes the receiving node from its parent.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/removeFromParent()
func (SKNode) RunAction ¶
Adds an action to the list of actions executed by the node.
action: The action to perform.
Discussion ¶
The new action is processed the next time the scene’s animation loop is processed.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/run(_:)
func (SKNode) RunActionCompletion ¶
func (n SKNode) RunActionCompletion(action ISKAction, block VoidHandler)
Adds an action to the list of actions executed by the node and schedules the argument block to be run upon completion of the action.
action: The action to perform.
block: A completion block called when the action completes.
Discussion ¶
See: https://developer.apple.com/documentation/SpriteKit/SKNode/run(_:completion:)
func (SKNode) RunActionCompletionSync ¶
RunActionCompletionSync is a synchronous wrapper around SKNode.RunActionCompletion. It blocks until the completion handler fires or the context is cancelled.
func (SKNode) RunActionWithKey ¶
Adds an identifiable action to the list of actions executed by the node.
action: The action to perform.
key: A unique key used to identify the action.
Discussion ¶
This method is identical to SKNode.RunAction, but the action is stored so that it can be retrieved later. If an action using the same key is already running, it is removed before the new action is added.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/run(_:withKey:)
func (SKNode) Scene ¶
The scene node that contains this node.
Discussion ¶
If the node is not embedded in a scene, the value is `nil`.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/scene
func (SKNode) SetAccessibilityChildren ¶
func (n SKNode) SetAccessibilityChildren(value foundation.INSArray)
func (SKNode) SetAccessibilityElement ¶
func (SKNode) SetAccessibilityEnabled ¶
func (SKNode) SetAccessibilityFrame ¶
func (n SKNode) SetAccessibilityFrame(value corefoundation.CGRect)
func (SKNode) SetAccessibilityHelp ¶
func (SKNode) SetAccessibilityLabel ¶
func (SKNode) SetAccessibilityParent ¶
func (n SKNode) SetAccessibilityParent(value objectivec.IObject)
func (SKNode) SetAccessibilityRole ¶
func (SKNode) SetAccessibilityRoleDescription ¶
func (SKNode) SetAccessibilitySubrole ¶
func (SKNode) SetConstraints ¶
func (n SKNode) SetConstraints(value []SKConstraint)
func (SKNode) SetEntity ¶
func (n SKNode) SetEntity(value objectivec.IObject)
func (SKNode) SetPhysicsBody ¶
func (n SKNode) SetPhysicsBody(value ISKPhysicsBody)
func (SKNode) SetPosition ¶
func (n SKNode) SetPosition(value corefoundation.CGPoint)
func (SKNode) SetReachConstraints ¶
func (n SKNode) SetReachConstraints(value ISKReachConstraints)
func (SKNode) SetScale ¶
Sets the SKNode.XScale and SKNode.YScale properties of the node.
scale: The new value to use for the node’s SKNode.XScale and SKNode.YScale properties.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/setScale(_:)
func (SKNode) SetUserData ¶
func (n SKNode) SetUserData(value foundation.INSDictionary)
func (SKNode) SetUserInteractionEnabled ¶
func (SKNode) SetZPosition ¶
func (SKNode) SetZRotation ¶
func (SKNode) Speed ¶
A speed modifier applied to all actions executed by a node and its descendants.
Discussion ¶
The default value is `1.0`, which means that all actions run at their normal speed. If you set a different speed, time appears to run faster or slower for all actions executed on the node and its descendants. For example, if you set a speed value of `2.0`, actions run twice as fast.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/speed
func (SKNode) UserData ¶
func (n SKNode) UserData() foundation.INSDictionary
A dictionary containing arbitrary data.
Discussion ¶
You use this property to store your own data in a node. For example, you might store game-specific data about each node to use inside your game logic. This can be a useful alternative to creating your own node subclasses to hold game data.
SpriteKit does not do anything with the data stored in the node. However, the data is archived when the node is archived.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/userData
func (SKNode) XScale ¶
A scaling factor that multiplies the width of a node and its children.
Discussion ¶
The SKNode.XScale property scales the width of the node and all of its descendants. The scale value affects how a node’s frame is calculated, its hit test area, how it is drawn, and other similar characteristics. The default value is `1.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/xScale
func (SKNode) YScale ¶
A scaling factor that multiplies the height of a node and its children.
Discussion ¶
The SKNode.YScale property scales the height of the node and all of its descendants. The scale value affects how a node’s frame is calculated, its hit test area, how it is drawn, and other similar characteristics. The default value is `1.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/yScale
func (SKNode) ZPosition ¶
The height of the node relative to its parent.
Discussion ¶
The default value is `0.0`. The positive z axis is projected toward the viewer so that nodes with larger z-position values are closer to the viewer. When a node tree is rendered, the height of each node (in absolute coordinates) is calculated and then all nodes in the tree are rendered from smallest z-position value to largest z-position value. If multiple nodes share the same z-position, those nodes are sorted so that parent nodes are drawn before their children, and siblings are rendered in the order that they appear in their parent’s SKNode.Children array. Hit-testing is processed in the opposite order.
The SKView class’s SKView.IgnoresSiblingOrder property controls whether node sorting is enabled for nodes at the same z-position.
Using a Node’s Depth to Add Effects ¶
SpriteKit uses the SKNode.ZPosition value only to determine the hit testing and drawing order. You can also the z position to implement your own game effects. For example, you might use the height of a node to determine how it is rendered or how it moves onscreen. In this way, you can simulate fog or parallax effects. SpriteKit does not create these effects for you. Usually, you implement them by processing the scene immediately before it is rendered.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/zPosition
func (SKNode) ZRotation ¶
The Euler rotation about the z axis (in radians).
Discussion ¶
The default value is `0.0`, which indicates no rotation. A positive value indicates a counterclockwise rotation. When the coordinate system is rotated, it affects the node and its descendants. The rotation affects the node’s SKNode.Frame property, hit testing, rendering, and other similar characteristics.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/zRotation
type SKNodeBoolHandler ¶
SKNodeBoolHandler handles A block to execute on nodes that match the `name` parameter.
Used by:
type SKNodeClass ¶
type SKNodeClass struct {
// contains filtered or unexported fields
}
func GetSKNodeClass ¶
func GetSKNodeClass() SKNodeClass
GetSKNodeClass returns the class object for SKNode.
func (SKNodeClass) Alloc ¶
func (sc SKNodeClass) Alloc() SKNode
Alloc allocates memory for a new instance of the class.
func (SKNodeClass) Class ¶
func (sc SKNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKNodeClass) ObstaclesFromNodeBounds ¶
func (_SKNodeClass SKNodeClass) ObstaclesFromNodeBounds(nodes []SKNode) []objectivec.IObject
Converts each node into an obstacle by transforming its bounds into the scene’s coordinate system.
nodes: An array of SKNode objects.
Return Value ¶
An array of GKPolygonObstacle objects.
Discussion ¶
Use the array of obstacles to create an obstacle graph (GKObstacleGraph) in GameplayKit. See GameplayKit and GameplayKit Programming Guide.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/obstacles(fromNodeBounds:)
func (SKNodeClass) ObstaclesFromNodePhysicsBodies ¶
func (_SKNodeClass SKNodeClass) ObstaclesFromNodePhysicsBodies(nodes []SKNode) []objectivec.IObject
Converts each node into an obstacle by transforming the node’s physics body shape into the scene’s coordinate system.
nodes: An array of SKNode objects.
Return Value ¶
An array of GKPolygonObstacle objects.
Discussion ¶
Use the array of obstacles to create an obstacle graph (GKObstacleGraph) in GameplayKit. See GameplayKit and GameplayKit Programming Guide.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/obstacles(fromNodePhysicsBodies:)
func (SKNodeClass) ObstaclesFromSpriteTexturesAccuracy ¶
func (_SKNodeClass SKNodeClass) ObstaclesFromSpriteTexturesAccuracy(sprites []SKNode, accuracy float32) []objectivec.IObject
Turns each node into an obstacle by changing the node’s texture into a physics shape and converting it into the scene’s coordinate system.
sprites: An array of SKNode objects.
accuracy: A floating point value between `0.001` and `1.0`, inclusive. Higher values create a more precise (but more complex) representation of the obstacle.
Return Value ¶
An array of GKPolygonObstacle objects.
Discussion ¶
Use the array of obstacles to create an obstacle graph (GKObstacleGraph) in GameplayKit. See GameplayKit and GameplayKit Programming Guide.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/obstacles(fromSpriteTextures:accuracy:)
type SKNodeFocusBehavior ¶
type SKNodeFocusBehavior int
See: https://developer.apple.com/documentation/SpriteKit/SKNodeFocusBehavior
const ( // SKNodeFocusBehaviorFocusable: Node is focusable and prevents nodes that it visually obscures from becoming focusable. SKNodeFocusBehaviorFocusable SKNodeFocusBehavior = 2 // SKNodeFocusBehaviorNone: Node is not focusable. SKNodeFocusBehaviorNone SKNodeFocusBehavior = 0 // SKNodeFocusBehaviorOccluding: Node is not focusable and prevents nodes that it visually obscures from becoming focusable. SKNodeFocusBehaviorOccluding SKNodeFocusBehavior = 1 )
func (SKNodeFocusBehavior) String ¶
func (e SKNodeFocusBehavior) String() string
type SKParticleRenderOrder ¶
type SKParticleRenderOrder uint
See: https://developer.apple.com/documentation/SpriteKit/SKParticleRenderOrder
const ( // SKParticleRenderOrderDontCare: The particles can be rendered in any order. SKParticleRenderOrderDontCare SKParticleRenderOrder = 2 // SKParticleRenderOrderOldestFirst: The particles are rendered from oldest to newest. SKParticleRenderOrderOldestFirst SKParticleRenderOrder = 1 // SKParticleRenderOrderOldestLast: The particles are rendered from newest to oldest. SKParticleRenderOrderOldestLast SKParticleRenderOrder = 0 )
func (SKParticleRenderOrder) String ¶
func (e SKParticleRenderOrder) String() string
type SKPhysicsBody ¶
type SKPhysicsBody struct {
objectivec.Object
}
An object that adds physics simulation to a node.
Overview ¶
Assign a SKPhysicsBody object to the SKNode.PhysicsBody property of the SKNode object to add physics simulation to the node. When a scene processes a new frame, it performs physics calculations on physics bodies attached to nodes in the scene. These calculations include gravity, friction, and collisions with other bodies. You can also apply your own forces and impulses to a body. After the scene completes these calculations, it updates the positions and orientations of the node objects.
SpriteKit supports two kinds of physics bodies, volume-based bodies and edge-based bodies. When you create a physics body, its kind, size, and shape are determined by the constructor method you call. An edge-based body does not have mass or volume and is unaffected by forces or impulses in the system. Edge-based bodies are used to represent volumeless boundaries or hollow spaces in your physics simulation. In contrast, volume-based bodies are used to represent objects with mass and volume. The [SKPhysicsBody.Dynamic] property controls whether a volume-based body is affected by gravity, friction, collisions with other objects, and forces or impulses you directly apply to it.
The SKPhysicsBody class defines the physical characteristics for the body when it is simulated by the scene. For volume-based bodies, the most important property is the SKPhysicsBody.Mass property. A volume-based body is assumed to have a uniform density. You can either set the SKPhysicsBody.Mass property directly, or you can set the body’s SKPhysicsBody.Density property and let the physics body calculate its own mass. All values in Sprite Kit are specified using the International System of Units (SI units). The actual forces and mass values are not important so long as your game uses consistent values.
When you design a game that uses physics, you define the different categories of physics objects that appear in the scene. You define up to 32 different categories of physics bodies, and a body can be assigned to as many of these categories as you want. In addition to declaring its own categories, a physics body also declares which categories of bodies it interacts with. See SKPhysicsBody. You use a similar mechanism to declare which physics field nodes (SKFieldNode) can affect the physics body.
For a volume-based body, you can dynamically control how the body is affected by forces or collisions. See SKPhysicsBody.
Defining How Forces Affect a Physics Body ¶
- SKPhysicsBody.AffectedByGravity: A Boolean value that indicates whether this physics body is affected by the physics world’s gravity.
- SKPhysicsBody.SetAffectedByGravity
- SKPhysicsBody.AllowsRotation: A Boolean value that indicates whether the physics body is affected by angular forces and impulses applied to it.
- SKPhysicsBody.SetAllowsRotation
- SKPhysicsBody.IsDynamic: A Boolean value that indicates whether the physics body is moved by the physics simulation.
- SKPhysicsBody.SetDynamic
Defining a Physics Body’s Physical Properties ¶
- SKPhysicsBody.Mass: The mass of the body, in kilograms.
- SKPhysicsBody.SetMass
- SKPhysicsBody.Density: The density of the object, in kilograms per square meter.
- SKPhysicsBody.SetDensity
- SKPhysicsBody.Area: The area covered by the body.
- SKPhysicsBody.Friction: The roughness of the surface of the physics body.
- SKPhysicsBody.SetFriction
- SKPhysicsBody.Restitution: The bounciness of the physics body.
- SKPhysicsBody.SetRestitution
- SKPhysicsBody.LinearDamping: A property that reduces the body’s linear velocity.
- SKPhysicsBody.SetLinearDamping
- SKPhysicsBody.AngularDamping: A property that reduces the body’s rotational velocity.
- SKPhysicsBody.SetAngularDamping
Working with Collisions and Contacts ¶
- SKPhysicsBody.CategoryBitMask: A mask that defines which categories this physics body belongs to.
- SKPhysicsBody.SetCategoryBitMask
- SKPhysicsBody.CollisionBitMask: A mask that defines which categories of physics bodies can collide with this physics body.
- SKPhysicsBody.SetCollisionBitMask
- SKPhysicsBody.UsesPreciseCollisionDetection: A Boolean value that determines whether the physics world uses an iterative collision detection algorithm.
- SKPhysicsBody.SetUsesPreciseCollisionDetection
- SKPhysicsBody.ContactTestBitMask: A mask that defines which categories of physics bodies cause intersection notifications with this physics body.
- SKPhysicsBody.SetContactTestBitMask
- SKPhysicsBody.AllContactedBodies: The physics bodies that this physics body is in contact with.
Applying Forces and Impulses to a Physics Body ¶
- SKPhysicsBody.ApplyForce: Applies a force to the center of gravity of a physics body.
- SKPhysicsBody.ApplyTorque: Applies torque to an object.
- SKPhysicsBody.ApplyForceAtPoint: Applies a force to a specific point of a physics body.
- SKPhysicsBody.ApplyImpulse: Applies an impulse to the center of gravity of a physics body.
- SKPhysicsBody.ApplyAngularImpulse: Applies an impulse that imparts angular momentum to an object.
- SKPhysicsBody.ApplyImpulseAtPoint: Applies an impulse to a specific point of a physics body.
Inspecting a Physics Body’s Position and Velocity ¶
- SKPhysicsBody.Velocity: The physics body’s velocity vector, measured in meters per second.
- SKPhysicsBody.SetVelocity
- SKPhysicsBody.AngularVelocity: The physics body’s angular speed.
- SKPhysicsBody.SetAngularVelocity
- SKPhysicsBody.IsResting: A Boolean property that indicates whether the object is at rest within the physics simulation.
- SKPhysicsBody.SetResting
Reading a Physics Body’s Node ¶
- SKPhysicsBody.Node: The node that this body is connected to.
Determining Which Joints Are Connected to a Physics Body ¶
- SKPhysicsBody.Joints: The joints connected to this physics body.
Interacting with Physics Fields ¶
- SKPhysicsBody.FieldBitMask: A mask that defines which categories of physics fields can exert forces on this physics body.
- SKPhysicsBody.SetFieldBitMask
- SKPhysicsBody.Charge: The electrical charge of the physics body.
- SKPhysicsBody.SetCharge
Pinning a Physics Body to a Node’s Parent ¶
- SKPhysicsBody.Pinned: A Boolean value that indicates whether the physics body’s node is pinned to its parent node.
- SKPhysicsBody.SetPinned
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody
func NewPhysicsBodyWithBodies ¶
func NewPhysicsBodyWithBodies(bodies []SKPhysicsBody) SKPhysicsBody
Creates a physics body that’s shaped like a union of the argument physics bodies.
bodies: An array of SKPhysicsBody objects. The objects must be volume-based physics bodies. (You may not use a compound body created using this method in the array.)
Return Value ¶
A new compound-physics body.
Discussion ¶
The shapes of the physics bodies passed into this method are used to create a new physics body whose covered area is the union of the areas of its children. These areas do not need to be contiguous. If there is space between two parts, other bodies may be able to pass between these parts. However, the physics body is treated as a single connected body, meaning that a force or impulse applied to the body affects all of the pieces as if they are held together with an indestructible frame.
The properties on the children, such as mass or friction, are ignored. Only the shapes of the child bodies are used.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(bodies:)
func NewPhysicsBodyWithCircleOfRadius ¶
func NewPhysicsBodyWithCircleOfRadius(r float64) SKPhysicsBody
Creates a circular physics body centered on the owning node’s origin.
r: The radius of the circle.
Return Value ¶
A new volume-based physics body.
Discussion ¶
The following code shows the code that creates the physics body for a spherical or circular object. Because the physics body is attached to a sprite object, it usually needs volume. In this case, the sprite image is assumed to closely approximate a circle centered on the anchor point, so the radius of the circle is calculated and used to create the physics body.
Listing 1. A physics body for a circular sprite
If the physics body were significantly smaller than the sprite’s image, the data used to create the physics body might need to be provided by some other source, such as a property list.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(circleOfRadius:)
func NewPhysicsBodyWithCircleOfRadiusCenter ¶
func NewPhysicsBodyWithCircleOfRadiusCenter(r float64, center corefoundation.CGPoint) SKPhysicsBody
Creates a circular physics body centered on an arbitrary point.
r: The radius of the circle.
center: The origin of the circle in the owning node’s coordinate system.
Return Value ¶
A new volume-based physics body.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(circleOfRadius:center:)
func NewPhysicsBodyWithEdgeChainFromPath ¶
func NewPhysicsBodyWithEdgeChainFromPath(path coregraphics.CGPathRef) SKPhysicsBody
Creates an edge chain from a path.
path: A Core Graphics path. The points are specified relative to the owning node’s origin. The path must not intersect itself.
Return Value ¶
A new edge-based physics body.
Discussion ¶
An edge has no volume or mass and is always treated as if the [SKPhysicsBody.Dynamic] property is equal to false. Edges may only collide with volume-based physics bodies.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(edgeChainFrom:)
func NewPhysicsBodyWithEdgeFromPointToPoint ¶
func NewPhysicsBodyWithEdgeFromPointToPoint(p1 corefoundation.CGPoint, p2 corefoundation.CGPoint) SKPhysicsBody
Creates an edge between two points.
p1: The starting point for the edge, relative to the owning node’s origin.
p2: The ending point for the edge, relative to the owning node’s origin.
Return Value ¶
A new edge-based physics body.
Discussion ¶
An edge has no volume or mass and is always treated as if the [SKPhysicsBody.Dynamic] property is equal to false. Edges may only collide with volume-based physics bodies.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(edgeFrom:to:)
func NewPhysicsBodyWithEdgeLoopFromPath ¶
func NewPhysicsBodyWithEdgeLoopFromPath(path coregraphics.CGPathRef) SKPhysicsBody
Creates an edge loop from a path.
path: A Core Graphics path. The points are specified relative to the owning node’s origin. The path must not intersect itself.
Return Value ¶
A new edge-based physics body.
Discussion ¶
If the path is not already closed, a loop is automatically created by joining the last point to the first.
An edge has no volume or mass and is always treated as if the [SKPhysicsBody.Dynamic] property is equal to false. Edges may only collide with volume-based physics bodies.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(edgeLoopFrom:)-5grxu
func NewPhysicsBodyWithEdgeLoopFromRect ¶
func NewPhysicsBodyWithEdgeLoopFromRect(rect corefoundation.CGRect) SKPhysicsBody
Creates an edge loop from a rectangle.
rect: The rectangle that defines the edges. The rectangle is specified relative to the owning node’s origin.
Return Value ¶
A new edge-based physics body.
Discussion ¶
An edge has no volume or mass and is always treated as if the [SKPhysicsBody.Dynamic] property is equal to false. Edges may only collide with volume-based physics bodies.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(edgeLoopFrom:)-8sqfy
func NewPhysicsBodyWithPolygonFromPath ¶
func NewPhysicsBodyWithPolygonFromPath(path coregraphics.CGPathRef) SKPhysicsBody
Creates a polygonal physics body.
path: A convex polygonal path with counterclockwise winding and no self intersections. The points are specified relative to the owning node’s origin.
Return Value ¶
A new volume-based physics body.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(polygonFrom:)
func NewPhysicsBodyWithRectangleOfSize ¶
func NewPhysicsBodyWithRectangleOfSize(s corefoundation.CGSize) SKPhysicsBody
Creates a rectangular physics body centered on the owning node’s origin.
s: The size of the rectangle.
Return Value ¶
A new volume-based physics body.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(rectangleOf:)
func NewPhysicsBodyWithRectangleOfSizeCenter ¶
func NewPhysicsBodyWithRectangleOfSizeCenter(s corefoundation.CGSize, center corefoundation.CGPoint) SKPhysicsBody
Creates a rectangular physics body centered on an arbitrary point.
s: The size of the rectangle.
center: The center of the square in the owning node’s coordinate system.
Return Value ¶
A new volume-based physics body.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(rectangleOf:center:)
func NewPhysicsBodyWithTextureAlphaThresholdSize ¶
func NewPhysicsBodyWithTextureAlphaThresholdSize(texture ISKTexture, alphaThreshold float32, size corefoundation.CGSize) SKPhysicsBody
Creates a physics body from the contents of a texture, capturing only the texels that exceed a specified transparency value.
texture: The texture to analyze.
alphaThreshold: The minimum alpha value for texels that should be part of the new physics body.
size: The size of the physics body to return.
Return Value ¶
A new volume-based physics body.
Discussion ¶
Use this method when your sprite has a shape that you want replicated in its physics body. The texture is scaled to the new size and then analyzed. A new physics body is created that includes all of the texels in the texture whose alpha values equal or exceed the `alphaThreshold` parameter. The shape of this body attempts to strike a good balance between performance and accuracy. For example, fine details may be ignored if keeping them would cause a significant performance penalty.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(texture:alphaThreshold:size:)
func NewPhysicsBodyWithTextureSize ¶
func NewPhysicsBodyWithTextureSize(texture ISKTexture, size corefoundation.CGSize) SKPhysicsBody
Creates a physics body from the contents of a texture.
texture: The texture to convert into a physics body.
size: The size of the physics body to return.
Return Value ¶
A new volume-based physics body.
Discussion ¶
Use this method when your sprite has a shape that you want replicated in its physics body. The texture is scaled to the new size and then analyzed. A new physics body is created that includes all of the texels in the texture that have a nonzero alpha value. The shape of this body attempts to strike a good balance between performance and accuracy. For example, fine details may be ignored if keeping them would cause a significant performance penalty.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/init(texture:size:)
func NewSKPhysicsBody ¶
func NewSKPhysicsBody() SKPhysicsBody
NewSKPhysicsBody creates a new SKPhysicsBody instance.
func SKPhysicsBodyFromID ¶
func SKPhysicsBodyFromID(id objc.ID) SKPhysicsBody
SKPhysicsBodyFromID constructs a SKPhysicsBody from an objc.ID.
An object that adds physics simulation to a node.
func (SKPhysicsBody) AffectedByGravity ¶
func (p SKPhysicsBody) AffectedByGravity() bool
A Boolean value that indicates whether this physics body is affected by the physics world’s gravity.
Discussion ¶
The physics world’s SKPhysicsWorld.Gravity property defines the gravitational forces applied to volume-based bodies in the scene.
The default value is `true`. This property is ignored on edge-based bodies, which are always unaffected by gravity.
Physics bodies with `affectedByGravity` set to `false` are still affected by the gravity fields created by SKFieldNodeClass.LinearGravityFieldWithVector and SKFieldNodeClass.RadialGravityField.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/affectedByGravity
func (SKPhysicsBody) AllContactedBodies ¶
func (p SKPhysicsBody) AllContactedBodies() []SKPhysicsBody
The physics bodies that this physics body is in contact with.
Return Value ¶
An array of SKPhysicsBody objects that this body is in contact with.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/allContactedBodies()
func (SKPhysicsBody) AllowsRotation ¶
func (p SKPhysicsBody) AllowsRotation() bool
A Boolean value that indicates whether the physics body is affected by angular forces and impulses applied to it.
Discussion ¶
The default value is true. This property is ignored on edge-based bodies, which are unaffected by forces in the system.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/allowsRotation
func (SKPhysicsBody) AngularDamping ¶
func (p SKPhysicsBody) AngularDamping() float64
A property that reduces the body’s rotational velocity.
Discussion ¶
This property is used to simulate fluid or air friction forces on the body. The property must be a value between `0.0` and `1.0`. The default value is `0.1`. If the value is `0.0`, no angular damping is applied to the object.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/angularDamping
func (SKPhysicsBody) AngularVelocity ¶
func (p SKPhysicsBody) AngularVelocity() float64
The physics body’s angular speed.
Discussion ¶
The angular velocity is a pseudo vector around an axis vector of `(0.0,0.0,1.0)` measured in radians per second.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/angularVelocity
func (SKPhysicsBody) ApplyAngularImpulse ¶
func (p SKPhysicsBody) ApplyAngularImpulse(impulse float64)
Applies an impulse that imparts angular momentum to an object.
impulse: The magnitude of the impulse. The impulse is measured in Newton-seconds.
Discussion ¶
This method affects the body’s angular velocity without changing the body’s linear velocity.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/applyAngularImpulse(_:)
func (SKPhysicsBody) ApplyForce ¶
func (p SKPhysicsBody) ApplyForce(force corefoundation.CGVector)
Applies a force to the center of gravity of a physics body.
force: A vector that describes how much force was applied in each dimension. The force is measured in Newtons.
Discussion ¶
This method accelerates the body without imparting any angular acceleration to it. The acceleration is applied for a single simulation step (one frame).
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/applyForce(_:)
func (SKPhysicsBody) ApplyForceAtPoint ¶
func (p SKPhysicsBody) ApplyForceAtPoint(force corefoundation.CGVector, point corefoundation.CGPoint)
Applies a force to a specific point of a physics body.
force: A vector that describes how much force was applied in each dimension. The force is measured in Newtons.
point: A point in scene coordinates that defines where the force was applied to the physics body.
Discussion ¶
Because the force is applied to a specific point on the body, it may impart both linear acceleration and angular acceleration. The force is applied for a single simulation step (one frame).
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/applyForce(_:at:)
func (SKPhysicsBody) ApplyImpulse ¶
func (p SKPhysicsBody) ApplyImpulse(impulse corefoundation.CGVector)
Applies an impulse to the center of gravity of a physics body.
impulse: A vector that describes how much momentum was imparted in each dimension. The impulse is measured in Newton-seconds.
Discussion ¶
This method affects the body’s linear velocity without changing the body’s angular velocity.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/applyImpulse(_:)
func (SKPhysicsBody) ApplyImpulseAtPoint ¶
func (p SKPhysicsBody) ApplyImpulseAtPoint(impulse corefoundation.CGVector, point corefoundation.CGPoint)
Applies an impulse to a specific point of a physics body.
impulse: A vector that describes how much momentum to impart to the body. The impulse is measured in Newton-seconds.
point: A point in scene coordinates that defines where the impulse was applied to the physics body.
Discussion ¶
Because this impulse is applied to a specific point on the object, it may change both the body’s velocity and angular velocity.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/applyImpulse(_:at:)
func (SKPhysicsBody) ApplyTorque ¶
func (p SKPhysicsBody) ApplyTorque(torque float64)
Applies torque to an object.
torque: The amount of torque, in Newton-meters.
Discussion ¶
This method generates an angular acceleration on the body without causing any linear acceleration. The force is applied for a single simulation step (one frame).
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/applyTorque(_:)
func (SKPhysicsBody) Area ¶
func (p SKPhysicsBody) Area() float64
The area covered by the body.
Discussion ¶
This property is used in conjunction with the SKPhysicsBody.Density property to calculate the body’s mass.
The value returned for the area is measured in meters: if you need to convert it into points — as used by SpriteKit — multiply the values by 150². The following listing shows how to calculate the area of a box which is ten points square.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/area
func (SKPhysicsBody) Autorelease ¶
func (p SKPhysicsBody) Autorelease() SKPhysicsBody
Autorelease adds the receiver to the current autorelease pool.
func (SKPhysicsBody) CategoryBitMask ¶
func (p SKPhysicsBody) CategoryBitMask() uint32
A mask that defines which categories this physics body belongs to.
Discussion ¶
Every physics body in a scene can be assigned to up to 32 different categories, each corresponding to a bit in the bit mask. You define the mask values used in your game. In conjunction with the SKPhysicsBody.CollisionBitMask and SKPhysicsBody.ContactTestBitMask properties, you define which physics bodies interact with each other and when your game is notified of these interactions.
The default value is `0xFFFFFFFF` (all bits set).
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/categoryBitMask
func (SKPhysicsBody) Charge ¶
func (p SKPhysicsBody) Charge() float64
The electrical charge of the physics body.
Discussion ¶
The electrical charge is used by electromagnetic fields to calculate electromagnetic force effects on the physics body. See SKFieldNode.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/charge
func (SKPhysicsBody) CollisionBitMask ¶
func (p SKPhysicsBody) CollisionBitMask() uint32
A mask that defines which categories of physics bodies can collide with this physics body.
Discussion ¶
When two physics bodies contact each other, a collision may occur. This body’s collision mask is compared to the other body’s category mask by performing a logical AND operation. If the result is a nonzero value, this body is affected by the collision. Each body independently chooses whether it wants to be affected by the other body. For example, you might use this to avoid collision calculations that would make negligible changes to a body’s velocity.
The default value is `0xFFFFFFFF` (all bits set).
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/collisionBitMask
func (SKPhysicsBody) ContactTestBitMask ¶
func (p SKPhysicsBody) ContactTestBitMask() uint32
A mask that defines which categories of physics bodies cause intersection notifications with this physics body.
Discussion ¶
When two bodies share the same space, each body’s category mask is tested against the other body’s contact mask by performing a logical AND operation. If either comparison results in a nonzero value, an SKPhysicsContact object is created and passed to the physics world’s delegate. For best performance, only set bits in the contacts mask for interactions you are interested in.
The default value is `0x00000000` (all bits cleared).
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/contactTestBitMask
func (SKPhysicsBody) Density ¶
func (p SKPhysicsBody) Density() float64
The density of the object, in kilograms per square meter.
Discussion ¶
The actual unit is arbitrary as long as relative masses of objects are consistent throughout the game.
The SKPhysicsBody.Mass and SKPhysicsBody.Density properties are interrelated. When you change the value of either property, the other property’s value is automatically recalculated to be consistent.
The default value is `1.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/density
func (SKPhysicsBody) EncodeWithCoder ¶
func (p SKPhysicsBody) EncodeWithCoder(coder foundation.INSCoder)
func (SKPhysicsBody) FieldBitMask ¶
func (p SKPhysicsBody) FieldBitMask() uint32
A mask that defines which categories of physics fields can exert forces on this physics body.
Discussion ¶
When a physics body is inside the region of an SKFieldNode object, that field node’s SKFieldNode.CategoryBitMask property is compared to this physics body’s SKPhysicsBody.FieldBitMask property by performing a logical AND operation. If the result is a nonzero value, the field node’s effect is applied to the physics body.
The default value is `0xFFFFFFFF` (all bits set).
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/fieldBitMask
func (SKPhysicsBody) Friction ¶
func (p SKPhysicsBody) Friction() float64
The roughness of the surface of the physics body.
Discussion ¶
This property is used to apply a frictional force to physics bodies in contact with this physics body. The property must be a value between `0.0` and `1.0`. The default value is `0.2`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/friction
func (SKPhysicsBody) Init ¶
func (p SKPhysicsBody) Init() SKPhysicsBody
Init initializes the instance.
func (SKPhysicsBody) IsDynamic ¶
func (p SKPhysicsBody) IsDynamic() bool
A Boolean value that indicates whether the physics body is moved by the physics simulation.
Discussion ¶
The default value is true. If the value is false, the physics body ignores all forces and impulses applied to it. This property is ignored on edge-based bodies; they are automatically static.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/isDynamic
func (SKPhysicsBody) IsResting ¶
func (p SKPhysicsBody) IsResting() bool
A Boolean property that indicates whether the object is at rest within the physics simulation.
Discussion ¶
This property is automatically set to true by the physics simulation when it determines that the body is at rest. This means that the body is at rest on another body in the system. Resting bodies do not participate in the physics simulation until an impulse is applied to the object or another object collides with it. This improves the performance of the physics simulation. If all bodies in the world are resting, the entire simulation is at rest, reducing the number of calculations that are performed by the physics world.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/isResting
func (SKPhysicsBody) Joints ¶
func (p SKPhysicsBody) Joints() []SKPhysicsJoint
The joints connected to this physics body.
Discussion ¶
This property holds an array of SKPhysicsJoint objects that define all joints added to the scene’s physics world that are connected to this physics body.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/joints
func (SKPhysicsBody) LinearDamping ¶
func (p SKPhysicsBody) LinearDamping() float64
A property that reduces the body’s linear velocity.
Discussion ¶
This property is used to simulate fluid or air friction forces on the body. The property must be a value between `0.0` and `1.0`. The default value is `0.1`. If the value is `0.0`, no linear damping is applied to the object.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/linearDamping
func (SKPhysicsBody) Mass ¶
func (p SKPhysicsBody) Mass() float64
The mass of the body, in kilograms.
Discussion ¶
The actual unit is arbitrary as long as relative masses of objects are consistent throughout the game. The mass of the body affects its momentum as well as how forces are applied to the object.
The SKPhysicsBody.Mass and SKPhysicsBody.Density properties are interrelated. When you change the value of either property, the other property’s value is automatically recalculated to be consistent. The default value is based on the size of the physics body and the body’s default density.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/mass
func (SKPhysicsBody) Node ¶
func (p SKPhysicsBody) Node() ISKNode
The node that this body is connected to.
Discussion ¶
You associate the body with a node by assigning it to the SKNode.PhysicsBody property of the SKNode object. If the body is not associated with a node, the value is `nil`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/node
func (SKPhysicsBody) Pinned ¶
func (p SKPhysicsBody) Pinned() bool
A Boolean value that indicates whether the physics body’s node is pinned to its parent node.
Discussion ¶
The default value is false. If true, the node’s position is fixed relative to its parent. The node’s position cannot be changed by actions or physics forces. The node can freely rotate around its position in response to collisions or other forces. If the parent node has a physics body, the two physics bodies are treated as if they are connected with a pin joint.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/pinned
func (SKPhysicsBody) Restitution ¶
func (p SKPhysicsBody) Restitution() float64
The bounciness of the physics body.
Discussion ¶
This property is used to determine how much energy the physics body loses when it bounces off another object. The property must be a value between `0.0` and `1.0`. The default value is `0.2`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/restitution
func (SKPhysicsBody) SetAffectedByGravity ¶
func (p SKPhysicsBody) SetAffectedByGravity(value bool)
func (SKPhysicsBody) SetAllowsRotation ¶
func (p SKPhysicsBody) SetAllowsRotation(value bool)
func (SKPhysicsBody) SetAngularDamping ¶
func (p SKPhysicsBody) SetAngularDamping(value float64)
func (SKPhysicsBody) SetAngularVelocity ¶
func (p SKPhysicsBody) SetAngularVelocity(value float64)
func (SKPhysicsBody) SetCategoryBitMask ¶
func (p SKPhysicsBody) SetCategoryBitMask(value uint32)
func (SKPhysicsBody) SetCharge ¶
func (p SKPhysicsBody) SetCharge(value float64)
func (SKPhysicsBody) SetCollisionBitMask ¶
func (p SKPhysicsBody) SetCollisionBitMask(value uint32)
func (SKPhysicsBody) SetContactTestBitMask ¶
func (p SKPhysicsBody) SetContactTestBitMask(value uint32)
func (SKPhysicsBody) SetDensity ¶
func (p SKPhysicsBody) SetDensity(value float64)
func (SKPhysicsBody) SetDynamic ¶
func (p SKPhysicsBody) SetDynamic(value bool)
func (SKPhysicsBody) SetFieldBitMask ¶
func (p SKPhysicsBody) SetFieldBitMask(value uint32)
func (SKPhysicsBody) SetFriction ¶
func (p SKPhysicsBody) SetFriction(value float64)
func (SKPhysicsBody) SetLinearDamping ¶
func (p SKPhysicsBody) SetLinearDamping(value float64)
func (SKPhysicsBody) SetMass ¶
func (p SKPhysicsBody) SetMass(value float64)
func (SKPhysicsBody) SetPinned ¶
func (p SKPhysicsBody) SetPinned(value bool)
func (SKPhysicsBody) SetResting ¶
func (p SKPhysicsBody) SetResting(value bool)
func (SKPhysicsBody) SetRestitution ¶
func (p SKPhysicsBody) SetRestitution(value float64)
func (SKPhysicsBody) SetUsesPreciseCollisionDetection ¶
func (p SKPhysicsBody) SetUsesPreciseCollisionDetection(value bool)
func (SKPhysicsBody) SetVelocity ¶
func (p SKPhysicsBody) SetVelocity(value corefoundation.CGVector)
func (SKPhysicsBody) UsesPreciseCollisionDetection ¶
func (p SKPhysicsBody) UsesPreciseCollisionDetection() bool
A Boolean value that determines whether the physics world uses an iterative collision detection algorithm.
Discussion ¶
When SpriteKit performs collision detection, it first determines the locations of all of the physics bodies in the scene. Then it determines whether collisions or contacts occurred. This computational method is fast, but can sometimes result in missed collisions. A small body might move so fast that it completely passes through another physics body without ever having a frame of animation where the two touch each other.
If you have physics bodies that must collide, you can hint to SpriteKit to use a more precise collision model to check for interactions. This model is more expensive, so it should be used sparingly. When either body uses precise collisions, multiple contact iterations are evaluated to ensure that all contacts are detected.
The default value is false. If two bodies in a collision do not perform precise collision detection, and one passes completely through the other in a single frame, no collision is detected. If this property is set to true on either body, the simulation performs a more precise and more expensive calculation to detect these collisions. This property should be set to true on small, fast moving bodies.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/usesPreciseCollisionDetection
func (SKPhysicsBody) Velocity ¶
func (p SKPhysicsBody) Velocity() corefoundation.CGVector
The physics body’s velocity vector, measured in meters per second.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsBody/velocity
type SKPhysicsBodyBoolHandler ¶
type SKPhysicsBodyBoolHandler = func(*SKPhysicsBody, *bool)
SKPhysicsBodyBoolHandler handles A block to be called for each physics body that contains the point.
- body: The physics body that the ray intersected.
- stop: A pointer to a Boolean variable. Your block can set this to [true](<https://developer.apple.com/documentation/Swift/true>) to terminate the enumeration.
Used by:
type SKPhysicsBodyCGPointCGVectorBoolHandler ¶
type SKPhysicsBodyCGPointCGVectorBoolHandler = func(*SKPhysicsBody, corefoundation.CGPoint, corefoundation.CGVector, *bool)
SKPhysicsBodyCGPointCGVectorBoolHandler handles A block to be called for each physics body that the ray touches.
- body: The physics body that the ray intersected.
- point: The point in scene coordinates where the ray contacted the physics body.
- normal: The normal vector for the physics body at the point of contact.
- stop: A pointer to a Boolean variable. Your block can set this to [true](<https://developer.apple.com/documentation/Swift/true>) to terminate the enumeration.
Used by:
type SKPhysicsBodyClass ¶
type SKPhysicsBodyClass struct {
// contains filtered or unexported fields
}
func GetSKPhysicsBodyClass ¶
func GetSKPhysicsBodyClass() SKPhysicsBodyClass
GetSKPhysicsBodyClass returns the class object for SKPhysicsBody.
func (SKPhysicsBodyClass) Alloc ¶
func (sc SKPhysicsBodyClass) Alloc() SKPhysicsBody
Alloc allocates memory for a new instance of the class.
func (SKPhysicsBodyClass) Class ¶
func (sc SKPhysicsBodyClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKPhysicsContact ¶
type SKPhysicsContact struct {
objectivec.Object
}
A description of the contact between two physics bodies.
Overview ¶
An SKPhysicsContact object is created automatically by SpriteKit to describe a contact between two physical bodies in a physics world.To receive contact messages, read the SKScene.PhysicsWorld property of an SKScene object you are interested in, and assign its SKPhysicsWorld.ContactDelegate property to point to an object that implements the SKPhysicsContactDelegate protocol. Then, for each physics body in your scene, set the SKPhysicsBody.CategoryBitMask and SKPhysicsBody.ContactTestBitMask properties to define which interactions should generate contact messages.
Inspecting the Contact Properties ¶
- SKPhysicsContact.BodyA: The first body in the contact.
- SKPhysicsContact.BodyB: The second body in the contact.
- SKPhysicsContact.ContactPoint: The contact point between the two physics bodies, in scene coordinates.
- SKPhysicsContact.CollisionImpulse: The impulse that specifies how hard these two bodies struck each other in Newton-seconds.
- SKPhysicsContact.ContactNormal: The normal vector specifying the direction of the collision.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsContact
func NewSKPhysicsContact ¶
func NewSKPhysicsContact() SKPhysicsContact
NewSKPhysicsContact creates a new SKPhysicsContact instance.
func SKPhysicsContactFromID ¶
func SKPhysicsContactFromID(id objc.ID) SKPhysicsContact
SKPhysicsContactFromID constructs a SKPhysicsContact from an objc.ID.
A description of the contact between two physics bodies.
func (SKPhysicsContact) Autorelease ¶
func (p SKPhysicsContact) Autorelease() SKPhysicsContact
Autorelease adds the receiver to the current autorelease pool.
func (SKPhysicsContact) BodyA ¶
func (p SKPhysicsContact) BodyA() ISKPhysicsBody
The first body in the contact.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsContact/bodyA
func (SKPhysicsContact) BodyB ¶
func (p SKPhysicsContact) BodyB() ISKPhysicsBody
The second body in the contact.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsContact/bodyB
func (SKPhysicsContact) CollisionImpulse ¶
func (p SKPhysicsContact) CollisionImpulse() float64
The impulse that specifies how hard these two bodies struck each other in Newton-seconds.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsContact/collisionImpulse
func (SKPhysicsContact) ContactNormal ¶
func (p SKPhysicsContact) ContactNormal() corefoundation.CGVector
The normal vector specifying the direction of the collision.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsContact/contactNormal
func (SKPhysicsContact) ContactPoint ¶
func (p SKPhysicsContact) ContactPoint() corefoundation.CGPoint
The contact point between the two physics bodies, in scene coordinates.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsContact/contactPoint
func (SKPhysicsContact) Init ¶
func (p SKPhysicsContact) Init() SKPhysicsContact
Init initializes the instance.
type SKPhysicsContactClass ¶
type SKPhysicsContactClass struct {
// contains filtered or unexported fields
}
func GetSKPhysicsContactClass ¶
func GetSKPhysicsContactClass() SKPhysicsContactClass
GetSKPhysicsContactClass returns the class object for SKPhysicsContact.
func (SKPhysicsContactClass) Alloc ¶
func (sc SKPhysicsContactClass) Alloc() SKPhysicsContact
Alloc allocates memory for a new instance of the class.
func (SKPhysicsContactClass) Class ¶
func (sc SKPhysicsContactClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKPhysicsContactDelegate ¶
type SKPhysicsContactDelegate interface {
objectivec.IObject
}
Methods your app can implement to respond when physics bodies come into contact.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsContactDelegate
type SKPhysicsContactDelegateConfig ¶
type SKPhysicsContactDelegateConfig struct {
// Other Methods
// DidBeginContact — Called when two bodies first contact each other.
DidBeginContact func(contact SKPhysicsContact)
// DidEndContact — Called when the contact ends between two physics bodies.
DidEndContact func(contact SKPhysicsContact)
}
SKPhysicsContactDelegateConfig holds optional typed callbacks for SKPhysicsContactDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.
See Apple Documentation for protocol details.
type SKPhysicsContactDelegateObject ¶
type SKPhysicsContactDelegateObject struct {
objectivec.Object
}
SKPhysicsContactDelegateObject wraps an existing Objective-C object that conforms to the SKPhysicsContactDelegate protocol.
func NewSKPhysicsContactDelegate ¶
func NewSKPhysicsContactDelegate(config SKPhysicsContactDelegateConfig) SKPhysicsContactDelegateObject
NewSKPhysicsContactDelegate creates an Objective-C object implementing the SKPhysicsContactDelegate protocol.
Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.
The returned SKPhysicsContactDelegateObject satisfies the SKPhysicsContactDelegate interface and can be passed directly to SetDelegate and similar methods.
See Apple Documentation for protocol details.
func SKPhysicsContactDelegateObjectFromID ¶
func SKPhysicsContactDelegateObjectFromID(id objc.ID) SKPhysicsContactDelegateObject
SKPhysicsContactDelegateObjectFromID constructs a SKPhysicsContactDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func (SKPhysicsContactDelegateObject) BaseObject ¶
func (o SKPhysicsContactDelegateObject) BaseObject() objectivec.Object
func (SKPhysicsContactDelegateObject) DidBeginContact ¶
func (o SKPhysicsContactDelegateObject) DidBeginContact(contact ISKPhysicsContact)
Called when two bodies first contact each other.
contact: An object that describes the contact.
Discussion ¶
The two physics bodies described in the contact parameter are not passed in a guaranteed order. The following code shows how you might respond to the beginning of a contact event to execute code if either physics body is owned by a node with the name `ground`.
Listing 1. Responding to a contact event.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsContactDelegate/didBegin(_:)
func (SKPhysicsContactDelegateObject) DidEndContact ¶
func (o SKPhysicsContactDelegateObject) DidEndContact(contact ISKPhysicsContact)
Called when the contact ends between two physics bodies.
contact: An object that describes the contact.
Discussion ¶
The two physics bodies described in the contact parameter are not passed in a guaranteed order. The following code shows how you might respond to the end of a contact event to execute code if either physics body is owned by a node with the name `ground`.
Listing 1. Responding to a contact event
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsContactDelegate/didEnd(_:)
type SKPhysicsJoint ¶
type SKPhysicsJoint struct {
objectivec.Object
}
The abstract superclass for objects that connect physics bodies.
Overview ¶
An SKPhysicsJoint object connects two physics bodies so that they are simulated together by the physics world. You never instantiate objects of this class directly; instead, you instantiate one of the subclasses that defines the kind of joint you want to make.
Accessing or Setting a Joint’s Bodies ¶
- SKPhysicsJoint.BodyA: The first body connected by the joint.
- SKPhysicsJoint.SetBodyA
- SKPhysicsJoint.BodyB: The second body connected by the joint.
- SKPhysicsJoint.SetBodyB
Reading the Stress and Speed that Are Currently Applied to a Joint ¶
- SKPhysicsJoint.ReactionForce: The instantaneous reaction force, in newtons, currently being directed at the anchor point.
- SKPhysicsJoint.ReactionTorque: Instantaneous reaction torque, in newton-meters, currently being directed at the anchor point.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJoint
func NewSKPhysicsJoint ¶
func NewSKPhysicsJoint() SKPhysicsJoint
NewSKPhysicsJoint creates a new SKPhysicsJoint instance.
func SKPhysicsJointFromID ¶
func SKPhysicsJointFromID(id objc.ID) SKPhysicsJoint
SKPhysicsJointFromID constructs a SKPhysicsJoint from an objc.ID.
The abstract superclass for objects that connect physics bodies.
func (SKPhysicsJoint) Autorelease ¶
func (p SKPhysicsJoint) Autorelease() SKPhysicsJoint
Autorelease adds the receiver to the current autorelease pool.
func (SKPhysicsJoint) BodyA ¶
func (p SKPhysicsJoint) BodyA() ISKPhysicsBody
The first body connected by the joint.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJoint/bodyA
func (SKPhysicsJoint) BodyB ¶
func (p SKPhysicsJoint) BodyB() ISKPhysicsBody
The second body connected by the joint.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJoint/bodyB
func (SKPhysicsJoint) EncodeWithCoder ¶
func (p SKPhysicsJoint) EncodeWithCoder(coder foundation.INSCoder)
func (SKPhysicsJoint) Init ¶
func (p SKPhysicsJoint) Init() SKPhysicsJoint
Init initializes the instance.
func (SKPhysicsJoint) ReactionForce ¶
func (p SKPhysicsJoint) ReactionForce() corefoundation.CGVector
The instantaneous reaction force, in newtons, currently being directed at the anchor point.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJoint/reactionForce
func (SKPhysicsJoint) ReactionTorque ¶
func (p SKPhysicsJoint) ReactionTorque() float64
Instantaneous reaction torque, in newton-meters, currently being directed at the anchor point.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJoint/reactionTorque
func (SKPhysicsJoint) SetBodyA ¶
func (p SKPhysicsJoint) SetBodyA(value ISKPhysicsBody)
func (SKPhysicsJoint) SetBodyB ¶
func (p SKPhysicsJoint) SetBodyB(value ISKPhysicsBody)
type SKPhysicsJointClass ¶
type SKPhysicsJointClass struct {
// contains filtered or unexported fields
}
func GetSKPhysicsJointClass ¶
func GetSKPhysicsJointClass() SKPhysicsJointClass
GetSKPhysicsJointClass returns the class object for SKPhysicsJoint.
func (SKPhysicsJointClass) Alloc ¶
func (sc SKPhysicsJointClass) Alloc() SKPhysicsJoint
Alloc allocates memory for a new instance of the class.
func (SKPhysicsJointClass) Class ¶
func (sc SKPhysicsJointClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKPhysicsJointFixed ¶
type SKPhysicsJointFixed struct {
SKPhysicsJoint
}
A joint that fuses two physics bodies together at a reference point.
Overview ¶
An SKPhysicsJointFixed object fuses two physics bodies together at a reference point. Fixed joints are useful for creating complex shapes that can be broken apart later.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointFixed
func NewSKPhysicsJointFixed ¶
func NewSKPhysicsJointFixed() SKPhysicsJointFixed
NewSKPhysicsJointFixed creates a new SKPhysicsJointFixed instance.
func SKPhysicsJointFixedFromID ¶
func SKPhysicsJointFixedFromID(id objc.ID) SKPhysicsJointFixed
SKPhysicsJointFixedFromID constructs a SKPhysicsJointFixed from an objc.ID.
A joint that fuses two physics bodies together at a reference point.
func (SKPhysicsJointFixed) Autorelease ¶
func (p SKPhysicsJointFixed) Autorelease() SKPhysicsJointFixed
Autorelease adds the receiver to the current autorelease pool.
func (SKPhysicsJointFixed) Init ¶
func (p SKPhysicsJointFixed) Init() SKPhysicsJointFixed
Init initializes the instance.
type SKPhysicsJointFixedClass ¶
type SKPhysicsJointFixedClass struct {
// contains filtered or unexported fields
}
func GetSKPhysicsJointFixedClass ¶
func GetSKPhysicsJointFixedClass() SKPhysicsJointFixedClass
GetSKPhysicsJointFixedClass returns the class object for SKPhysicsJointFixed.
func (SKPhysicsJointFixedClass) Alloc ¶
func (sc SKPhysicsJointFixedClass) Alloc() SKPhysicsJointFixed
Alloc allocates memory for a new instance of the class.
func (SKPhysicsJointFixedClass) Class ¶
func (sc SKPhysicsJointFixedClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKPhysicsJointFixedClass) JointWithBodyABodyBAnchor ¶
func (_SKPhysicsJointFixedClass SKPhysicsJointFixedClass) JointWithBodyABodyBAnchor(bodyA ISKPhysicsBody, bodyB ISKPhysicsBody, anchor corefoundation.CGPoint) SKPhysicsJointFixed
Creates a new fixed joint.
bodyA: The first body to connect. The body must be connected to a node that is already part of the scene’s node tree.
bodyB: The second body to connect. The body must be connected to a node that is already part of the scene’s node tree.
anchor: The anchor point for the connection in the scene’s coordinate system.
Return Value ¶
A new fixed joint.
Discussion ¶
You must add the joint to a physics world associated with the scene before it takes effect.
type SKPhysicsJointLimit ¶
type SKPhysicsJointLimit struct {
SKPhysicsJoint
}
A joint that imposes a maximum distance between two physics bodies, as if they were connected by a rope.
Configuring a Limit Joint ¶
- SKPhysicsJointLimit.MaxLength: The maximum distance allowed between the two physics bodies connected by the limit joint.
- SKPhysicsJointLimit.SetMaxLength
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointLimit
func NewSKPhysicsJointLimit ¶
func NewSKPhysicsJointLimit() SKPhysicsJointLimit
NewSKPhysicsJointLimit creates a new SKPhysicsJointLimit instance.
func SKPhysicsJointLimitFromID ¶
func SKPhysicsJointLimitFromID(id objc.ID) SKPhysicsJointLimit
SKPhysicsJointLimitFromID constructs a SKPhysicsJointLimit from an objc.ID.
A joint that imposes a maximum distance between two physics bodies, as if they were connected by a rope.
func (SKPhysicsJointLimit) Autorelease ¶
func (p SKPhysicsJointLimit) Autorelease() SKPhysicsJointLimit
Autorelease adds the receiver to the current autorelease pool.
func (SKPhysicsJointLimit) Init ¶
func (p SKPhysicsJointLimit) Init() SKPhysicsJointLimit
Init initializes the instance.
func (SKPhysicsJointLimit) MaxLength ¶
func (p SKPhysicsJointLimit) MaxLength() float64
The maximum distance allowed between the two physics bodies connected by the limit joint.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointLimit/maxLength
func (SKPhysicsJointLimit) SetMaxLength ¶
func (p SKPhysicsJointLimit) SetMaxLength(value float64)
type SKPhysicsJointLimitClass ¶
type SKPhysicsJointLimitClass struct {
// contains filtered or unexported fields
}
func GetSKPhysicsJointLimitClass ¶
func GetSKPhysicsJointLimitClass() SKPhysicsJointLimitClass
GetSKPhysicsJointLimitClass returns the class object for SKPhysicsJointLimit.
func (SKPhysicsJointLimitClass) Alloc ¶
func (sc SKPhysicsJointLimitClass) Alloc() SKPhysicsJointLimit
Alloc allocates memory for a new instance of the class.
func (SKPhysicsJointLimitClass) Class ¶
func (sc SKPhysicsJointLimitClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKPhysicsJointLimitClass) JointWithBodyABodyBAnchorAAnchorB ¶
func (_SKPhysicsJointLimitClass SKPhysicsJointLimitClass) JointWithBodyABodyBAnchorAAnchorB(bodyA ISKPhysicsBody, bodyB ISKPhysicsBody, anchorA corefoundation.CGPoint, anchorB corefoundation.CGPoint) SKPhysicsJointLimit
Creates a new limit joint.
bodyA: The first body to connect. The body must be connected to a node that is already part of the scene’s node tree.
bodyB: The second body to connect. The body must be connected to a node that is already part of the scene’s node tree.
anchorA: A connection point on the first body in the scene’s coordinate system.
anchorB: A connection point on the second body in the scene’s coordinate system.
Return Value ¶
A new limit joint.
Discussion ¶
You must add the joint to a physics world associated with the scene before it takes effect.
type SKPhysicsJointPin ¶
type SKPhysicsJointPin struct {
SKPhysicsJoint
}
A joint that pins together two physics bodies, allowing independent rotation.
Overview ¶
An SKPhysicsJointPin object allows two physics bodies to independently rotate around the anchor point as if pinned together. You can configure how far the two objects may rotate and the resistance to rotation.
Configuring a Pin Joint ¶
- SKPhysicsJointPin.RotationSpeed: The speed, in radians per second, at which the physics bodies are driven around the pin joint.
- SKPhysicsJointPin.SetRotationSpeed
- SKPhysicsJointPin.ShouldEnableLimits: A Boolean value that indicates whether the pin joint’s rotation is limited to a specific range of values.
- SKPhysicsJointPin.SetShouldEnableLimits
- SKPhysicsJointPin.LowerAngleLimit: The smallest angle allowed for the pin joint, in radians.
- SKPhysicsJointPin.SetLowerAngleLimit
- SKPhysicsJointPin.UpperAngleLimit: The largest angle allowed for the pin joint, in radians.
- SKPhysicsJointPin.SetUpperAngleLimit
- SKPhysicsJointPin.FrictionTorque: The resistance applied by the pin joint to spinning around the anchor point.
- SKPhysicsJointPin.SetFrictionTorque
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointPin
func NewSKPhysicsJointPin ¶
func NewSKPhysicsJointPin() SKPhysicsJointPin
NewSKPhysicsJointPin creates a new SKPhysicsJointPin instance.
func SKPhysicsJointPinFromID ¶
func SKPhysicsJointPinFromID(id objc.ID) SKPhysicsJointPin
SKPhysicsJointPinFromID constructs a SKPhysicsJointPin from an objc.ID.
A joint that pins together two physics bodies, allowing independent rotation.
func (SKPhysicsJointPin) Autorelease ¶
func (p SKPhysicsJointPin) Autorelease() SKPhysicsJointPin
Autorelease adds the receiver to the current autorelease pool.
func (SKPhysicsJointPin) FrictionTorque ¶
func (p SKPhysicsJointPin) FrictionTorque() float64
The resistance applied by the pin joint to spinning around the anchor point.
Discussion ¶
The range of values is from `0.0` to `1.0`. The default value is `0.0`. If a value greater than the default is specified, friction is applied to reduce the object’s angular velocity around the pin.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointPin/frictionTorque
func (SKPhysicsJointPin) Init ¶
func (p SKPhysicsJointPin) Init() SKPhysicsJointPin
Init initializes the instance.
func (SKPhysicsJointPin) LowerAngleLimit ¶
func (p SKPhysicsJointPin) LowerAngleLimit() float64
The smallest angle allowed for the pin joint, in radians.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointPin/lowerAngleLimit
func (SKPhysicsJointPin) RotationSpeed ¶
func (p SKPhysicsJointPin) RotationSpeed() float64
The speed, in radians per second, at which the physics bodies are driven around the pin joint.
Discussion ¶
The SKPhysicsJointPin.FrictionTorque property limits the maximum amount of torque that can be applied to the physics bodies.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointPin/rotationSpeed
func (SKPhysicsJointPin) SetFrictionTorque ¶
func (p SKPhysicsJointPin) SetFrictionTorque(value float64)
func (SKPhysicsJointPin) SetLowerAngleLimit ¶
func (p SKPhysicsJointPin) SetLowerAngleLimit(value float64)
func (SKPhysicsJointPin) SetRotationSpeed ¶
func (p SKPhysicsJointPin) SetRotationSpeed(value float64)
func (SKPhysicsJointPin) SetShouldEnableLimits ¶
func (p SKPhysicsJointPin) SetShouldEnableLimits(value bool)
func (SKPhysicsJointPin) SetUpperAngleLimit ¶
func (p SKPhysicsJointPin) SetUpperAngleLimit(value float64)
func (SKPhysicsJointPin) ShouldEnableLimits ¶
func (p SKPhysicsJointPin) ShouldEnableLimits() bool
A Boolean value that indicates whether the pin joint’s rotation is limited to a specific range of values.
Discussion ¶
The default value is false. If true, the SKPhysicsJointPin.LowerAngleLimit and SKPhysicsJointPin.UpperAngleLimit properties are used to limit the angle of the pin joint.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointPin/shouldEnableLimits
func (SKPhysicsJointPin) UpperAngleLimit ¶
func (p SKPhysicsJointPin) UpperAngleLimit() float64
The largest angle allowed for the pin joint, in radians.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointPin/upperAngleLimit
type SKPhysicsJointPinClass ¶
type SKPhysicsJointPinClass struct {
// contains filtered or unexported fields
}
func GetSKPhysicsJointPinClass ¶
func GetSKPhysicsJointPinClass() SKPhysicsJointPinClass
GetSKPhysicsJointPinClass returns the class object for SKPhysicsJointPin.
func (SKPhysicsJointPinClass) Alloc ¶
func (sc SKPhysicsJointPinClass) Alloc() SKPhysicsJointPin
Alloc allocates memory for a new instance of the class.
func (SKPhysicsJointPinClass) Class ¶
func (sc SKPhysicsJointPinClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKPhysicsJointPinClass) JointWithBodyABodyBAnchor ¶
func (_SKPhysicsJointPinClass SKPhysicsJointPinClass) JointWithBodyABodyBAnchor(bodyA ISKPhysicsBody, bodyB ISKPhysicsBody, anchor corefoundation.CGPoint) SKPhysicsJointPin
Creates a new pin joint.
bodyA: The first body to connect. The body must be connected to a node that is already part of the scene’s node tree.
bodyB: The second body to connect. The body must be connected to a node that is already part of the scene’s node tree.
anchor: The connection point between the two bodies in the scene’s coordinate system.
Return Value ¶
A new pin joint.
Discussion ¶
You must add the joint to a physics world associated with the scene before it takes effect.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointPin/joint(withBodyA:bodyB:anchor:)
type SKPhysicsJointSliding ¶
type SKPhysicsJointSliding struct {
SKPhysicsJoint
}
A joint that allows two physics bodies to slide along an axis.
Overview ¶
An SKPhysicsJointSliding object allows the anchor points of the two physics bodies to slide along a chosen axis. The joint can be configured to limit the distance that the two objects are allowed to slide along the axis.
Configuring a Sliding Joint ¶
- SKPhysicsJointSliding.ShouldEnableLimits: A Boolean value that indicates whether the sliding joint is restricted so that the objects may only slide a finite distance from the initial anchor point.
- SKPhysicsJointSliding.SetShouldEnableLimits
- SKPhysicsJointSliding.LowerDistanceLimit: The smallest distance allowed for the sliding joint.
- SKPhysicsJointSliding.SetLowerDistanceLimit
- SKPhysicsJointSliding.UpperDistanceLimit: The largest distance allowed for the sliding joint.
- SKPhysicsJointSliding.SetUpperDistanceLimit
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointSliding
func NewSKPhysicsJointSliding ¶
func NewSKPhysicsJointSliding() SKPhysicsJointSliding
NewSKPhysicsJointSliding creates a new SKPhysicsJointSliding instance.
func SKPhysicsJointSlidingFromID ¶
func SKPhysicsJointSlidingFromID(id objc.ID) SKPhysicsJointSliding
SKPhysicsJointSlidingFromID constructs a SKPhysicsJointSliding from an objc.ID.
A joint that allows two physics bodies to slide along an axis.
func (SKPhysicsJointSliding) Autorelease ¶
func (p SKPhysicsJointSliding) Autorelease() SKPhysicsJointSliding
Autorelease adds the receiver to the current autorelease pool.
func (SKPhysicsJointSliding) Init ¶
func (p SKPhysicsJointSliding) Init() SKPhysicsJointSliding
Init initializes the instance.
func (SKPhysicsJointSliding) LowerDistanceLimit ¶
func (p SKPhysicsJointSliding) LowerDistanceLimit() float64
The smallest distance allowed for the sliding joint.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointSliding/lowerDistanceLimit
func (SKPhysicsJointSliding) SetLowerDistanceLimit ¶
func (p SKPhysicsJointSliding) SetLowerDistanceLimit(value float64)
func (SKPhysicsJointSliding) SetShouldEnableLimits ¶
func (p SKPhysicsJointSliding) SetShouldEnableLimits(value bool)
func (SKPhysicsJointSliding) SetUpperDistanceLimit ¶
func (p SKPhysicsJointSliding) SetUpperDistanceLimit(value float64)
func (SKPhysicsJointSliding) ShouldEnableLimits ¶
func (p SKPhysicsJointSliding) ShouldEnableLimits() bool
A Boolean value that indicates whether the sliding joint is restricted so that the objects may only slide a finite distance from the initial anchor point.
Discussion ¶
The default value is false. If true, then the SKPhysicsJointSliding.LowerDistanceLimit and SKPhysicsJointSliding.UpperDistanceLimit properties are used to limit the distance of the sliding joint.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointSliding/shouldEnableLimits
func (SKPhysicsJointSliding) UpperDistanceLimit ¶
func (p SKPhysicsJointSliding) UpperDistanceLimit() float64
The largest distance allowed for the sliding joint.
Discussion ¶
The default value is `0.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointSliding/upperDistanceLimit
type SKPhysicsJointSlidingClass ¶
type SKPhysicsJointSlidingClass struct {
// contains filtered or unexported fields
}
func GetSKPhysicsJointSlidingClass ¶
func GetSKPhysicsJointSlidingClass() SKPhysicsJointSlidingClass
GetSKPhysicsJointSlidingClass returns the class object for SKPhysicsJointSliding.
func (SKPhysicsJointSlidingClass) Alloc ¶
func (sc SKPhysicsJointSlidingClass) Alloc() SKPhysicsJointSliding
Alloc allocates memory for a new instance of the class.
func (SKPhysicsJointSlidingClass) Class ¶
func (sc SKPhysicsJointSlidingClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKPhysicsJointSlidingClass) JointWithBodyABodyBAnchorAxis ¶
func (_SKPhysicsJointSlidingClass SKPhysicsJointSlidingClass) JointWithBodyABodyBAnchorAxis(bodyA ISKPhysicsBody, bodyB ISKPhysicsBody, anchor corefoundation.CGPoint, axis corefoundation.CGVector) SKPhysicsJointSliding
Creates a new sliding joint.
bodyA: The first body to connect. The body must be connected to a node that is already part of the scene’s node tree.
bodyB: The second body to connect. The body must be connected to a node that is already part of the scene’s node tree.
anchor: The anchor point for the connection in the scene’s coordinate system.
axis: A vector that defines the direction that the joint is allowed to slide.
Return Value ¶
A new sliding joint.
Discussion ¶
You must add the joint to a physics world associated with the scene before it takes effect.
type SKPhysicsJointSpring ¶
type SKPhysicsJointSpring struct {
SKPhysicsJoint
}
A joint that simulates a spring connecting two physics bodies.
Overview ¶
An SKPhysicsJointSpring object simulates connecting two physics bodies together with a spring. The farther the two objects move from each other, the more force is applied to bring the two bodies back together.
Configuring a Spring Joint ¶
- SKPhysicsJointSpring.Damping: Defines how the spring’s motion should be damped due to the forces of friction.
- SKPhysicsJointSpring.SetDamping
- SKPhysicsJointSpring.Frequency: Defines the frequency or stiffness characteristics of the spring.
- SKPhysicsJointSpring.SetFrequency
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointSpring
func NewSKPhysicsJointSpring ¶
func NewSKPhysicsJointSpring() SKPhysicsJointSpring
NewSKPhysicsJointSpring creates a new SKPhysicsJointSpring instance.
func SKPhysicsJointSpringFromID ¶
func SKPhysicsJointSpringFromID(id objc.ID) SKPhysicsJointSpring
SKPhysicsJointSpringFromID constructs a SKPhysicsJointSpring from an objc.ID.
A joint that simulates a spring connecting two physics bodies.
func (SKPhysicsJointSpring) Autorelease ¶
func (p SKPhysicsJointSpring) Autorelease() SKPhysicsJointSpring
Autorelease adds the receiver to the current autorelease pool.
func (SKPhysicsJointSpring) Damping ¶
func (p SKPhysicsJointSpring) Damping() float64
Defines how the spring’s motion should be damped due to the forces of friction.
Discussion ¶
The default value is `0.0`. Increasing the value increases the energy loss with each oscillation: there will be fewer and smaller oscillations and time taken for the spring to settle will decrease.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointSpring/damping
func (SKPhysicsJointSpring) Frequency ¶
func (p SKPhysicsJointSpring) Frequency() float64
Defines the frequency or stiffness characteristics of the spring.
Discussion ¶
The default value is `0.0`, creating a rigid joint between the spring’s two bodies. Setting the frequency to a low value, for example `0.5`, creates a spring with slow oscillations that will settle slowly. Setting the frequency to a high value, for example `10.0`, creates a stiffer spring with faster and fewer oscillations.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsJointSpring/frequency
func (SKPhysicsJointSpring) Init ¶
func (p SKPhysicsJointSpring) Init() SKPhysicsJointSpring
Init initializes the instance.
func (SKPhysicsJointSpring) SetDamping ¶
func (p SKPhysicsJointSpring) SetDamping(value float64)
func (SKPhysicsJointSpring) SetFrequency ¶
func (p SKPhysicsJointSpring) SetFrequency(value float64)
type SKPhysicsJointSpringClass ¶
type SKPhysicsJointSpringClass struct {
// contains filtered or unexported fields
}
func GetSKPhysicsJointSpringClass ¶
func GetSKPhysicsJointSpringClass() SKPhysicsJointSpringClass
GetSKPhysicsJointSpringClass returns the class object for SKPhysicsJointSpring.
func (SKPhysicsJointSpringClass) Alloc ¶
func (sc SKPhysicsJointSpringClass) Alloc() SKPhysicsJointSpring
Alloc allocates memory for a new instance of the class.
func (SKPhysicsJointSpringClass) Class ¶
func (sc SKPhysicsJointSpringClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKPhysicsJointSpringClass) JointWithBodyABodyBAnchorAAnchorB ¶
func (_SKPhysicsJointSpringClass SKPhysicsJointSpringClass) JointWithBodyABodyBAnchorAAnchorB(bodyA ISKPhysicsBody, bodyB ISKPhysicsBody, anchorA corefoundation.CGPoint, anchorB corefoundation.CGPoint) SKPhysicsJointSpring
Creates a new spring joint.
bodyA: The first body to connect. The body must be connected to a node that is already part of the scene’s node tree.
bodyB: The second body to connect. The body must be connected to a node that is already part of the scene’s node tree.
anchorA: The connection point on the first body in the scene’s coordinate system.
anchorB: The connection point on the second body in the scene’s coordinate system.
Return Value ¶
A new spring joint.
Discussion ¶
You must add the joint to a physics world associated with the scene before it takes effect.
type SKPhysicsWorld ¶
type SKPhysicsWorld struct {
objectivec.Object
}
The driver of the physics engine in a scene; it exposes the ability for you to configure and query the physics system.
Overview ¶
SKPhysicsWorld runs the physics engine of a scene and is the place that contact detection occurs. Do not create a SKPhysicsWorld directly; the system creates a physics world and adds it to the scene’s SKScene.PhysicsWorld property.
The physics world allows you to:
- Set important properties like SKPhysicsWorld.Gravity - Join two physics bodies using an SKPhysicsJoint - Respond to collision between two physics bodies using SKPhysicsWorld.ContactDelegate - Do custom collisions detection or hit testing
Configuring the Physics World ¶
- SKPhysicsWorld.Gravity: A vector that specifies the gravitational acceleration applied to physics bodies in the physics world.
- SKPhysicsWorld.SetGravity
- SKPhysicsWorld.Speed: The rate at which the simulation executes.
- SKPhysicsWorld.SetSpeed
Joining Physics Bodies with Joints ¶
- SKPhysicsWorld.AddJoint: Adds a joint to the physics world.
- SKPhysicsWorld.RemoveAllJoints: Removes all joints from the physics world.
- SKPhysicsWorld.RemoveJoint: Removes a specific joint from the physics world.
Detecting Collisions ¶
- SKPhysicsWorld.ContactDelegate: A delegate that is called when two physics bodies come in contact with each other.
- SKPhysicsWorld.SetContactDelegate
Searching the Scene for Physics Bodies ¶
- SKPhysicsWorld.BodyAlongRayStartEnd: Searches for the first physics body that intersects a ray.
- SKPhysicsWorld.BodyAtPoint: Searches for the first physics body that contains a point.
- SKPhysicsWorld.BodyInRect: Searches for the first physics body that intersects the specified rectangle.
- SKPhysicsWorld.EnumerateBodiesAlongRayStartEndUsingBlock: Enumerates all the physics bodies in the scene that intersect a ray.
- SKPhysicsWorld.EnumerateBodiesAtPointUsingBlock: Enumerates all the physics bodies in the scene that contain a point.
- SKPhysicsWorld.EnumerateBodiesInRectUsingBlock: Enumerates all the physics bodies in the scene that intersect the specified rectangle.
Sampling Physics Fields ¶
- SKPhysicsWorld.SampleFieldsAt: Samples all of the field nodes in the scene and returns the summation of their forces at that point.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld
func NewSKPhysicsWorld ¶
func NewSKPhysicsWorld() SKPhysicsWorld
NewSKPhysicsWorld creates a new SKPhysicsWorld instance.
func SKPhysicsWorldFromID ¶
func SKPhysicsWorldFromID(id objc.ID) SKPhysicsWorld
SKPhysicsWorldFromID constructs a SKPhysicsWorld from an objc.ID.
The driver of the physics engine in a scene; it exposes the ability for you to configure and query the physics system.
func (SKPhysicsWorld) AddJoint ¶
func (p SKPhysicsWorld) AddJoint(joint ISKPhysicsJoint)
Adds a joint to the physics world.
joint: The joint to add.
Discussion ¶
For a joint to take effect, it must be added to the physics world.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/add(_:)
func (SKPhysicsWorld) Autorelease ¶
func (p SKPhysicsWorld) Autorelease() SKPhysicsWorld
Autorelease adds the receiver to the current autorelease pool.
func (SKPhysicsWorld) BodyAlongRayStartEnd ¶
func (p SKPhysicsWorld) BodyAlongRayStartEnd(start corefoundation.CGPoint, end corefoundation.CGPoint) ISKPhysicsBody
Searches for the first physics body that intersects a ray.
start: The starting point for the ray in scene coordinates.
end: The ending point for the ray in scene coordinates.
Return Value ¶
The first physics body discovered that intersects the ray. This may be any body along the ray; it is not guaranteed to be the closest physics body. If no body intersects the ray, this method returns `nil`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/body(alongRayStart:end:)
func (SKPhysicsWorld) BodyAtPoint ¶
func (p SKPhysicsWorld) BodyAtPoint(point corefoundation.CGPoint) ISKPhysicsBody
Searches for the first physics body that contains a point.
point: A point in scene coordinates.
Return Value ¶
The first physics body discovered that contains the point. If no body contains the point, this method returns `nil`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/body(at:)
func (SKPhysicsWorld) BodyInRect ¶
func (p SKPhysicsWorld) BodyInRect(rect corefoundation.CGRect) ISKPhysicsBody
Searches for the first physics body that intersects the specified rectangle.
rect: A rectangle in scene coordinates.
Return Value ¶
The first physics body discovered that intersects the rectangle. If no body intersects the rectangle, this method returns `nil`.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/body(in:)
func (SKPhysicsWorld) ContactDelegate ¶
func (p SKPhysicsWorld) ContactDelegate() SKPhysicsContactDelegate
A delegate that is called when two physics bodies come in contact with each other.
Discussion ¶
A contact is created when two physics bodies overlap and one of the physics bodies has a SKPhysicsBody.ContactTestBitMask property that overlaps with the other body’s SKPhysicsBody.CategoryBitMask property. By default, a physics body’s SKPhysicsBody.ContactTestBitMask is set to all bits cleared.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/contactDelegate
func (SKPhysicsWorld) EncodeWithCoder ¶
func (p SKPhysicsWorld) EncodeWithCoder(coder foundation.INSCoder)
func (SKPhysicsWorld) EnumerateBodiesAlongRayStartEndUsingBlock ¶
func (p SKPhysicsWorld) EnumerateBodiesAlongRayStartEndUsingBlock(start corefoundation.CGPoint, end corefoundation.CGPoint, block SKPhysicsBodyCGPointCGVectorBoolHandler)
Enumerates all the physics bodies in the scene that intersect a ray.
start: The starting point for the ray in scene coordinates.
end: The ending point for the ray in scene coordinates.
block: A block to be called for each physics body that the ray touches. The block takes the following parameters:
body: The physics body that the ray intersected. point: The point in scene coordinates where the ray contacted the physics body. normal: The normal vector for the physics body at the point of contact. stop: A pointer to a Boolean variable. Your block can set this to true to terminate the enumeration.
func (SKPhysicsWorld) EnumerateBodiesAtPointUsingBlock ¶
func (p SKPhysicsWorld) EnumerateBodiesAtPointUsingBlock(point corefoundation.CGPoint, block SKPhysicsBodyBoolHandler)
Enumerates all the physics bodies in the scene that contain a point.
point: A point in scene coordinates.
block: A block to be called for each physics body that contains the point. The block takes the following parameters:
body: The physics body that the ray intersected. stop: A pointer to a Boolean variable. Your block can set this to true to terminate the enumeration.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/enumerateBodies(at:using:)
func (SKPhysicsWorld) EnumerateBodiesInRectUsingBlock ¶
func (p SKPhysicsWorld) EnumerateBodiesInRectUsingBlock(rect corefoundation.CGRect, block SKPhysicsBodyBoolHandler)
Enumerates all the physics bodies in the scene that intersect the specified rectangle.
rect: A rectangle in scene coordinates.
block: A block to be called for each physics body that contains the point. The block takes the following parameters:
body: The physics body that intersected the rectangle. stop: A pointer to a Boolean variable. Your block can set this to true to terminate the enumeration.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/enumerateBodies(in:using:)
func (SKPhysicsWorld) Gravity ¶
func (p SKPhysicsWorld) Gravity() corefoundation.CGVector
A vector that specifies the gravitational acceleration applied to physics bodies in the physics world.
Discussion ¶
The components of this property are measured in meters per second. The default value is `(0.0,-9.8)`, which represent’s Earth’s gravity.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/gravity
func (SKPhysicsWorld) Init ¶
func (p SKPhysicsWorld) Init() SKPhysicsWorld
Init initializes the instance.
func (SKPhysicsWorld) RemoveAllJoints ¶
func (p SKPhysicsWorld) RemoveAllJoints()
Removes all joints from the physics world.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/removeAllJoints()
func (SKPhysicsWorld) RemoveJoint ¶
func (p SKPhysicsWorld) RemoveJoint(joint ISKPhysicsJoint)
Removes a specific joint from the physics world.
joint: The joint to remove.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/remove(_:)
func (SKPhysicsWorld) SampleFieldsAt ¶
func (p SKPhysicsWorld) SampleFieldsAt(position Vector_float3) Vector_float3
Samples all of the field nodes in the scene and returns the summation of their forces at that point.
position: A position in scene coordinates.
Return Value ¶
The summation of forces exerted on that point.
Discussion ¶
The sample is calculated as if a physics body is placed at that position in the scene. The body is assumed to have a mass of `1.0`, with no charge or velocity. The body is affected by all field nodes.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/sampleFields(at:)
func (SKPhysicsWorld) SetContactDelegate ¶
func (p SKPhysicsWorld) SetContactDelegate(value SKPhysicsContactDelegate)
func (SKPhysicsWorld) SetGravity ¶
func (p SKPhysicsWorld) SetGravity(value corefoundation.CGVector)
func (SKPhysicsWorld) SetSpeed ¶
func (p SKPhysicsWorld) SetSpeed(value float64)
func (SKPhysicsWorld) Speed ¶
func (p SKPhysicsWorld) Speed() float64
The rate at which the simulation executes.
Discussion ¶
The default value is `1.0`, which means the simulation runs at normal speed. A value other than the default changes the rate at which time passes in the physics simulation. For example, a speed value of `2.0` indicates that time in the physics simulation passes twice as fast as the scene’s simulation time. A value of `0.0` pauses the physics simulation.
See: https://developer.apple.com/documentation/SpriteKit/SKPhysicsWorld/speed
type SKPhysicsWorldClass ¶
type SKPhysicsWorldClass struct {
// contains filtered or unexported fields
}
func GetSKPhysicsWorldClass ¶
func GetSKPhysicsWorldClass() SKPhysicsWorldClass
GetSKPhysicsWorldClass returns the class object for SKPhysicsWorld.
func (SKPhysicsWorldClass) Alloc ¶
func (sc SKPhysicsWorldClass) Alloc() SKPhysicsWorld
Alloc allocates memory for a new instance of the class.
func (SKPhysicsWorldClass) Class ¶
func (sc SKPhysicsWorldClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKRange ¶
type SKRange struct {
objectivec.Object
}
A definition of a range of floating-point values.
Overview ¶
You typically use a SKRange to clamp a value so that it is within the specified range.
Creating a Range Object ¶
- SKRange.InitWithLowerLimitUpperLimit: Initializes a new range object.
Inspecting a Range Object’s Limits ¶
- SKRange.LowerLimit: The minimum possible value.
- SKRange.SetLowerLimit
- SKRange.UpperLimit: The maximum possible value.
- SKRange.SetUpperLimit
See: https://developer.apple.com/documentation/SpriteKit/SKRange
func NewRangeWithConstantValue ¶
Creates and initializes a new range object that specifies a constant value.
value: A constant.
Return Value ¶
A newly initialized range object whose minimum and maximum value are both equal to `value`.
See: https://developer.apple.com/documentation/SpriteKit/SKRange/init(constantValue:)
func NewRangeWithLowerLimit ¶
Creates and initializes a new range object that specifies only a minimum value.
lower: The minimum value for the range.
Return Value ¶
A newly initialized range object whose minimum value is `lower` and whose maximum value is `+Inf`.
See: https://developer.apple.com/documentation/SpriteKit/SKRange/init(lowerLimit:)
func NewRangeWithLowerLimitUpperLimit ¶
Initializes a new range object.
lower: The minimum value for the range.
upper: The maximum value for the range.
Return Value ¶
A newly initialized range object.
See: https://developer.apple.com/documentation/SpriteKit/SKRange/init(lowerLimit:upperLimit:)
func NewRangeWithUpperLimit ¶
Creates and initializes a new range object that specifies only a maximum value.
upper: The maximum value for the range.
Return Value ¶
A newly initialized range object whose minimum value is `-Inf` and whose maximum value is `upper`.
See: https://developer.apple.com/documentation/SpriteKit/SKRange/init(upperLimit:)
func NewRangeWithValueVariance ¶
Creates and initializes a new range object using a value and a maximum distance from that value.
value: The midpoint for the range.
variance: The maximum amount that a value may differ from the midpoint.
Return Value ¶
A newly initialized range object whose minimum value is `value-variance` and whose maximum value is `value+variance`.
See: https://developer.apple.com/documentation/SpriteKit/SKRange/init(value:variance:)
func SKRangeFromID ¶
SKRangeFromID constructs a SKRange from an objc.ID.
A definition of a range of floating-point values.
func (SKRange) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (SKRange) EncodeWithCoder ¶
func (r SKRange) EncodeWithCoder(coder foundation.INSCoder)
func (SKRange) InitWithLowerLimitUpperLimit ¶
Initializes a new range object.
lower: The minimum value for the range.
upper: The maximum value for the range.
Return Value ¶
A newly initialized range object.
See: https://developer.apple.com/documentation/SpriteKit/SKRange/init(lowerLimit:upperLimit:)
func (SKRange) LowerLimit ¶
The minimum possible value.
See: https://developer.apple.com/documentation/SpriteKit/SKRange/lowerLimit
func (SKRange) SetLowerLimit ¶
func (SKRange) SetUpperLimit ¶
func (SKRange) UpperLimit ¶
The maximum possible value.
See: https://developer.apple.com/documentation/SpriteKit/SKRange/upperLimit
type SKRangeClass ¶
type SKRangeClass struct {
// contains filtered or unexported fields
}
func GetSKRangeClass ¶
func GetSKRangeClass() SKRangeClass
GetSKRangeClass returns the class object for SKRange.
func (SKRangeClass) Alloc ¶
func (sc SKRangeClass) Alloc() SKRange
Alloc allocates memory for a new instance of the class.
func (SKRangeClass) Class ¶
func (sc SKRangeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKRangeClass) RangeWithNoLimits ¶
func (_SKRangeClass SKRangeClass) RangeWithNoLimits() SKRange
Creates and initializes a new range object that encompasses all possible values.
Return Value ¶
A newly initialized range object whose minimum value is `—Inf` and whose maximum value is `+Inf`.
See: https://developer.apple.com/documentation/SpriteKit/SKRange/withNoLimits()
type SKReachConstraints ¶
type SKReachConstraints struct {
objectivec.Object
}
A specification of the degree of freedom when solving inverse kinematics.
Overview ¶
An SKReachConstraints object is used to describe the range of motion for an SKNode object whenever an inverse kinematic (IK) action is executed. To use reach constraints, create an SKReachConstraints object and assign it to a node’s SKNode.ReachConstraints property. For more information on using reach actions to perform IK animations, see the SKAction class.
Working with Reach Constraints ¶
- SKReachConstraints.InitWithLowerAngleLimitUpperAngleLimit: Initializes a new reach constraint object.
- SKReachConstraints.LowerAngleLimit: The minimum angle that the node can have after it is rotated by a reach event.
- SKReachConstraints.SetLowerAngleLimit
- SKReachConstraints.UpperAngleLimit: The maximum angle that the node can have after it is rotated by a reach event.
- SKReachConstraints.SetUpperAngleLimit
See: https://developer.apple.com/documentation/SpriteKit/SKReachConstraints
func NewReachConstraintsWithLowerAngleLimitUpperAngleLimit ¶
func NewReachConstraintsWithLowerAngleLimitUpperAngleLimit(lowerAngleLimit float64, upperAngleLimit float64) SKReachConstraints
Initializes a new reach constraint object.
lowerAngleLimit: The minimum angle that the node can have when it is rotated by a reach event.
upperAngleLimit: The maximum angle that the node can have when it is rotated by a reach event.
Return Value ¶
A newly initialized reach constraint.
Discussion ¶
When a reach action is executed, a node’s SKNode.ZRotation property may be changed by the action to satisfy the reach action. Any value calculated by the reach action for a node is always inside the range specified by the reach constraint attached to the node’s SKNode.ReachConstraints property.
func NewSKReachConstraints ¶
func NewSKReachConstraints() SKReachConstraints
NewSKReachConstraints creates a new SKReachConstraints instance.
func SKReachConstraintsFromID ¶
func SKReachConstraintsFromID(id objc.ID) SKReachConstraints
SKReachConstraintsFromID constructs a SKReachConstraints from an objc.ID.
A specification of the degree of freedom when solving inverse kinematics.
func (SKReachConstraints) Autorelease ¶
func (r SKReachConstraints) Autorelease() SKReachConstraints
Autorelease adds the receiver to the current autorelease pool.
func (SKReachConstraints) EncodeWithCoder ¶
func (r SKReachConstraints) EncodeWithCoder(coder foundation.INSCoder)
func (SKReachConstraints) Init ¶
func (r SKReachConstraints) Init() SKReachConstraints
Init initializes the instance.
func (SKReachConstraints) InitWithLowerAngleLimitUpperAngleLimit ¶
func (r SKReachConstraints) InitWithLowerAngleLimitUpperAngleLimit(lowerAngleLimit float64, upperAngleLimit float64) SKReachConstraints
Initializes a new reach constraint object.
lowerAngleLimit: The minimum angle that the node can have when it is rotated by a reach event.
upperAngleLimit: The maximum angle that the node can have when it is rotated by a reach event.
Return Value ¶
A newly initialized reach constraint.
Discussion ¶
When a reach action is executed, a node’s SKNode.ZRotation property may be changed by the action to satisfy the reach action. Any value calculated by the reach action for a node is always inside the range specified by the reach constraint attached to the node’s SKNode.ReachConstraints property.
func (SKReachConstraints) LowerAngleLimit ¶
func (r SKReachConstraints) LowerAngleLimit() float64
The minimum angle that the node can have after it is rotated by a reach event.
See: https://developer.apple.com/documentation/SpriteKit/SKReachConstraints/lowerAngleLimit
func (SKReachConstraints) SetLowerAngleLimit ¶
func (r SKReachConstraints) SetLowerAngleLimit(value float64)
func (SKReachConstraints) SetUpperAngleLimit ¶
func (r SKReachConstraints) SetUpperAngleLimit(value float64)
func (SKReachConstraints) UpperAngleLimit ¶
func (r SKReachConstraints) UpperAngleLimit() float64
The maximum angle that the node can have after it is rotated by a reach event.
See: https://developer.apple.com/documentation/SpriteKit/SKReachConstraints/upperAngleLimit
type SKReachConstraintsClass ¶
type SKReachConstraintsClass struct {
// contains filtered or unexported fields
}
func GetSKReachConstraintsClass ¶
func GetSKReachConstraintsClass() SKReachConstraintsClass
GetSKReachConstraintsClass returns the class object for SKReachConstraints.
func (SKReachConstraintsClass) Alloc ¶
func (sc SKReachConstraintsClass) Alloc() SKReachConstraints
Alloc allocates memory for a new instance of the class.
func (SKReachConstraintsClass) Class ¶
func (sc SKReachConstraintsClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKReferenceNode ¶
type SKReferenceNode struct {
SKNode
}
A node that’s defined in an archived `XCUIElementTypeSks` file.
Overview ¶
SKReferenceNode is used within an archived `XCUIElementTypeSks` file to refer to node defined in another `XCUIElementTypeSks` file without duplicating its definition. This way, a change to the referenced node propagates to all the references in other files.
As an example, you might want to share an enemy ship across two different levels, Scene1.sks and Scene2.sks, in a level-based game. Reference nodes allow you to do that without creating copies of the shared node and its properties.
To use a reference node:
- Create the shared content in a separate archive - Add references to the shared archive within your scene archives
When each scene is loaded, the reference nodes are resolved dynamically, and therefore you only need to configure a shared object in one place.
Initializers ¶
- SKReferenceNode.InitWithURL: Initializes a reference node from a URL.
- SKReferenceNode.InitWithFileNamed: Initializes a reference node from a file in the app’s main bundle.
Regenerating ¶
- SKReferenceNode.ResolveReferenceNode: Loads the reference node’s content and adds it as a new child node.
Loading Callback ¶
- SKReferenceNode.DidLoadReferenceNode: A method called by SpriteKit after the reference node’s contents are loaded.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode
func NewReferenceNodeWithCoder ¶
func NewReferenceNodeWithCoder(aDecoder foundation.INSCoder) SKReferenceNode
A method that initializes a reference node from an archive.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode/init(coder:)
func NewReferenceNodeWithFileNamed ¶
func NewReferenceNodeWithFileNamed(fileName string) SKReferenceNode
Initializes a reference node from a file in the app’s main bundle.
fileName: The name of a file stored in the app’s main bundle.
Return Value ¶
A newly initialized reference node.
Discussion ¶
This initializer is for loading files that reside inside of the app bundle.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode/init(fileNamed:)-2yeh2
func NewReferenceNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewReferenceNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKReferenceNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewReferenceNodeWithURL ¶
func NewReferenceNodeWithURL(url foundation.NSURL) SKReferenceNode
Initializes a reference node from a URL.
url: The URL of the reference node.
Return Value ¶
A newly initialized reference node.
Discussion ¶
This intializer is for loading archives that reside outside of the app bundle.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode/init(url:)-429mo
func NewSKReferenceNode ¶
func NewSKReferenceNode() SKReferenceNode
NewSKReferenceNode creates a new SKReferenceNode instance.
func SKReferenceNodeFromID ¶
func SKReferenceNodeFromID(id objc.ID) SKReferenceNode
SKReferenceNodeFromID constructs a SKReferenceNode from an objc.ID.
A node that’s defined in an archived `XCUIElementTypeSks` file.
func (SKReferenceNode) Autorelease ¶
func (r SKReferenceNode) Autorelease() SKReferenceNode
Autorelease adds the receiver to the current autorelease pool.
func (SKReferenceNode) DidLoadReferenceNode ¶
func (r SKReferenceNode) DidLoadReferenceNode(node ISKNode)
A method called by SpriteKit after the reference node’s contents are loaded.
node: The deserialized content’s root node.
Discussion ¶
This method is called after the referenced content is added as a child of the reference node. Override this method in a subclass to implement custom loading behavior.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode/didLoad(_:)
func (SKReferenceNode) Init ¶
func (r SKReferenceNode) Init() SKReferenceNode
Init initializes the instance.
func (SKReferenceNode) InitWithFileNamed ¶
func (r SKReferenceNode) InitWithFileNamed(fileName string) SKReferenceNode
Initializes a reference node from a file in the app’s main bundle.
fileName: The name of a file stored in the app’s main bundle.
Return Value ¶
A newly initialized reference node.
Discussion ¶
This initializer is for loading files that reside inside of the app bundle.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode/init(fileNamed:)-2yeh2
func (SKReferenceNode) InitWithURL ¶
func (r SKReferenceNode) InitWithURL(url foundation.NSURL) SKReferenceNode
Initializes a reference node from a URL.
url: The URL of the reference node.
Return Value ¶
A newly initialized reference node.
Discussion ¶
This intializer is for loading archives that reside outside of the app bundle.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode/init(url:)-429mo
func (SKReferenceNode) ResolveReferenceNode ¶
func (r SKReferenceNode) ResolveReferenceNode()
Loads the reference node’s content and adds it as a new child node.
Discussion ¶
The archive is deserialized and the root node is added as a child of the reference node. If this method is called on a reference node whose content is already loaded, the existing node tree is discarded and replaced with a fresh copy of the archive’s data.
SpriteKit calls this method automatically if the scene renders the reference node and the reference node has not previously been loaded.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode/resolve()
type SKReferenceNodeClass ¶
type SKReferenceNodeClass struct {
// contains filtered or unexported fields
}
func GetSKReferenceNodeClass ¶
func GetSKReferenceNodeClass() SKReferenceNodeClass
GetSKReferenceNodeClass returns the class object for SKReferenceNode.
func (SKReferenceNodeClass) Alloc ¶
func (sc SKReferenceNodeClass) Alloc() SKReferenceNode
Alloc allocates memory for a new instance of the class.
func (SKReferenceNodeClass) Class ¶
func (sc SKReferenceNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKReferenceNodeClass) ReferenceNodeWithFileNamed ¶
func (_SKReferenceNodeClass SKReferenceNodeClass) ReferenceNodeWithFileNamed(fileName string) SKReferenceNode
Creates a reference node from a file in the app’s main bundle.
fileName: The name of a file stored in the app’s main bundle.
Return Value ¶
A newly initialized reference node.
Discussion ¶
This initializer is for loading files that reside inside of the app bundle.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode/init(fileNamed:)-77gs0
func (SKReferenceNodeClass) ReferenceNodeWithURL ¶
func (_SKReferenceNodeClass SKReferenceNodeClass) ReferenceNodeWithURL(referenceURL foundation.NSURL) SKReferenceNode
Creates a reference node from a URL.
referenceURL: The URL of the reference node.
Return Value ¶
A newly initialized reference node.
Discussion ¶
This intializer is for loading archives that reside outside of the app bundle.
See: https://developer.apple.com/documentation/SpriteKit/SKReferenceNode/init(url:)-3jryz
type SKRegion ¶
type SKRegion struct {
objectivec.Object
}
The definition of an arbitrary area.
Overview ¶
An SKRegion object defines a mathematical shape and is typically used to determine whether a particular point lies inside this area. For example, regions are used to define the area that a physics field can affect. Regions are defined using paths and mathematical shapes and can also be combined using constructive solid geometry.
Creating and Initializing Region Objects ¶
- SKRegion.InitWithSize: Initializes a new region with a rectangular area.
- SKRegion.InitWithRadius: Initializes a new region with a circular area.
- SKRegion.InitWithPath: Initializes a new region using a Core Graphics path.
- SKRegion.InverseRegion: Returns a new region that is the mathematical inverse of an existing region.
- SKRegion.RegionByDifferenceFromRegion: Returns a new region created by subtracting the contents of another region from this region.
- SKRegion.RegionByIntersectionWithRegion: Returns a new region created by intersecting the contents of this region with another region.
- SKRegion.RegionByUnionWithRegion: Returns a new region created by combining the contents of this region with another region.
Interacting with a Region ¶
- SKRegion.Path: Returns a Core Graphics path that defines the region.
- SKRegion.ContainsPoint: Returns a Boolean value that indicates whether a particular point is contained in the region.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion
func NewRegionWithPath ¶
func NewRegionWithPath(path coregraphics.CGPathRef) SKRegion
Initializes a new region using a Core Graphics path.
path: A path that defines the new region’s shape. The path is assumed to use the even-odd winding rule.
Return Value ¶
A newly initialized region.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/init(path:)
func NewRegionWithRadius ¶
Initializes a new region with a circular area.
radius: The radius of the region in points.
Return Value ¶
A newly initialized region. The region is circular and centered on the origin.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/init(radius:)
func NewRegionWithSize ¶
func NewRegionWithSize(size corefoundation.CGSize) SKRegion
Initializes a new region with a rectangular area.
size: The size of the rectangle in points.
Return Value ¶
A newly initialized region. The region is rectangular and centered on the origin.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/init(size:)
func SKRegionFromID ¶
SKRegionFromID constructs a SKRegion from an objc.ID.
The definition of an arbitrary area.
func (SKRegion) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (SKRegion) ContainsPoint ¶
func (r SKRegion) ContainsPoint(point corefoundation.CGPoint) bool
Returns a Boolean value that indicates whether a particular point is contained in the region.
point: A point.
Return Value ¶
true if the point is contained in the region; otherwise, false.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/contains(_:)
func (SKRegion) EncodeWithCoder ¶
func (r SKRegion) EncodeWithCoder(coder foundation.INSCoder)
func (SKRegion) InitWithPath ¶
func (r SKRegion) InitWithPath(path coregraphics.CGPathRef) SKRegion
Initializes a new region using a Core Graphics path.
path: A path that defines the new region’s shape. The path is assumed to use the even-odd winding rule.
Return Value ¶
A newly initialized region.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/init(path:)
func (SKRegion) InitWithRadius ¶
Initializes a new region with a circular area.
radius: The radius of the region in points.
Return Value ¶
A newly initialized region. The region is circular and centered on the origin.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/init(radius:)
func (SKRegion) InitWithSize ¶
func (r SKRegion) InitWithSize(size corefoundation.CGSize) SKRegion
Initializes a new region with a rectangular area.
size: The size of the rectangle in points.
Return Value ¶
A newly initialized region. The region is rectangular and centered on the origin.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/init(size:)
func (SKRegion) InverseRegion ¶
Returns a new region that is the mathematical inverse of an existing region.
Return Value ¶
A new region object whose contents include all points that are not in the current region.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/inverse()
func (SKRegion) Path ¶
func (r SKRegion) Path() coregraphics.CGPathRef
Returns a Core Graphics path that defines the region.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/path
func (SKRegion) RegionByDifferenceFromRegion ¶
Returns a new region created by subtracting the contents of another region from this region.
region: The region to subtract.
Return Value ¶
A new region whose contents include all points in the current region that are not also included in the second region.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/byDifference(from:)
func (SKRegion) RegionByIntersectionWithRegion ¶
Returns a new region created by intersecting the contents of this region with another region.
region: The region to intersect.
Return Value ¶
A new region whose contents include all points that are included in both regions.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/byIntersection(with:)
func (SKRegion) RegionByUnionWithRegion ¶
Returns a new region created by combining the contents of this region with another region.
region: The region to combine with the current region.
Return Value ¶
A new region whose contents include all points that are included in either region.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/byUnion(with:)
type SKRegionClass ¶
type SKRegionClass struct {
// contains filtered or unexported fields
}
func GetSKRegionClass ¶
func GetSKRegionClass() SKRegionClass
GetSKRegionClass returns the class object for SKRegion.
func (SKRegionClass) Alloc ¶
func (sc SKRegionClass) Alloc() SKRegion
Alloc allocates memory for a new instance of the class.
func (SKRegionClass) Class ¶
func (sc SKRegionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKRegionClass) InfiniteRegion ¶
func (_SKRegionClass SKRegionClass) InfiniteRegion() SKRegion
Returns a region that defines a region that includes all points.
Return Value ¶
Returns a singleton region that covers an infinite area.
See: https://developer.apple.com/documentation/SpriteKit/SKRegion/infinite()
type SKRenderer ¶
type SKRenderer struct {
objectivec.Object
}
An object that renders a scene into a custom Metal rendering pipeline and drives the scene update cycle.
Overview ¶
SKRenderer allows an app to mix SpriteKit and Metal content by rendering an SKScene into a Metal command buffer. The reasons an app may do this instead of displaying a scene in SKView are:
- Apps that are built in Metal can mix in SpriteKit content. While it’s possible to add SKView as a subview to a Metal view, plugging SKRenderer into their Metal pipeline allows layering SpriteKit content at a specific z-position. - You might be writing a SpriteKit app and decide later to take full control over some portion of renderering by implementing it with Metal, yet continue to use SpriteKit for the rest of the app. For example, you might write the environmental effects layer of your app that does fog, clouds, and rain, with custom Metal shaders, and continue to layer content below and above that with SpriteKit.
First Steps ¶
- SKRenderer.Scene: The scene this renderer will draw into the Metal command buffer.
- SKRenderer.SetScene
Rendering the Scene ¶
- SKRenderer.RenderWithViewportCommandBufferRenderPassDescriptor
- SKRenderer.RenderWithViewportRenderCommandEncoderRenderPassDescriptorCommandQueue
Driving the Scene’s Update Cycle ¶
Configuring Performance Related Toggles ¶
- SKRenderer.IgnoresSiblingOrder
- SKRenderer.SetIgnoresSiblingOrder
- SKRenderer.ShouldCullNonVisibleNodes
- SKRenderer.SetShouldCullNonVisibleNodes
Enabling Visual Statistics for Debugging ¶
- SKRenderer.ShowsNodeCount: A Boolean value that indicates whether the view displays an overlay that shows physics bodies that are visible in the scene.
- SKRenderer.SetShowsNodeCount
- SKRenderer.ShowsDrawCount: A Boolean value that indicates whether the view displays the number of drawing passes it needed to render the view.
- SKRenderer.SetShowsDrawCount
- SKRenderer.ShowsQuadCount: A Boolean value that indicates whether the view displays the number of rectangles used to render the scene.
- SKRenderer.SetShowsQuadCount
- SKRenderer.ShowsPhysics: A Boolean value that indicates whether the view displays physics-related debugging information.
- SKRenderer.SetShowsPhysics
- SKRenderer.ShowsFields: A Boolean value that indicates whether the view displays information about physics fields in the scene.
- SKRenderer.SetShowsFields
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer
func NewRendererWithDevice ¶
func NewRendererWithDevice(device metal.MTLDevice) SKRenderer
Initializes with a specific GPU to render into.
device: A Metal device.
Return Value ¶
A new renderer object.
Discussion ¶
Pass in the same Metal device that is associated to the Metal command buffer passed into SKRenderer.RenderWithViewportCommandBufferRenderPassDescriptor.
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer/init(device:)
func NewSKRenderer ¶
func NewSKRenderer() SKRenderer
NewSKRenderer creates a new SKRenderer instance.
func SKRendererFromID ¶
func SKRendererFromID(id objc.ID) SKRenderer
SKRendererFromID constructs a SKRenderer from an objc.ID.
An object that renders a scene into a custom Metal rendering pipeline and drives the scene update cycle.
func (SKRenderer) Autorelease ¶
func (r SKRenderer) Autorelease() SKRenderer
Autorelease adds the receiver to the current autorelease pool.
func (SKRenderer) IgnoresSiblingOrder ¶
func (r SKRenderer) IgnoresSiblingOrder() bool
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer/ignoresSiblingOrder
func (SKRenderer) RenderWithViewportCommandBufferRenderPassDescriptor ¶
func (r SKRenderer) RenderWithViewportCommandBufferRenderPassDescriptor(viewport corefoundation.CGRect, commandBuffer metal.MTLCommandBuffer, renderPassDescriptor metal.MTLRenderPassDescriptor)
func (SKRenderer) RenderWithViewportRenderCommandEncoderRenderPassDescriptorCommandQueue ¶
func (r SKRenderer) RenderWithViewportRenderCommandEncoderRenderPassDescriptorCommandQueue(viewport corefoundation.CGRect, renderCommandEncoder metal.MTLRenderCommandEncoder, renderPassDescriptor metal.MTLRenderPassDescriptor, commandQueue metal.MTLCommandQueue)
func (SKRenderer) Scene ¶
func (r SKRenderer) Scene() ISKScene
The scene this renderer will draw into the Metal command buffer.
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer/scene
func (SKRenderer) SetIgnoresSiblingOrder ¶
func (r SKRenderer) SetIgnoresSiblingOrder(value bool)
func (SKRenderer) SetScene ¶
func (r SKRenderer) SetScene(value ISKScene)
func (SKRenderer) SetShouldCullNonVisibleNodes ¶
func (r SKRenderer) SetShouldCullNonVisibleNodes(value bool)
func (SKRenderer) SetShowsDrawCount ¶
func (r SKRenderer) SetShowsDrawCount(value bool)
func (SKRenderer) SetShowsFields ¶
func (r SKRenderer) SetShowsFields(value bool)
func (SKRenderer) SetShowsNodeCount ¶
func (r SKRenderer) SetShowsNodeCount(value bool)
func (SKRenderer) SetShowsPhysics ¶
func (r SKRenderer) SetShowsPhysics(value bool)
func (SKRenderer) SetShowsQuadCount ¶
func (r SKRenderer) SetShowsQuadCount(value bool)
func (SKRenderer) ShouldCullNonVisibleNodes ¶
func (r SKRenderer) ShouldCullNonVisibleNodes() bool
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer/shouldCullNonVisibleNodes
func (SKRenderer) ShowsDrawCount ¶
func (r SKRenderer) ShowsDrawCount() bool
A Boolean value that indicates whether the view displays the number of drawing passes it needed to render the view.
Discussion ¶
Some operations in SpriteKit can require multiple rendering passes to draw a scene’s content. For example, an SKEffectNode object must render its children into a separate buffer, apply the effect, and then perform another pass to blend those results into its parent node. These additional rendering passes use more rendering resources, reducing your game’s frame rate or increasing its total power consumption. Use the draw count as another piece of data when you profile your game’s performance.
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer/showsDrawCount
func (SKRenderer) ShowsFields ¶
func (r SKRenderer) ShowsFields() bool
A Boolean value that indicates whether the view displays information about physics fields in the scene.
Discussion ¶
When this debugging option is enabled, each time a frame is rendered, an image is drawn behind your scene that shows the effects of any physics fields contained in the scene.
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer/showsFields
func (SKRenderer) ShowsNodeCount ¶
func (r SKRenderer) ShowsNodeCount() bool
A Boolean value that indicates whether the view displays an overlay that shows physics bodies that are visible in the scene.
Discussion ¶
When you enable this option, it shows the number of nodes currently in the scene’s node tree.
You may achieve additional performance gain by actually removing nodes from the node tree manually which are off screen. For example, in the case of SKRenderer.ShouldCullNonVisibleNodes, there would be less nodes for SpriteKit to test every frame whether they’re on screen.
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer/showsNodeCount
func (SKRenderer) ShowsPhysics ¶
func (r SKRenderer) ShowsPhysics() bool
A Boolean value that indicates whether the view displays physics-related debugging information.
Discussion ¶
When this debugging option is enabled, each time a frame is rendered, an overlay image is drawn on top of your scene that shows the positions and shapes of any physics bodies visible in the scene.
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer/showsPhysics
func (SKRenderer) ShowsQuadCount ¶
func (r SKRenderer) ShowsQuadCount() bool
A Boolean value that indicates whether the view displays the number of rectangles used to render the scene.
Discussion ¶
SpriteKit converts the node tree into one or more rendering passes. Each rendering pass is rendered using a series of textured rectangles (quads). The showsQuadCount property allows you to see the total number of quads that were used to render the scene’s contents. Use this as another piece of data when you profile your game’s performance. In most cases, fewer quads is better.
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer/showsQuadCount
func (SKRenderer) UpdateAtTime ¶
func (r SKRenderer) UpdateAtTime(currentTime foundation.NSTimeInterval)
See: https://developer.apple.com/documentation/SpriteKit/SKRenderer/update(atTime:)
type SKRendererClass ¶
type SKRendererClass struct {
// contains filtered or unexported fields
}
func GetSKRendererClass ¶
func GetSKRendererClass() SKRendererClass
GetSKRendererClass returns the class object for SKRenderer.
func (SKRendererClass) Alloc ¶
func (sc SKRendererClass) Alloc() SKRenderer
Alloc allocates memory for a new instance of the class.
func (SKRendererClass) Class ¶
func (sc SKRendererClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKRepeatMode ¶
type SKRepeatMode int
See: https://developer.apple.com/documentation/SpriteKit/SKRepeatMode
const ( // SKRepeatModeClamp: When a sample is calculated, the time value is clamped to the range of time values found in the sequence. SKRepeatModeClamp SKRepeatMode = 1 // SKRepeatModeLoop: When a sample is calculated, the sequence loops back to the beginning of the sequence. SKRepeatModeLoop SKRepeatMode = 2 )
func (SKRepeatMode) String ¶
func (e SKRepeatMode) String() string
type SKScene ¶
type SKScene struct {
SKEffectNode
}
An object that organizes all of the active SpriteKit content.
Overview ¶
An SKScene object represents a scene of content in SpriteKit. A scene is the root node in a tree of SpriteKit nodes (SKNode). These nodes provide content that the scene animates and renders for display. To display a scene, you present it from an SKView, SKRenderer, or WKInterfaceSKScene.
SKScene is a subclass of SKEffectNode and enables certain effects to apply to the entire scene. Though applying effects to an entire scene can be an expensive operation, creativity, and ingenuity may help you find some interesting ways to use effects.
Creating a Scene Programmatically ¶
- SKScene.InitWithSize: Initializes a new scene object.
- SKScene.Size: The dimensions of the scene, in points.
- SKScene.SetSize
Stretching Content to Fit the View ¶
- SKScene.ScaleMode: A setting that defines how the scene is mapped to the view that presents it.
- SKScene.SetScaleMode
Configuring the Viewport ¶
- SKScene.Camera: The camera node in the scene that determines what part of the scene’s coordinate space is visible in the view.
- SKScene.SetCamera
- SKScene.AnchorPoint: The point in the view’s frame that corresponds to the scene’s origin.
- SKScene.SetAnchorPoint
Responding to Loading and Resizing Events ¶
- SKScene.SceneDidLoad: Tells you when the scene is presented.
- SKScene.DidChangeSize: Tells you when the scene’s size has changed.
- SKScene.WillMoveFromView: Tells you when the scene is about to be removed from a view.
- SKScene.DidMoveToView: Tells you when the scene is presented by a view.
Responding to Frame-Cycle Events ¶
- SKScene.Update: Tells your app to perform any app-specific logic to update your scene.
- SKScene.DidEvaluateActions: Tells your app to peform any necessary logic after scene actions are evaluated.
- SKScene.DidSimulatePhysics: Tells your app to peform any necessary logic after physics simulations are performed.
- SKScene.DidApplyConstraints: Tells your app to peform any necessary logic after constraints are applied.
- SKScene.DidFinishUpdate: Tells your app to peform any necessary logic after the scene has finished all of the steps required to process animations.
Configuring a Delegate ¶
- SKScene.Delegate: A delegate to be called during the animation loop.
- SKScene.SetDelegate
Setting the Background Appearance ¶
- SKScene.View: The view that is currently presenting the scene.
- SKScene.BackgroundColor: The background color of the scene.
- SKScene.SetBackgroundColor
Configuring Physics Properties ¶
- SKScene.PhysicsWorld: The physics simulation associated with the scene.
Adding Positional Audio ¶
- SKScene.Listener: A node used to determine the position of the listener for positional audio in the scene.
- SKScene.SetListener
- SKScene.AudioEngine: The AVFoundation audio engine used to play audio from audio nodes contained in the scene.
Converting Between Coordinate Systems ¶
- SKScene.ConvertPointFromView: Converts a point from view coordinates to scene coordinates.
- SKScene.ConvertPointToView: Converts a point from scene coordinates to view coordinates.
See: https://developer.apple.com/documentation/SpriteKit/SKScene
func NewSceneNodeWithFileNamed ¶
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewSceneNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewSceneNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKScene, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewSceneWithCoder ¶
func NewSceneWithCoder(aDecoder foundation.INSCoder) SKScene
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewSceneWithSize ¶
func NewSceneWithSize(size corefoundation.CGSize) SKScene
Initializes a new scene object.
size: The size of the scene in points.
Return Value ¶
A newly initialized scene object.
Discussion ¶
This is the class’s designated initializer method.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/init(size:)
func SKSceneFromID ¶
SKSceneFromID constructs a SKScene from an objc.ID.
An object that organizes all of the active SpriteKit content.
func (SKScene) AnchorPoint ¶
func (s SKScene) AnchorPoint() corefoundation.CGPoint
The point in the view’s frame that corresponds to the scene’s origin.
Discussion ¶
When a scene is presented and a camera node has not been specified, the SKScene.Size and SKScene.AnchorPoint properties determine which part of the scene’s coordinate space is visible in the view.
You specify the value using the unit coordinate space. The default value is `(0,0)`, which corresponds to the lower-left corner of the view’s frame rectangle.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/anchorPoint
func (SKScene) AudioEngine ¶
func (s SKScene) AudioEngine() avfaudio.AVAudioEngine
The AVFoundation audio engine used to play audio from audio nodes contained in the scene.
Discussion ¶
An audio engine instance is automatically created for you when the scene is created. You can use methods and properties on a scene’s audio engine for overall control of all of its child audio nodes. The following code shows how a scene’s overall volume can be reduced from its default of 1.0 down to 0.2 and then paused:
See: https://developer.apple.com/documentation/SpriteKit/SKScene/audioEngine
func (SKScene) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (SKScene) BackgroundColor ¶
The background color of the scene.
Discussion ¶
The default value is a gray color (RGBA `0.15, 0.15, 0.15, 1.0)`.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/backgroundColor
func (SKScene) Camera ¶
func (s SKScene) Camera() ISKCameraNode
The camera node in the scene that determines what part of the scene’s coordinate space is visible in the view.
Discussion ¶
The default value of this property is `nil`, which means that the scene’s SKScene.AnchorPoint and SKScene.Size properties determine what portion of the scene is visible. If set to point to a camera node contained in the scene, the SKScene.AnchorPoint property is ignored and the scene is rendered using the camera node’s properties instead.
A camera must be added as a child of the scene for it to render that scene.
Listing 1 shows, in Swift, how to add a camera to an SKScene named `scene`. The camera is positioned in the center of the scene which gives the same result as rendering a camera-less scene with an SKScene.AnchorPoint of zero.
Listing 1. Adding a camera to a scene
For more information, see SKCameraNode.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/camera
func (SKScene) ConvertPointFromView ¶
func (s SKScene) ConvertPointFromView(point corefoundation.CGPoint) corefoundation.CGPoint
Converts a point from view coordinates to scene coordinates.
point: A point in view coordinates.
Return Value ¶
The same point in the scene’s coordinate system.
Discussion ¶
The scene must be presented in a view before calling this method.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/convertPoint(fromView:)
func (SKScene) ConvertPointToView ¶
func (s SKScene) ConvertPointToView(point corefoundation.CGPoint) corefoundation.CGPoint
Converts a point from scene coordinates to view coordinates.
point: A point in scene coordinates.
Return Value ¶
The same point in the view’s coordinate system.
Discussion ¶
The scene must be presented in a view before calling this method.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/convertPoint(toView:)
func (SKScene) Delegate ¶
func (s SKScene) Delegate() SKSceneDelegate
A delegate to be called during the animation loop.
Discussion ¶
When a delegate is present, when any of the animation loop methods steps are executed, your delegate is called. Typically, you use a delegate when you do not want to implement a scene subclass or if you want to dynamically change the scene behavior at runtime.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/delegate
func (SKScene) DidApplyConstraints ¶
func (s SKScene) DidApplyConstraints()
Tells your app to peform any necessary logic after constraints are applied.
Discussion ¶
Do not call this method directly; it is called exactly once per frame, so long as the scene is presented in a view and is not paused. By default, this method does nothing. Your scene subclass should override this method and perform any necessary updates to the scene.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/didApplyConstraints()
func (SKScene) DidChangeSize ¶
func (s SKScene) DidChangeSize(oldSize corefoundation.CGSize)
Tells you when the scene’s size has changed.
oldSize: The old size of the scene, in points.
Discussion ¶
This method is intended to be overridden in a subclass. Typically, you use this method to adjust the positions of nodes in the scene.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/didChangeSize(_:)
func (SKScene) DidEvaluateActions ¶
func (s SKScene) DidEvaluateActions()
Tells your app to peform any necessary logic after scene actions are evaluated.
Discussion ¶
Do not call this method directly; it is called by the system exactly once per frame, so long as the scene is presented in a view and is not paused. It is called after any actions have been evaluated by nodes in the scene but before any physics are simulated.
Any additional actions applied are not evaluated until the next update.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/didEvaluateActions()
func (SKScene) DidFinishUpdate ¶
func (s SKScene) DidFinishUpdate()
Tells your app to peform any necessary logic after the scene has finished all of the steps required to process animations.
Discussion ¶
Do not call this method directly; it is called by the system exactly once per frame, so long as the scene is presented in a view and is not paused. It is called after all update logic has been completed and before the scene is rendered.
Any additional actions applied are not evaluated until the next update.
Any changes to physics bodies are not simulated until the next update.
Any changes to constraints will not be applied until the next update.
No further update logic will be applied to the scene after this call. Any values set on nodes here will be used when the scene is rendered for the current frame.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/didFinishUpdate()
func (SKScene) DidMoveToView ¶
Tells you when the scene is presented by a view.
view: The view that is presenting the scene.
Discussion ¶
This method is intended to be overridden in a subclass. You can use this method to implement any custom behavior for your scene when it is about to be presented by a view. For example, you might use this method to create the scene’s contents.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/didMove(to:)
func (SKScene) DidSimulatePhysics ¶
func (s SKScene) DidSimulatePhysics()
Tells your app to peform any necessary logic after physics simulations are performed.
Discussion ¶
Do not call this method directly; it is called by the system exactly once per frame, so long as the scene is presented in a view and is not paused. It is called after physics has been simulated in the scene.
Any additional actions applied are not evaluated until the next update.
Any changes to physics bodies are not simulated until the next update.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/didSimulatePhysics()
func (SKScene) InitWithSize ¶
func (s SKScene) InitWithSize(size corefoundation.CGSize) SKScene
Initializes a new scene object.
size: The size of the scene in points.
Return Value ¶
A newly initialized scene object.
Discussion ¶
This is the class’s designated initializer method.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/init(size:)
func (SKScene) Listener ¶
A node used to determine the position of the listener for positional audio in the scene.
Discussion ¶
The default value is `nil`, which means that the scene’s origin is used as the listener position for audio effects played by SKAudioNode objects in the scene. If a non-`nil` value is specified, it must be a node in the scene.
Typically, you want the SKScene.Camera to be the listener so that audio nodes which are on screen are louder than off screen ones. In a game, the node that defines the player would likely be set as the `listener`.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/listener
func (SKScene) PhysicsWorld ¶
func (s SKScene) PhysicsWorld() ISKPhysicsWorld
The physics simulation associated with the scene.
Discussion ¶
Every scene automatically creates a physics world object to simulate physics on nodes in the scene. You use this property to access the scene’s global physics properties, such as gravity. To add physics to a particular node, see SKNode.PhysicsBody.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/physicsWorld
func (SKScene) ScaleMode ¶
func (s SKScene) ScaleMode() SKSceneScaleMode
A setting that defines how the scene is mapped to the view that presents it.
Discussion ¶
It is possible for a scene’s size to differ from the size of the view it is presented in. The scale mode determines how the visible portion of the scene is mapped to the view. The possible values are listed in SKSceneScaleMode. The default value is SKSceneScaleMode.fill.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/scaleMode
func (SKScene) SceneDidLoad ¶
func (s SKScene) SceneDidLoad()
Tells you when the scene is presented.
Discussion ¶
This method is intended to be overridden in a subclass. It is the preferred location to peform custom setup after the scene has been initialized or decoded.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/sceneDidLoad()
func (SKScene) SetAnchorPoint ¶
func (s SKScene) SetAnchorPoint(value corefoundation.CGPoint)
func (SKScene) SetBackgroundColor ¶
func (SKScene) SetCamera ¶
func (s SKScene) SetCamera(value ISKCameraNode)
func (SKScene) SetDelegate ¶
func (s SKScene) SetDelegate(value SKSceneDelegate)
func (SKScene) SetListener ¶
func (SKScene) SetScaleMode ¶
func (s SKScene) SetScaleMode(value SKSceneScaleMode)
func (SKScene) SetSize ¶
func (s SKScene) SetSize(value corefoundation.CGSize)
func (SKScene) Size ¶
func (s SKScene) Size() corefoundation.CGSize
The dimensions of the scene, in points.
Discussion ¶
When a scene is first initialized, its size property is configured by the designated initializer. The size of the scene specifies the size of the visible portion of the scene in points. This is only used to specify the visible portion of the scene. Nodes in the tree can be positioned outside of this area; those nodes are still processed by the scene, but are ignored by the renderer.
When a scene is presented, the SKScene.Size and SKScene.AnchorPoint properties determine the portion of the scene’s coordinate space that is visible in the view.
If you set the SKScene.Size property to a new value, the scene’s SKScene.DidChangeSize method is called. This property can also change if the SKScene.ScaleMode property is set to SKSceneScaleMode.resizeFill and the presenting view is resized. After the scene’s size changes, future updates are rendered immediately at the new size.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/size
func (SKScene) Update ¶
func (s SKScene) Update(currentTime foundation.NSTimeInterval)
Tells your app to perform any app-specific logic to update your scene.
currentTime: The current system time.
Discussion ¶
Do not call this method directly; it is called by the system exactly once per frame, so long as the scene is presented in a view and is not paused. This is the first method called when animating the scene, before any actions are evaluated and before any physics are simulated.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/update(_:)
func (SKScene) View ¶
The view that is currently presenting the scene.
Discussion ¶
To present a scene, you call the SKView.PresentScene method or SKView.PresentSceneTransition method on the SKView class. If the scene is not currently presented, this property holds `nil`.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/view
func (SKScene) WillMoveFromView ¶
Tells you when the scene is about to be removed from a view.
view: The view that is presenting the scene.
Discussion ¶
This method is intended to be overridden in a subclass. You can use this method to implement any custom behavior for your scene when it is about to be removed from the view.
See: https://developer.apple.com/documentation/SpriteKit/SKScene/willMove(from:)
type SKSceneClass ¶
type SKSceneClass struct {
// contains filtered or unexported fields
}
func GetSKSceneClass ¶
func GetSKSceneClass() SKSceneClass
GetSKSceneClass returns the class object for SKScene.
func (SKSceneClass) Alloc ¶
func (sc SKSceneClass) Alloc() SKScene
Alloc allocates memory for a new instance of the class.
func (SKSceneClass) Class ¶
func (sc SKSceneClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKSceneDelegate ¶
type SKSceneDelegate interface {
objectivec.IObject
}
Methods that, when implemented, allow any class to participate in the SpriteKit render loop callbacks.
See: https://developer.apple.com/documentation/SpriteKit/SKSceneDelegate
type SKSceneDelegateConfig ¶
type SKSceneDelegateConfig struct {
// Other Methods
// UpdateForScene — Tells you to perform any app specific logic to update your scene.
UpdateForScene func(currentTime foundation.NSTimeInterval, scene SKScene)
// DidEvaluateActionsForScene — Tells you to peform any necessary logic after scene actions are evaluated.
DidEvaluateActionsForScene func(scene SKScene)
// DidSimulatePhysicsForScene — Tells you to peform any necessary logic after physics simulations are performed.
DidSimulatePhysicsForScene func(scene SKScene)
// DidApplyConstraintsForScene — Tells you to peform any necessary logic after constraints are applied.
DidApplyConstraintsForScene func(scene SKScene)
// DidFinishUpdateForScene — Tells you to peform any necessary logic after the scene has finished all of the steps required to process animations.
DidFinishUpdateForScene func(scene SKScene)
}
SKSceneDelegateConfig holds optional typed callbacks for SKSceneDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.
See Apple Documentation for protocol details.
type SKSceneDelegateObject ¶
type SKSceneDelegateObject struct {
objectivec.Object
}
SKSceneDelegateObject wraps an existing Objective-C object that conforms to the SKSceneDelegate protocol.
func NewSKSceneDelegate ¶
func NewSKSceneDelegate(config SKSceneDelegateConfig) SKSceneDelegateObject
NewSKSceneDelegate creates an Objective-C object implementing the SKSceneDelegate protocol.
Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.
The returned SKSceneDelegateObject satisfies the SKSceneDelegate interface and can be passed directly to SetDelegate and similar methods.
See Apple Documentation for protocol details.
func SKSceneDelegateObjectFromID ¶
func SKSceneDelegateObjectFromID(id objc.ID) SKSceneDelegateObject
SKSceneDelegateObjectFromID constructs a SKSceneDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func (SKSceneDelegateObject) BaseObject ¶
func (o SKSceneDelegateObject) BaseObject() objectivec.Object
func (SKSceneDelegateObject) DidApplyConstraintsForScene ¶
func (o SKSceneDelegateObject) DidApplyConstraintsForScene(scene ISKScene)
Tells you to peform any necessary logic after constraints are applied.
scene: The scene that is being animated.
Discussion ¶
Do not call this method directly; it is called by the system exactly once per frame, so long as the scene is presented in a view and is not paused. It is called after any enabled constraints in the scene have been applied.
Any additional actions applied are not evaluated until the next update.
Any changes to physics bodies is not simulated until the next update.
Any changes to constraints will not be applied until the next update.
See: https://developer.apple.com/documentation/SpriteKit/SKSceneDelegate/didApplyConstraints(for:)
func (SKSceneDelegateObject) DidEvaluateActionsForScene ¶
func (o SKSceneDelegateObject) DidEvaluateActionsForScene(scene ISKScene)
Tells you to peform any necessary logic after scene actions are evaluated.
scene: The scene that is being animated.
Discussion ¶
Do not call this method directly; it is called by the system exactly once per frame, so long as the scene is presented in a view and is not paused. It is called after any actions have been evaluated by nodes in the scene but before any physics are simulated.
Any additional actions applied are not evaluated until the next update.
See: https://developer.apple.com/documentation/SpriteKit/SKSceneDelegate/didEvaluateActions(for:)
func (SKSceneDelegateObject) DidFinishUpdateForScene ¶
func (o SKSceneDelegateObject) DidFinishUpdateForScene(scene ISKScene)
Tells you to peform any necessary logic after the scene has finished all of the steps required to process animations.
scene: The scene that is being animated.
Discussion ¶
Do not call this method directly; it is called by the system exactly once per frame, so long as the scene is presented in a view and is not paused. It is called after all update logic has been completed and before the scene is rendered.
Any additional actions applied are not evaluated until the next update.
Any changes to physics bodies are not simulated until the next update.
Any changes to constraints will not be applied until the next update.
No further update logic will be applied to the scene after this call. Any values set on nodes here will be used when the scene is rendered for the current frame.
See: https://developer.apple.com/documentation/SpriteKit/SKSceneDelegate/didFinishUpdate(for:)
func (SKSceneDelegateObject) DidSimulatePhysicsForScene ¶
func (o SKSceneDelegateObject) DidSimulatePhysicsForScene(scene ISKScene)
Tells you to peform any necessary logic after physics simulations are performed.
scene: The scene that is being animated.
Discussion ¶
Do not call this method directly; it is called by the system exactly once per frame, so long as the scene is presented in a view and is not paused. It is called after physics has been simulated in the scene.
Any additional actions applied are not evaluated until the next update.
Any changes to physics bodies are not simulated until the next update.
See: https://developer.apple.com/documentation/SpriteKit/SKSceneDelegate/didSimulatePhysics(for:)
func (SKSceneDelegateObject) UpdateForScene ¶
func (o SKSceneDelegateObject) UpdateForScene(currentTime foundation.NSTimeInterval, scene ISKScene)
Tells you to perform any app specific logic to update your scene.
currentTime: The current system time.
scene: The scene that is being animated.
Discussion ¶
Do not call this method directly; it is called by the system exactly once per frame, so long as the scene is presented in a view and is not paused. This is the first method called when animating the scene, before any actions are evaluated and before any physics are simulated.
See: https://developer.apple.com/documentation/SpriteKit/SKSceneDelegate/update(_:for:)
type SKSceneScaleMode ¶
type SKSceneScaleMode int
See: https://developer.apple.com/documentation/SpriteKit/SKSceneScaleMode
const ( // SKSceneScaleModeAspectFill: The scaling factor of each dimension is calculated and the larger of the two is chosen. SKSceneScaleModeAspectFill SKSceneScaleMode = 1 // SKSceneScaleModeAspectFit: The scaling factor of each dimension is calculated and the smaller of the two is chosen. SKSceneScaleModeAspectFit SKSceneScaleMode = 2 // SKSceneScaleModeFill: Each axis of the scene is scaled independently so that each axis in the scene exactly maps to the length of that axis in the view. SKSceneScaleModeFill SKSceneScaleMode = 0 // SKSceneScaleModeResizeFill: The scene is not scaled to match the view. SKSceneScaleModeResizeFill SKSceneScaleMode = 3 )
func (SKSceneScaleMode) String ¶
func (e SKSceneScaleMode) String() string
type SKShader ¶
type SKShader struct {
objectivec.Object
}
An object that allows you to apply a custom fragment shader.
Overview ¶
An SKShader object holds a custom OpenGL ES fragment shader. Shader objects are used to customize the drawing behavior of many different kinds of nodes in SpriteKit.
To use a custom shader, create an SKShader object and provide the source for the custom fragment shader. If your shader needs to provide uniform data to the shader, create one or more SKUniform objects and associate them with the shader object. If your shader needs to provide per-node data to the shader, create one or more SKAttribute objects and associate them with the relevant nodes. Then, assign the shader object to the SKSpriteNode.Shader property of any sprites that need the custom behavior.
Compiling a shader and the uniform data associated with it can be expensive. Because of this, you should:
- Initialize shader objects when your game launches, not while the game is running. - Avoid changing the shader’s source or changing the list of uniforms or attributes while your game is running. Either of these things recompiles the shader. - Share shader objects whenever possible. If multiple sprites need the same behavior, create one shader object and associate it with every sprite that needs that behavior. Do not create a separate shader for each sprite.
Creating a Shader ¶
- SKShader.InitWithSourceUniforms: Initializes a new shader object using the specified source and uniform data.
- SKShader.InitWithSource: Initializes a new shader object using the specified source code.
Providing Uniform Data to a Shader ¶
- SKShader.AddUniform: Adds a uniform to the shader.
- SKShader.RemoveUniformNamed: Removes a uniform from the shader.
- SKShader.Uniforms: The list of uniforms associated with the shader.
- SKShader.SetUniforms
- SKShader.UniformNamed: Returns the uniform object corresponding to a particular uniform variable.
Providing Attribute Data to a Shader ¶
- SKShader.Attributes: The list of attributes associated with the shader.
- SKShader.SetAttributes
Accessing or Setting a Shader’s Source Code ¶
- SKShader.Source: The source code for the shader.
- SKShader.SetSource
See: https://developer.apple.com/documentation/SpriteKit/SKShader
func NewShaderWithFileNamed ¶
Creates a new shader object by loading the source for a fragment shader from a file stored in the app’s bundle.
name: The name of the fragment shader to load. The file must be present in your app bundle with the same name and a `XCUIElementTypeFsh` file extension.
Return Value ¶
A newly initialized shader object whose initial source is loaded from the shader file.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/init(fileNamed:)
func NewShaderWithSource ¶
Initializes a new shader object using the specified source code.
source: A string that holds the initial source for the shader.
Return Value ¶
An initialized shader object.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/init(source:)
func NewShaderWithSourceUniforms ¶
Initializes a new shader object using the specified source and uniform data.
source: A string that holds the initial source for the shader.
uniforms: A list of uniforms to add to the shader object.
Return Value ¶
An initialized shader object.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/init(source:uniforms:)
func SKShaderFromID ¶
SKShaderFromID constructs a SKShader from an objc.ID.
An object that allows you to apply a custom fragment shader.
func (SKShader) AddUniform ¶
func (s SKShader) AddUniform(uniform ISKUniform)
Adds a uniform to the shader.
uniform: The new uniform object to add. The uniform object’s name must not already be in use by another uniform attached to the shader.
Discussion ¶
The uniform variable is automatically accessible inside your shader; do not add a declaration for it in your shader’s source code. The uniform must be accessed in the fragment shader.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/addUniform(_:)
func (SKShader) Attributes ¶
func (s SKShader) Attributes() []SKAttribute
The list of attributes associated with the shader.
Discussion ¶
This property is not read-only, so you can also use it to provide all of the attributes in a single operation. Each of the attributes should be uniquely named.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/attributes
func (SKShader) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (SKShader) EncodeWithCoder ¶
func (s SKShader) EncodeWithCoder(coder foundation.INSCoder)
func (SKShader) InitWithSource ¶
Initializes a new shader object using the specified source code.
source: A string that holds the initial source for the shader.
Return Value ¶
An initialized shader object.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/init(source:)
func (SKShader) InitWithSourceUniforms ¶
Initializes a new shader object using the specified source and uniform data.
source: A string that holds the initial source for the shader.
uniforms: A list of uniforms to add to the shader object.
Return Value ¶
An initialized shader object.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/init(source:uniforms:)
func (SKShader) RemoveUniformNamed ¶
Removes a uniform from the shader.
name: The name of the uniform to remove.
Discussion ¶
If a uniform with that name does not exist in the shader, nothing happens.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/removeUniformNamed(_:)
func (SKShader) SetAttributes ¶
func (s SKShader) SetAttributes(value []SKAttribute)
func (SKShader) SetUniforms ¶
func (SKShader) Source ¶
The source code for the shader.
Discussion ¶
The source code for a shader object can be updated at runtime. However, recompiling the fragment shader can be an expensive operation.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/source
func (SKShader) UniformNamed ¶
func (s SKShader) UniformNamed(name string) ISKUniform
Returns the uniform object corresponding to a particular uniform variable.
name: The name of the uniform to search for.
Return Value ¶
The uniform object corresponding to the name, or `nil` if that uniform cannot be found.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/uniformNamed(_:)
func (SKShader) Uniforms ¶
The list of uniforms associated with the shader.
Discussion ¶
This property is not read-only, so you can also use it to provide all of the uniforms in a single operation. Each of the uniforms should be uniquely named.
See: https://developer.apple.com/documentation/SpriteKit/SKShader/uniforms
type SKShaderClass ¶
type SKShaderClass struct {
// contains filtered or unexported fields
}
func GetSKShaderClass ¶
func GetSKShaderClass() SKShaderClass
GetSKShaderClass returns the class object for SKShader.
func (SKShaderClass) Alloc ¶
func (sc SKShaderClass) Alloc() SKShader
Alloc allocates memory for a new instance of the class.
func (SKShaderClass) Class ¶
func (sc SKShaderClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKShapeNode ¶
type SKShapeNode struct {
SKNode
}
A mathematical shape that can be stroked or filled.
Overview ¶
SKShapeNode allows you to create onscreen graphical elements from mathematical points, lines, and curves. The advantage this has over rasterized graphics, such as those displayed by textures, is that shapes are rasterized dynamically at runtime to produce crisp detail and smoother edges.
Creating a Shape from a Path ¶
- SKShapeNode.Path: The path that defines the shape.
- SKShapeNode.SetPath
Filling a Shape ¶
- SKShapeNode.FillColor: The color used to fill the shape.
- SKShapeNode.SetFillColor
- SKShapeNode.FillTexture: The texture used to fill the shape.
- SKShapeNode.SetFillTexture
Stroking a Shape ¶
- SKShapeNode.LineWidth: The width used to stroke the path.
- SKShapeNode.SetLineWidth
- SKShapeNode.StrokeColor: The color used to stroke the shape.
- SKShapeNode.SetStrokeColor
- SKShapeNode.StrokeTexture: The texture used to stroke the shape.
- SKShapeNode.SetStrokeTexture
- SKShapeNode.GlowWidth: A glow that extends outward from the stroked line.
- SKShapeNode.SetGlowWidth
- SKShapeNode.LineCap: The style used to render the endpoints of the stroked portion of the shape node.
- SKShapeNode.SetLineCap
- SKShapeNode.LineJoin: The junction type used when the stroked portion of the shape node is rendered.
- SKShapeNode.SetLineJoin
- SKShapeNode.MiterLimit: The miter limit to use when the line is stroked using a miter join style.
- SKShapeNode.SetMiterLimit
- SKShapeNode.IsAntialiased: A Boolean value that determines whether the stroked path is smoothed when drawn.
- SKShapeNode.SetAntialiased
Configuring Alpha Blending ¶
- SKShapeNode.BlendMode: The blend mode used to blend the shape into the parent’s framebuffer.
- SKShapeNode.SetBlendMode
Controlling or Animating Sroke Length ¶
- SKShapeNode.LineLength: The length of the line defined by the shape node.
Customizing Stroking or Fill Drawing ¶
- SKShapeNode.StrokeShader: A custom shader used to determine the color of the stroked portion of the shape node.
- SKShapeNode.SetStrokeShader
- SKShapeNode.FillShader: A custom shader used to determine the color of the filled portion of the shape node.
- SKShapeNode.SetFillShader
- SKShapeNode.AttributeValues: The values of each attribute associated with the node’s attached shader.
- SKShapeNode.SetAttributeValues
- SKShapeNode.SetValueForAttributeNamed: Sets an attribute value for an attached shader.
- SKShapeNode.ValueForAttributeNamed: The value of a shader attribute.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode
func NewSKShapeNode ¶
func NewSKShapeNode() SKShapeNode
NewSKShapeNode creates a new SKShapeNode instance.
func NewShapeNodeWithCircleOfRadius ¶
func NewShapeNodeWithCircleOfRadius(radius float64) SKShapeNode
Creates a shape node with a circular path centered on the node’s origin.
radius: The radius of the circle.
Return Value ¶
A new shape node.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(circleOfRadius:)
func NewShapeNodeWithCoder ¶
func NewShapeNodeWithCoder(aDecoder foundation.INSCoder) SKShapeNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewShapeNodeWithEllipseInRect ¶
func NewShapeNodeWithEllipseInRect(rect corefoundation.CGRect) SKShapeNode
Creates a shape node with an elliptical path that fills the specified rectangle.
rect: A rectangle, relative to the node’s origin.
Return Value ¶
A new shape node.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(ellipseIn:)
func NewShapeNodeWithEllipseOfSize ¶
func NewShapeNodeWithEllipseOfSize(size corefoundation.CGSize) SKShapeNode
Creates a shape node with an elliptical path centered on the node’s origin.
size: The height and width of the ellipse.
Return Value ¶
A new shape node.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(ellipseOf:)
func NewShapeNodeWithFileNamed ¶
func NewShapeNodeWithFileNamed(filename string) SKShapeNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewShapeNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewShapeNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKShapeNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewShapeNodeWithPath ¶
func NewShapeNodeWithPath(path coregraphics.CGPathRef) SKShapeNode
Creates a shape node from a Core Graphics path.
path: The Core Graphics path to use. The path is relative to the node’s origin.
Return Value ¶
A new shape node.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(path:)
func NewShapeNodeWithPathCentered ¶
func NewShapeNodeWithPathCentered(path coregraphics.CGPathRef, centered bool) SKShapeNode
Creates a shape node from a Core Graphics path, centered around its position.
path: The Core Graphics path to use.
centered: If true, the path is translated so that the center of the path’s bounding box is at the node’s origin; otherwise the path is relative to the node’s origin.
Return Value ¶
A new shape node.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(path:centered:)
func NewShapeNodeWithPointsCount ¶
func NewShapeNodeWithPointsCount(points []corefoundation.CGPoint, numPoints uintptr) SKShapeNode
Creates a shape node from a series of points.
points: An array of Core Graphics points. The points are relative to the node’s origin.
numPoints: The number of points in the array.
Return Value ¶
A new shape node. The node is created with a path that starts at the first point in the array, joining each adjacent pair of points with a line segment.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(points:count:)
func NewShapeNodeWithRect ¶
func NewShapeNodeWithRect(rect corefoundation.CGRect) SKShapeNode
Creates a shape node with a rectangular path.
rect: A rectangle, relative to the node’s origin.
Return Value ¶
A new shape node.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(rect:)
func NewShapeNodeWithRectCornerRadius ¶
func NewShapeNodeWithRectCornerRadius(rect corefoundation.CGRect, cornerRadius float64) SKShapeNode
Creates a shape with a rectangular path that has rounded corners.
rect: A rectangle, relative to the node’s origin.
cornerRadius: The radius of the rounded corners. The radius should not be a negative number. The value should be no larger than half of the rectangle’s width or height, whichever is smaller.
Return Value ¶
A new shape node.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(rect:cornerRadius:)
func NewShapeNodeWithRectOfSize ¶
func NewShapeNodeWithRectOfSize(size corefoundation.CGSize) SKShapeNode
Creates a shape node with a rectangular path centered on the node’s origin.
size: The size of the rectangle.
Return Value ¶
A new shape node.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(rectOf:)
func NewShapeNodeWithRectOfSizeCornerRadius ¶
func NewShapeNodeWithRectOfSizeCornerRadius(size corefoundation.CGSize, cornerRadius float64) SKShapeNode
Creates a shape with a rectangular path that has rounded corners centered on the node’s position.
size: The size of the rectangle.
cornerRadius: The radius of the rounded corners. The radius should not be a negative number. The value should be no larger than half of the rectangle’s width or height, whichever is smaller.
Return Value ¶
A new shape node.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(rectOf:cornerRadius:)
func NewShapeNodeWithSplinePointsCount ¶
func NewShapeNodeWithSplinePointsCount(points []corefoundation.CGPoint, numPoints uintptr) SKShapeNode
Creates a shape node from a series of spline points.
points: An array of Core Graphics points.
numPoints: The number of points in the array.
Return Value ¶
A new shape node is created. The node is created with a path that starts at the first point in the array, joining each pair of points with a quadratic curve. The control points are calculated automatically based on previous points in the array.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/init(splinePoints:count:)
func SKShapeNodeFromID ¶
func SKShapeNodeFromID(id objc.ID) SKShapeNode
SKShapeNodeFromID constructs a SKShapeNode from an objc.ID.
A mathematical shape that can be stroked or filled.
func (SKShapeNode) AttributeValues ¶
func (s SKShapeNode) AttributeValues() foundation.INSDictionary
The values of each attribute associated with the node’s attached shader.
Discussion ¶
All nodes have their own copy of an attribute value and therefore the attribute values can be different across the same SKShader. If instead you need all nodes to share the same value, use SKUniform. Uniforms can change values every frame, but uniforms cannot vary per-node like attributes can.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/attributeValues
func (SKShapeNode) Autorelease ¶
func (s SKShapeNode) Autorelease() SKShapeNode
Autorelease adds the receiver to the current autorelease pool.
func (SKShapeNode) BlendMode ¶
func (s SKShapeNode) BlendMode() SKBlendMode
The blend mode used to blend the shape into the parent’s framebuffer.
Discussion ¶
The default value is SKBlendMode.alpha.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/blendMode
func (SKShapeNode) FillColor ¶
func (s SKShapeNode) FillColor() appkit.NSColor
The color used to fill the shape.
Discussion ¶
The default fill color is `[SKColor clearColor]`, which means the shape is not filled.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/fillColor
func (SKShapeNode) FillShader ¶
func (s SKShapeNode) FillShader() ISKShader
A custom shader used to determine the color of the filled portion of the shape node.
Discussion ¶
The default value is `nil`. If a `fillShader` is specified, when the shape node is drawn, the shader is used to determine the output colors for any part of the shape node that’s fillled. SpriteKit implements many fill features using a default shader, such as:
- Fill color. - Animations on SKNode.Alpha. - Light cast by SKLightNode.
If you supply a custom value for `fillShader`, your custom shader overrides the default shader which neutralizes the default features. It is the responsibility of your custom fillShader to implement any of the features your shape requires.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/fillShader
func (SKShapeNode) FillTexture ¶
func (s SKShapeNode) FillTexture() ISKTexture
The texture used to fill the shape.
Discussion ¶
The default value is `nil`. If a fill texture is specified, the shape node is rendered using that texture blended with the SKShapeNode.FillColor.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/fillTexture
func (SKShapeNode) GlowWidth ¶
func (s SKShapeNode) GlowWidth() float64
A glow that extends outward from the stroked line.
Discussion ¶
The default value is `0.0`, which means no glow is added. The glow color is determined by SKShapeNode.StrokeColor.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/glowWidth
func (SKShapeNode) IsAntialiased ¶
func (s SKShapeNode) IsAntialiased() bool
A Boolean value that determines whether the stroked path is smoothed when drawn.
Discussion ¶
The default value is true.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/isAntialiased
func (SKShapeNode) LineCap ¶
func (s SKShapeNode) LineCap() int32
The style used to render the endpoints of the stroked portion of the shape node.
Discussion ¶
The default value is CGLineCap.butt. See CGLineCap.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/lineCap
func (SKShapeNode) LineJoin ¶
func (s SKShapeNode) LineJoin() int32
The junction type used when the stroked portion of the shape node is rendered.
Discussion ¶
The default value is CGLineJoin.bevel. See CGLineJoin.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/lineJoin
func (SKShapeNode) LineLength ¶
func (s SKShapeNode) LineLength() float64
The length of the line defined by the shape node.
Discussion ¶
This property takes effect only when the shape has a stroke. The valid range is between `[0.1]` where one indicates that the shape is fully stroked, and zero indicates that the shape is not stroked at all. By interpolating this value over time (for example, in your scene’s SKScene.Update callback), you can animate the shape as if it were drawn in real time.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/lineLength
func (SKShapeNode) LineWidth ¶
func (s SKShapeNode) LineWidth() float64
The width used to stroke the path.
Discussion ¶
A line width larger than `2.0` may cause rendering artifacts in the final rendered image. The default value is `1.0`.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/lineWidth
func (SKShapeNode) MiterLimit ¶
func (s SKShapeNode) MiterLimit() float64
The miter limit to use when the line is stroked using a miter join style.
Discussion ¶
If the line join style is set to CGLineJoin.miter, SpriteKit uses the miter limit to determine whether the lines should be joined with a bevel instead of a miter. SpriteKit divides the length of the miter by the line width. If the result is greater than the miter limit, SpriteKit converts the style to a bevel.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/miterLimit
func (SKShapeNode) Path ¶
func (s SKShapeNode) Path() coregraphics.CGPathRef
The path that defines the shape.
Discussion ¶
The path is defined in the node’s coordinate space.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/path
func (SKShapeNode) SetAntialiased ¶
func (s SKShapeNode) SetAntialiased(value bool)
func (SKShapeNode) SetAttributeValues ¶
func (s SKShapeNode) SetAttributeValues(value foundation.INSDictionary)
func (SKShapeNode) SetBlendMode ¶
func (s SKShapeNode) SetBlendMode(value SKBlendMode)
func (SKShapeNode) SetFillColor ¶
func (s SKShapeNode) SetFillColor(value appkit.NSColor)
func (SKShapeNode) SetFillShader ¶
func (s SKShapeNode) SetFillShader(value ISKShader)
func (SKShapeNode) SetFillTexture ¶
func (s SKShapeNode) SetFillTexture(value ISKTexture)
func (SKShapeNode) SetGlowWidth ¶
func (s SKShapeNode) SetGlowWidth(value float64)
func (SKShapeNode) SetLineCap ¶
func (s SKShapeNode) SetLineCap(value int32)
func (SKShapeNode) SetLineJoin ¶
func (s SKShapeNode) SetLineJoin(value int32)
func (SKShapeNode) SetLineWidth ¶
func (s SKShapeNode) SetLineWidth(value float64)
func (SKShapeNode) SetMiterLimit ¶
func (s SKShapeNode) SetMiterLimit(value float64)
func (SKShapeNode) SetPath ¶
func (s SKShapeNode) SetPath(value coregraphics.CGPathRef)
func (SKShapeNode) SetStrokeColor ¶
func (s SKShapeNode) SetStrokeColor(value appkit.NSColor)
func (SKShapeNode) SetStrokeShader ¶
func (s SKShapeNode) SetStrokeShader(value ISKShader)
func (SKShapeNode) SetStrokeTexture ¶
func (s SKShapeNode) SetStrokeTexture(value ISKTexture)
func (SKShapeNode) SetValueForAttributeNamed ¶
func (s SKShapeNode) SetValueForAttributeNamed(value ISKAttributeValue, key string)
Sets an attribute value for an attached shader.
value: An attribute value object containing the scalar or vector value to set in the attached shader.
key: The attribute name.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/setValue(_:forAttribute:)
func (SKShapeNode) StrokeColor ¶
func (s SKShapeNode) StrokeColor() appkit.NSColor
The color used to stroke the shape.
Discussion ¶
The default stroke color is `[SKColor whiteColor]`. If you do not want to stroke the shape, use `[SKColor clearColor].`
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/strokeColor
func (SKShapeNode) StrokeShader ¶
func (s SKShapeNode) StrokeShader() ISKShader
A custom shader used to determine the color of the stroked portion of the shape node.
Discussion ¶
The default value is `nil`. If a `strokeShader` is specified, when the shape node is drawn, the shader is used to determine the output colors for any part of the shape node that’s stroked. SpriteKit implements many stroke features using a default shader, such as:
- lineCap - SKShapeNode.GlowWidth - SKShapeNode.StrokeColor
If you supply a custom value for `strokeShader`, your custom shader overrides the default shader which neutralizes the default features. It is the responsibility of your custom `strokeShader` to implement any of the features your shape requires.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/strokeShader
func (SKShapeNode) StrokeTexture ¶
func (s SKShapeNode) StrokeTexture() ISKTexture
The texture used to stroke the shape.
Discussion ¶
The default value is `nil`. If a stroke texture is specified, the SKShapeNode.StrokeColor property is ignored and the stroked portion of the shape node is rendered using the texture instead.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/strokeTexture
func (SKShapeNode) ValueForAttributeNamed ¶
func (s SKShapeNode) ValueForAttributeNamed(key string) ISKAttributeValue
The value of a shader attribute.
key: The attribute name.
Return Value ¶
An attribute value object containing the scalar or vector value or `nil` if no such attribute exists.
See: https://developer.apple.com/documentation/SpriteKit/SKShapeNode/value(forAttributeNamed:)
type SKShapeNodeClass ¶
type SKShapeNodeClass struct {
// contains filtered or unexported fields
}
func GetSKShapeNodeClass ¶
func GetSKShapeNodeClass() SKShapeNodeClass
GetSKShapeNodeClass returns the class object for SKShapeNode.
func (SKShapeNodeClass) Alloc ¶
func (sc SKShapeNodeClass) Alloc() SKShapeNode
Alloc allocates memory for a new instance of the class.
func (SKShapeNodeClass) Class ¶
func (sc SKShapeNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKSpriteNode ¶
type SKSpriteNode struct {
SKNode
}
An image or solid color.
Overview ¶
SKSpriteNode is an onscreen graphical element that can be initialized from an image or a solid color. SpriteKit adds functionality to its ability to display images using the functions discussed below.
Creating a Sprite from an Image Filename ¶
- SKSpriteNode.InitWithImageNamed: Initializes a textured sprite using an image file.
Creating a Sprite from a Texture ¶
- SKSpriteNode.InitWithTexture: Initializes a textured sprite using an existing texture object.
- SKSpriteNode.InitWithTextureColorSize: Initializes a textured sprite in color using an existing texture object.
- SKSpriteNode.Texture: The texture used to draw the sprite.
- SKSpriteNode.SetTexture
Creating a Solid-Color Sprite ¶
- SKSpriteNode.InitWithColorSize: Initializes a single-color sprite node.
Setting a Sprite’s Size and Position ¶
- SKSpriteNode.Size: The dimensions of the sprite, in points.
- SKSpriteNode.SetSize
- SKSpriteNode.ScaleToSize: Scales the sprite node to a specified size.
- SKSpriteNode.AnchorPoint: Defines the point in the sprite that corresponds to the node’s position.
- SKSpriteNode.SetAnchorPoint
Scaling a Sprite in Nine Parts ¶
- SKSpriteNode.CenterRect: Enable nine-part stretching of the sprite’s texture.
- SKSpriteNode.SetCenterRect
Tinting a Sprite ¶
- SKSpriteNode.Color: The sprite’s color.
- SKSpriteNode.SetColor
- SKSpriteNode.ColorBlendFactor: A floating-point value that describes how the color is blended with the sprite’s texture.
- SKSpriteNode.SetColorBlendFactor
Configuring Alpha Blendling ¶
- SKSpriteNode.BlendMode: The blend mode used to draw the sprite into the parent’s framebuffer.
- SKSpriteNode.SetBlendMode
Lighting a Sprite ¶
- SKSpriteNode.LightingBitMask: A mask that defines how this sprite is lit by light nodes in the scene.
- SKSpriteNode.SetLightingBitMask
- SKSpriteNode.ShadowedBitMask: A mask that defines which lights add shadows to the sprite.
- SKSpriteNode.SetShadowedBitMask
- SKSpriteNode.ShadowCastBitMask: A mask that defines which lights are occluded by this sprite.
- SKSpriteNode.SetShadowCastBitMask
- SKSpriteNode.NormalTexture: A texture that specifies the normal map for the sprite.
- SKSpriteNode.SetNormalTexture
Adding a Custom Shader to a Sprite ¶
- SKSpriteNode.Shader: A text file that defines code that does custom per-pixel drawing or colorization.
- SKSpriteNode.SetShader
- SKSpriteNode.AttributeValues: The values of each attribute associated with the node’s attached shader.
- SKSpriteNode.SetAttributeValues
- SKSpriteNode.SetValueForAttributeNamed: Sets an attribute value for an attached shader.
- SKSpriteNode.ValueForAttributeNamed: Sets the value of a shader attribute.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode
func NewSKSpriteNode ¶
func NewSKSpriteNode() SKSpriteNode
NewSKSpriteNode creates a new SKSpriteNode instance.
func NewSpriteNodeWithCoder ¶
func NewSpriteNodeWithCoder(aDecoder foundation.INSCoder) SKSpriteNode
Tells you when to initialize a sprite from an archive.
Discussion ¶
Don’t call this function directly; the system calls this function when you should initialize your sprite from the argument archived data.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(coder:)
func NewSpriteNodeWithColorSize ¶
func NewSpriteNodeWithColorSize(color appkit.NSColor, size corefoundation.CGSize) SKSpriteNode
Initializes a single-color sprite node.
color: The color for the resulting sprite node.
size: The size of the sprite node in points.
Return Value ¶
A newly initialized sprite node.
Discussion ¶
Although textured nodes are the most common way to use the SKSpriteNode class, you can also create sprite nodes without a texture. The behavior of the class changes when the node lacks a texture:
- The sprite node that is returned from this method has its SKSpriteNode.Texture property set to `nil`. - There is no texture to stretch, so the SKSpriteNode.CenterRect parameter is ignored. - There is no colorization step; the SKSpriteNode.Color property is used as the sprite’s color. - The sprite node’s SKNode.Alpha component is used to determine how it is blended into the buffer.
Listing 1 shows how to create a red sprite node `100 x 100` points in size.
Listing 1. Creating a non-textured sprite node
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(color:size:)
func NewSpriteNodeWithFileNamed ¶
func NewSpriteNodeWithFileNamed(filename string) SKSpriteNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewSpriteNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewSpriteNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKSpriteNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewSpriteNodeWithImageNamed ¶
func NewSpriteNodeWithImageNamed(name string) SKSpriteNode
Initializes a textured sprite using an image file.
name: The name of an image file stored in the app bundle.
Return Value ¶
A newly initialized sprite object.
Discussion ¶
This method creates a new texture object from the image file and assigns that texture to the SKSpriteNode.Texture property, the SKSpriteNode.NormalTexture properties is set to `nil`. The SKSpriteNode.Size property of the sprite is set to the dimensions of the image. The SKSpriteNode.Color property is set to white with an alpha of zero `(1.0,1.0,1.0,0.0)`.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(imageNamed:)
func NewSpriteNodeWithImageNamedNormalMapped ¶
func NewSpriteNodeWithImageNamedNormalMapped(name string, generateNormalMap bool) SKSpriteNode
Initializes a textured sprite using an image file, optionally adding a normal map to simulate 3D lighting.
name: The name of an image file stored in the app bundle.
generateNormalMap: If true, a normal map is generated from the image texture without applying any filter to it (SKTextureNormalMapFilteringTypeNone). If false, no normal map is generated (matching the behavior of the spriteNodeWithImageNamed: class method).
Return Value ¶
A newly initialized sprite object.
Discussion ¶
The normal map is used only when lighting is enabled in the scene. For more information, see SKSpriteNode and SKLightNode.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(imageNamed:normalMapped:)
func NewSpriteNodeWithTexture ¶
func NewSpriteNodeWithTexture(texture ISKTexture) SKSpriteNode
Initializes a textured sprite using an existing texture object.
texture: A SpriteKit texture.
Return Value ¶
A newly initialized sprite object.
Discussion ¶
The SKSpriteNode.Size property of the sprite is set to the dimensions of the texture. The SKSpriteNode.Color property is set to white with an alpha of zero `(1.0,1.0,1.0,0.0)`.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(texture:)
func NewSpriteNodeWithTextureColorSize ¶
func NewSpriteNodeWithTextureColorSize(texture ISKTexture, color appkit.NSColor, size corefoundation.CGSize) SKSpriteNode
Initializes a textured sprite in color using an existing texture object.
texture: A texture to apply to the sprite.
color: The color for the new sprite.
size: The size for the new sprite.
Return Value ¶
A newly initialized sprite object.
Discussion ¶
To colorize your texture, you also need to set the SKSpriteNode.ColorBlendFactor property of the sprite.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(texture:color:size:)
func NewSpriteNodeWithTextureNormalMap ¶
func NewSpriteNodeWithTextureNormalMap(texture ISKTexture, normalMap ISKTexture) SKSpriteNode
Initializes a textured sprite with a normal map to simulate 3D lighting.
texture: A SpriteKit texture used to draw the sprite.
normalMap: A SpriteKit texture used to add lighting behavior to the sprite.
Return Value ¶
A newly initialized sprite object.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(texture:normalMap:)
func NewSpriteNodeWithTextureSize ¶
func NewSpriteNodeWithTextureSize(texture ISKTexture, size corefoundation.CGSize) SKSpriteNode
Initializes a textured sprite using an existing texture object but with a specified size.
texture: A SpriteKit texture.
size: The size of the sprite in points.
Return Value ¶
A newly initialized sprite object.
Discussion ¶
The sprite is initialized using the texture, but the texture’s dimensions are not used. Instead, the size passed into the constructor method is used.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(texture:size:)
func SKSpriteNodeFromID ¶
func SKSpriteNodeFromID(id objc.ID) SKSpriteNode
SKSpriteNodeFromID constructs a SKSpriteNode from an objc.ID.
An image or solid color.
func (SKSpriteNode) AnchorPoint ¶
func (s SKSpriteNode) AnchorPoint() corefoundation.CGPoint
Defines the point in the sprite that corresponds to the node’s position.
Discussion ¶
You specify the value for this property in the unit coordinate space. The default value is `(0.5,0.5)`, which means that the sprite is centered on its position.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/anchorPoint
func (SKSpriteNode) AttributeValues ¶
func (s SKSpriteNode) AttributeValues() foundation.INSDictionary
The values of each attribute associated with the node’s attached shader.
Discussion ¶
All nodes have their own copy of an attribute value and therefore the attribute values can be different per-node across the same SKShader. If instead you need all nodes to share the same value, use SKUniform. Uniforms can change values every frame, but uniforms cannot vary per-node like attributes can.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/attributeValues
func (SKSpriteNode) Autorelease ¶
func (s SKSpriteNode) Autorelease() SKSpriteNode
Autorelease adds the receiver to the current autorelease pool.
func (SKSpriteNode) BlendMode ¶
func (s SKSpriteNode) BlendMode() SKBlendMode
The blend mode used to draw the sprite into the parent’s framebuffer.
Discussion ¶
The default value is SKBlendMode.alpha.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/blendMode
func (SKSpriteNode) CenterRect ¶
func (s SKSpriteNode) CenterRect() corefoundation.CGRect
Enable nine-part stretching of the sprite’s texture.
Discussion ¶
Controls how the texture is stretched to fill the SKSpriteNode.
The argument rectangle is in the unit coordinate space with a default value of `(0,0)-(1.0,1.0)`, which indicates that the entire texture is stretched to fill the sprite.
If instead you define a different rectangle, its coordinates are used to break the texture into a 3 x 3 grid that is scaled like the following:
- The four corners of this grid are applied without performing any scaling. - The upper and lower-middle parts are scaled horizontally - The left and right-middle parts are scaled vertically - The center is scaled in all directions.
This is what’s referred to as a 9-part scaling algorithm.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/centerRect
func (SKSpriteNode) Color ¶
func (s SKSpriteNode) Color() appkit.NSColor
The sprite’s color.
Discussion ¶
If the SKSpriteNode.Texture property is non-`nil`, the red, green, and blue values of the color property are blended with the texture before the texture is drawn and the alpha property is ignored. If the SKSpriteNode.Texture property is `nil`, the color (including the alpha component) is used to draw a single-color rectangle.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/color
func (SKSpriteNode) ColorBlendFactor ¶
func (s SKSpriteNode) ColorBlendFactor() float64
A floating-point value that describes how the color is blended with the sprite’s texture.
Discussion ¶
The value must be a number between `0.0` and `1.0`, inclusive. The default value (`0.0`) indicates the color property is ignored and that the texture’s values should be used unmodified. For values greater than `0.0`, the texture is blended with the color before being drawn to the scene.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/colorBlendFactor
func (SKSpriteNode) InitWithColorSize ¶
func (s SKSpriteNode) InitWithColorSize(color appkit.NSColor, size corefoundation.CGSize) SKSpriteNode
Initializes a single-color sprite node.
color: The color for the resulting sprite node.
size: The size of the sprite node in points.
Return Value ¶
A newly initialized sprite node.
Discussion ¶
Although textured nodes are the most common way to use the SKSpriteNode class, you can also create sprite nodes without a texture. The behavior of the class changes when the node lacks a texture:
- The sprite node that is returned from this method has its SKSpriteNode.Texture property set to `nil`. - There is no texture to stretch, so the SKSpriteNode.CenterRect parameter is ignored. - There is no colorization step; the SKSpriteNode.Color property is used as the sprite’s color. - The sprite node’s SKNode.Alpha component is used to determine how it is blended into the buffer.
Listing 1 shows how to create a red sprite node `100 x 100` points in size.
Listing 1. Creating a non-textured sprite node
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(color:size:)
func (SKSpriteNode) InitWithImageNamed ¶
func (s SKSpriteNode) InitWithImageNamed(name string) SKSpriteNode
Initializes a textured sprite using an image file.
name: The name of an image file stored in the app bundle.
Return Value ¶
A newly initialized sprite object.
Discussion ¶
This method creates a new texture object from the image file and assigns that texture to the SKSpriteNode.Texture property, the SKSpriteNode.NormalTexture properties is set to `nil`. The SKSpriteNode.Size property of the sprite is set to the dimensions of the image. The SKSpriteNode.Color property is set to white with an alpha of zero `(1.0,1.0,1.0,0.0)`.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(imageNamed:)
func (SKSpriteNode) InitWithTexture ¶
func (s SKSpriteNode) InitWithTexture(texture ISKTexture) SKSpriteNode
Initializes a textured sprite using an existing texture object.
texture: A SpriteKit texture.
Return Value ¶
A newly initialized sprite object.
Discussion ¶
The SKSpriteNode.Size property of the sprite is set to the dimensions of the texture. The SKSpriteNode.Color property is set to white with an alpha of zero `(1.0,1.0,1.0,0.0)`.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(texture:)
func (SKSpriteNode) InitWithTextureColorSize ¶
func (s SKSpriteNode) InitWithTextureColorSize(texture ISKTexture, color appkit.NSColor, size corefoundation.CGSize) SKSpriteNode
Initializes a textured sprite in color using an existing texture object.
texture: A texture to apply to the sprite.
color: The color for the new sprite.
size: The size for the new sprite.
Return Value ¶
A newly initialized sprite object.
Discussion ¶
To colorize your texture, you also need to set the SKSpriteNode.ColorBlendFactor property of the sprite.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/init(texture:color:size:)
func (SKSpriteNode) LightingBitMask ¶
func (s SKSpriteNode) LightingBitMask() uint32
A mask that defines how this sprite is lit by light nodes in the scene.
Discussion ¶
To determine whether this sprite is lit by a light node, the sprite’s SKSpriteNode.LightingBitMask property is tested against the light’s categoryBitMask property by performing a logical AND operation. If the comparison results in a nonzero value, the sprite is lit by this light.
The default value is 0x00000000 (all bits cleared).
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/lightingBitMask
func (SKSpriteNode) NormalTexture ¶
func (s SKSpriteNode) NormalTexture() ISKTexture
A texture that specifies the normal map for the sprite.
Discussion ¶
A normal map texture is used when a sprite is lit, giving it a more realistic look with shadows and specular highlights. The texture must be a normal map texture.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/normalTexture
func (SKSpriteNode) ScaleToSize ¶
func (s SKSpriteNode) ScaleToSize(size corefoundation.CGSize)
Scales the sprite node to a specified size.
Discussion ¶
This method works by setting the sprite node’s SKNode.XScale and SKNode.YScale to achieve the specified size in its parent’s coordinate space.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/scale(to:)
func (SKSpriteNode) SetAnchorPoint ¶
func (s SKSpriteNode) SetAnchorPoint(value corefoundation.CGPoint)
func (SKSpriteNode) SetAttributeValues ¶
func (s SKSpriteNode) SetAttributeValues(value foundation.INSDictionary)
func (SKSpriteNode) SetBlendMode ¶
func (s SKSpriteNode) SetBlendMode(value SKBlendMode)
func (SKSpriteNode) SetCenterRect ¶
func (s SKSpriteNode) SetCenterRect(value corefoundation.CGRect)
func (SKSpriteNode) SetColor ¶
func (s SKSpriteNode) SetColor(value appkit.NSColor)
func (SKSpriteNode) SetColorBlendFactor ¶
func (s SKSpriteNode) SetColorBlendFactor(value float64)
func (SKSpriteNode) SetLightingBitMask ¶
func (s SKSpriteNode) SetLightingBitMask(value uint32)
func (SKSpriteNode) SetNormalTexture ¶
func (s SKSpriteNode) SetNormalTexture(value ISKTexture)
func (SKSpriteNode) SetShader ¶
func (s SKSpriteNode) SetShader(value ISKShader)
func (SKSpriteNode) SetShadowCastBitMask ¶
func (s SKSpriteNode) SetShadowCastBitMask(value uint32)
func (SKSpriteNode) SetShadowedBitMask ¶
func (s SKSpriteNode) SetShadowedBitMask(value uint32)
func (SKSpriteNode) SetSize ¶
func (s SKSpriteNode) SetSize(value corefoundation.CGSize)
func (SKSpriteNode) SetSubdivisionLevels ¶
func (o SKSpriteNode) SetSubdivisionLevels(value int)
The maximum number of subdivision iterations used to generate the final vertices.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/subdivisionLevels
func (SKSpriteNode) SetTexture ¶
func (s SKSpriteNode) SetTexture(value ISKTexture)
func (SKSpriteNode) SetValueForAttributeNamed ¶
func (s SKSpriteNode) SetValueForAttributeNamed(value ISKAttributeValue, key string)
Sets an attribute value for an attached shader.
value: An attribute value object containing the scalar or vector value to set in the attached shader.
key: The attribute name.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/setValue(_:forAttribute:)
func (SKSpriteNode) SetWarpGeometry ¶
func (o SKSpriteNode) SetWarpGeometry(value ISKWarpGeometry)
The warp geometry used to define the distortion.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/warpGeometry
func (SKSpriteNode) Shader ¶
func (s SKSpriteNode) Shader() ISKShader
A text file that defines code that does custom per-pixel drawing or colorization.
Discussion ¶
The default value is `nil`, which means the default behavior for sprite rendering is performed. SpriteKit implements many sprite features using a default shader, such as:
- Animations on SKNode.Alpha. - SKTexture SKTexture.FilteringMode. - Light from SKLightNode.
If you supply a custom value for `shader`, your custom shader overrides the default shader which neutralizes the default features. It is the responsibility of your custom shader to implement any of the features your sprites require.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/shader
func (SKSpriteNode) ShadowCastBitMask ¶
func (s SKSpriteNode) ShadowCastBitMask() uint32
A mask that defines which lights are occluded by this sprite.
Discussion ¶
To determine whether this sprite blocks the light (casting a shadow), the sprite’s SKSpriteNode.ShadowedBitMask property is tested against the light’s categoryBitMask property by performing a logical AND operation. If the comparison results in a nonzero value, the sprite casts a shadow past itself.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/shadowCastBitMask
func (SKSpriteNode) ShadowedBitMask ¶
func (s SKSpriteNode) ShadowedBitMask() uint32
A mask that defines which lights add shadows to the sprite.
Discussion ¶
To determine whether this sprite is affected by being a shadow generated by a light, its SKSpriteNode.ShadowCastBitMask property is tested against the light’s categoryBitMask property by performing a logical AND operation. If the comparison results in a nonzero value, the sprite is drawn using a shadowed effect.
The default value is 0x00000000 (all bits cleared).
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/shadowedBitMask
func (SKSpriteNode) Size ¶
func (s SKSpriteNode) Size() corefoundation.CGSize
The dimensions of the sprite, in points.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/size
func (SKSpriteNode) SubdivisionLevels ¶
func (s SKSpriteNode) SubdivisionLevels() int
The maximum number of subdivision iterations used to generate the final vertices.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/subdivisionLevels
func (SKSpriteNode) Texture ¶
func (s SKSpriteNode) Texture() ISKTexture
The texture used to draw the sprite.
Discussion ¶
If the value is `nil`, the sprite is drawn as a single-color rectangle using its SKSpriteNode.Color property. Otherwise, the texture is used to draw the sprite. The related properties affect how the texture is applied.
SpriteKit automatically generates a texture for sprites when they are initialized with SKSpriteNode.InitWithImageNamed.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/texture
func (SKSpriteNode) ValueForAttributeNamed ¶
func (s SKSpriteNode) ValueForAttributeNamed(key string) ISKAttributeValue
Sets the value of a shader attribute.
key: The attribute name.
Return Value ¶
An attribute value object containing the scalar or vector value or `nil` if no such attribute exists.
See: https://developer.apple.com/documentation/SpriteKit/SKSpriteNode/value(forAttributeNamed:)
func (SKSpriteNode) WarpGeometry ¶
func (s SKSpriteNode) WarpGeometry() ISKWarpGeometry
The warp geometry used to define the distortion.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/warpGeometry
type SKSpriteNodeClass ¶
type SKSpriteNodeClass struct {
// contains filtered or unexported fields
}
func GetSKSpriteNodeClass ¶
func GetSKSpriteNodeClass() SKSpriteNodeClass
GetSKSpriteNodeClass returns the class object for SKSpriteNode.
func (SKSpriteNodeClass) Alloc ¶
func (sc SKSpriteNodeClass) Alloc() SKSpriteNode
Alloc allocates memory for a new instance of the class.
func (SKSpriteNodeClass) Class ¶
func (sc SKSpriteNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKTexture ¶
type SKTexture struct {
objectivec.Object
}
An image, decoded on the GPU, that can be used to render various SpriteKit objects.
Overview ¶
An SKTexture object is an image that can be applied to SKSpriteNode and SKShapeNode objects, particles created by an SKEmitterNode object, or tiles used in an SKTileMapNode. A texture object manages the texture data and graphics resources that are needed to render the image. Most texture objects are created from source images stored in your app bundle—your game’s artwork. Once created, a texture object’s contents are immutable. Multiple sprites can share the same texture object, sharing a single resource.
Deallocating a Texture ¶
After a texture is loaded into the graphics hardware memory, it stays in memory until the referencing SKTexture object is deleted. This means that between levels (or in a dynamic game), you may need to make sure a texture object is deleted. Delete a SKTexture object by removing any strong references to it, including:
- All texture references from SKSpriteNode and SKEffectNode objects in your game - Any strong references to the texture in your own code - An SKTextureAtlas object that was used to create the texture object
Reading a Texture’s Size and Optional Source Location ¶
- SKTexture.Size: Gets the size of the texture.
- SKTexture.TextureRect: Gets a rectangle that defines the portion of the texture used to render its image.
Configuring a Texture’s Behavior for Scaling ¶
- SKTexture.FilteringMode: The filtering mode used when the size of a sprite drawn with the texture is not drawn at the texture’s native size.
- SKTexture.SetFilteringMode
- SKTexture.UsesMipmaps: A Boolean value that indicates whether the texture attempts to generate mipmaps.
- SKTexture.SetUsesMipmaps
Getting a Texture’s Underlying Image ¶
- SKTexture.CGImage: Returns the texture’s image data as a Quartz 2D image.
Preloading a Texture for Performance ¶
- SKTexture.PreloadWithCompletionHandler: Load texture data into memory, calling a completion handler after the task completes.
See: https://developer.apple.com/documentation/SpriteKit/SKTexture
func SKTextureFromID ¶
SKTextureFromID constructs a SKTexture from an objc.ID.
An image, decoded on the GPU, that can be used to render various SpriteKit objects.
func (SKTexture) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (SKTexture) CGImage ¶
func (t SKTexture) CGImage() coregraphics.CGImageRef
Returns the texture’s image data as a Quartz 2D image.
Discussion ¶
The SKTexture.CGImage property returns the contents of a texture as a Quartz Image.
As an example use, you can create an image from a portion of your scene and save it to disk by doing the following:
- Use the SKView.TextureFromNode method to render the scene’s contents to a texture. - Call SKTexture.CGImage on the result. - Use CGImageDestination to write the [CGImage] out to disk.
See: https://developer.apple.com/documentation/SpriteKit/SKTexture/cgImage()
func (SKTexture) EncodeWithCoder ¶
func (t SKTexture) EncodeWithCoder(coder foundation.INSCoder)
func (SKTexture) FilteringMode ¶
func (t SKTexture) FilteringMode() SKTextureFilteringMode
The filtering mode used when the size of a sprite drawn with the texture is not drawn at the texture’s native size.
Discussion ¶
The possible values for this property are listed in SKTextureFilteringMode. The default value is SKTextureFilteringMode.linear where each pixel is drawn by using a linear filter of multiple texels in the texture. The other option is SKTextureFilteringMode.nearest where each pixel is drawn using the nearest point in the texture.
The figure below shows the effect of different filtering modes. The rabbit texture (original on left) has been scaled up five times. Node 1 has been scaled using SKTextureFilteringMode.nearest and node 2 has been scaled with SKTextureFilteringMode.linear.
[media-2668828]
See: https://developer.apple.com/documentation/SpriteKit/SKTexture/filteringMode
func (SKTexture) Preload ¶
Preload is a synchronous wrapper around SKTexture.PreloadWithCompletionHandler. It blocks until the completion handler fires or the context is cancelled.
func (SKTexture) PreloadWithCompletionHandler ¶
func (t SKTexture) PreloadWithCompletionHandler(completionHandler VoidHandler)
Load texture data into memory, calling a completion handler after the task completes.
completionHandler: A block called after the texture data is loaded.
Discussion ¶
SpriteKit creates a background task to load the texture data from the associated file, then returns control to your game. After the texture data is loaded, your completion handler is called. Typically, you use this method when you want to guarantee that a particular texture is in memory before accessing it.
If you need to preload multiple textures at once, use the SKTextureClass.PreloadTexturesWithCompletionHandler method instead.
See: https://developer.apple.com/documentation/SpriteKit/SKTexture/preload(completionHandler:)
func (SKTexture) SetFilteringMode ¶
func (t SKTexture) SetFilteringMode(value SKTextureFilteringMode)
func (SKTexture) SetUsesMipmaps ¶
func (SKTexture) Size ¶
func (t SKTexture) Size() corefoundation.CGSize
Gets the size of the texture.
Return Value ¶
The dimensions of the texture, measured in points.
Discussion ¶
If the texture was created using an image file and that image file hasn’t been loaded, calling this method forces the texture data to be loaded from the file.
See: https://developer.apple.com/documentation/SpriteKit/SKTexture/size()
func (SKTexture) TextureRect ¶
func (t SKTexture) TextureRect() corefoundation.CGRect
Gets a rectangle that defines the portion of the texture used to render its image.
Return Value ¶
A rectangle in the unit coordinate space.
Discussion ¶
The default value is a rectangle that covers the entire texture `(0,0)` - `(1,1)`. You cannot set this value directly; to use only a portion of a texture, use the init(rect:in:) method to create a new texture.
See: https://developer.apple.com/documentation/SpriteKit/SKTexture/textureRect()
func (SKTexture) UsesMipmaps ¶
A Boolean value that indicates whether the texture attempts to generate mipmaps.
Discussion ¶
The default value is false. If you set this to true, Sprite Kit creates mipmaps for the texture when it prepares the texture for rendering. Mipmaps take up additional memory (usually one-third more) but can improve rendering quality and performance when the texture is reduced in size (such as when you reduce the scale of a sprite rendered using the texture).
You can only request mipmaps if both of the texture’s dimensions are a power of two.
See: https://developer.apple.com/documentation/SpriteKit/SKTexture/usesMipmaps
type SKTextureAtlas ¶
type SKTextureAtlas struct {
objectivec.Object
}
A collection of textures optimized for storage and drawing performance.
Overview ¶
An SKTextureAtlas is a collection of textures that were either created from an `XCUIElementTypeAtlas` folder in the app bundle, or created at runtime. Texture atlases improve memory usage and rendering performance by reducing draw calls. Whenever you have textures that are always used together, store them in an atlas for best results.
SpriteKit implicitly loads an atlas when one of the atlas’s textures is accessed. Use SKTextureAtlas.TextureNamed when you want to explicitly access a texture atlas’s contents.
The preferred place to create a texture atlas is within an asset catalog (see Creating a Sprite Atlas), but you can also put your source textures in an `XCUIElementTypeAtlas` folder in the app bundle.
Accessing Textures ¶
- SKTextureAtlas.TextureNamed: Creates a texture from data stored in the texture atlas.
Preloading Textures ¶
- SKTextureAtlas.PreloadWithCompletionHandler: Loads an atlas object’s textures into memory, calling a completion handler after the task completes.
Reading Source Image Filenames ¶
- SKTextureAtlas.TextureNames: The names of the texture images stored in the atlas.
See: https://developer.apple.com/documentation/SpriteKit/SKTextureAtlas
func NewSKTextureAtlas ¶
func NewSKTextureAtlas() SKTextureAtlas
NewSKTextureAtlas creates a new SKTextureAtlas instance.
func NewTextureAtlasNamed ¶
func NewTextureAtlasNamed(name string) SKTextureAtlas
Creates a texture atlas from data stored in the app bundle.
name: The name of the texture atlas, without the `XCUIElementTypeAtlas` extension.
Return Value ¶
A new texture atlas object.
Discussion ¶
If the texture atlas cannot be found, an exception is thrown.
See: https://developer.apple.com/documentation/SpriteKit/SKTextureAtlas/init(named:)
func NewTextureAtlasWithDictionary ¶
func NewTextureAtlasWithDictionary(properties foundation.INSDictionary) SKTextureAtlas
Creates a texture atlas from a set of image files.
properties: A dictionary that defines which textures are to be merged into the atlas.
Return Value ¶
A new texture atlas object.
Discussion ¶
Normally, Xcode creates texture atlases at compile time from the image files included in your project. These atlases are compiled and installed inside the app bundle. However, sometimes the assets needed to create a texture atlas are not available at compile time. For example, those assets might be procedurally generated or downloaded from the network. However, you still want the benefit of texture atlases to reduce the number of state changes required in the hardware. You can use this method to generate an atlas object at runtime. This is a potentially expensive operation best performed when your game loop is not running.
The keys in the dictionary represent the names of the individual textures. The associated object for each key can be:
- An NSString object that contains a file system path to a file that contains the texture - An NSURL object that contains a file system path to a file that contains the texture - A UIImage object - An NSImage object
See: https://developer.apple.com/documentation/SpriteKit/SKTextureAtlas/init(dictionary:)
func SKTextureAtlasFromID ¶
func SKTextureAtlasFromID(id objc.ID) SKTextureAtlas
SKTextureAtlasFromID constructs a SKTextureAtlas from an objc.ID.
A collection of textures optimized for storage and drawing performance.
func (SKTextureAtlas) Autorelease ¶
func (t SKTextureAtlas) Autorelease() SKTextureAtlas
Autorelease adds the receiver to the current autorelease pool.
func (SKTextureAtlas) EncodeWithCoder ¶
func (t SKTextureAtlas) EncodeWithCoder(coder foundation.INSCoder)
func (SKTextureAtlas) Init ¶
func (t SKTextureAtlas) Init() SKTextureAtlas
Init initializes the instance.
func (SKTextureAtlas) Preload ¶
func (t SKTextureAtlas) Preload(ctx context.Context) error
Preload is a synchronous wrapper around SKTextureAtlas.PreloadWithCompletionHandler. It blocks until the completion handler fires or the context is cancelled.
func (SKTextureAtlas) PreloadWithCompletionHandler ¶
func (t SKTextureAtlas) PreloadWithCompletionHandler(completionHandler VoidHandler)
Loads an atlas object’s textures into memory, calling a completion handler after the task completes.
completionHandler: A block called after the texture atlas is loaded.
Discussion ¶
SpriteKit creates a background task that loads the texture data from the atlas object. Then, SpriteKit returns control to your game. After the texture atlas is loaded, your completion handler is called.
If you need to preload multiple texture atlas objects immediately, use the SKTextureAtlasClass.PreloadTextureAtlasesWithCompletionHandler method instead.
See: https://developer.apple.com/documentation/SpriteKit/SKTextureAtlas/preload(completionHandler:)
func (SKTextureAtlas) TextureNamed ¶
func (t SKTextureAtlas) TextureNamed(name string) ISKTexture
Creates a texture from data stored in the texture atlas.
name: The name of a texture stored in the atlas object.
Return Value ¶
The SpriteKit texture associated with the name. If the specified image does not exist in the atlas object, SpriteKit returns a placeholder texture image.
See: https://developer.apple.com/documentation/SpriteKit/SKTextureAtlas/textureNamed(_:)
func (SKTextureAtlas) TextureNames ¶
func (t SKTextureAtlas) TextureNames() []string
The names of the texture images stored in the atlas.
Discussion ¶
The property holds an array of NSString objects. Each string is the name of a texture stored in the atlas. The count of the array is the number of textures stored in the atlas.
If the atlas is not currently loaded into memory, this method forces it to be loaded from the app bundle. Your game blocks until the atlas is loaded.
See: https://developer.apple.com/documentation/SpriteKit/SKTextureAtlas/textureNames
type SKTextureAtlasArrayErrorHandler ¶
type SKTextureAtlasArrayErrorHandler = func(*[]SKTextureAtlas, error)
SKTextureAtlasArrayErrorHandler handles A block called after all of the texture atlases are loaded. The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.
Used by:
- [SKTextureAtlas.PreloadTextureAtlasesNamedWithCompletionHandler]
type SKTextureAtlasClass ¶
type SKTextureAtlasClass struct {
// contains filtered or unexported fields
}
func GetSKTextureAtlasClass ¶
func GetSKTextureAtlasClass() SKTextureAtlasClass
GetSKTextureAtlasClass returns the class object for SKTextureAtlas.
func (SKTextureAtlasClass) Alloc ¶
func (sc SKTextureAtlasClass) Alloc() SKTextureAtlas
Alloc allocates memory for a new instance of the class.
func (SKTextureAtlasClass) Class ¶
func (sc SKTextureAtlasClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKTextureAtlasClass) PreloadTextureAtlasesNamedWithCompletionHandler ¶
func (_SKTextureAtlasClass SKTextureAtlasClass) PreloadTextureAtlasesNamedWithCompletionHandler(atlasNames []string, completionHandler SKTextureAtlasArrayErrorHandler)
Loads the textures of multiple atlases into memory, calling a completion handler after the task completes.
atlasNames: An array containing the atlas names to preload.
completionHandler: A block called after all of the texture atlases are loaded.
Discussion ¶
SpriteKit creates a background task that loads the texture data from all of the specified atlas objects. Then, SpriteKit returns control to your game. After the atlases are loaded, your completion handler is called.
func (SKTextureAtlasClass) PreloadTextureAtlasesWithCompletionHandler ¶
func (_SKTextureAtlasClass SKTextureAtlasClass) PreloadTextureAtlasesWithCompletionHandler(textureAtlases []SKTextureAtlas, completionHandler VoidHandler)
Loads the textures of multiple atlas objects into memory, calling a completion handler after the task completes.
textureAtlases: An array of SKTextureAtlas objects.
completionHandler: A block called after all of the texture atlases are loaded.
Discussion ¶
SpriteKit creates a background task that loads the texture data from all of the specified atlas objects. Then, SpriteKit returns control to your game. After the atlas objects are loaded, your completion handler is called.
type SKTextureClass ¶
type SKTextureClass struct {
// contains filtered or unexported fields
}
func GetSKTextureClass ¶
func GetSKTextureClass() SKTextureClass
GetSKTextureClass returns the class object for SKTexture.
func (SKTextureClass) Alloc ¶
func (sc SKTextureClass) Alloc() SKTexture
Alloc allocates memory for a new instance of the class.
func (SKTextureClass) Class ¶
func (sc SKTextureClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKTextureClass) PreloadTexturesWithCompletionHandler ¶
func (_SKTextureClass SKTextureClass) PreloadTexturesWithCompletionHandler(textures []SKTexture, completionHandler VoidHandler)
Load the data of multiple textures into memory.
textures: An array of SKTexture objects.
completionHandler: A block called after all of the textures are loaded.
Discussion ¶
SpriteKit creates a background task that loads the texture data for all of the textures in the array, then returns control to your game. Your completion handler is called after all of the textures are loaded.
See: https://developer.apple.com/documentation/SpriteKit/SKTexture/preload(_:withCompletionHandler:)
type SKTextureFilteringMode ¶
type SKTextureFilteringMode int
See: https://developer.apple.com/documentation/SpriteKit/SKTextureFilteringMode
const ( // SKTextureFilteringLinear: Each pixel is drawn by using a linear filter of multiple texels in the texture. SKTextureFilteringLinear SKTextureFilteringMode = 1 // SKTextureFilteringNearest: Each pixel is drawn using the nearest point in the texture. SKTextureFilteringNearest SKTextureFilteringMode = 0 )
func (SKTextureFilteringMode) String ¶
func (e SKTextureFilteringMode) String() string
type SKTileAdjacencyMask ¶
type SKTileAdjacencyMask uint
See: https://developer.apple.com/documentation/SpriteKit/SKTileAdjacencyMask
const ( SKTileAdjacencyAll SKTileAdjacencyMask = 255 SKTileAdjacencyDown SKTileAdjacencyMask = 16 SKTileAdjacencyDownEdge SKTileAdjacencyMask = 199 SKTileAdjacencyLeft SKTileAdjacencyMask = 64 SKTileAdjacencyLeftEdge SKTileAdjacencyMask = 31 SKTileAdjacencyLowerLeft SKTileAdjacencyMask = 32 SKTileAdjacencyLowerLeftCorner SKTileAdjacencyMask = 253 SKTileAdjacencyLowerLeftEdge SKTileAdjacencyMask = 7 SKTileAdjacencyLowerRight SKTileAdjacencyMask = 8 SKTileAdjacencyLowerRightCorner SKTileAdjacencyMask = 127 SKTileAdjacencyLowerRightEdge SKTileAdjacencyMask = 193 SKTileAdjacencyRight SKTileAdjacencyMask = 4 SKTileAdjacencyRightEdge SKTileAdjacencyMask = 241 SKTileAdjacencyUp SKTileAdjacencyMask = 1 SKTileAdjacencyUpEdge SKTileAdjacencyMask = 124 SKTileAdjacencyUpperLeft SKTileAdjacencyMask = 128 SKTileAdjacencyUpperLeftCorner SKTileAdjacencyMask = 247 SKTileAdjacencyUpperLeftEdge SKTileAdjacencyMask = 28 SKTileAdjacencyUpperRight SKTileAdjacencyMask = 2 SKTileAdjacencyUpperRightCorner SKTileAdjacencyMask = 223 SKTileAdjacencyUpperRightEdge SKTileAdjacencyMask = 112 SKTileHexFlatAdjacencyAll SKTileAdjacencyMask = 63 SKTileHexFlatAdjacencyDown SKTileAdjacencyMask = 8 SKTileHexFlatAdjacencyLowerLeft SKTileAdjacencyMask = 16 SKTileHexFlatAdjacencyLowerRight SKTileAdjacencyMask = 4 SKTileHexFlatAdjacencyUp SKTileAdjacencyMask = 1 SKTileHexFlatAdjacencyUpperLeft SKTileAdjacencyMask = 32 SKTileHexFlatAdjacencyUpperRight SKTileAdjacencyMask = 2 SKTileHexPointyAdjacencyAdd SKTileAdjacencyMask = 63 SKTileHexPointyAdjacencyLeft SKTileAdjacencyMask = 32 SKTileHexPointyAdjacencyLowerLeft SKTileAdjacencyMask = 16 SKTileHexPointyAdjacencyLowerRight SKTileAdjacencyMask = 8 SKTileHexPointyAdjacencyRight SKTileAdjacencyMask = 4 SKTileHexPointyAdjacencyUpperLeft SKTileAdjacencyMask = 1 SKTileHexPointyAdjacencyUpperRight SKTileAdjacencyMask = 2 )
func (SKTileAdjacencyMask) String ¶
func (e SKTileAdjacencyMask) String() string
type SKTileDefinition ¶
type SKTileDefinition struct {
objectivec.Object
}
A single tile that can be repeated in a tile map.
Overview ¶
To define the visual representation of a single tile, you create an SKTileDefinition object with texture and size information. Tile definitions support separate normal textures, for simulating 3D lighting, and arrays of textures for animation with speed controlled by the SKTileDefinition.TimePerFrame property. Textures can be rotated in 90˚ increments or flipped either vertically or horizontally.
Once a tile definition has been created, you encapsulate it in a SKTileGroup which is added to a SKTileSet which, in turn, is displayed in the scene with a SKTileMapNode.
Creating a Tile with a Texture ¶
- SKTileDefinition.InitWithTexture: Initializes a new tile definition with a single texture.
Creating a Tile with a Normal Texture ¶
- SKTileDefinition.InitWithTextureNormalTextureSize: Initializes a new tile definition with a single texture and separate normal texture for simulating 3D lighting.
Creating a Tile with a Size ¶
- SKTileDefinition.InitWithTextureSize: Initializes a new tile definition of a specified size with a single texture.
Creating an Animated Tile ¶
- SKTileDefinition.InitWithTexturesNormalTexturesSizeTimePerFrame: Initializes a new tile definition with arrays of textures and normal textures for animation.
- SKTileDefinition.InitWithTexturesSizeTimePerFrame: Initializes a new tile definition with an array of textures for animation.
Flipping a Tile Vertically or Horizontally ¶
- SKTileDefinition.FlipHorizontally: A Boolean that flips the definition’s image vertically.
- SKTileDefinition.SetFlipHorizontally
- SKTileDefinition.FlipVertically: A Boolean that flips the definition’s image horizontally.
- SKTileDefinition.SetFlipVertically
Rotating a Tile ¶
- SKTileDefinition.Rotation: The rotation of the tile definition in 90˚ increments.
- SKTileDefinition.SetRotation
Configure Animated Tile Properties ¶
- SKTileDefinition.Textures: An array of SKTexture(<https://developer.apple.com/documentation/SpriteKit/SKTexture>) objects that defines the tile definition object’s content.
- SKTileDefinition.SetTextures
- SKTileDefinition.NormalTextures: An array of SKTexture(<https://developer.apple.com/documentation/SpriteKit/SKTexture>) objects used to generate the normals for the tile to simulate 3D lighting.
- SKTileDefinition.SetNormalTextures
- SKTileDefinition.TimePerFrame: The duration, in seconds, that each texture in the textures array is displayed before switching to the next texture in the sequence.
- SKTileDefinition.SetTimePerFrame
Reading or Adding a Tile’s Custom Data ¶
- SKTileDefinition.UserData: A dictionary containing arbitrary data.
- SKTileDefinition.SetUserData
Reading or Adjusting a Tile’s Instance Properties ¶
- SKTileDefinition.Name: A name associated with the tile definition.
- SKTileDefinition.SetName
- SKTileDefinition.PlacementWeight: The placement weight of the tile definition.
- SKTileDefinition.SetPlacementWeight
- SKTileDefinition.Size: The size of the tile definition in points.
- SKTileDefinition.SetSize
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition
func NewSKTileDefinition ¶
func NewSKTileDefinition() SKTileDefinition
NewSKTileDefinition creates a new SKTileDefinition instance.
func NewTileDefinitionWithTexture ¶
func NewTileDefinitionWithTexture(texture ISKTexture) SKTileDefinition
Initializes a new tile definition with a single texture.
texture: The texture to reference for the definition’s size and content.
Return Value ¶
A new tile definition.
Discussion ¶
The size of the newly created tile definition will be the same as the texture used to initialize it.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/init(texture:)
func NewTileDefinitionWithTextureNormalTextureSize ¶
func NewTileDefinitionWithTextureNormalTextureSize(texture ISKTexture, normalTexture ISKTexture, size corefoundation.CGSize) SKTileDefinition
Initializes a new tile definition with a single texture and separate normal texture for simulating 3D lighting.
texture: The texture to reference for the definition’s content.
normalTexture: The texture to reference for generating normals to simulate 3D lighting.
size: The size of the tile in points.
Return Value ¶
A new tile definition.
func NewTileDefinitionWithTextureSize ¶
func NewTileDefinitionWithTextureSize(texture ISKTexture, size corefoundation.CGSize) SKTileDefinition
Initializes a new tile definition of a specified size with a single texture.
texture: The texture to reference for the definition’s content.
size: The size of the tile in points.
Return Value ¶
A new tile definition.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/init(texture:size:)
func NewTileDefinitionWithTexturesNormalTexturesSizeTimePerFrame ¶
func NewTileDefinitionWithTexturesNormalTexturesSizeTimePerFrame(textures []SKTexture, normalTextures []SKTexture, size corefoundation.CGSize, timePerFrame float64) SKTileDefinition
Initializes a new tile definition with arrays of textures and normal textures for animation.
textures: An array of textures to reference for the definition’s content.
normalTextures: An array of textures to reference for generating normals to simulate 3D lighting.
size: The size of the tile in points.
timePerFrame: The duration, in seconds, that each texture is displayed.
Return Value ¶
A new tile definition.
func NewTileDefinitionWithTexturesSizeTimePerFrame ¶
func NewTileDefinitionWithTexturesSizeTimePerFrame(textures []SKTexture, size corefoundation.CGSize, timePerFrame float64) SKTileDefinition
Initializes a new tile definition with an array of textures for animation.
textures: An array of textures to reference for the definition’s size and content.
size: The size of the tile in points.
timePerFrame: The duration, in seconds, that each texture is displayed.
Return Value ¶
A new tile definition.
func SKTileDefinitionFromID ¶
func SKTileDefinitionFromID(id objc.ID) SKTileDefinition
SKTileDefinitionFromID constructs a SKTileDefinition from an objc.ID.
A single tile that can be repeated in a tile map.
func (SKTileDefinition) Autorelease ¶
func (t SKTileDefinition) Autorelease() SKTileDefinition
Autorelease adds the receiver to the current autorelease pool.
func (SKTileDefinition) EncodeWithCoder ¶
func (t SKTileDefinition) EncodeWithCoder(coder foundation.INSCoder)
func (SKTileDefinition) FlipHorizontally ¶
func (t SKTileDefinition) FlipHorizontally() bool
A Boolean that flips the definition’s image vertically.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/flipHorizontally
func (SKTileDefinition) FlipVertically ¶
func (t SKTileDefinition) FlipVertically() bool
A Boolean that flips the definition’s image horizontally.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/flipVertically
func (SKTileDefinition) Init ¶
func (t SKTileDefinition) Init() SKTileDefinition
Init initializes the instance.
func (SKTileDefinition) InitWithTexture ¶
func (t SKTileDefinition) InitWithTexture(texture ISKTexture) SKTileDefinition
Initializes a new tile definition with a single texture.
texture: The texture to reference for the definition’s size and content.
Return Value ¶
A new tile definition.
Discussion ¶
The size of the newly created tile definition will be the same as the texture used to initialize it.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/init(texture:)
func (SKTileDefinition) InitWithTextureNormalTextureSize ¶
func (t SKTileDefinition) InitWithTextureNormalTextureSize(texture ISKTexture, normalTexture ISKTexture, size corefoundation.CGSize) SKTileDefinition
Initializes a new tile definition with a single texture and separate normal texture for simulating 3D lighting.
texture: The texture to reference for the definition’s content.
normalTexture: The texture to reference for generating normals to simulate 3D lighting.
size: The size of the tile in points.
Return Value ¶
A new tile definition.
func (SKTileDefinition) InitWithTextureSize ¶
func (t SKTileDefinition) InitWithTextureSize(texture ISKTexture, size corefoundation.CGSize) SKTileDefinition
Initializes a new tile definition of a specified size with a single texture.
texture: The texture to reference for the definition’s content.
size: The size of the tile in points.
Return Value ¶
A new tile definition.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/init(texture:size:)
func (SKTileDefinition) InitWithTexturesNormalTexturesSizeTimePerFrame ¶
func (t SKTileDefinition) InitWithTexturesNormalTexturesSizeTimePerFrame(textures []SKTexture, normalTextures []SKTexture, size corefoundation.CGSize, timePerFrame float64) SKTileDefinition
Initializes a new tile definition with arrays of textures and normal textures for animation.
textures: An array of textures to reference for the definition’s content.
normalTextures: An array of textures to reference for generating normals to simulate 3D lighting.
size: The size of the tile in points.
timePerFrame: The duration, in seconds, that each texture is displayed.
Return Value ¶
A new tile definition.
func (SKTileDefinition) InitWithTexturesSizeTimePerFrame ¶
func (t SKTileDefinition) InitWithTexturesSizeTimePerFrame(textures []SKTexture, size corefoundation.CGSize, timePerFrame float64) SKTileDefinition
Initializes a new tile definition with an array of textures for animation.
textures: An array of textures to reference for the definition’s size and content.
size: The size of the tile in points.
timePerFrame: The duration, in seconds, that each texture is displayed.
Return Value ¶
A new tile definition.
func (SKTileDefinition) Name ¶
func (t SKTileDefinition) Name() string
A name associated with the tile definition.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/name
func (SKTileDefinition) NormalTextures ¶
func (t SKTileDefinition) NormalTextures() []SKTexture
An array of SKTexture objects used to generate the normals for the tile to simulate 3D lighting.
Discussion ¶
If the tile is non-animated, this will be an array containing one texture.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/normalTextures
func (SKTileDefinition) PlacementWeight ¶
func (t SKTileDefinition) PlacementWeight() uint
The placement weight of the tile definition.
Discussion ¶
This value is used to determine how likely this tile definition is to be chosen for placement when a SKTileGroupRule has multiple tile definitions assigned to it. A higher value relative to the other definitions assigned to the rule make it more likely for this definition to be selected; lower values make it less likely. Defaults to 1. When set to 0, the definition will never be chosen as long as there is at least one other definition with a SKTileDefinition.PlacementWeight above 0.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/placementWeight
func (SKTileDefinition) Rotation ¶
func (t SKTileDefinition) Rotation() SKTileDefinitionRotation
The rotation of the tile definition in 90˚ increments.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/rotation
func (SKTileDefinition) SetFlipHorizontally ¶
func (t SKTileDefinition) SetFlipHorizontally(value bool)
func (SKTileDefinition) SetFlipVertically ¶
func (t SKTileDefinition) SetFlipVertically(value bool)
func (SKTileDefinition) SetName ¶
func (t SKTileDefinition) SetName(value string)
func (SKTileDefinition) SetNormalTextures ¶
func (t SKTileDefinition) SetNormalTextures(value []SKTexture)
func (SKTileDefinition) SetPlacementWeight ¶
func (t SKTileDefinition) SetPlacementWeight(value uint)
func (SKTileDefinition) SetRotation ¶
func (t SKTileDefinition) SetRotation(value SKTileDefinitionRotation)
func (SKTileDefinition) SetSize ¶
func (t SKTileDefinition) SetSize(value corefoundation.CGSize)
func (SKTileDefinition) SetTextures ¶
func (t SKTileDefinition) SetTextures(value []SKTexture)
func (SKTileDefinition) SetTimePerFrame ¶
func (t SKTileDefinition) SetTimePerFrame(value float64)
func (SKTileDefinition) SetUserData ¶
func (t SKTileDefinition) SetUserData(value foundation.INSDictionary)
func (SKTileDefinition) Size ¶
func (t SKTileDefinition) Size() corefoundation.CGSize
The size of the tile definition in points.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/size
func (SKTileDefinition) Textures ¶
func (t SKTileDefinition) Textures() []SKTexture
An array of SKTexture objects that defines the tile definition object’s content.
Discussion ¶
If the tile is non-animated, this will be an array containing one textures.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/textures
func (SKTileDefinition) TimePerFrame ¶
func (t SKTileDefinition) TimePerFrame() float64
The duration, in seconds, that each texture in the textures array is displayed before switching to the next texture in the sequence.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/timePerFrame
func (SKTileDefinition) UserData ¶
func (t SKTileDefinition) UserData() foundation.INSDictionary
A dictionary containing arbitrary data.
Discussion ¶
You use this property to store your own data in a tile definition. For example, you might use this property to specify whether this tile is a platform that a player can land on.
SpriteKit doesn’t do anything with this data. However, the data is archived when the tile definition is archived.
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinition/userData
type SKTileDefinitionClass ¶
type SKTileDefinitionClass struct {
// contains filtered or unexported fields
}
func GetSKTileDefinitionClass ¶
func GetSKTileDefinitionClass() SKTileDefinitionClass
GetSKTileDefinitionClass returns the class object for SKTileDefinition.
func (SKTileDefinitionClass) Alloc ¶
func (sc SKTileDefinitionClass) Alloc() SKTileDefinition
Alloc allocates memory for a new instance of the class.
func (SKTileDefinitionClass) Class ¶
func (sc SKTileDefinitionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKTileDefinitionRotation ¶
type SKTileDefinitionRotation uint
See: https://developer.apple.com/documentation/SpriteKit/SKTileDefinitionRotation
const ( SKTileDefinitionRotation0 SKTileDefinitionRotation = 0 SKTileDefinitionRotation180 SKTileDefinitionRotation = 2 SKTileDefinitionRotation270 SKTileDefinitionRotation = 3 SKTileDefinitionRotation90 SKTileDefinitionRotation = 1 )
func (SKTileDefinitionRotation) String ¶
func (e SKTileDefinitionRotation) String() string
type SKTileGroup ¶
type SKTileGroup struct {
objectivec.Object
}
A set of tiles that collectively define one type of terrain.
Overview ¶
An SKTileGroup object contains either the definition of a single tile or an array of SKTileGroupRule objects that define adjacency rules.
You supply a tile group with either:
- The definition of a single tile that can be used to populate a tile map node with a single texture. - An array of one or more tile group rules that allow for the automatic placement of textures dependent on their adjacency and the placement weights of their definitions. For example, a tile group may contain nine tile group rules containing the definitions of the central tile and eight edge tiles that, when placed adjacently, appear as a single object.
The preferred method to create tile groups is to use the editor tools in Xcode. However, to work with SpriteKit’s tile support programmatically, see the following articles.
Creating Tile Groups ¶
- SKTileGroup.InitWithTileDefinition: Creates and initializes a simple tile group with a single tile definition.
- SKTileGroup.InitWithRules: Creates and initializes a tile group with the specified tile group rules.
Accessing or Setting a Tile Group’s Properties ¶
- SKTileGroup.Name: The receiver’s name.
- SKTileGroup.SetName
- SKTileGroup.Rules: An array of SKTileGroupRule(<https://developer.apple.com/documentation/SpriteKit/SKTileGroupRule>) objects that the tile group uses to determine tile placement.
- SKTileGroup.SetRules
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroup
func NewSKTileGroup ¶
func NewSKTileGroup() SKTileGroup
NewSKTileGroup creates a new SKTileGroup instance.
func NewTileGroupWithRules ¶
func NewTileGroupWithRules(rules []SKTileGroupRule) SKTileGroup
Creates and initializes a tile group with the specified tile group rules.
rules: The tile group rules to determine tile placement.
Return Value ¶
A new tile group.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroup/init(rules:)
func NewTileGroupWithTileDefinition ¶
func NewTileGroupWithTileDefinition(tileDefinition ISKTileDefinition) SKTileGroup
Creates and initializes a simple tile group with a single tile definition.
tileDefinition: The tile definition to place in a tile map.
Return Value ¶
A new tile group.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroup/init(tileDefinition:)
func SKTileGroupFromID ¶
func SKTileGroupFromID(id objc.ID) SKTileGroup
SKTileGroupFromID constructs a SKTileGroup from an objc.ID.
A set of tiles that collectively define one type of terrain.
func (SKTileGroup) Autorelease ¶
func (t SKTileGroup) Autorelease() SKTileGroup
Autorelease adds the receiver to the current autorelease pool.
func (SKTileGroup) EncodeWithCoder ¶
func (t SKTileGroup) EncodeWithCoder(coder foundation.INSCoder)
func (SKTileGroup) InitWithRules ¶
func (t SKTileGroup) InitWithRules(rules []SKTileGroupRule) SKTileGroup
Creates and initializes a tile group with the specified tile group rules.
rules: The tile group rules to determine tile placement.
Return Value ¶
A new tile group.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroup/init(rules:)
func (SKTileGroup) InitWithTileDefinition ¶
func (t SKTileGroup) InitWithTileDefinition(tileDefinition ISKTileDefinition) SKTileGroup
Creates and initializes a simple tile group with a single tile definition.
tileDefinition: The tile definition to place in a tile map.
Return Value ¶
A new tile group.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroup/init(tileDefinition:)
func (SKTileGroup) Name ¶
func (t SKTileGroup) Name() string
The receiver’s name.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroup/name
func (SKTileGroup) Rules ¶
func (t SKTileGroup) Rules() []SKTileGroupRule
An array of SKTileGroupRule objects that the tile group uses to determine tile placement.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroup/rules
func (SKTileGroup) SetName ¶
func (t SKTileGroup) SetName(value string)
func (SKTileGroup) SetRules ¶
func (t SKTileGroup) SetRules(value []SKTileGroupRule)
type SKTileGroupClass ¶
type SKTileGroupClass struct {
// contains filtered or unexported fields
}
func GetSKTileGroupClass ¶
func GetSKTileGroupClass() SKTileGroupClass
GetSKTileGroupClass returns the class object for SKTileGroup.
func (SKTileGroupClass) Alloc ¶
func (sc SKTileGroupClass) Alloc() SKTileGroup
Alloc allocates memory for a new instance of the class.
func (SKTileGroupClass) Class ¶
func (sc SKTileGroupClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKTileGroupClass) EmptyTileGroup ¶
func (_SKTileGroupClass SKTileGroupClass) EmptyTileGroup() SKTileGroup
Creates an empty tile that erases the existing tile at that location on a tile map.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroup/empty()
type SKTileGroupRule ¶
type SKTileGroupRule struct {
objectivec.Object
}
Rules that describe how various tiles should be placed in a map.
Overview ¶
When a tile is filled in a tile map, the tile group rule defines how neighboring tiles are populated based on adjacency rules. A rule with multiple definitions uses the placement weights of the definitions to randomly select which to use.
Creating a Tile Group Rule ¶
- SKTileGroupRule.InitWithAdjacencyTileDefinitions: Initializes a new tile group rule with adjacency rules and tile definitions.
Accessing or Setting Tile Group Rule Properties ¶
- SKTileGroupRule.Adjacency: The adjacency requirement for this rule.
- SKTileGroupRule.SetAdjacency
- SKTileGroupRule.Name: A name associated with the tile group rule.
- SKTileGroupRule.SetName
- SKTileGroupRule.TileDefinitions: The tile definitions used for this rule.
- SKTileGroupRule.SetTileDefinitions
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroupRule
func NewSKTileGroupRule ¶
func NewSKTileGroupRule() SKTileGroupRule
NewSKTileGroupRule creates a new SKTileGroupRule instance.
func NewTileGroupRuleWithAdjacencyTileDefinitions ¶
func NewTileGroupRuleWithAdjacencyTileDefinitions(adjacency SKTileAdjacencyMask, tileDefinitions []SKTileDefinition) SKTileGroupRule
Initializes a new tile group rule with adjacency rules and tile definitions.
adjacency: The adjacency requirements for this rule.
tileDefinitions: The tile definitions used for this rule.
Return Value ¶
A new tile group rule.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroupRule/init(adjacency:tileDefinitions:)
func SKTileGroupRuleFromID ¶
func SKTileGroupRuleFromID(id objc.ID) SKTileGroupRule
SKTileGroupRuleFromID constructs a SKTileGroupRule from an objc.ID.
Rules that describe how various tiles should be placed in a map.
func (SKTileGroupRule) Adjacency ¶
func (t SKTileGroupRule) Adjacency() SKTileAdjacencyMask
The adjacency requirement for this rule.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroupRule/adjacency
func (SKTileGroupRule) Autorelease ¶
func (t SKTileGroupRule) Autorelease() SKTileGroupRule
Autorelease adds the receiver to the current autorelease pool.
func (SKTileGroupRule) EncodeWithCoder ¶
func (t SKTileGroupRule) EncodeWithCoder(coder foundation.INSCoder)
func (SKTileGroupRule) Init ¶
func (t SKTileGroupRule) Init() SKTileGroupRule
Init initializes the instance.
func (SKTileGroupRule) InitWithAdjacencyTileDefinitions ¶
func (t SKTileGroupRule) InitWithAdjacencyTileDefinitions(adjacency SKTileAdjacencyMask, tileDefinitions []SKTileDefinition) SKTileGroupRule
Initializes a new tile group rule with adjacency rules and tile definitions.
adjacency: The adjacency requirements for this rule.
tileDefinitions: The tile definitions used for this rule.
Return Value ¶
A new tile group rule.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroupRule/init(adjacency:tileDefinitions:)
func (SKTileGroupRule) Name ¶
func (t SKTileGroupRule) Name() string
A name associated with the tile group rule.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroupRule/name
func (SKTileGroupRule) SetAdjacency ¶
func (t SKTileGroupRule) SetAdjacency(value SKTileAdjacencyMask)
func (SKTileGroupRule) SetName ¶
func (t SKTileGroupRule) SetName(value string)
func (SKTileGroupRule) SetTileDefinitions ¶
func (t SKTileGroupRule) SetTileDefinitions(value []SKTileDefinition)
func (SKTileGroupRule) TileDefinitions ¶
func (t SKTileGroupRule) TileDefinitions() []SKTileDefinition
The tile definitions used for this rule.
Discussion ¶
When this rule is evaluated and its conditions met, one of the definitions is randomly selected for placement based on their placement weights.
See: https://developer.apple.com/documentation/SpriteKit/SKTileGroupRule/tileDefinitions
type SKTileGroupRuleClass ¶
type SKTileGroupRuleClass struct {
// contains filtered or unexported fields
}
func GetSKTileGroupRuleClass ¶
func GetSKTileGroupRuleClass() SKTileGroupRuleClass
GetSKTileGroupRuleClass returns the class object for SKTileGroupRule.
func (SKTileGroupRuleClass) Alloc ¶
func (sc SKTileGroupRuleClass) Alloc() SKTileGroupRule
Alloc allocates memory for a new instance of the class.
func (SKTileGroupRuleClass) Class ¶
func (sc SKTileGroupRuleClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKTileMapNode ¶
type SKTileMapNode struct {
SKNode
}
A two-dimensional array of images.
Overview ¶
SKTileMapNode does the work of laying out predefined tiles in a grid of any size. Typically, you configure 9-slice images (tile groups) in Xcode’s SpriteKit scene editor and paint the look of your tile map ahead of time versus configuring the tile map in code.
As with sprite nodes, you can layer tile maps with different blend modes or control it with actions and physics, for example, for the purpose of parallax scrolling. The rendered tile map can be post processed with an SKShader to add effects such as motion blur or atmospheric perspective.
To work with a tile map programmatically, you supply SKTileMapNode with a tile set that defines the tile definitions it can render. Then, fill each tile in the tile map with the fill(with:) method and set individual tiles with setTileGroup(_:andTileDefinition:forColumn:row:).
Controlling a Tile Map’s On-Screen Position Relative to its Origin ¶
- SKTileMapNode.AnchorPoint: Defines the point in the tile map that corresponds to its [position](<https://developer.apple.com/documentation/SpriteKit/SKNode/position>).
- SKTileMapNode.SetAnchorPoint
Reading or Manually Configuring the Tile Map’s Size ¶
- SKTileMapNode.TileSize: The size of each tile in points.
- SKTileMapNode.SetTileSize
- SKTileMapNode.TileSet: The tile set being used by this tile map. The tile map object can only display tiles that exist in this set.
- SKTileMapNode.SetTileSet
- SKTileMapNode.NumberOfColumns: The number of columns in the tile map
- SKTileMapNode.SetNumberOfColumns
- SKTileMapNode.NumberOfRows: The number of rows in the tile map.
- SKTileMapNode.SetNumberOfRows
Querying the Tile Map’s Properties ¶
- SKTileMapNode.CenterOfTileAtColumnRow
- SKTileMapNode.TileColumnIndexFromPosition
- SKTileMapNode.TileDefinitionAtColumnRow
- SKTileMapNode.TileGroupAtColumnRow
- SKTileMapNode.TileRowIndexFromPosition: Returns the tile map node object’s tile row index for the specified position in points.
- SKTileMapNode.MapSize: The overall size of the tile map.
Tinting a Tile Map ¶
- SKTileMapNode.Color: The base color for the tile map. The influence of the color over the tile map node’s textures is controlled by [colorBlendFactor](<https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/colorBlendFactor>).
- SKTileMapNode.SetColor
- SKTileMapNode.ColorBlendFactor: Controls the blending between the texture and the tile map object’s [color](<https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/color>). Values are clamped between zero and one where zero has no color blending and one has the maximum color blending.
- SKTileMapNode.SetColorBlendFactor
Lighting a Tile Map ¶
- SKTileMapNode.LightingBitMask: A mask that defines how the tile map is lit by light nodes in the scene.
- SKTileMapNode.SetLightingBitMask
Configuring How Alpha Values Blend the Sprite ¶
- SKTileMapNode.BlendMode: Defines the blend mode to use when compositing the tile map over other nodes.
- SKTileMapNode.SetBlendMode
Working with Custom Shaders ¶
- SKTileMapNode.Shader: Defines a shader which is applied to each tile of the tile map.
- SKTileMapNode.SetShader
- SKTileMapNode.AttributeValues: The values of each attribute associated with the node’s attached shader.
- SKTileMapNode.SetAttributeValues
- SKTileMapNode.SetValueForAttributeNamed: Sets an attribute value for an attached shader.
- SKTileMapNode.ValueForAttributeNamed: The value of a shader attribute.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode
func NewSKTileMapNode ¶
func NewSKTileMapNode() SKTileMapNode
NewSKTileMapNode creates a new SKTileMapNode instance.
func NewTileMapNodeWithCoder ¶
func NewTileMapNodeWithCoder(aDecoder foundation.INSCoder) SKTileMapNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewTileMapNodeWithFileNamed ¶
func NewTileMapNodeWithFileNamed(filename string) SKTileMapNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewTileMapNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewTileMapNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKTileMapNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func SKTileMapNodeFromID ¶
func SKTileMapNodeFromID(id objc.ID) SKTileMapNode
SKTileMapNodeFromID constructs a SKTileMapNode from an objc.ID.
A two-dimensional array of images.
func (SKTileMapNode) AnchorPoint ¶
func (t SKTileMapNode) AnchorPoint() corefoundation.CGPoint
Defines the point in the tile map that corresponds to its SKNode.Position.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/anchorPoint
func (SKTileMapNode) AttributeValues ¶
func (t SKTileMapNode) AttributeValues() foundation.INSDictionary
The values of each attribute associated with the node’s attached shader.
Discussion ¶
All nodes have their own copy of an attribute value and therefore the attribute values can be different per-node across the same SKShader. If instead you need all nodes to share the same value, use SKUniform. Uniforms can change values every frame, but uniforms cannot vary per-node like attributes can.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/attributeValues
func (SKTileMapNode) Autorelease ¶
func (t SKTileMapNode) Autorelease() SKTileMapNode
Autorelease adds the receiver to the current autorelease pool.
func (SKTileMapNode) BlendMode ¶
func (t SKTileMapNode) BlendMode() SKBlendMode
Defines the blend mode to use when compositing the tile map over other nodes.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/blendMode
func (SKTileMapNode) CenterOfTileAtColumnRow ¶
func (t SKTileMapNode) CenterOfTileAtColumnRow(column uint, row uint) corefoundation.CGPoint
column: The column index of the tile.
row: The row index of the tile.
Return Value ¶
The coordinates in points of the center of the tile for a given column and row.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/centerOfTile(atColumn:row:)
func (SKTileMapNode) Color ¶
func (t SKTileMapNode) Color() appkit.NSColor
The base color for the tile map. The influence of the color over the tile map node’s textures is controlled by SKTileMapNode.ColorBlendFactor.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/color
func (SKTileMapNode) ColorBlendFactor ¶
func (t SKTileMapNode) ColorBlendFactor() float64
Controls the blending between the texture and the tile map object’s SKTileMapNode.Color. Values are clamped between zero and one where zero has no color blending and one has the maximum color blending.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/colorBlendFactor
func (SKTileMapNode) EnableAutomapping ¶
func (t SKTileMapNode) EnableAutomapping() bool
When creating a tile map node programmatically, specifies whether the tile map uses automapping behavior like the scene editor.
See: https://developer.apple.com/documentation/spritekit/sktilemapnode/enableautomapping
func (SKTileMapNode) Init ¶
func (t SKTileMapNode) Init() SKTileMapNode
Init initializes the instance.
func (SKTileMapNode) LightingBitMask ¶
func (t SKTileMapNode) LightingBitMask() uint32
A mask that defines how the tile map is lit by light nodes in the scene.
Discussion ¶
To determine whether this sprite is lit by a light node, the sprite’s `lightingBitMask` property is tested against the light’s categoryBitMask property by performing a logical AND operation. If the comparison results in a nonzero value, the sprite is lit by this light.
The default value is 0x00000000 (all bits cleared).
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/lightingBitMask
func (SKTileMapNode) MapSize ¶
func (t SKTileMapNode) MapSize() corefoundation.CGSize
The overall size of the tile map.
Discussion ¶
For a grid set type, the overall size, in points, of the node will be SKTileMapNode.NumberOfColumns `*` SKTileMapNode.TileSize `.` width wide and SKWarpGeometryGrid.NumberOfRows `*` SKTileMapNode.TileSize `.` height high.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/mapSize
func (SKTileMapNode) NumberOfColumns ¶
func (t SKTileMapNode) NumberOfColumns() uint
The number of columns in the tile map
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/numberOfColumns
func (SKTileMapNode) NumberOfRows ¶
func (t SKTileMapNode) NumberOfRows() uint
The number of rows in the tile map.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/numberOfRows
func (SKTileMapNode) SetAnchorPoint ¶
func (t SKTileMapNode) SetAnchorPoint(value corefoundation.CGPoint)
func (SKTileMapNode) SetAttributeValues ¶
func (t SKTileMapNode) SetAttributeValues(value foundation.INSDictionary)
func (SKTileMapNode) SetBlendMode ¶
func (t SKTileMapNode) SetBlendMode(value SKBlendMode)
func (SKTileMapNode) SetColor ¶
func (t SKTileMapNode) SetColor(value appkit.NSColor)
func (SKTileMapNode) SetColorBlendFactor ¶
func (t SKTileMapNode) SetColorBlendFactor(value float64)
func (SKTileMapNode) SetEnableAutomapping ¶
func (t SKTileMapNode) SetEnableAutomapping(value bool)
func (SKTileMapNode) SetLightingBitMask ¶
func (t SKTileMapNode) SetLightingBitMask(value uint32)
func (SKTileMapNode) SetNumberOfColumns ¶
func (t SKTileMapNode) SetNumberOfColumns(value uint)
func (SKTileMapNode) SetNumberOfRows ¶
func (t SKTileMapNode) SetNumberOfRows(value uint)
func (SKTileMapNode) SetShader ¶
func (t SKTileMapNode) SetShader(value ISKShader)
func (SKTileMapNode) SetTileSet ¶
func (t SKTileMapNode) SetTileSet(value ISKTileSet)
func (SKTileMapNode) SetTileSize ¶
func (t SKTileMapNode) SetTileSize(value corefoundation.CGSize)
func (SKTileMapNode) SetValueForAttributeNamed ¶
func (t SKTileMapNode) SetValueForAttributeNamed(value ISKAttributeValue, key string)
Sets an attribute value for an attached shader.
value: An attribute value object containing the scalar or vector value to set in the attached shader.
key: The attribute name.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/setValue(_:forAttribute:)
func (SKTileMapNode) Shader ¶
func (t SKTileMapNode) Shader() ISKShader
Defines a shader which is applied to each tile of the tile map.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/shader
func (SKTileMapNode) TileColumnIndexFromPosition ¶
func (t SKTileMapNode) TileColumnIndexFromPosition(position corefoundation.CGPoint) uint
position: The position in the tile map to check.
Return Value ¶
The tile map node object’s tile column index for the specified position.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/tileColumnIndex(fromPosition:)
func (SKTileMapNode) TileDefinitionAtColumnRow ¶
func (t SKTileMapNode) TileDefinitionAtColumnRow(column uint, row uint) ISKTileDefinition
column: The column index of the tile.
row: The row index of the tile.
Return Value ¶
The tile definition for the tile at the specified column and row.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/tileDefinition(atColumn:row:)
func (SKTileMapNode) TileGroupAtColumnRow ¶
func (t SKTileMapNode) TileGroupAtColumnRow(column uint, row uint) ISKTileGroup
column: The column index of the tile.
row: The row index of the tile.
Return Value ¶
The tile group for the tile at the specified column and row.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/tileGroup(atColumn:row:)
func (SKTileMapNode) TileRowIndexFromPosition ¶
func (t SKTileMapNode) TileRowIndexFromPosition(position corefoundation.CGPoint) uint
Returns the tile map node object’s tile row index for the specified position in points.
position: The position in the tile map to check.
Return Value ¶
The tile map node object’s tile row index for the specified position.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/tileRowIndex(fromPosition:)
func (SKTileMapNode) TileSet ¶
func (t SKTileMapNode) TileSet() ISKTileSet
The tile set being used by this tile map. The tile map object can only display tiles that exist in this set.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/tileSet
func (SKTileMapNode) TileSize ¶
func (t SKTileMapNode) TileSize() corefoundation.CGSize
The size of each tile in points.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/tileSize
func (SKTileMapNode) ValueForAttributeNamed ¶
func (t SKTileMapNode) ValueForAttributeNamed(key string) ISKAttributeValue
The value of a shader attribute.
key: The attribute name.
Return Value ¶
An attribute value object containing the scalar or vector value or `nil` if no such attribute exists.
See: https://developer.apple.com/documentation/SpriteKit/SKTileMapNode/value(forAttributeNamed:)
type SKTileMapNodeClass ¶
type SKTileMapNodeClass struct {
// contains filtered or unexported fields
}
func GetSKTileMapNodeClass ¶
func GetSKTileMapNodeClass() SKTileMapNodeClass
GetSKTileMapNodeClass returns the class object for SKTileMapNode.
func (SKTileMapNodeClass) Alloc ¶
func (sc SKTileMapNodeClass) Alloc() SKTileMapNode
Alloc allocates memory for a new instance of the class.
func (SKTileMapNodeClass) Class ¶
func (sc SKTileMapNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKTileSet ¶
type SKTileSet struct {
objectivec.Object
}
A container for related tile groups.
Overview ¶
An SKTileSet object contains an array of tile groups that define which tile definitions are available for use in a tile map.
Tile sets also define the arrangement of tiles within a tile map. In addition to the default rectangular grid layout, tile sets can also define hexagonal and isometric layouts.
Creating a Tile Set Programmatically ¶
- SKTileSet.InitWithTileGroups: Initializes a new tile set with an array of tile groups and rectangular grid layout.
- SKTileSet.InitWithTileGroupsTileSetType: Initializes a new tile set with an array of tile groups and specified layout.
Accessing or Reading a Tile Set’s Properties ¶
- SKTileSet.DefaultTileGroup: The tile set’s default tile group.
- SKTileSet.SetDefaultTileGroup
- SKTileSet.DefaultTileSize: The tile set’s default tile size.
- SKTileSet.SetDefaultTileSize
- SKTileSet.Name: A name associated with the tile set.
- SKTileSet.SetName
- SKTileSet.TileGroups: The tile set’s array of tile group objects.
- SKTileSet.SetTileGroups
- SKTileSet.Type: The tile set’s type.
- SKTileSet.SetType
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet
func NewTileSetFromURL ¶
func NewTileSetFromURL(url foundation.NSURL) SKTileSet
Initializes a tile set from a URL to an archived .sks file.
url: The URL of a tile set file.
Return Value ¶
A new tile set or `nil` if the URL doesn’t point to a valid tile set file.
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/init(from:)
func NewTileSetNamed ¶
Initializes a tile set by searching the app bundle for an archived `XCUIElementTypeSks` file by name.
name: The name of the tile set to search for.
Return Value ¶
A new tile set or `nil` if a tile set with a matching name cannot be found.
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/init(named:)
func NewTileSetWithTileGroups ¶
func NewTileSetWithTileGroups(tileGroups []SKTileGroup) SKTileSet
Initializes a new tile set with an array of tile groups and rectangular grid layout.
tileGroups: An array of SKTileGroup objects from which to create the tile set from.
Return Value ¶
A new tile set.
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/init(tileGroups:)
func NewTileSetWithTileGroupsTileSetType ¶
func NewTileSetWithTileGroupsTileSetType(tileGroups []SKTileGroup, tileSetType SKTileSetType) SKTileSet
Initializes a new tile set with an array of tile groups and specified layout.
tileGroups: An array of SKTileGroup objects from which to create the tile set from.
tileSetType: The arrangement of the tiles.
Return Value ¶
A new tile set.
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/init(tileGroups:tileSetType:)
func SKTileSetFromID ¶
SKTileSetFromID constructs a SKTileSet from an objc.ID.
A container for related tile groups.
func (SKTileSet) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (SKTileSet) DefaultTileGroup ¶
func (t SKTileSet) DefaultTileGroup() ISKTileGroup
The tile set’s default tile group.
Discussion ¶
With auto-mapping enabled, it is possible for some tiles to be removed because there is either no valid rule or a missing tile group for the required adjacency rule. In this situation, those tiles are replaced by the tile group specified by SKTileSet.DefaultTileGroup.
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/defaultTileGroup
func (SKTileSet) DefaultTileSize ¶
func (t SKTileSet) DefaultTileSize() corefoundation.CGSize
The tile set’s default tile size.
Discussion ¶
The default tile size an SKTileMapNode will use for its tiles
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/defaultTileSize
func (SKTileSet) EncodeWithCoder ¶
func (t SKTileSet) EncodeWithCoder(coder foundation.INSCoder)
func (SKTileSet) InitWithTileGroups ¶
func (t SKTileSet) InitWithTileGroups(tileGroups []SKTileGroup) SKTileSet
Initializes a new tile set with an array of tile groups and rectangular grid layout.
tileGroups: An array of SKTileGroup objects from which to create the tile set from.
Return Value ¶
A new tile set.
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/init(tileGroups:)
func (SKTileSet) InitWithTileGroupsTileSetType ¶
func (t SKTileSet) InitWithTileGroupsTileSetType(tileGroups []SKTileGroup, tileSetType SKTileSetType) SKTileSet
Initializes a new tile set with an array of tile groups and specified layout.
tileGroups: An array of SKTileGroup objects from which to create the tile set from.
tileSetType: The arrangement of the tiles.
Return Value ¶
A new tile set.
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/init(tileGroups:tileSetType:)
func (SKTileSet) Name ¶
A name associated with the tile set.
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/name
func (SKTileSet) SetDefaultTileGroup ¶
func (t SKTileSet) SetDefaultTileGroup(value ISKTileGroup)
func (SKTileSet) SetDefaultTileSize ¶
func (t SKTileSet) SetDefaultTileSize(value corefoundation.CGSize)
func (SKTileSet) SetTileGroups ¶
func (t SKTileSet) SetTileGroups(value []SKTileGroup)
func (SKTileSet) SetType ¶
func (t SKTileSet) SetType(value SKTileSetType)
func (SKTileSet) TileGroups ¶
func (t SKTileSet) TileGroups() []SKTileGroup
The tile set’s array of tile group objects.
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/tileGroups
func (SKTileSet) Type ¶
func (t SKTileSet) Type() SKTileSetType
The tile set’s type.
Discussion ¶
The tile set’s type specifies how the tiles in the set will be arranged when placed in a tile map.
See: https://developer.apple.com/documentation/SpriteKit/SKTileSet/type
type SKTileSetClass ¶
type SKTileSetClass struct {
// contains filtered or unexported fields
}
func GetSKTileSetClass ¶
func GetSKTileSetClass() SKTileSetClass
GetSKTileSetClass returns the class object for SKTileSet.
func (SKTileSetClass) Alloc ¶
func (sc SKTileSetClass) Alloc() SKTileSet
Alloc allocates memory for a new instance of the class.
func (SKTileSetClass) Class ¶
func (sc SKTileSetClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKTileSetType ¶
type SKTileSetType uint
See: https://developer.apple.com/documentation/SpriteKit/SKTileSetType
const ( SKTileSetTypeGrid SKTileSetType = 0 SKTileSetTypeHexagonalFlat SKTileSetType = 2 SKTileSetTypeHexagonalPointy SKTileSetType = 3 SKTileSetTypeIsometric SKTileSetType = 1 )
func (SKTileSetType) String ¶
func (e SKTileSetType) String() string
type SKTransformNode ¶
type SKTransformNode struct {
SKNode
}
A node that allows its children to rotate in 3D.
Overview ¶
[SKTranformNode] adds the ability to rotate nodes across the x and y axes. When combined with SKNode’s SKNode.ZRotation property, nodes added as children to a transform node have the ability to rotate in 3D.
Rotating Child Nodes ¶
- SKTransformNode.XRotation
- SKTransformNode.SetXRotation
- SKTransformNode.YRotation
- SKTransformNode.SetYRotation
- SKTransformNode.SetEulerAngles
- SKTransformNode.SetRotationMatrix
Reading the Current Rotation ¶
See: https://developer.apple.com/documentation/SpriteKit/SKTransformNode
func NewSKTransformNode ¶
func NewSKTransformNode() SKTransformNode
NewSKTransformNode creates a new SKTransformNode instance.
func NewTransformNodeWithCoder ¶
func NewTransformNodeWithCoder(aDecoder foundation.INSCoder) SKTransformNode
Called when a node is initialized from an .sks file.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(coder:)
func NewTransformNodeWithFileNamed ¶
func NewTransformNodeWithFileNamed(filename string) SKTransformNode
Creates a new node by loading an archive file from the game’s main bundle.
filename: The name of the file, without a file extension. The file must be in the app’s main bundle and have a `XCUIElementTypeSks` filename extension.
Return Value ¶
The unarchived node object.
Discussion ¶
If you call this method on a subclass of the SKScene class and the object in the archive is an SKScene object, the returned object is initialized as if it is a member of the subclass. You use this behavior to create scene layouts in the Xcode Editor and provide custom behaviors in your subclass.
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:)
func NewTransformNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewTransformNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKTransformNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func SKTransformNodeFromID ¶
func SKTransformNodeFromID(id objc.ID) SKTransformNode
SKTransformNodeFromID constructs a SKTransformNode from an objc.ID.
A node that allows its children to rotate in 3D.
func (SKTransformNode) Autorelease ¶
func (t SKTransformNode) Autorelease() SKTransformNode
Autorelease adds the receiver to the current autorelease pool.
func (SKTransformNode) EulerAngles ¶
func (t SKTransformNode) EulerAngles() Vector_float3
See: https://developer.apple.com/documentation/SpriteKit/SKTransformNode/eulerAngles()
func (SKTransformNode) Init ¶
func (t SKTransformNode) Init() SKTransformNode
Init initializes the instance.
func (SKTransformNode) RotationMatrix ¶
func (t SKTransformNode) RotationMatrix() [3][4]float32
See: https://developer.apple.com/documentation/SpriteKit/SKTransformNode/rotationMatrix()
func (SKTransformNode) SetEulerAngles ¶
func (t SKTransformNode) SetEulerAngles(euler Vector_float3)
See: https://developer.apple.com/documentation/SpriteKit/SKTransformNode/setEulerAngles(_:)
func (SKTransformNode) SetRotationMatrix ¶
func (t SKTransformNode) SetRotationMatrix(rotationMatrix [3][4]float32)
See: https://developer.apple.com/documentation/SpriteKit/SKTransformNode/setRotationMatrix(_:)
func (SKTransformNode) SetXRotation ¶
func (t SKTransformNode) SetXRotation(value float64)
func (SKTransformNode) SetYRotation ¶
func (t SKTransformNode) SetYRotation(value float64)
func (SKTransformNode) XRotation ¶
func (t SKTransformNode) XRotation() float64
See: https://developer.apple.com/documentation/SpriteKit/SKTransformNode/xRotation
func (SKTransformNode) YRotation ¶
func (t SKTransformNode) YRotation() float64
See: https://developer.apple.com/documentation/SpriteKit/SKTransformNode/yRotation
type SKTransformNodeClass ¶
type SKTransformNodeClass struct {
// contains filtered or unexported fields
}
func GetSKTransformNodeClass ¶
func GetSKTransformNodeClass() SKTransformNodeClass
GetSKTransformNodeClass returns the class object for SKTransformNode.
func (SKTransformNodeClass) Alloc ¶
func (sc SKTransformNodeClass) Alloc() SKTransformNode
Alloc allocates memory for a new instance of the class.
func (SKTransformNodeClass) Class ¶
func (sc SKTransformNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKTransition ¶
type SKTransition struct {
objectivec.Object
}
An object used to perform an animated transition to a new scene.
Overview ¶
Scenes are the basic building blocks of games. Typically, you design self-contained scenes for the parts of your game, and then transition between these scenes as necessary. For example, you might create different scene classes to represent any or all of the following concepts:
- A loading scene to display while other content is loaded - A main menu scene to choose what kind of game the user wants to play - A scene to configure the details of the specific kind of game the user chose - A scene that provides the gameplay - A scene displayed when gameplay ends
When you present a new scene in a view that is already presenting a scene, you have the option of using a transition to animate the change from the old scene to the new scene. Using a transition provides continuity so that the scene change is not quite so abrupt.
Pausing ¶
- SKTransition.PausesIncomingScene: A Boolean value that determines whether the incoming scene is paused during the transition.
- SKTransition.SetPausesIncomingScene
- SKTransition.PausesOutgoingScene: A Boolean value that determines whether the outgoing scene is paused during the transition.
- SKTransition.SetPausesOutgoingScene
See: https://developer.apple.com/documentation/SpriteKit/SKTransition
func NewSKTransition ¶
func NewSKTransition() SKTransition
NewSKTransition creates a new SKTransition instance.
func NewTransitionWithCIFilterDuration ¶
func NewTransitionWithCIFilterDuration(filter *coreimage.CIFilter, sec foundation.NSTimeInterval) SKTransition
Creates a transition that uses a Core Image filter to perform the transition.
filter: A Core Image filter.
sec: The duration of the transition.
Return Value ¶
A new transition.
Discussion ¶
The filter used to perform the transition must a be filter that requires only two image parameters (`inputImage`, `inputTargetImage`) and generates a single image (`outputImage`). The transition automatically sets the filter’s `inputImage`, `inputTargetImage`, and `inputTime` properties. You must set up any other filter properties before creating the transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/init(ciFilter:duration:)
func SKTransitionFromID ¶
func SKTransitionFromID(id objc.ID) SKTransition
SKTransitionFromID constructs a SKTransition from an objc.ID.
An object used to perform an animated transition to a new scene.
func (SKTransition) Autorelease ¶
func (t SKTransition) Autorelease() SKTransition
Autorelease adds the receiver to the current autorelease pool.
func (SKTransition) PausesIncomingScene ¶
func (t SKTransition) PausesIncomingScene() bool
A Boolean value that determines whether the incoming scene is paused during the transition.
Discussion ¶
The default value is true.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/pausesIncomingScene
func (SKTransition) PausesOutgoingScene ¶
func (t SKTransition) PausesOutgoingScene() bool
A Boolean value that determines whether the outgoing scene is paused during the transition.
Discussion ¶
The default value is true.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/pausesOutgoingScene
func (SKTransition) SetPausesIncomingScene ¶
func (t SKTransition) SetPausesIncomingScene(value bool)
func (SKTransition) SetPausesOutgoingScene ¶
func (t SKTransition) SetPausesOutgoingScene(value bool)
type SKTransitionClass ¶
type SKTransitionClass struct {
// contains filtered or unexported fields
}
func GetSKTransitionClass ¶
func GetSKTransitionClass() SKTransitionClass
GetSKTransitionClass returns the class object for SKTransition.
func (SKTransitionClass) Alloc ¶
func (sc SKTransitionClass) Alloc() SKTransition
Alloc allocates memory for a new instance of the class.
func (SKTransitionClass) Class ¶
func (sc SKTransitionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (SKTransitionClass) CrossFadeWithDuration ¶
func (_SKTransitionClass SKTransitionClass) CrossFadeWithDuration(sec foundation.NSTimeInterval) SKTransition
Creates a cross fade transition.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/crossFade(withDuration:)
func (SKTransitionClass) DoorsCloseHorizontalWithDuration ¶
func (_SKTransitionClass SKTransitionClass) DoorsCloseHorizontalWithDuration(sec foundation.NSTimeInterval) SKTransition
Creates a transition where the new scene appears as a pair of closing horizontal doors.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/doorsCloseHorizontal(withDuration:)
func (SKTransitionClass) DoorsCloseVerticalWithDuration ¶
func (_SKTransitionClass SKTransitionClass) DoorsCloseVerticalWithDuration(sec foundation.NSTimeInterval) SKTransition
Creates a transition where the new scene appears as a pair of closing vertical doors.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/doorsCloseVertical(withDuration:)
func (SKTransitionClass) DoorsOpenHorizontalWithDuration ¶
func (_SKTransitionClass SKTransitionClass) DoorsOpenHorizontalWithDuration(sec foundation.NSTimeInterval) SKTransition
Creates a transition where the new scene appears as a pair of opening horizontal doors.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/doorsOpenHorizontal(withDuration:)
func (SKTransitionClass) DoorsOpenVerticalWithDuration ¶
func (_SKTransitionClass SKTransitionClass) DoorsOpenVerticalWithDuration(sec foundation.NSTimeInterval) SKTransition
Creates a transition where the new scene appears as a pair of opening vertical doors.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/doorsOpenVertical(withDuration:)
func (SKTransitionClass) DoorwayWithDuration ¶
func (_SKTransitionClass SKTransitionClass) DoorwayWithDuration(sec foundation.NSTimeInterval) SKTransition
Creates a transition where the previous scene disappears as a pair of opening doors.
sec: The duration of the transition.
Return Value ¶
A new transition.
Discussion ¶
The new scene starts in the background and moves closer as the doors open.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/doorway(withDuration:)
func (SKTransitionClass) FadeWithColorDuration ¶
func (_SKTransitionClass SKTransitionClass) FadeWithColorDuration(color appkit.NSColor, sec foundation.NSTimeInterval) SKTransition
Creates a transition that first fades to a constant color and then fades to the new scene.
color: The color to use as the fade color.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/fade(with:duration:)
func (SKTransitionClass) FadeWithDuration ¶
func (_SKTransitionClass SKTransitionClass) FadeWithDuration(sec foundation.NSTimeInterval) SKTransition
Creates a transition that first fades to black and then fades to the new scene.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/fade(withDuration:)
func (SKTransitionClass) FlipHorizontalWithDuration ¶
func (_SKTransitionClass SKTransitionClass) FlipHorizontalWithDuration(sec foundation.NSTimeInterval) SKTransition
Creates a transition where the two scenes are flipped across a horizontal line running through the center of the view.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/flipHorizontal(withDuration:)
func (SKTransitionClass) FlipVerticalWithDuration ¶
func (_SKTransitionClass SKTransitionClass) FlipVerticalWithDuration(sec foundation.NSTimeInterval) SKTransition
Creates a transition where the two scenes are flipped across a vertical line running through the center of the view.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/flipVertical(withDuration:)
func (SKTransitionClass) MoveInWithDirectionDuration ¶
func (_SKTransitionClass SKTransitionClass) MoveInWithDirectionDuration(direction SKTransitionDirection, sec foundation.NSTimeInterval) SKTransition
Creates a transition where the new scene moves in on top of the old scene.
direction: The direction of the move. Possible values are described in SKTransitionDirection.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/moveIn(with:duration:)
func (SKTransitionClass) PushWithDirectionDuration ¶
func (_SKTransitionClass SKTransitionClass) PushWithDirectionDuration(direction SKTransitionDirection, sec foundation.NSTimeInterval) SKTransition
Creates a transition where the new scene moves in, pushing the old scene out of the view.
direction: The direction of the push. Possible values are described in SKTransitionDirection.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/push(with:duration:)
func (SKTransitionClass) RevealWithDirectionDuration ¶
func (_SKTransitionClass SKTransitionClass) RevealWithDirectionDuration(direction SKTransitionDirection, sec foundation.NSTimeInterval) SKTransition
Creates a transition where the old scene moves out of the view, revealing the new scene underneath it.
direction: The direction of the reveal. Possible values are described in SKTransitionDirection.
sec: The duration of the transition.
Return Value ¶
A new transition.
See: https://developer.apple.com/documentation/SpriteKit/SKTransition/reveal(with:duration:)
type SKTransitionDirection ¶
type SKTransitionDirection int
See: https://developer.apple.com/documentation/SpriteKit/SKTransitionDirection
const ( // SKTransitionDirectionDown: The transition goes down. SKTransitionDirectionDown SKTransitionDirection = 1 // SKTransitionDirectionLeft: The transition goes left. SKTransitionDirectionLeft SKTransitionDirection = 3 // SKTransitionDirectionRight: The transition goes right. SKTransitionDirectionRight SKTransitionDirection = 2 // SKTransitionDirectionUp: The transition goes up. SKTransitionDirectionUp SKTransitionDirection = 0 )
func (SKTransitionDirection) String ¶
func (e SKTransitionDirection) String() string
type SKUniform ¶
type SKUniform struct {
objectivec.Object
}
A container for uniform shader data.
Overview ¶
An SKUniform object is used to hold uniform data for a custom OpenGL or OpenGL ES shader. The uniform data is accessible from all shaders that include the uniform.To use a uniform variable in your shader, create the SKUniform object and set its initial value. Once its value is specified, the SKUniform.UniformType property changes to match the type of the initial value you provided and can never change afterward. To use the uniform object, add it to an SKShader object that needs to access the uniform variable. To update the uniform variable’s value, choose the appropriate property on the uniform object based on the data type it encapsulates.
Creating and Initializing Uniform Objects ¶
- SKUniform.InitWithName: Initializes a new uniform object.
- SKUniform.InitWithNameFloat: Initializes a new uniform object that holds a floating-point number.
- SKUniform.InitWithNameTexture: Initializes a new uniform object that holds a reference to a texture.
Reading Information About a Uniform ¶
- SKUniform.Name: The uniform’s name.
- SKUniform.UniformType: The uniform object’s data type.
Reading and Writing an Uniform Object’s Value ¶
- SKUniform.FloatValue: The receiver’s value as a floating-point value.
- SKUniform.SetFloatValue
- SKUniform.TextureValue: The receiver’s value as a SpriteKit texture.
- SKUniform.SetTextureValue
Initializers ¶
- SKUniform.InitWithNameMatrixFloat2x2
- SKUniform.InitWithNameMatrixFloat3x3
- SKUniform.InitWithNameMatrixFloat4x4
- SKUniform.InitWithNameVectorFloat2
- SKUniform.InitWithNameVectorFloat3
- SKUniform.InitWithNameVectorFloat4
Instance Properties ¶
- SKUniform.MatrixFloat2x2Value
- SKUniform.SetMatrixFloat2x2Value
- SKUniform.MatrixFloat3x3Value
- SKUniform.SetMatrixFloat3x3Value
- SKUniform.MatrixFloat4x4Value
- SKUniform.SetMatrixFloat4x4Value
- SKUniform.VectorFloat2Value
- SKUniform.SetVectorFloat2Value
- SKUniform.VectorFloat3Value
- SKUniform.SetVectorFloat3Value
- SKUniform.VectorFloat4Value
- SKUniform.SetVectorFloat4Value
See: https://developer.apple.com/documentation/SpriteKit/SKUniform
func NewUniformWithName ¶
Initializes a new uniform object.
name: The name used to identify the uniform variable; you use this name inside your shader to read the uniform variable’s value.
Return Value ¶
An initialized uniform object.
Discussion ¶
A uniform initialized with this method has no initial type and cannot be used in a shader until it is given an initial value. To set the initial value, use one of the properties defined in SKUniform. After its value is set, its SKUniform.UniformType property is set to match the uniform’s new type. Once set, the type may not be changed.
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:)
func NewUniformWithNameFloat ¶
Initializes a new uniform object that holds a floating-point number.
name: The name used to identify the uniform variable; you use this name inside your shader to read the uniform variable’s value.
value: The initial floating-point value for the uniform variable.
Return Value ¶
An initialized uniform object whose type is set to SKUniformType.float.
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:float:)-48rln
func NewUniformWithNameMatrixFloat2x2 ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:matrixFloat2x2:)
func NewUniformWithNameMatrixFloat3x3 ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:matrixFloat3x3:)
func NewUniformWithNameMatrixFloat4x4 ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:matrixFloat4x4:)
func NewUniformWithNameTexture ¶
func NewUniformWithNameTexture(name string, texture ISKTexture) SKUniform
Initializes a new uniform object that holds a reference to a texture.
name: The name used to identify the uniform variable; you use this name inside your shader to read the uniform variable’s value.
texture: The initial texture to use for the uniform variable.
Return Value ¶
An initialized uniform object whose type is set to SKUniformType.texture.
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:texture:)
func NewUniformWithNameVectorFloat2 ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:vectorFloat2:)
func NewUniformWithNameVectorFloat3 ¶
func NewUniformWithNameVectorFloat3(name string, value Vector_float3) SKUniform
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:vectorFloat3:)
func NewUniformWithNameVectorFloat4 ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:vectorFloat4:)
func SKUniformFromID ¶
SKUniformFromID constructs a SKUniform from an objc.ID.
A container for uniform shader data.
func (SKUniform) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (SKUniform) EncodeWithCoder ¶
func (u SKUniform) EncodeWithCoder(coder foundation.INSCoder)
func (SKUniform) FloatValue ¶
The receiver’s value as a floating-point value.
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/floatValue
func (SKUniform) InitWithName ¶
Initializes a new uniform object.
name: The name used to identify the uniform variable; you use this name inside your shader to read the uniform variable’s value.
Return Value ¶
An initialized uniform object.
Discussion ¶
A uniform initialized with this method has no initial type and cannot be used in a shader until it is given an initial value. To set the initial value, use one of the properties defined in SKUniform. After its value is set, its SKUniform.UniformType property is set to match the uniform’s new type. Once set, the type may not be changed.
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:)
func (SKUniform) InitWithNameFloat ¶
Initializes a new uniform object that holds a floating-point number.
name: The name used to identify the uniform variable; you use this name inside your shader to read the uniform variable’s value.
value: The initial floating-point value for the uniform variable.
Return Value ¶
An initialized uniform object whose type is set to SKUniformType.float.
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:float:)-48rln
func (SKUniform) InitWithNameMatrixFloat2x2 ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:matrixFloat2x2:)
func (SKUniform) InitWithNameMatrixFloat3x3 ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:matrixFloat3x3:)
func (SKUniform) InitWithNameMatrixFloat4x4 ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:matrixFloat4x4:)
func (SKUniform) InitWithNameTexture ¶
func (u SKUniform) InitWithNameTexture(name string, texture ISKTexture) SKUniform
Initializes a new uniform object that holds a reference to a texture.
name: The name used to identify the uniform variable; you use this name inside your shader to read the uniform variable’s value.
texture: The initial texture to use for the uniform variable.
Return Value ¶
An initialized uniform object whose type is set to SKUniformType.texture.
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:texture:)
func (SKUniform) InitWithNameVectorFloat2 ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:vectorFloat2:)
func (SKUniform) InitWithNameVectorFloat3 ¶
func (u SKUniform) InitWithNameVectorFloat3(name string, value Vector_float3) SKUniform
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:vectorFloat3:)
func (SKUniform) InitWithNameVectorFloat4 ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/init(name:vectorFloat4:)
func (SKUniform) MatrixFloat2x2Value ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/matrixFloat2x2Value
func (SKUniform) MatrixFloat3x3Value ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/matrixFloat3x3Value
func (SKUniform) MatrixFloat4x4Value ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/matrixFloat4x4Value
func (SKUniform) Name ¶
The uniform’s name.
Discussion ¶
Your custom fragment shader uses this name to identify the variable. SpriteKit automatically declares the uniform variable for your shader.
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/name
func (SKUniform) SetFloatValue ¶
func (SKUniform) SetMatrixFloat2x2Value ¶
func (SKUniform) SetMatrixFloat3x3Value ¶
func (SKUniform) SetMatrixFloat4x4Value ¶
func (SKUniform) SetTextureValue ¶
func (u SKUniform) SetTextureValue(value ISKTexture)
func (SKUniform) SetVectorFloat2Value ¶
func (SKUniform) SetVectorFloat3Value ¶
func (u SKUniform) SetVectorFloat3Value(value Vector_float3)
func (SKUniform) SetVectorFloat4Value ¶
func (SKUniform) TextureValue ¶
func (u SKUniform) TextureValue() ISKTexture
The receiver’s value as a SpriteKit texture.
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/textureValue
func (SKUniform) UniformType ¶
func (u SKUniform) UniformType() SKUniformType
The uniform object’s data type.
Discussion ¶
A uniform object’s type is set to SKUniformType.none until the first time that the uniform variable’s value is set; this happens automatically if you use an initialization method that provides an initial type and value. Once the uniform object is given an initial value, its type changes to that value’s type and thereafter cannot be changed.
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/uniformType
func (SKUniform) VectorFloat2Value ¶
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/vectorFloat2Value
func (SKUniform) VectorFloat3Value ¶
func (u SKUniform) VectorFloat3Value() Vector_float3
See: https://developer.apple.com/documentation/SpriteKit/SKUniform/vectorFloat3Value
type SKUniformClass ¶
type SKUniformClass struct {
// contains filtered or unexported fields
}
func GetSKUniformClass ¶
func GetSKUniformClass() SKUniformClass
GetSKUniformClass returns the class object for SKUniform.
func (SKUniformClass) Alloc ¶
func (sc SKUniformClass) Alloc() SKUniform
Alloc allocates memory for a new instance of the class.
func (SKUniformClass) Class ¶
func (sc SKUniformClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKUniformType ¶
type SKUniformType int
See: https://developer.apple.com/documentation/SpriteKit/SKUniformType
const ( // SKUniformTypeFloat: Indicates that the uniform variable holds a 32-bit floating-point value. SKUniformTypeFloat SKUniformType = 1 // SKUniformTypeFloatMatrix2: Indicates that the uniform variable holds a matrix of four 32-bit floating-point values. SKUniformTypeFloatMatrix2 SKUniformType = 5 // SKUniformTypeFloatMatrix3: Indicates that the uniform variable holds a matrix of four 32-bit floating-point values. SKUniformTypeFloatMatrix3 SKUniformType = 6 // SKUniformTypeFloatMatrix4: Indicates that the uniform variable holds a matrix of four 32-bit floating-point values. SKUniformTypeFloatMatrix4 SKUniformType = 7 // SKUniformTypeFloatVector2: Indicates that the uniform variable holds a vector of two 32-bit floating-point values. SKUniformTypeFloatVector2 SKUniformType = 2 // SKUniformTypeFloatVector3: Indicates that the uniform variable holds a vector of three 32-bit floating-point values. SKUniformTypeFloatVector3 SKUniformType = 3 // SKUniformTypeFloatVector4: Indicates that the uniform variable holds a vector of four 32-bit floating-point values. SKUniformTypeFloatVector4 SKUniformType = 4 // SKUniformTypeNone: Indicates that the uniform variable does not currently hold any data. SKUniformTypeNone SKUniformType = 0 // SKUniformTypeTexture: Indicates that the uniform variable holds a reference to a SpriteKit texture. SKUniformTypeTexture SKUniformType = 8 )
func (SKUniformType) String ¶
func (e SKUniformType) String() string
type SKVideoNode ¶
type SKVideoNode struct {
SKNode
}
A graphical element that plays video content.
Overview ¶
This class renders a video at a given size and location in your scene with no exposed player controls.
Creating a Video Node ¶
- SKVideoNode.InitWithAVPlayer: Initializes a video node using an existing [AVPlayer](<https://developer.apple.com/documentation/AVFoundation/AVPlayer>) object.
- SKVideoNode.InitWithFileNamed: Initializes a video node using a video file stored in the app bundle.
- SKVideoNode.InitWithURL: Initializes a video node using a URL.
Setting the Video Node’s Visual Properties ¶
- SKVideoNode.AnchorPoint: The point in the sprite that corresponds to the node’s position.
- SKVideoNode.SetAnchorPoint
- SKVideoNode.Size: The dimensions of the video node, in points.
- SKVideoNode.SetSize
Controlling Video Playback ¶
- SKVideoNode.Play: Starts video playback.
- SKVideoNode.Pause: Pauses video playback.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode
func NewSKVideoNode ¶
func NewSKVideoNode() SKVideoNode
NewSKVideoNode creates a new SKVideoNode instance.
func NewVideoNodeWithAVPlayer ¶
func NewVideoNodeWithAVPlayer(player objectivec.IObject) SKVideoNode
Initializes a video node using an existing AVPlayer object.
player: A player object.
Return Value ¶
An initialized video node.
Discussion ¶
You can use the AVPlayer object to control playback.
Listing 1 shows, in Swift, how you can create a video node using the SKVideoNode.InitWithAVPlayer initializer.
Listing 1. Creating a video node with an AV Player
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/init(avPlayer:)
func NewVideoNodeWithCoder ¶
func NewVideoNodeWithCoder(aDecoder foundation.INSCoder) SKVideoNode
Tells you when to initialize a video node that was created from an archive.
Discussion ¶
Do not call this initializer yourself; it is called by the system when you should intialize a video node that was created from an archive.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/init(coder:)
func NewVideoNodeWithFileNamed ¶
func NewVideoNodeWithFileNamed(videoFile string) SKVideoNode
Initializes a video node using a video file stored in the app bundle.
videoFile: The name of the video file.
Return Value ¶
An initialized video node.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/init(fileNamed:)
func NewVideoNodeWithFileNamedSecurelyWithClassesAndError ¶
func NewVideoNodeWithFileNamedSecurelyWithClassesAndError(filename string, classes foundation.INSSet) (SKVideoNode, error)
See: https://developer.apple.com/documentation/SpriteKit/SKNode/init(fileNamed:securelyWithClasses:)
func NewVideoNodeWithURL ¶
func NewVideoNodeWithURL(url foundation.NSURL) SKVideoNode
Initializes a video node using a URL.
url: The URL for the video to play.
Return Value ¶
An initialized video node.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/init(url:)
func SKVideoNodeFromID ¶
func SKVideoNodeFromID(id objc.ID) SKVideoNode
SKVideoNodeFromID constructs a SKVideoNode from an objc.ID.
A graphical element that plays video content.
func (SKVideoNode) AnchorPoint ¶
func (v SKVideoNode) AnchorPoint() corefoundation.CGPoint
The point in the sprite that corresponds to the node’s position.
Discussion ¶
You specify the anchor point using the unit coordinate space. The default value is `(0.5,0.5)`, which means that the video is centered on the node’s position.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/anchorPoint
func (SKVideoNode) Autorelease ¶
func (v SKVideoNode) Autorelease() SKVideoNode
Autorelease adds the receiver to the current autorelease pool.
func (SKVideoNode) InitWithAVPlayer ¶
func (v SKVideoNode) InitWithAVPlayer(player objectivec.IObject) SKVideoNode
Initializes a video node using an existing AVPlayer object.
player: A player object.
player is a [*avfoundation.AVPlayer].
Return Value ¶
An initialized video node.
Discussion ¶
You can use the AVPlayer object to control playback.
Listing 1 shows, in Swift, how you can create a video node using the SKVideoNode.InitWithAVPlayer initializer.
Listing 1. Creating a video node with an AV Player
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/init(avPlayer:)
func (SKVideoNode) InitWithFileNamed ¶
func (v SKVideoNode) InitWithFileNamed(videoFile string) SKVideoNode
Initializes a video node using a video file stored in the app bundle.
videoFile: The name of the video file.
Return Value ¶
An initialized video node.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/init(fileNamed:)
func (SKVideoNode) InitWithURL ¶
func (v SKVideoNode) InitWithURL(url foundation.NSURL) SKVideoNode
Initializes a video node using a URL.
url: The URL for the video to play.
Return Value ¶
An initialized video node.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/init(url:)
func (SKVideoNode) Pause ¶
func (v SKVideoNode) Pause()
Pauses video playback.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/pause()
func (SKVideoNode) Play ¶
func (v SKVideoNode) Play()
Starts video playback.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/play()
func (SKVideoNode) SetAnchorPoint ¶
func (v SKVideoNode) SetAnchorPoint(value corefoundation.CGPoint)
func (SKVideoNode) SetSize ¶
func (v SKVideoNode) SetSize(value corefoundation.CGSize)
func (SKVideoNode) Size ¶
func (v SKVideoNode) Size() corefoundation.CGSize
The dimensions of the video node, in points.
Discussion ¶
The default value is the size of the video used to instantiate the node.
See: https://developer.apple.com/documentation/SpriteKit/SKVideoNode/size
type SKVideoNodeClass ¶
type SKVideoNodeClass struct {
// contains filtered or unexported fields
}
func GetSKVideoNodeClass ¶
func GetSKVideoNodeClass() SKVideoNodeClass
GetSKVideoNodeClass returns the class object for SKVideoNode.
func (SKVideoNodeClass) Alloc ¶
func (sc SKVideoNodeClass) Alloc() SKVideoNode
Alloc allocates memory for a new instance of the class.
func (SKVideoNodeClass) Class ¶
func (sc SKVideoNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKView ¶
A view subclass that renders a SpriteKit scene.
Overview ¶
You present a scene by calling the view’s SKView.PresentScene method. When a scene is presented by the view, it alternates between running its simulation (which animates the content) and rendering the content for display. You can pause the scene by setting the view’s [SKView.Paused] property to true.
Displaying a Scene ¶
- SKView.Scene: The scene currently presented by this view.
- SKView.PresentScene: Presents a scene.
- SKView.PresentSceneTransition: Transitions from the current scene to a new scene.
Controlling the Timing of a Scene’s Rendering ¶
- SKView.IsPaused: A Boolean value that indicates whether the view’s scene animations are paused.
- SKView.SetPaused
- SKView.PreferredFramesPerSecond: The animation frame rate that the view uses to render its scene.
- SKView.SetPreferredFramesPerSecond
- SKView.Delegate: A delegate that allows dynamic control of the view’s render rate.
- SKView.SetDelegate
Configuring Performance Related Toggles ¶
- SKView.IgnoresSiblingOrder: A Boolean value that indicates whether parent-child and sibling relationships affect the rendering order of nodes in the scene.
- SKView.SetIgnoresSiblingOrder
- SKView.ShouldCullNonVisibleNodes: A Boolean value that indicates whether the view automatically culls non-visible nodes from the rendering tree.
- SKView.SetShouldCullNonVisibleNodes
- SKView.AllowsTransparency: A Boolean property that indicates whether the view is rendered using transparency.
- SKView.SetAllowsTransparency
- SKView.IsAsynchronous: A Boolean value that indicates whether the content is rendered asynchronously.
- SKView.SetAsynchronous
Enabling Visual Statistics for Debugging ¶
- SKView.ShowsFPS: A Boolean value that indicates whether the view displays a frame rate indicator.
- SKView.SetShowsFPS
- SKView.ShowsNodeCount: A Boolean value that indicates whether the view displays an overlay that shows physics bodies that are visible in the scene.
- SKView.SetShowsNodeCount
- SKView.ShowsDrawCount: A Boolean value that indicates whether the view displays the number of drawing passes it needed to render the view.
- SKView.SetShowsDrawCount
- SKView.ShowsQuadCount: A Boolean value that indicates whether the view displays the number of rectangles used to render the scene.
- SKView.SetShowsQuadCount
- SKView.ShowsPhysics: A Boolean value that indicates whether the view displays physics-related debugging information.
- SKView.SetShowsPhysics
- SKView.ShowsFields: A Boolean value that indicates whether the view displays information about physics fields in the scene.
- SKView.SetShowsFields
Converting Between View and Scene Coordinates ¶
- SKView.ConvertPointFromScene: Converts a point from scene coordinates to view coordinates.
- SKView.ConvertPointToScene: Converts a point from view coordinates to scene coordinates.
Snapshotting Nodes to a Texture ¶
- SKView.TextureFromNodeCrop: Renders a portion of a node’s contents and returns the rendered image as a texture.
- SKView.TextureFromNode: Renders the contents of a node tree and returns the rendered image as a texture.
Instance Properties ¶
See: https://developer.apple.com/documentation/SpriteKit/SKView
func SKViewFromID ¶
SKViewFromID constructs a SKView from an objc.ID.
A view subclass that renders a SpriteKit scene.
func (SKView) AllowsTransparency ¶
A Boolean property that indicates whether the view is rendered using transparency.
Discussion ¶
This property tells the drawing system as to how it should treat the view. If set to false, the drawing system treats the view as fully opaque, which allows the drawing system to optimize some drawing operations and improve performance. If set to true, the drawing system composites the view normally with other content. The default value of this property is false.
An opaque view is expected to fill its bounds with entirely opaque content—that is, the content should have an alpha value of 1.0. If the view is opaque and either does not fill its bounds or contains wholly or partially transparent content, the results are unpredictable. Always set the value of this property to false if the view is fully or partially transparent.
See: https://developer.apple.com/documentation/SpriteKit/SKView/allowsTransparency
func (SKView) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (SKView) ConvertPointFromScene ¶
func (v SKView) ConvertPointFromScene(point corefoundation.CGPoint, scene ISKScene) corefoundation.CGPoint
Converts a point from scene coordinates to view coordinates.
point: A point in scene coordinates.
scene: A scene.
Return Value ¶
The same point in the view’s coordinate system.
Discussion ¶
This method performs the coordinate conversion as if the scene is presented inside the view.
See: https://developer.apple.com/documentation/SpriteKit/SKView/convert(_:from:)
func (SKView) ConvertPointToScene ¶
func (v SKView) ConvertPointToScene(point corefoundation.CGPoint, scene ISKScene) corefoundation.CGPoint
Converts a point from view coordinates to scene coordinates.
point: A point in view coordinates.
scene: A scene.
Return Value ¶
The same point in the scene’s coordinate system.
Discussion ¶
This method performs the coordinate conversion as if the scene is presented inside the view.
See: https://developer.apple.com/documentation/SpriteKit/SKView/convert(_:to:)
func (SKView) Delegate ¶
func (v SKView) Delegate() objectivec.Object
A delegate that allows dynamic control of the view’s render rate.
See: https://developer.apple.com/documentation/SpriteKit/SKView/delegate
func (SKView) DisableDepthStencilBuffer ¶
See: https://developer.apple.com/documentation/SpriteKit/SKView/disableDepthStencilBuffer
func (SKView) IgnoresSiblingOrder ¶
A Boolean value that indicates whether parent-child and sibling relationships affect the rendering order of nodes in the scene.
Discussion ¶
The default value is false, which means that when multiple nodes share the same z position, those nodes are sorted and rendered in a deterministic order. Parents are rendered before their children, and siblings are rendered in array order. When this property is set to true, the position of the nodes in the tree is ignored when determining the rendering order. The rendering order of nodes at the same z position is arbitrary and may change every time a new frame is rendered. When sibling and parent order is ignored, SpriteKit applies additional optimizations to improve rendering performance. If you need nodes to be rendered in a specific and deterministic order, you must set the z position of those nodes.
See: https://developer.apple.com/documentation/SpriteKit/SKView/ignoresSiblingOrder
func (SKView) IsAsynchronous ¶
A Boolean value that indicates whether the content is rendered asynchronously.
Discussion ¶
The default value is true. If the value is false, the contents of this view are synchronized with Core Animation updates.
See: https://developer.apple.com/documentation/SpriteKit/SKView/isAsynchronous
func (SKView) IsPaused ¶
A Boolean value that indicates whether the view’s scene animations are paused.
Discussion ¶
If the value is true, the scene’s content is fixed onscreen. No actions are executed and no physics simulation is performed.
When an application moves from an active to an inactive state, [SKView.Paused] is automatically set to true. When an application returns to an active state, [SKView.Paused] is automatically set to its previous value.
See: https://developer.apple.com/documentation/SpriteKit/SKView/isPaused
func (SKView) PreferredFramesPerSecond ¶
The animation frame rate that the view uses to render its scene.
Discussion ¶
When your application sets its preferred frame rate, the view chooses a frame rate as close to that as possible based on the capabilities of the screen the view is displayed on. The actual frame rate chosen is usually a factor of the maximum refresh rate of the screen to provide a consistent frame rate. For example, if the maximum refresh rate of the screen is 60 frames per second, that is also the highest frame rate the view sets as the actual frame rate. However, if you ask for a lower frame rate, the view might choose 30, 20, or 15 frames per second, or another rate, as the actual frame rate.
Your application should choose a frame rate that it can consistently maintain.
The default value is 60 frames per second.
See: https://developer.apple.com/documentation/SpriteKit/SKView/preferredFramesPerSecond
func (SKView) PresentScene ¶
Presents a scene.
scene: The scene to present.
Discussion ¶
The new scene immediately replaces the current scene, if one exists.
See: https://developer.apple.com/documentation/SpriteKit/SKView/presentScene(_:)
func (SKView) PresentSceneTransition ¶
func (v SKView) PresentSceneTransition(scene ISKScene, transition ISKTransition)
Transitions from the current scene to a new scene.
scene: The scene to present.
transition: A transition used to animate between the two scenes.
Discussion ¶
If there is currently a scene presented by the view, the view’s SKView.Scene property is updated immediately, the transition is executed to swap between the scenes. Otherwise, the new scene is presented immediately and the transition property is ignored.
See: https://developer.apple.com/documentation/SpriteKit/SKView/presentScene(_:transition:)
func (SKView) Scene ¶
The scene currently presented by this view.
Discussion ¶
The default value is `nil`.
You call SKView.PresentScene to assign a value to this property.
See: https://developer.apple.com/documentation/SpriteKit/SKView/scene
func (SKView) SetAllowsTransparency ¶
func (SKView) SetAsynchronous ¶
func (SKView) SetDelegate ¶
func (v SKView) SetDelegate(value objectivec.Object)
func (SKView) SetDisableDepthStencilBuffer ¶
func (SKView) SetIgnoresSiblingOrder ¶
func (SKView) SetPreferredFramesPerSecond ¶
func (SKView) SetShouldCullNonVisibleNodes ¶
func (SKView) SetShowsDrawCount ¶
func (SKView) SetShowsFPS ¶
func (SKView) SetShowsFields ¶
func (SKView) SetShowsNodeCount ¶
func (SKView) SetShowsPhysics ¶
func (SKView) SetShowsQuadCount ¶
func (SKView) ShouldCullNonVisibleNodes ¶
A Boolean value that indicates whether the view automatically culls non-visible nodes from the rendering tree.
Discussion ¶
The default value is true, meaning that when the scene is rendered, the scene first searches the tree for invisible or offscreen nodes and culls them from the list of nodes to be rendered. Then the remaining (visible) nodes are processed and rendered. This is normally the desired behavior, because Scene Kit avoids expensive processing on nodes that cannot affect the final output. However, if your game is already managing the contents of the scene’s node tree (for example, by removing nodes from the tree when they are offscreen), you can set this to false to disable automatic scene culling. Disabling scene culling removes the performance overhead of this check, but each invisible or offscreen node present in the node tree reduces the performance of the renderer.
See: https://developer.apple.com/documentation/SpriteKit/SKView/shouldCullNonVisibleNodes
func (SKView) ShowsDrawCount ¶
A Boolean value that indicates whether the view displays the number of drawing passes it needed to render the view.
Discussion ¶
Some operations in SpriteKit can require multiple rendering passes to draw a scene’s content. For example, an SKEffectNode object must render its children into a separate buffer, apply the effect, and then perform another pass to blend those results into its parent node. These additional rendering passes use more rendering resources, reducing your game’s frame rate or increasing its total power consumption. Use the draw count as another piece of data when you profile your game’s performance.
See: https://developer.apple.com/documentation/SpriteKit/SKView/showsDrawCount
func (SKView) ShowsFPS ¶
A Boolean value that indicates whether the view displays a frame rate indicator.
Discussion ¶
The frame rate is a good indicator of the performance of your scene. Avoid creating scenes that have widely varying frame rates.
See: https://developer.apple.com/documentation/SpriteKit/SKView/showsFPS
func (SKView) ShowsFields ¶
A Boolean value that indicates whether the view displays information about physics fields in the scene.
Discussion ¶
When this debugging option is enabled, each time a frame is rendered, an image is drawn behind your scene that shows the effects of any physics fields contained in the scene.
See: https://developer.apple.com/documentation/SpriteKit/SKView/showsFields
func (SKView) ShowsNodeCount ¶
A Boolean value that indicates whether the view displays an overlay that shows physics bodies that are visible in the scene.
Discussion ¶
When you enable this option, it shows the number of nodes currently in the scene’s node tree.
You may achieve additional performance gain by actually removing nodes from the node tree manually which are off screen. For example, in the case of SKView.ShouldCullNonVisibleNodes, there would be less nodes for SpriteKit to test every frame whether they’re on screen.
See: https://developer.apple.com/documentation/SpriteKit/SKView/showsNodeCount
func (SKView) ShowsPhysics ¶
A Boolean value that indicates whether the view displays physics-related debugging information.
Discussion ¶
When this debugging option is enabled, each time a frame is rendered, an overlay image is drawn on top of your scene that shows the positions and shapes of any physics bodies visible in the scene.
See: https://developer.apple.com/documentation/SpriteKit/SKView/showsPhysics
func (SKView) ShowsQuadCount ¶
A Boolean value that indicates whether the view displays the number of rectangles used to render the scene.
Discussion ¶
SpriteKit converts the node tree into one or more rendering passes. Each rendering pass is rendered using a series of textured rectangles (quads). The SKView.ShowsQuadCount property allows you to see the total number of quads that were used to render the scene’s contents. Use this as another piece of data when you profile your game’s performance. In most cases, fewer quads is better.
See: https://developer.apple.com/documentation/SpriteKit/SKView/showsQuadCount
func (SKView) TextureFromNode ¶
func (v SKView) TextureFromNode(node ISKNode) ISKTexture
Renders the contents of a node tree and returns the rendered image as a texture.
node: The node object that is the root node of the tree you want to render to the texture.
Return Value ¶
A SpriteKit texture that holds the rendered image.
Discussion ¶
The node being rendered does not need to appear in the view’s presented scene. The new texture is created with a size equal to the rectangle returned by the node’s SKNode.CalculateAccumulatedFrame method. If the node is not a scene node, it is rendered with a clear background color (`[“SKColor` `clear]`).
See: https://developer.apple.com/documentation/SpriteKit/SKView/texture(from:)
func (SKView) TextureFromNodeCrop ¶
func (v SKView) TextureFromNodeCrop(node ISKNode, crop corefoundation.CGRect) ISKTexture
Renders a portion of a node’s contents and returns the rendered image as a texture.
node: The node object that is the root node of the tree you want to render to the texture.
crop: A rectangle in the node’s coordinate system that describes the area to be rendered.
Return Value ¶
A SpriteKit texture that holds the rendered image.
Discussion ¶
The node being rendered does not need to appear in the view’s presented scene. The new texture is created with a size equal to the size of the `crop` rectangle. If the node is not a scene node, it is rendered with a clear background color (`[“SKColor` `clear]`).
See: https://developer.apple.com/documentation/SpriteKit/SKView/texture(from:crop:)
type SKViewClass ¶
type SKViewClass struct {
// contains filtered or unexported fields
}
func GetSKViewClass ¶
func GetSKViewClass() SKViewClass
GetSKViewClass returns the class object for SKView.
func (SKViewClass) Alloc ¶
func (sc SKViewClass) Alloc() SKView
Alloc allocates memory for a new instance of the class.
func (SKViewClass) Class ¶
func (sc SKViewClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKViewDelegate ¶
type SKViewDelegate interface {
objectivec.IObject
}
Methods to take custom control over the view’s render rate.
See: https://developer.apple.com/documentation/SpriteKit/SKViewDelegate
type SKViewDelegateConfig ¶
type SKViewDelegateConfig struct {
// Instance Methods
// ViewShouldRenderAtTime — Specifies whether the view should render at the given time.
ViewShouldRenderAtTime func(view SKView, time foundation.NSTimeInterval) bool
}
SKViewDelegateConfig holds optional typed callbacks for SKViewDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.
See Apple Documentation for protocol details.
type SKViewDelegateObject ¶
type SKViewDelegateObject struct {
objectivec.Object
}
SKViewDelegateObject wraps an existing Objective-C object that conforms to the SKViewDelegate protocol.
func NewSKViewDelegate ¶
func NewSKViewDelegate(config SKViewDelegateConfig) SKViewDelegateObject
NewSKViewDelegate creates an Objective-C object implementing the SKViewDelegate protocol.
Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.
The returned SKViewDelegateObject satisfies the SKViewDelegate interface and can be passed directly to SetDelegate and similar methods.
See Apple Documentation for protocol details.
func SKViewDelegateObjectFromID ¶
func SKViewDelegateObjectFromID(id objc.ID) SKViewDelegateObject
SKViewDelegateObjectFromID constructs a SKViewDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func (SKViewDelegateObject) BaseObject ¶
func (o SKViewDelegateObject) BaseObject() objectivec.Object
func (SKViewDelegateObject) ViewShouldRenderAtTime ¶
func (o SKViewDelegateObject) ViewShouldRenderAtTime(view ISKView, time foundation.NSTimeInterval) bool
Specifies whether the view should render at the given time.
view: The SKView.
time: The target time.
Return Value ¶
Return `true` to initiate an update and render for the target time. Return `false` to skip the update and render for the target time.
See: https://developer.apple.com/documentation/SpriteKit/SKViewDelegate/view(_:shouldRenderAtTime:)
type SKWarpGeometry ¶
type SKWarpGeometry struct {
objectivec.Object
}
A definition for a deformation of nodes that conform to SKWarpable.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometry
func NewSKWarpGeometry ¶
func NewSKWarpGeometry() SKWarpGeometry
NewSKWarpGeometry creates a new SKWarpGeometry instance.
func SKWarpGeometryFromID ¶
func SKWarpGeometryFromID(id objc.ID) SKWarpGeometry
SKWarpGeometryFromID constructs a SKWarpGeometry from an objc.ID.
A definition for a deformation of nodes that conform to SKWarpable.
func (SKWarpGeometry) Autorelease ¶
func (w SKWarpGeometry) Autorelease() SKWarpGeometry
Autorelease adds the receiver to the current autorelease pool.
func (SKWarpGeometry) EncodeWithCoder ¶
func (w SKWarpGeometry) EncodeWithCoder(coder foundation.INSCoder)
func (SKWarpGeometry) Init ¶
func (w SKWarpGeometry) Init() SKWarpGeometry
Init initializes the instance.
type SKWarpGeometryClass ¶
type SKWarpGeometryClass struct {
// contains filtered or unexported fields
}
func GetSKWarpGeometryClass ¶
func GetSKWarpGeometryClass() SKWarpGeometryClass
GetSKWarpGeometryClass returns the class object for SKWarpGeometry.
func (SKWarpGeometryClass) Alloc ¶
func (sc SKWarpGeometryClass) Alloc() SKWarpGeometry
Alloc allocates memory for a new instance of the class.
func (SKWarpGeometryClass) Class ¶
func (sc SKWarpGeometryClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKWarpGeometryGrid ¶
type SKWarpGeometryGrid struct {
SKWarpGeometry
}
A definition for a grid-based deformation of nodes that conform to SKWarpable.
Overview ¶
An SKWarpGeometryGrid exposes a 2D array of source positions, and set of destination positions with matching size, that allow you to define which sections of a node should be translated from the source positions to the destination positions. Conceptually, this forms two grids—a source grid and a destination grid—where the visual warping is accomplished by stretching or shrinking each section of the node as the source positions of the grid interpolate to their corresponding destination positions.
Accessing or Setting Warp Geometry Grid Size ¶
- SKWarpGeometryGrid.NumberOfColumns: The object’s number of columns.
- SKWarpGeometryGrid.NumberOfRows: The object’s number of rows.
- SKWarpGeometryGrid.VertexCount: The object’s total number of vertices.
Accessing or Setting Grid Vertices ¶
- SKWarpGeometryGrid.DestPositionAtIndex: Returns the destination position of a vertex.
- SKWarpGeometryGrid.SourcePositionAtIndex: Returns the source position of a vertex.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometryGrid
func NewSKWarpGeometryGrid ¶
func NewSKWarpGeometryGrid() SKWarpGeometryGrid
NewSKWarpGeometryGrid creates a new SKWarpGeometryGrid instance.
func NewWarpGeometryGridWithCoder ¶
func NewWarpGeometryGridWithCoder(aDecoder foundation.INSCoder) SKWarpGeometryGrid
Tells you when to intialize a grid that was loaded from an archive.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometryGrid/init(coder:)
func NewWarpGeometryGridWithColumnsRows ¶
func NewWarpGeometryGridWithColumnsRows(cols int, rows int) SKWarpGeometryGrid
Creates a warp geometry grid of a specified size.
cols: The number of columns in the grid.
rows: The number of rows in the grid.
Return Value ¶
A new warp geometry grid object.
Discussion ¶
Creating a warp geometry grid without explicit source and destination positions automatically generates the required position arrays. For example, a 2 column by 2 row grid would create two arrays containing nine positions each, beginning at `[0,0]` - for the bottom left position - and ending at `[1,1]` - for the top left position.
[Table data omitted]
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometryGrid/init(columns:rows:)
func SKWarpGeometryGridFromID ¶
func SKWarpGeometryGridFromID(id objc.ID) SKWarpGeometryGrid
SKWarpGeometryGridFromID constructs a SKWarpGeometryGrid from an objc.ID.
A definition for a grid-based deformation of nodes that conform to SKWarpable.
func (SKWarpGeometryGrid) Autorelease ¶
func (w SKWarpGeometryGrid) Autorelease() SKWarpGeometryGrid
Autorelease adds the receiver to the current autorelease pool.
func (SKWarpGeometryGrid) DestPositionAtIndex ¶
func (w SKWarpGeometryGrid) DestPositionAtIndex(index int) [2]float32
Returns the destination position of a vertex.
index: The index of the position vertex to query.
Return Value ¶
The normalized position of the specified vertex in `destPositions`.
Discussion ¶
The specified index must be between 0 and the warp geometry grid’s SKWarpGeometryGrid.VertexCount `- 1`.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometryGrid/destPosition(at:)
func (SKWarpGeometryGrid) Init ¶
func (w SKWarpGeometryGrid) Init() SKWarpGeometryGrid
Init initializes the instance.
func (SKWarpGeometryGrid) NumberOfColumns ¶
func (w SKWarpGeometryGrid) NumberOfColumns() int
The object’s number of columns.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometryGrid/numberOfColumns
func (SKWarpGeometryGrid) NumberOfRows ¶
func (w SKWarpGeometryGrid) NumberOfRows() int
The object’s number of rows.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometryGrid/numberOfRows
func (SKWarpGeometryGrid) SourcePositionAtIndex ¶
func (w SKWarpGeometryGrid) SourcePositionAtIndex(index int) [2]float32
Returns the source position of a vertex.
index: The index of the position vertex to query.
Return Value ¶
The normalized position of the specified vertex in `sourcePositions`.
Discussion ¶
The specified index must be between 0 and the warp geometry grid’s SKWarpGeometryGrid.VertexCount `- 1`.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometryGrid/sourcePosition(at:)
func (SKWarpGeometryGrid) VertexCount ¶
func (w SKWarpGeometryGrid) VertexCount() int
The object’s total number of vertices.
Discussion ¶
The number of vertices is the same as `(```numberOfColumns“ `+ 1) * (```numberOfRows“ `+ 1)`.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpGeometryGrid/vertexCount
type SKWarpGeometryGridClass ¶
type SKWarpGeometryGridClass struct {
// contains filtered or unexported fields
}
func GetSKWarpGeometryGridClass ¶
func GetSKWarpGeometryGridClass() SKWarpGeometryGridClass
GetSKWarpGeometryGridClass returns the class object for SKWarpGeometryGrid.
func (SKWarpGeometryGridClass) Alloc ¶
func (sc SKWarpGeometryGridClass) Alloc() SKWarpGeometryGrid
Alloc allocates memory for a new instance of the class.
func (SKWarpGeometryGridClass) Class ¶
func (sc SKWarpGeometryGridClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type SKWarpable ¶
type SKWarpable interface {
objectivec.IObject
// The maximum number of subdivision iterations used to generate the final vertices.
//
// See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/subdivisionLevels
SubdivisionLevels() int
SetSubdivisionLevels(value int)
// The warp geometry used to define the distortion.
//
// See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/warpGeometry
WarpGeometry() ISKWarpGeometry
SetWarpGeometry(value ISKWarpGeometry)
}
A protocol for objects that can be warped and animated by an SKWarpGeometry(<https://developer.apple.com/documentation/SpriteKit/SKWarpGeometry>).
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable
type SKWarpableObject ¶
type SKWarpableObject struct {
objectivec.Object
}
SKWarpableObject wraps an existing Objective-C object that conforms to the SKWarpable protocol.
func SKWarpableObjectFromID ¶
func SKWarpableObjectFromID(id objc.ID) SKWarpableObject
SKWarpableObjectFromID constructs a SKWarpableObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func (SKWarpableObject) BaseObject ¶
func (o SKWarpableObject) BaseObject() objectivec.Object
func (SKWarpableObject) SetSubdivisionLevels ¶
func (o SKWarpableObject) SetSubdivisionLevels(value int)
func (SKWarpableObject) SetWarpGeometry ¶
func (o SKWarpableObject) SetWarpGeometry(value ISKWarpGeometry)
func (SKWarpableObject) SubdivisionLevels ¶
func (o SKWarpableObject) SubdivisionLevels() int
The maximum number of subdivision iterations used to generate the final vertices.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/subdivisionLevels
func (SKWarpableObject) WarpGeometry ¶
func (o SKWarpableObject) WarpGeometry() ISKWarpGeometry
The warp geometry used to define the distortion.
See: https://developer.apple.com/documentation/SpriteKit/SKWarpable/warpGeometry
type UnsafePointerUintptrHandler ¶
UnsafePointerUintptrHandler handles A block to be called when the texture can be safely modified.
- pixelData: A pointer to the start of the current texture data.
- lengthInBytes: The length of the texture data in bytes.
Used by:
type VectorFloat3 ¶
type VectorFloat3 = Vector_float3
VectorFloat3 is a Go-name alias for Vector_float3.
type Vector_float3 ¶
type Vector_float3 = [3]float32
Vector_float3 is a floating point vector type used to perform physics calculations.
See: https://developer.apple.com/documentation/SpriteKit/vector_float3
type VoidHandler ¶
type VoidHandler = func()
VoidHandler handles A completion block called when the action completes.
Used by:
- SKNode.RunActionCompletion
- [SKTexture.PreloadTexturesWithCompletionHandler]
- SKTexture.PreloadWithCompletionHandler
- [SKTextureAtlas.PreloadTextureAtlasesWithCompletionHandler]
- SKTextureAtlas.PreloadWithCompletionHandler
Source Files
¶
- blocks.gen.go
- delegate_class_counter.gen.go
- doc.gen.go
- enums.gen.go
- functions.gen.go
- generate.go
- physics_contact_delegate_protocol.gen.go
- scene_delegate_protocol.gen.go
- sk_action.gen.go
- sk_attribute.gen.go
- sk_attribute_value.gen.go
- sk_audio_node.gen.go
- sk_camera_node.gen.go
- sk_constraint.gen.go
- sk_crop_node.gen.go
- sk_effect_node.gen.go
- sk_emitter_node.gen.go
- sk_field_node.gen.go
- sk_keyframe_sequence.gen.go
- sk_label_node.gen.go
- sk_light_node.gen.go
- sk_mutable_texture.gen.go
- sk_node.gen.go
- sk_physics_body.gen.go
- sk_physics_contact.gen.go
- sk_physics_joint.gen.go
- sk_physics_joint_fixed.gen.go
- sk_physics_joint_limit.gen.go
- sk_physics_joint_pin.gen.go
- sk_physics_joint_sliding.gen.go
- sk_physics_joint_spring.gen.go
- sk_physics_world.gen.go
- sk_range.gen.go
- sk_reach_constraints.gen.go
- sk_reference_node.gen.go
- sk_region.gen.go
- sk_renderer.gen.go
- sk_scene.gen.go
- sk_shader.gen.go
- sk_shape_node.gen.go
- sk_sprite_node.gen.go
- sk_texture.gen.go
- sk_texture_atlas.gen.go
- sk_tile_definition.gen.go
- sk_tile_group.gen.go
- sk_tile_group_rule.gen.go
- sk_tile_map_node.gen.go
- sk_tile_set.gen.go
- sk_transform_node.gen.go
- sk_transition.gen.go
- sk_uniform.gen.go
- sk_video_node.gen.go
- sk_view.gen.go
- sk_warp_geometry.gen.go
- sk_warp_geometry_grid.gen.go
- typedefs.gen.go
- types.gen.go
- undefined_types.gen.go
- view_delegate_protocol.gen.go
- warpable_protocol.gen.go