pub struct SKEmitterNode { /* private fields */ }SKEmitterNode and crate feature SKNode and crate feature objc2-app-kit and macOS only.Expand description
An emitter of particle sprites.
See also Apple’s documentation
Implementations§
Source§impl SKEmitterNode
impl SKEmitterNode
Sourcepub unsafe fn advanceSimulationTime(&self, sec: NSTimeInterval)
pub unsafe fn advanceSimulationTime(&self, sec: NSTimeInterval)
The particle simulation is stepped automatically each frame when present in the scene. This allows the user to manually advance the simulation by a fixed amount of time. Useful for pre-populating particles before adding them to the scene.
pub unsafe fn resetSimulation(&self)
Sourcepub unsafe fn particleTexture(&self) -> Option<Retained<SKTexture>>
Available on crate feature SKTexture only.
pub unsafe fn particleTexture(&self) -> Option<Retained<SKTexture>>
SKTexture only.The texture to be used for the particles.
Sourcepub unsafe fn setParticleTexture(&self, particle_texture: Option<&SKTexture>)
Available on crate feature SKTexture only.
pub unsafe fn setParticleTexture(&self, particle_texture: Option<&SKTexture>)
SKTexture only.Setter for particleTexture.
Sourcepub unsafe fn particleBlendMode(&self) -> SKBlendMode
pub unsafe fn particleBlendMode(&self) -> SKBlendMode
The blend mode for each particle. Defaults to SKBlendModeAlpha.
Sourcepub unsafe fn setParticleBlendMode(&self, particle_blend_mode: SKBlendMode)
pub unsafe fn setParticleBlendMode(&self, particle_blend_mode: SKBlendMode)
Setter for particleBlendMode.
Sourcepub unsafe fn particleColor(&self) -> Retained<NSColor>
pub unsafe fn particleColor(&self) -> Retained<NSColor>
The starting color for each particle. Defaults to clear.
Sourcepub unsafe fn setParticleColor(&self, particle_color: &NSColor)
pub unsafe fn setParticleColor(&self, particle_color: &NSColor)
Setter for particleColor.
Sourcepub unsafe fn particleColorRedRange(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleColorRedRange(&self) -> CGFloat
objc2-core-foundation only.The random variance about each color component for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleColorRedRange(&self, particle_color_red_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorRedRange(&self, particle_color_red_range: CGFloat)
objc2-core-foundation only.Setter for particleColorRedRange.
pub unsafe fn particleColorGreenRange(&self) -> CGFloat
objc2-core-foundation only.Sourcepub unsafe fn setParticleColorGreenRange(
&self,
particle_color_green_range: CGFloat,
)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorGreenRange( &self, particle_color_green_range: CGFloat, )
objc2-core-foundation only.Setter for particleColorGreenRange.
pub unsafe fn particleColorBlueRange(&self) -> CGFloat
objc2-core-foundation only.Sourcepub unsafe fn setParticleColorBlueRange(
&self,
particle_color_blue_range: CGFloat,
)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorBlueRange( &self, particle_color_blue_range: CGFloat, )
objc2-core-foundation only.Setter for particleColorBlueRange.
pub unsafe fn particleColorAlphaRange(&self) -> CGFloat
objc2-core-foundation only.Sourcepub unsafe fn setParticleColorAlphaRange(
&self,
particle_color_alpha_range: CGFloat,
)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorAlphaRange( &self, particle_color_alpha_range: CGFloat, )
objc2-core-foundation only.Setter for particleColorAlphaRange.
Sourcepub unsafe fn particleColorRedSpeed(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleColorRedSpeed(&self) -> CGFloat
objc2-core-foundation only.The rate at which to modify each color component for each particle (per second).
Sourcepub unsafe fn setParticleColorRedSpeed(&self, particle_color_red_speed: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorRedSpeed(&self, particle_color_red_speed: CGFloat)
objc2-core-foundation only.Setter for particleColorRedSpeed.
pub unsafe fn particleColorGreenSpeed(&self) -> CGFloat
objc2-core-foundation only.Sourcepub unsafe fn setParticleColorGreenSpeed(
&self,
particle_color_green_speed: CGFloat,
)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorGreenSpeed( &self, particle_color_green_speed: CGFloat, )
objc2-core-foundation only.Setter for particleColorGreenSpeed.
pub unsafe fn particleColorBlueSpeed(&self) -> CGFloat
objc2-core-foundation only.Sourcepub unsafe fn setParticleColorBlueSpeed(
&self,
particle_color_blue_speed: CGFloat,
)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorBlueSpeed( &self, particle_color_blue_speed: CGFloat, )
objc2-core-foundation only.Setter for particleColorBlueSpeed.
pub unsafe fn particleColorAlphaSpeed(&self) -> CGFloat
objc2-core-foundation only.Sourcepub unsafe fn setParticleColorAlphaSpeed(
&self,
particle_color_alpha_speed: CGFloat,
)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorAlphaSpeed( &self, particle_color_alpha_speed: CGFloat, )
objc2-core-foundation only.Setter for particleColorAlphaSpeed.
pub unsafe fn particleColorSequence( &self, ) -> Option<Retained<SKKeyframeSequence>>
SKKeyframeSequence only.Sourcepub unsafe fn setParticleColorSequence(
&self,
particle_color_sequence: Option<&SKKeyframeSequence>,
)
Available on crate feature SKKeyframeSequence only.
pub unsafe fn setParticleColorSequence( &self, particle_color_sequence: Option<&SKKeyframeSequence>, )
SKKeyframeSequence only.Setter for particleColorSequence.
Sourcepub unsafe fn particleColorBlendFactor(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleColorBlendFactor(&self) -> CGFloat
objc2-core-foundation only.The starting color blend for each particle. Behaves the same as SKSpriteNode. Defaults to 0.0.
Sourcepub unsafe fn setParticleColorBlendFactor(
&self,
particle_color_blend_factor: CGFloat,
)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorBlendFactor( &self, particle_color_blend_factor: CGFloat, )
objc2-core-foundation only.Setter for particleColorBlendFactor.
Sourcepub unsafe fn particleColorBlendFactorRange(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleColorBlendFactorRange(&self) -> CGFloat
objc2-core-foundation only.The random variance about the starting color blend for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleColorBlendFactorRange(
&self,
particle_color_blend_factor_range: CGFloat,
)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorBlendFactorRange( &self, particle_color_blend_factor_range: CGFloat, )
objc2-core-foundation only.Setter for particleColorBlendFactorRange.
Sourcepub unsafe fn particleColorBlendFactorSpeed(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleColorBlendFactorSpeed(&self) -> CGFloat
objc2-core-foundation only.The rate at which to modify the color blend for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleColorBlendFactorSpeed(
&self,
particle_color_blend_factor_speed: CGFloat,
)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleColorBlendFactorSpeed( &self, particle_color_blend_factor_speed: CGFloat, )
objc2-core-foundation only.Setter for particleColorBlendFactorSpeed.
pub unsafe fn particleColorBlendFactorSequence( &self, ) -> Option<Retained<SKKeyframeSequence>>
SKKeyframeSequence only.Sourcepub unsafe fn setParticleColorBlendFactorSequence(
&self,
particle_color_blend_factor_sequence: Option<&SKKeyframeSequence>,
)
Available on crate feature SKKeyframeSequence only.
pub unsafe fn setParticleColorBlendFactorSequence( &self, particle_color_blend_factor_sequence: Option<&SKKeyframeSequence>, )
SKKeyframeSequence only.Setter for particleColorBlendFactorSequence.
Sourcepub unsafe fn particlePosition(&self) -> CGPoint
Available on crate feature objc2-core-foundation only.
pub unsafe fn particlePosition(&self) -> CGPoint
objc2-core-foundation only.The starting position for each particle in the emitter’s coordinate space. Defaults to (0.0, 0,0).
Sourcepub unsafe fn setParticlePosition(&self, particle_position: CGPoint)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticlePosition(&self, particle_position: CGPoint)
objc2-core-foundation only.Setter for particlePosition.
Sourcepub unsafe fn particlePositionRange(&self) -> CGVector
Available on crate feature objc2-core-foundation only.
pub unsafe fn particlePositionRange(&self) -> CGVector
objc2-core-foundation only.The random variance about the starting position for each particle in the emitter’s coordinate space. Defaults to (0.0, 0,0).
Sourcepub unsafe fn setParticlePositionRange(&self, particle_position_range: CGVector)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticlePositionRange(&self, particle_position_range: CGVector)
objc2-core-foundation only.Setter for particlePositionRange.
Sourcepub unsafe fn particleSpeed(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleSpeed(&self) -> CGFloat
objc2-core-foundation only.The starting speed for each particle along its emission vector. Defaults to 0.0.
Sourcepub unsafe fn setParticleSpeed(&self, particle_speed: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleSpeed(&self, particle_speed: CGFloat)
objc2-core-foundation only.Setter for particleSpeed.
Sourcepub unsafe fn particleSpeedRange(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleSpeedRange(&self) -> CGFloat
objc2-core-foundation only.The random variance about the starting speed for each particle along its emission vector. Defaults to 0.0.
Sourcepub unsafe fn setParticleSpeedRange(&self, particle_speed_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleSpeedRange(&self, particle_speed_range: CGFloat)
objc2-core-foundation only.Setter for particleSpeedRange.
Sourcepub unsafe fn emissionAngle(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn emissionAngle(&self) -> CGFloat
objc2-core-foundation only.The angle at which to emit each new particle, in radians. Defaults to 0.0.
Sourcepub unsafe fn setEmissionAngle(&self, emission_angle: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setEmissionAngle(&self, emission_angle: CGFloat)
objc2-core-foundation only.Setter for emissionAngle.
Sourcepub unsafe fn emissionAngleRange(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn emissionAngleRange(&self) -> CGFloat
objc2-core-foundation only.The random variance about the angle at which to emit each new particle, in radians. Defaults to 0.0.
Sourcepub unsafe fn setEmissionAngleRange(&self, emission_angle_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setEmissionAngleRange(&self, emission_angle_range: CGFloat)
objc2-core-foundation only.Setter for emissionAngleRange.
Sourcepub unsafe fn xAcceleration(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn xAcceleration(&self) -> CGFloat
objc2-core-foundation only.The acceleration to apply to each particles velocity. Useful for simulating effects such as wind or gravity. Defaults to 0.0.
Sourcepub unsafe fn setXAcceleration(&self, x_acceleration: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setXAcceleration(&self, x_acceleration: CGFloat)
objc2-core-foundation only.Setter for xAcceleration.
pub unsafe fn yAcceleration(&self) -> CGFloat
objc2-core-foundation only.Sourcepub unsafe fn setYAcceleration(&self, y_acceleration: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setYAcceleration(&self, y_acceleration: CGFloat)
objc2-core-foundation only.Setter for yAcceleration.
Sourcepub unsafe fn particleBirthRate(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleBirthRate(&self) -> CGFloat
objc2-core-foundation only.The rate at which new particles are generated, in particles per second. Defaults to 0.0.
Sourcepub unsafe fn setParticleBirthRate(&self, particle_birth_rate: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleBirthRate(&self, particle_birth_rate: CGFloat)
objc2-core-foundation only.Setter for particleBirthRate.
Sourcepub unsafe fn numParticlesToEmit(&self) -> NSUInteger
pub unsafe fn numParticlesToEmit(&self) -> NSUInteger
The number of particles that will be emitted. If set to 0, there is no limit. Defaults to 0.
Sourcepub unsafe fn setNumParticlesToEmit(&self, num_particles_to_emit: NSUInteger)
pub unsafe fn setNumParticlesToEmit(&self, num_particles_to_emit: NSUInteger)
Setter for numParticlesToEmit.
Sourcepub unsafe fn particleLifetime(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleLifetime(&self) -> CGFloat
objc2-core-foundation only.The lifetime of each particle, in seconds. Defaults to 0.0.
Sourcepub unsafe fn setParticleLifetime(&self, particle_lifetime: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleLifetime(&self, particle_lifetime: CGFloat)
objc2-core-foundation only.Setter for particleLifetime.
Sourcepub unsafe fn particleLifetimeRange(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleLifetimeRange(&self) -> CGFloat
objc2-core-foundation only.The random variance about the lifetime of each particle, in seconds. Defaults to 0.0.
Sourcepub unsafe fn setParticleLifetimeRange(&self, particle_lifetime_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleLifetimeRange(&self, particle_lifetime_range: CGFloat)
objc2-core-foundation only.Setter for particleLifetimeRange.
Sourcepub unsafe fn particleRotation(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleRotation(&self) -> CGFloat
objc2-core-foundation only.The starting z-rotation for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleRotation(&self, particle_rotation: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleRotation(&self, particle_rotation: CGFloat)
objc2-core-foundation only.Setter for particleRotation.
Sourcepub unsafe fn particleRotationRange(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleRotationRange(&self) -> CGFloat
objc2-core-foundation only.The random variance about the starting z-rotation for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleRotationRange(&self, particle_rotation_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleRotationRange(&self, particle_rotation_range: CGFloat)
objc2-core-foundation only.Setter for particleRotationRange.
Sourcepub unsafe fn particleRotationSpeed(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleRotationSpeed(&self) -> CGFloat
objc2-core-foundation only.The rate at which to modify the z-rotation for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleRotationSpeed(&self, particle_rotation_speed: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleRotationSpeed(&self, particle_rotation_speed: CGFloat)
objc2-core-foundation only.Setter for particleRotationSpeed.
Sourcepub unsafe fn particleSize(&self) -> CGSize
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleSize(&self) -> CGSize
objc2-core-foundation only.The starting size for each particle. If set to CGSizeZero (the default) the particles will start at the size of the texture assigned to particleTexture. Note that particleScale and particleScaleRange will also have an effect on the effective size of each new particle.
Sourcepub unsafe fn setParticleSize(&self, particle_size: CGSize)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleSize(&self, particle_size: CGSize)
objc2-core-foundation only.Setter for particleSize.
Sourcepub unsafe fn particleScale(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleScale(&self) -> CGFloat
objc2-core-foundation only.The starting scale for each particle. Defaults to 1.0.
Sourcepub unsafe fn setParticleScale(&self, particle_scale: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleScale(&self, particle_scale: CGFloat)
objc2-core-foundation only.Setter for particleScale.
Sourcepub unsafe fn particleScaleRange(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleScaleRange(&self) -> CGFloat
objc2-core-foundation only.The random variance about the starting scale for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleScaleRange(&self, particle_scale_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleScaleRange(&self, particle_scale_range: CGFloat)
objc2-core-foundation only.Setter for particleScaleRange.
Sourcepub unsafe fn particleScaleSpeed(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleScaleSpeed(&self) -> CGFloat
objc2-core-foundation only.The rate at which to modify the scale for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleScaleSpeed(&self, particle_scale_speed: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleScaleSpeed(&self, particle_scale_speed: CGFloat)
objc2-core-foundation only.Setter for particleScaleSpeed.
pub unsafe fn particleScaleSequence( &self, ) -> Option<Retained<SKKeyframeSequence>>
SKKeyframeSequence only.Sourcepub unsafe fn setParticleScaleSequence(
&self,
particle_scale_sequence: Option<&SKKeyframeSequence>,
)
Available on crate feature SKKeyframeSequence only.
pub unsafe fn setParticleScaleSequence( &self, particle_scale_sequence: Option<&SKKeyframeSequence>, )
SKKeyframeSequence only.Setter for particleScaleSequence.
Sourcepub unsafe fn particleAlpha(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleAlpha(&self) -> CGFloat
objc2-core-foundation only.The starting alpha for each particle. Defaults to 1.0.
Sourcepub unsafe fn setParticleAlpha(&self, particle_alpha: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleAlpha(&self, particle_alpha: CGFloat)
objc2-core-foundation only.Setter for particleAlpha.
Sourcepub unsafe fn particleAlphaRange(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleAlphaRange(&self) -> CGFloat
objc2-core-foundation only.The random variance about the starting alpha for each particle. Defaults to 1.0.
Sourcepub unsafe fn setParticleAlphaRange(&self, particle_alpha_range: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleAlphaRange(&self, particle_alpha_range: CGFloat)
objc2-core-foundation only.Setter for particleAlphaRange.
Sourcepub unsafe fn particleAlphaSpeed(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleAlphaSpeed(&self) -> CGFloat
objc2-core-foundation only.The rate at which to modify the alpha for each particle. Defaults to 1.0.
Sourcepub unsafe fn setParticleAlphaSpeed(&self, particle_alpha_speed: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleAlphaSpeed(&self, particle_alpha_speed: CGFloat)
objc2-core-foundation only.Setter for particleAlphaSpeed.
pub unsafe fn particleAlphaSequence( &self, ) -> Option<Retained<SKKeyframeSequence>>
SKKeyframeSequence only.Sourcepub unsafe fn setParticleAlphaSequence(
&self,
particle_alpha_sequence: Option<&SKKeyframeSequence>,
)
Available on crate feature SKKeyframeSequence only.
pub unsafe fn setParticleAlphaSequence( &self, particle_alpha_sequence: Option<&SKKeyframeSequence>, )
SKKeyframeSequence only.Setter for particleAlphaSequence.
Sourcepub unsafe fn particleAction(&self) -> Option<Retained<SKAction>>
Available on crate feature SKAction only.
pub unsafe fn particleAction(&self) -> Option<Retained<SKAction>>
SKAction only.Specifies an action executed by new particles.
Sourcepub unsafe fn setParticleAction(&self, particle_action: Option<&SKAction>)
Available on crate feature SKAction only.
pub unsafe fn setParticleAction(&self, particle_action: Option<&SKAction>)
SKAction only.Setter for particleAction.
This is copied when set.
Sourcepub unsafe fn fieldBitMask(&self) -> u32
pub unsafe fn fieldBitMask(&self) -> u32
Defines what logical ‘categories’ of fields this particles emitted respond to. Defaults to all bits set (all categories). Can be forced off via affectedByGravity.
Sourcepub unsafe fn setFieldBitMask(&self, field_bit_mask: u32)
pub unsafe fn setFieldBitMask(&self, field_bit_mask: u32)
Setter for fieldBitMask.
Sourcepub unsafe fn targetNode(&self) -> Option<Retained<SKNode>>
pub unsafe fn targetNode(&self) -> Option<Retained<SKNode>>
Normally the particles are rendered as if they were a child of the SKEmitterNode, they can also be rendered as if they were a child of any other node in the scene by setting the targetNode property. Defaults to nil (standard behavior).
Sourcepub unsafe fn setTargetNode(&self, target_node: Option<&SKNode>)
pub unsafe fn setTargetNode(&self, target_node: Option<&SKNode>)
Setter for targetNode.
This is a weak property.
pub unsafe fn shader(&self) -> Option<Retained<SKShader>>
SKShader only.Sourcepub unsafe fn setShader(&self, shader: Option<&SKShader>)
Available on crate feature SKShader only.
pub unsafe fn setShader(&self, shader: Option<&SKShader>)
SKShader only.Setter for shader.
Sourcepub unsafe fn attributeValues(
&self,
) -> Retained<NSDictionary<NSString, SKAttributeValue>>
Available on crate feature SKAttribute only.
pub unsafe fn attributeValues( &self, ) -> Retained<NSDictionary<NSString, SKAttributeValue>>
SKAttribute only.Optional dictionary of SKAttributeValues Attributes can be used with custom SKShaders.
Sourcepub unsafe fn setAttributeValues(
&self,
attribute_values: &NSDictionary<NSString, SKAttributeValue>,
)
Available on crate feature SKAttribute only.
pub unsafe fn setAttributeValues( &self, attribute_values: &NSDictionary<NSString, SKAttributeValue>, )
SKAttribute only.Setter for attributeValues.
This is copied when set.
pub unsafe fn valueForAttributeNamed( &self, key: &NSString, ) -> Option<Retained<SKAttributeValue>>
SKAttribute only.pub unsafe fn setValue_forAttributeNamed( &self, value: &SKAttributeValue, key: &NSString, )
SKAttribute only.Sourcepub unsafe fn particleZPosition(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn particleZPosition(&self) -> CGFloat
objc2-core-foundation only.The starting z-position for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleZPosition(&self, particle_z_position: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setParticleZPosition(&self, particle_z_position: CGFloat)
objc2-core-foundation only.Setter for particleZPosition.
Sourcepub unsafe fn particleRenderOrder(&self) -> SKParticleRenderOrder
pub unsafe fn particleRenderOrder(&self) -> SKParticleRenderOrder
The order in which particles will be rendered. Defaults to SKParticleRenderOrderOldestLast.
Sourcepub unsafe fn setParticleRenderOrder(
&self,
particle_render_order: SKParticleRenderOrder,
)
pub unsafe fn setParticleRenderOrder( &self, particle_render_order: SKParticleRenderOrder, )
Setter for particleRenderOrder.
Sourcepub unsafe fn particleZPositionRange(&self) -> CGFloat
👎DeprecatedAvailable on crate feature objc2-core-foundation only.
pub unsafe fn particleZPositionRange(&self) -> CGFloat
objc2-core-foundation only.The random variance about the starting z-position for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleZPositionRange(
&self,
particle_z_position_range: CGFloat,
)
👎DeprecatedAvailable on crate feature objc2-core-foundation only.
pub unsafe fn setParticleZPositionRange( &self, particle_z_position_range: CGFloat, )
objc2-core-foundation only.Setter for particleZPositionRange.
Sourcepub unsafe fn particleZPositionSpeed(&self) -> CGFloat
👎DeprecatedAvailable on crate feature objc2-core-foundation only.
pub unsafe fn particleZPositionSpeed(&self) -> CGFloat
objc2-core-foundation only.The rate at which to modify the z-position for each particle. Defaults to 0.0.
Sourcepub unsafe fn setParticleZPositionSpeed(
&self,
particle_z_position_speed: CGFloat,
)
👎DeprecatedAvailable on crate feature objc2-core-foundation only.
pub unsafe fn setParticleZPositionSpeed( &self, particle_z_position_speed: CGFloat, )
objc2-core-foundation only.Setter for particleZPositionSpeed.
Source§impl SKEmitterNode
Methods declared on superclass SKNode.
impl SKEmitterNode
Methods declared on superclass SKNode.
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>
Sourcepub unsafe fn initWithCoder(
this: Allocated<Self>,
a_decoder: &NSCoder,
) -> Option<Retained<Self>>
pub unsafe fn initWithCoder( this: Allocated<Self>, a_decoder: &NSCoder, ) -> Option<Retained<Self>>
Support coding and decoding via NSKeyedArchiver.
§Safety
a_decoder possibly has further requirements.
pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>
pub unsafe fn nodeWithFileNamed( filename: &NSString, mtm: MainThreadMarker, ) -> Option<Retained<Self>>
Source§impl SKEmitterNode
Methods declared on superclass NSObject.
impl SKEmitterNode
Methods declared on superclass NSObject.
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>
Methods from Deref<Target = SKNode>§
pub unsafe fn frame(&self) -> CGRect
objc2-core-foundation only.Sourcepub unsafe fn calculateAccumulatedFrame(&self) -> CGRect
Available on crate feature objc2-core-foundation only.
pub unsafe fn calculateAccumulatedFrame(&self) -> CGRect
objc2-core-foundation only.Calculates the bounding box including all child nodes in parents coordinate system.
Sourcepub unsafe fn position(&self) -> CGPoint
Available on crate feature objc2-core-foundation only.
pub unsafe fn position(&self) -> CGPoint
objc2-core-foundation only.The position of the node in the parent’s coordinate system
Sourcepub unsafe fn setPosition(&self, position: CGPoint)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setPosition(&self, position: CGPoint)
objc2-core-foundation only.Setter for position.
Sourcepub unsafe fn zPosition(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn zPosition(&self) -> CGFloat
objc2-core-foundation only.The z-order of the node (used for ordering). Negative z is “into” the screen, Positive z is “out” of the screen. A greater zPosition will sort in front of a lesser zPosition.
Sourcepub unsafe fn setZPosition(&self, z_position: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setZPosition(&self, z_position: CGFloat)
objc2-core-foundation only.Setter for zPosition.
Sourcepub unsafe fn zRotation(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn zRotation(&self) -> CGFloat
objc2-core-foundation only.The Euler rotation about the z axis (in radians)
Sourcepub unsafe fn setZRotation(&self, z_rotation: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setZRotation(&self, z_rotation: CGFloat)
objc2-core-foundation only.Setter for zRotation.
Sourcepub unsafe fn xScale(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn xScale(&self) -> CGFloat
objc2-core-foundation only.The scaling in the X axis
Sourcepub unsafe fn setXScale(&self, x_scale: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setXScale(&self, x_scale: CGFloat)
objc2-core-foundation only.Setter for xScale.
Sourcepub unsafe fn yScale(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn yScale(&self) -> CGFloat
objc2-core-foundation only.The scaling in the Y axis
Sourcepub unsafe fn setYScale(&self, y_scale: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setYScale(&self, y_scale: CGFloat)
objc2-core-foundation only.Setter for yScale.
Sourcepub unsafe fn speed(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn speed(&self) -> CGFloat
objc2-core-foundation only.The speed multiplier applied to all actions run on this node. Inherited by its children.
Sourcepub unsafe fn setSpeed(&self, speed: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setSpeed(&self, speed: CGFloat)
objc2-core-foundation only.Setter for speed.
Sourcepub unsafe fn alpha(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn alpha(&self) -> CGFloat
objc2-core-foundation only.Alpha of this node (multiplied by the output color to give the final result)
Sourcepub unsafe fn setAlpha(&self, alpha: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setAlpha(&self, alpha: CGFloat)
objc2-core-foundation only.Setter for alpha.
Sourcepub unsafe fn isPaused(&self) -> bool
pub unsafe fn isPaused(&self) -> bool
Controls whether or not the node’s actions is updated or paused.
Sourcepub unsafe fn isHidden(&self) -> bool
pub unsafe fn isHidden(&self) -> bool
Controls whether or not the node and its children are rendered.
Sourcepub unsafe fn isUserInteractionEnabled(&self) -> bool
pub unsafe fn isUserInteractionEnabled(&self) -> bool
Controls whether or not the node receives touch events
Sourcepub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool)
pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool)
Setter for isUserInteractionEnabled.
Sourcepub unsafe fn focusBehavior(&self) -> SKNodeFocusBehavior
pub unsafe fn focusBehavior(&self) -> SKNodeFocusBehavior
Determines how this node participates in the focus system. The default is SKNodeFocusBehaviorNone.
Sourcepub unsafe fn setFocusBehavior(&self, focus_behavior: SKNodeFocusBehavior)
pub unsafe fn setFocusBehavior(&self, focus_behavior: SKNodeFocusBehavior)
Setter for focusBehavior.
Sourcepub unsafe fn parent(&self) -> Option<Retained<SKNode>>
pub unsafe fn parent(&self) -> Option<Retained<SKNode>>
The parent of the node.
If this is nil the node has not been added to another group and is thus the root node of its own graph.
Sourcepub unsafe fn name(&self) -> Option<Retained<NSString>>
pub unsafe fn name(&self) -> Option<Retained<NSString>>
The client assignable name.
In general, this should be unique among peers in the scene graph.
Sourcepub unsafe fn scene(&self) -> Option<Retained<SKScene>>
Available on crate features SKEffectNode and SKScene only.
pub unsafe fn scene(&self) -> Option<Retained<SKScene>>
SKEffectNode and SKScene only.The scene that the node is currently in.
Sourcepub unsafe fn physicsBody(&self) -> Option<Retained<SKPhysicsBody>>
Available on crate feature SKPhysicsBody only.
pub unsafe fn physicsBody(&self) -> Option<Retained<SKPhysicsBody>>
SKPhysicsBody only.Physics body attached to the node, with synchronized scale, rotation, and position
Sourcepub unsafe fn setPhysicsBody(&self, physics_body: Option<&SKPhysicsBody>)
Available on crate feature SKPhysicsBody only.
pub unsafe fn setPhysicsBody(&self, physics_body: Option<&SKPhysicsBody>)
SKPhysicsBody only.Setter for physicsBody.
Sourcepub unsafe fn userData(&self) -> Option<Retained<NSMutableDictionary>>
pub unsafe fn userData(&self) -> Option<Retained<NSMutableDictionary>>
An optional dictionary that can be used to store your own data in a node. Defaults to nil.
§Safety
The returned generic should be of the correct type.
Sourcepub unsafe fn setUserData(&self, user_data: Option<&NSMutableDictionary>)
pub unsafe fn setUserData(&self, user_data: Option<&NSMutableDictionary>)
Sourcepub unsafe fn reachConstraints(&self) -> Option<Retained<SKReachConstraints>>
Available on crate feature SKReachConstraints only.
pub unsafe fn reachConstraints(&self) -> Option<Retained<SKReachConstraints>>
SKReachConstraints only.Kinematic constraints, used in IK solving
Sourcepub unsafe fn setReachConstraints(
&self,
reach_constraints: Option<&SKReachConstraints>,
)
Available on crate feature SKReachConstraints only.
pub unsafe fn setReachConstraints( &self, reach_constraints: Option<&SKReachConstraints>, )
SKReachConstraints only.Setter for reachConstraints.
This is copied when set.
Sourcepub unsafe fn constraints(&self) -> Option<Retained<NSArray<SKConstraint>>>
Available on crate feature SKConstraint only.
pub unsafe fn constraints(&self) -> Option<Retained<NSArray<SKConstraint>>>
SKConstraint only.Optional array of SKConstraints Constraints are evaluated each frame after actions and physics. The node’s transform will be changed to satisfy the constraint.
Sourcepub unsafe fn setConstraints(&self, constraints: Option<&NSArray<SKConstraint>>)
Available on crate feature SKConstraint only.
pub unsafe fn setConstraints(&self, constraints: Option<&NSArray<SKConstraint>>)
SKConstraint only.Setter for constraints.
This is copied when set.
Sourcepub unsafe fn attributeValues(
&self,
) -> Retained<NSDictionary<NSString, SKAttributeValue>>
👎DeprecatedAvailable on crate feature SKAttribute only.
pub unsafe fn attributeValues( &self, ) -> Retained<NSDictionary<NSString, SKAttributeValue>>
SKAttribute only.Optional dictionary of SKAttributeValues Attributes can be used with custom SKShaders. DEPRECATED: Attributes are only available for node classes supporting SKShader (see SKSpriteNode etc.).
Sourcepub unsafe fn setAttributeValues(
&self,
attribute_values: &NSDictionary<NSString, SKAttributeValue>,
)
👎DeprecatedAvailable on crate feature SKAttribute only.
pub unsafe fn setAttributeValues( &self, attribute_values: &NSDictionary<NSString, SKAttributeValue>, )
SKAttribute only.Setter for attributeValues.
This is copied when set.
pub unsafe fn valueForAttributeNamed( &self, key: &NSString, ) -> Option<Retained<SKAttributeValue>>
SKAttribute only.pub unsafe fn setValue_forAttributeNamed( &self, value: &SKAttributeValue, key: &NSString, )
SKAttribute only.Sourcepub unsafe fn setScale(&self, scale: CGFloat)
Available on crate feature objc2-core-foundation only.
pub unsafe fn setScale(&self, scale: CGFloat)
objc2-core-foundation only.Sets both the x & y scale
Parameter scale: the uniform scale to set.
Sourcepub unsafe fn addChild(&self, node: &SKNode)
pub unsafe fn addChild(&self, node: &SKNode)
Adds a node as a child node of this node
The added node must not have a parent.
Parameter node: the child node to add.
pub unsafe fn insertChild_atIndex(&self, node: &SKNode, index: NSInteger)
pub unsafe fn removeChildrenInArray(&self, nodes: &NSArray<SKNode>)
pub unsafe fn removeAllChildren(&self)
pub unsafe fn removeFromParent(&self)
pub unsafe fn moveToParent(&self, parent: &SKNode)
pub unsafe fn childNodeWithName( &self, name: &NSString, ) -> Option<Retained<SKNode>>
pub unsafe fn enumerateChildNodesWithName_usingBlock( &self, name: &NSString, block: &DynBlock<dyn Fn(NonNull<SKNode>, NonNull<Bool>)>, )
block2 only.Sourcepub unsafe fn objectForKeyedSubscript(
&self,
name: &NSString,
) -> Retained<NSArray<SKNode>>
pub unsafe fn objectForKeyedSubscript( &self, name: &NSString, ) -> Retained<NSArray<SKNode>>
Simplified shorthand for enumerateChildNodesWithName that returns an array of the matching nodes. This allows subscripting of the form: NSArray *childrenMatchingName = node[ “ name“]
or even complex like: NSArray siblingsBeginningWithA = node[ “ ../a“]
Parameter name: An Xpath style path that can include simple regular expressions for matching node names.
See: enumerateChildNodesWithName:usingBlock:
pub unsafe fn inParentHierarchy(&self, parent: &SKNode) -> bool
pub unsafe fn runAction(&self, action: &SKAction)
SKAction only.pub unsafe fn runAction_completion( &self, action: &SKAction, block: &DynBlock<dyn Fn()>, )
SKAction and block2 only.pub unsafe fn runAction_withKey(&self, action: &SKAction, key: &NSString)
SKAction only.pub unsafe fn hasActions(&self) -> bool
pub unsafe fn actionForKey(&self, key: &NSString) -> Option<Retained<SKAction>>
SKAction only.pub unsafe fn removeActionForKey(&self, key: &NSString)
pub unsafe fn removeAllActions(&self)
pub unsafe fn containsPoint(&self, p: CGPoint) -> bool
objc2-core-foundation only.Sourcepub unsafe fn nodeAtPoint(&self, p: CGPoint) -> Retained<SKNode>
Available on crate feature objc2-core-foundation only.
pub unsafe fn nodeAtPoint(&self, p: CGPoint) -> Retained<SKNode>
objc2-core-foundation only.Returns the node itself or a child node at the point given. If the receiver is returned there is no child node at the given point.
Returns: a child node or self at the given location.
pub unsafe fn nodesAtPoint(&self, p: CGPoint) -> Retained<NSArray<SKNode>>
objc2-core-foundation only.pub unsafe fn convertPoint_fromNode( &self, point: CGPoint, node: &SKNode, ) -> CGPoint
objc2-core-foundation only.pub unsafe fn convertPoint_toNode( &self, point: CGPoint, node: &SKNode, ) -> CGPoint
objc2-core-foundation only.pub unsafe fn intersectsNode(&self, node: &SKNode) -> bool
pub unsafe fn isEqualToNode(&self, node: &SKNode) -> bool
pub unsafe fn isAccessibilityElement(&self) -> bool
SKNode_NSAccessibility only.Sourcepub unsafe fn setAccessibilityElement(&self, accessibility_element: bool)
Available on crate feature SKNode_NSAccessibility only.
pub unsafe fn setAccessibilityElement(&self, accessibility_element: bool)
SKNode_NSAccessibility only.Setter for isAccessibilityElement.
pub unsafe fn accessibilityRole(&self) -> Option<Retained<NSString>>
SKNode_NSAccessibility only.Sourcepub unsafe fn setAccessibilityRole(&self, accessibility_role: Option<&NSString>)
Available on crate feature SKNode_NSAccessibility only.
pub unsafe fn setAccessibilityRole(&self, accessibility_role: Option<&NSString>)
SKNode_NSAccessibility only.Setter for accessibilityRole.
This is copied when set.
pub unsafe fn accessibilityRoleDescription(&self) -> Option<Retained<NSString>>
SKNode_NSAccessibility only.Sourcepub unsafe fn setAccessibilityRoleDescription(
&self,
accessibility_role_description: Option<&NSString>,
)
Available on crate feature SKNode_NSAccessibility only.
pub unsafe fn setAccessibilityRoleDescription( &self, accessibility_role_description: Option<&NSString>, )
SKNode_NSAccessibility only.Setter for accessibilityRoleDescription.
This is copied when set.
pub unsafe fn accessibilitySubrole(&self) -> Option<Retained<NSString>>
SKNode_NSAccessibility only.Sourcepub unsafe fn setAccessibilitySubrole(
&self,
accessibility_subrole: Option<&NSString>,
)
Available on crate feature SKNode_NSAccessibility only.
pub unsafe fn setAccessibilitySubrole( &self, accessibility_subrole: Option<&NSString>, )
SKNode_NSAccessibility only.Setter for accessibilitySubrole.
This is copied when set.
pub unsafe fn accessibilityFrame(&self) -> CGRect
SKNode_NSAccessibility and objc2-core-foundation only.Sourcepub unsafe fn setAccessibilityFrame(&self, accessibility_frame: CGRect)
Available on crate features SKNode_NSAccessibility and objc2-core-foundation only.
pub unsafe fn setAccessibilityFrame(&self, accessibility_frame: CGRect)
SKNode_NSAccessibility and objc2-core-foundation only.Setter for accessibilityFrame.
pub unsafe fn accessibilityParent(&self) -> Option<Retained<AnyObject>>
SKNode_NSAccessibility only.Sourcepub unsafe fn setAccessibilityParent(
&self,
accessibility_parent: Option<&AnyObject>,
)
Available on crate feature SKNode_NSAccessibility only.
pub unsafe fn setAccessibilityParent( &self, accessibility_parent: Option<&AnyObject>, )
SKNode_NSAccessibility only.Setter for accessibilityParent.
This is a weak property.
§Safety
accessibility_parent should be of the correct type.
pub unsafe fn accessibilityChildren(&self) -> Option<Retained<NSArray>>
SKNode_NSAccessibility only.Sourcepub unsafe fn setAccessibilityChildren(
&self,
accessibility_children: Option<&NSArray>,
)
Available on crate feature SKNode_NSAccessibility only.
pub unsafe fn setAccessibilityChildren( &self, accessibility_children: Option<&NSArray>, )
SKNode_NSAccessibility only.Setter for accessibilityChildren.
This is copied when set.
§Safety
accessibility_children generic should be of the correct type.
pub unsafe fn accessibilityHelp(&self) -> Option<Retained<NSString>>
SKNode_NSAccessibility only.Sourcepub unsafe fn setAccessibilityHelp(&self, accessibility_help: Option<&NSString>)
Available on crate feature SKNode_NSAccessibility only.
pub unsafe fn setAccessibilityHelp(&self, accessibility_help: Option<&NSString>)
SKNode_NSAccessibility only.Setter for accessibilityHelp.
This is copied when set.
pub unsafe fn accessibilityLabel(&self) -> Option<Retained<NSString>>
SKNode_NSAccessibility only.Sourcepub unsafe fn setAccessibilityLabel(
&self,
accessibility_label: Option<&NSString>,
)
Available on crate feature SKNode_NSAccessibility only.
pub unsafe fn setAccessibilityLabel( &self, accessibility_label: Option<&NSString>, )
SKNode_NSAccessibility only.Setter for accessibilityLabel.
This is copied when set.
pub unsafe fn isAccessibilityEnabled(&self) -> bool
SKNode_NSAccessibility only.Sourcepub unsafe fn setAccessibilityEnabled(&self, accessibility_enabled: bool)
Available on crate feature SKNode_NSAccessibility only.
pub unsafe fn setAccessibilityEnabled(&self, accessibility_enabled: bool)
SKNode_NSAccessibility only.Setter for isAccessibilityEnabled.
pub unsafe fn accessibilityHitTest( &self, point: CGPoint, ) -> Option<Retained<AnyObject>>
SKNode_NSAccessibility and objc2-core-foundation only.Methods from Deref<Target = NSResponder>§
Sourcepub unsafe fn nextResponder(&self) -> Option<Retained<NSResponder>>
pub unsafe fn nextResponder(&self) -> Option<Retained<NSResponder>>
§Safety
This is not retained internally, you must ensure the object is still alive.
Sourcepub unsafe fn setNextResponder(&self, next_responder: Option<&NSResponder>)
pub unsafe fn setNextResponder(&self, next_responder: Option<&NSResponder>)
Setter for nextResponder.
§Safety
This is unretained, you must ensure the object is kept alive while in use.
Sourcepub unsafe fn tryToPerform_with(
&self,
action: Sel,
object: Option<&AnyObject>,
) -> bool
pub unsafe fn tryToPerform_with( &self, action: Sel, object: Option<&AnyObject>, ) -> bool
§Safety
actionmust be a valid selector.objectshould be of the correct type.
pub fn performKeyEquivalent(&self, event: &NSEvent) -> bool
pub fn mouseDown(&self, event: &NSEvent)
pub fn rightMouseDown(&self, event: &NSEvent)
pub fn otherMouseDown(&self, event: &NSEvent)
pub fn mouseUp(&self, event: &NSEvent)
pub fn rightMouseUp(&self, event: &NSEvent)
pub fn otherMouseUp(&self, event: &NSEvent)
pub fn mouseMoved(&self, event: &NSEvent)
pub fn mouseDragged(&self, event: &NSEvent)
pub fn mouseCancelled(&self, event: &NSEvent)
pub fn scrollWheel(&self, event: &NSEvent)
pub fn rightMouseDragged(&self, event: &NSEvent)
pub fn otherMouseDragged(&self, event: &NSEvent)
pub fn mouseEntered(&self, event: &NSEvent)
pub fn mouseExited(&self, event: &NSEvent)
pub fn keyDown(&self, event: &NSEvent)
pub fn keyUp(&self, event: &NSEvent)
pub fn flagsChanged(&self, event: &NSEvent)
pub fn tabletPoint(&self, event: &NSEvent)
pub fn tabletProximity(&self, event: &NSEvent)
pub fn cursorUpdate(&self, event: &NSEvent)
pub fn magnifyWithEvent(&self, event: &NSEvent)
pub fn rotateWithEvent(&self, event: &NSEvent)
pub fn swipeWithEvent(&self, event: &NSEvent)
pub fn beginGestureWithEvent(&self, event: &NSEvent)
pub fn endGestureWithEvent(&self, event: &NSEvent)
pub fn smartMagnifyWithEvent(&self, event: &NSEvent)
pub fn changeModeWithEvent(&self, event: &NSEvent)
pub fn touchesBeganWithEvent(&self, event: &NSEvent)
pub fn touchesMovedWithEvent(&self, event: &NSEvent)
pub fn touchesEndedWithEvent(&self, event: &NSEvent)
pub fn touchesCancelledWithEvent(&self, event: &NSEvent)
pub fn quickLookWithEvent(&self, event: &NSEvent)
pub fn pressureChangeWithEvent(&self, event: &NSEvent)
Sourcepub fn contextMenuKeyDown(&self, event: &NSEvent)
pub fn contextMenuKeyDown(&self, event: &NSEvent)
Handle a key event that should present a context menu at the user focus.
Most applications should not override this method. Instead, you should customize the context menu displayed from a keyboard event by implementing menuForEvent: and selectionAnchorRect, or showContextMenuForSelection:, rather than this method.
You should only override this method when you do not want the system-provided default behavior for the context menu hotkey, either for a specific key combination, or for the hotkey in general. For example, if your application already provides a different behavior for control-Return (the default context menu hotkey definition), and you want to preserve that behavior, you should override this method to handle that specific key combination, and then return without calling super. Note that the user may customize the hotkey to a different key combination, so in this example, if any other key combination is passed to your method, you would call super.
An implementation of this method should call [super contextMenuKeyDown:event] to pass the request up the responder chain. If the message reaches the application object, NSApplication’s implementation of this method will send showContextMenuForSelection: to the responder chain. If you do not call super, then no further handling of the key event will be performed.
Note: In some cases, showContextMenuForSelection: will be called without a prior call to contextMenuKeyDown:. This occurs when a view receives an Accessibility ShowMenu action, or when the user has created a Cocoa Text key binding to map a different key combination to the showContextMenuForSelection: action.
Parameter event: The key down event that matches the system-wide context menu hotkey combination.
See also: showContextMenuForSelection:
Sourcepub unsafe fn noResponderFor(&self, event_selector: Sel)
pub unsafe fn noResponderFor(&self, event_selector: Sel)
§Safety
event_selector must be a valid selector.
pub fn acceptsFirstResponder(&self) -> bool
pub fn becomeFirstResponder(&self) -> bool
pub fn resignFirstResponder(&self) -> bool
pub fn interpretKeyEvents(&self, event_array: &NSArray<NSEvent>)
pub fn flushBufferedKeyEvents(&self)
Sourcepub unsafe fn showContextHelp(&self, sender: Option<&AnyObject>)
pub unsafe fn showContextHelp(&self, sender: Option<&AnyObject>)
§Safety
sender should be of the correct type.
pub fn helpRequested(&self, event_ptr: &NSEvent)
pub fn shouldBeTreatedAsInkEvent(&self, event: &NSEvent) -> bool
pub fn wantsScrollEventsForSwipeTrackingOnAxis( &self, axis: NSEventGestureAxis, ) -> bool
pub fn wantsForwardedScrollEventsForAxis( &self, axis: NSEventGestureAxis, ) -> bool
Sourcepub unsafe fn supplementalTargetForAction_sender(
&self,
action: Sel,
sender: Option<&AnyObject>,
) -> Option<Retained<AnyObject>>
pub unsafe fn supplementalTargetForAction_sender( &self, action: Sel, sender: Option<&AnyObject>, ) -> Option<Retained<AnyObject>>
§Safety
actionmust be a valid selector.sendershould be of the correct type.
pub fn undoManager(&self) -> Option<Retained<NSUndoManager>>
pub fn validateProposedFirstResponder_forEvent( &self, responder: &NSResponder, event: Option<&NSEvent>, ) -> bool
pub fn presentError(&self, error: &NSError) -> bool
pub fn willPresentError(&self, error: &NSError) -> Retained<NSError>
Sourcepub unsafe fn performTextFinderAction(&self, sender: Option<&AnyObject>)
pub unsafe fn performTextFinderAction(&self, sender: Option<&AnyObject>)
§Safety
sender should be of the correct type.
Sourcepub unsafe fn newWindowForTab(&self, sender: Option<&AnyObject>)
pub unsafe fn newWindowForTab(&self, sender: Option<&AnyObject>)
§Safety
sender should be of the correct type.
Sourcepub unsafe fn showWritingTools(&self, sender: Option<&AnyObject>)
pub unsafe fn showWritingTools(&self, sender: Option<&AnyObject>)
§Safety
sender should be of the correct type.
pub fn performMnemonic(&self, string: &NSString) -> bool
Methods from Deref<Target = NSObject>§
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
pub fn class(&self) -> &'static AnyClass
Dynamically find the class of this object.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init/new methods).
§Example
Check that an instance of NSObject has the precise class NSObject.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load instead.Use Ivar::load instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T.
See Ivar::load_ptr for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Attempt to downcast the object to a class of type T.
This is the reference-variant. Use Retained::downcast if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString to a NSMutableString,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass: for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject.
§Panics
This works internally by calling isKindOfClass:. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject and
NSProxy implement this method.
§Examples
Cast an NSString back and forth from NSObject.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();Try (and fail) to cast an NSObject to an NSString.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}Trait Implementations§
Source§impl AsRef<AnyObject> for SKEmitterNode
impl AsRef<AnyObject> for SKEmitterNode
Source§impl AsRef<NSObject> for SKEmitterNode
impl AsRef<NSObject> for SKEmitterNode
Source§impl AsRef<NSResponder> for SKEmitterNode
impl AsRef<NSResponder> for SKEmitterNode
Source§fn as_ref(&self) -> &NSResponder
fn as_ref(&self) -> &NSResponder
Source§impl AsRef<SKEmitterNode> for SKEmitterNode
impl AsRef<SKEmitterNode> for SKEmitterNode
Source§impl AsRef<SKNode> for SKEmitterNode
impl AsRef<SKNode> for SKEmitterNode
Source§impl Borrow<AnyObject> for SKEmitterNode
impl Borrow<AnyObject> for SKEmitterNode
Source§impl Borrow<NSObject> for SKEmitterNode
impl Borrow<NSObject> for SKEmitterNode
Source§impl Borrow<NSResponder> for SKEmitterNode
impl Borrow<NSResponder> for SKEmitterNode
Source§fn borrow(&self) -> &NSResponder
fn borrow(&self) -> &NSResponder
Source§impl Borrow<SKNode> for SKEmitterNode
impl Borrow<SKNode> for SKEmitterNode
Source§impl ClassType for SKEmitterNode
impl ClassType for SKEmitterNode
Source§const NAME: &'static str = "SKEmitterNode"
const NAME: &'static str = "SKEmitterNode"
Source§type ThreadKind = <<SKEmitterNode as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<SKEmitterNode as ClassType>::Super as ClassType>::ThreadKind
Source§impl CopyingHelper for SKEmitterNode
impl CopyingHelper for SKEmitterNode
Source§type Result = SKEmitterNode
type Result = SKEmitterNode
Self if the type has no
immutable counterpart. Read moreSource§impl Debug for SKEmitterNode
impl Debug for SKEmitterNode
Source§impl Deref for SKEmitterNode
impl Deref for SKEmitterNode
Source§impl Hash for SKEmitterNode
impl Hash for SKEmitterNode
Source§impl Message for SKEmitterNode
impl Message for SKEmitterNode
Source§impl NSCoding for SKEmitterNode
impl NSCoding for SKEmitterNode
Source§impl NSCopying for SKEmitterNode
impl NSCopying for SKEmitterNode
Source§impl NSObjectProtocol for SKEmitterNode
impl NSObjectProtocol for SKEmitterNode
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass directly, or cast your objects with AnyObject::downcast_refSource§fn isMemberOfClass(&self, cls: &AnyClass) -> bool
fn isMemberOfClass(&self, cls: &AnyClass) -> bool
Source§fn respondsToSelector(&self, aSelector: Sel) -> bool
fn respondsToSelector(&self, aSelector: Sel) -> bool
Source§fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
Source§fn debugDescription(&self) -> Retained<NSObject>
fn debugDescription(&self) -> Retained<NSObject>
Source§impl NSSecureCoding for SKEmitterNode
impl NSSecureCoding for SKEmitterNode
Source§impl PartialEq for SKEmitterNode
impl PartialEq for SKEmitterNode
Source§impl RefEncode for SKEmitterNode
impl RefEncode for SKEmitterNode
Source§const ENCODING_REF: Encoding = <SKNode as ::objc2::RefEncode>::ENCODING_REF
const ENCODING_REF: Encoding = <SKNode as ::objc2::RefEncode>::ENCODING_REF
impl DowncastTarget for SKEmitterNode
impl Eq for SKEmitterNode
Auto Trait Implementations§
impl !Freeze for SKEmitterNode
impl !RefUnwindSafe for SKEmitterNode
impl !Send for SKEmitterNode
impl !Sync for SKEmitterNode
impl !Unpin for SKEmitterNode
impl !UnwindSafe for SKEmitterNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<'a, T> MainThreadOnly for T
impl<'a, T> MainThreadOnly for T
Source§fn mtm(&self) -> MainThreadMarker
fn mtm(&self) -> MainThreadMarker
MainThreadMarker from the main-thread-only object. Read more