Struct SKTileMapNode

Source
#[repr(C)]
pub struct SKTileMapNode { /* private fields */ }
Available on crate feature SKNode and crate feature SKTileMapNode and crate feature objc2-app-kit and macOS only.
Expand description

A SpriteKit node used to render a 2D array of textured sprites. Uses SKTileSet to determine what textures it can use to render. Separate tile map nodes can be layered on top of one another to achieve various effects, such as parallax scrolling.

See also Apple’s documentation

Implementations§

Source§

impl SKTileMapNode

Source

pub unsafe fn tileMapNodeWithTileSet_columns_rows_tileSize( tile_set: &SKTileSet, columns: NSUInteger, rows: NSUInteger, tile_size: CGSize, mtm: MainThreadMarker, ) -> Retained<Self>

Available on crate features SKTileSet and objc2-core-foundation only.

Create a tile map node with the specified tile set and dimensions. The tiles of the map will be empty, equivalent to the nil tile definition/group.

Parameter tileSet: the tile set that is used to render the tiles

Parameter columns: the number of columns in the map that can hold tiles

Parameter rows: the number of rows in the map that can hold tiles

Parameter tileSize: the size of each tile in points

Source

pub unsafe fn tileMapNodeWithTileSet_columns_rows_tileSize_fillWithTileGroup( tile_set: &SKTileSet, columns: NSUInteger, rows: NSUInteger, tile_size: CGSize, tile_group: &SKTileGroup, mtm: MainThreadMarker, ) -> Retained<Self>

Available on crate features SKTileSet and objc2-core-foundation only.

Create a tile map node with the specified tile set and dimensions, and fill it with the specified tile group.

Parameter tileSet: the tile set that is used to render the tiles

Parameter columns: the number of columns in the map that can hold tiles

Parameter rows: the number of rows in the map that can hold tiles

Parameter tileSize: the size of each tile in points

Parameter tileGroup: the tile group we wish to fill the tile map with

Source

pub unsafe fn tileMapNodeWithTileSet_columns_rows_tileSize_tileGroupLayout( tile_set: &SKTileSet, columns: NSUInteger, rows: NSUInteger, tile_size: CGSize, tile_group_layout: &NSArray<SKTileGroup>, mtm: MainThreadMarker, ) -> Retained<Self>

Available on crate features SKTileSet and objc2-core-foundation only.

Create a tile map node with the specified tile set and dimensions, and fill it with a specific layout of tile groups that belong to the provided tile set. The tileGroupLayout array should match the dimensions of the tile map (i.e., the number of elements should be equal to columns * rows). Index 0 of the array maps to column 0, row 0 of the tile map. Index 1 is column 1, row 0, and so on, wrapping around to the next row once the index passes the number of columns in the tile map. If the array has fewer elements than the number of tiles in the map, the remaining tiles are initialized with the nil tile group. If the array has more elements than the number of tiles in the map, the extra tile groups are ignored.

Parameter tileSet: the tile set that is used to render the tiles

Parameter columns: the number of columns in the map that can hold tiles

Parameter rows: the number of rows in the map that can hold tiles

Parameter tileSize: the size of each tile in points

Parameter tileGroupLayout: an array of tile groups that we want to use to fill the tile map

Source

pub unsafe fn initWithTileSet_columns_rows_tileSize( this: Allocated<Self>, tile_set: &SKTileSet, columns: NSUInteger, rows: NSUInteger, tile_size: CGSize, ) -> Retained<Self>

Available on crate features SKTileSet and objc2-core-foundation only.

Initialize a tile map node with the specified tile set and dimensions. The tiles of the map will be empty, equivalent to the nil tile definition/group.

Parameter tileSet: the tile set that is used to render the tiles

Parameter columns: the number of columns in the map that can hold tiles

Parameter rows: the number of rows in the map that can hold tiles

Parameter tileSize: the size of each tile in points

Source

pub unsafe fn initWithTileSet_columns_rows_tileSize_fillWithTileGroup( this: Allocated<Self>, tile_set: &SKTileSet, columns: NSUInteger, rows: NSUInteger, tile_size: CGSize, tile_group: &SKTileGroup, ) -> Retained<Self>

Available on crate features SKTileSet and objc2-core-foundation only.

Initialize a tile map node with the specified tile set and dimensions, and fill it with the specified tile group.

Parameter tileSet: the tile set that is used to render the tiles

Parameter columns: the number of columns in the map that can hold tiles

Parameter rows: the number of rows in the map that can hold tiles

Parameter tileSize: the size of each tile in points

Parameter tileGroup: the tile group we wish to fill the tile map with

Source

pub unsafe fn initWithTileSet_columns_rows_tileSize_tileGroupLayout( this: Allocated<Self>, tile_set: &SKTileSet, columns: NSUInteger, rows: NSUInteger, tile_size: CGSize, tile_group_layout: &NSArray<SKTileGroup>, ) -> Retained<Self>

Available on crate features SKTileSet and objc2-core-foundation only.

Initialize a tile map node with the specified tile set and dimensions, and fill it with a specific layout of tile groups that belong to the provided tile set. The tileGroupLayout array should match the dimensions of the tile map (i.e., the number of elements should be equal to columns * rows). Index 0 of the array maps to column 0, row 0 of the tile map. Index 1 is column 1, row 0, and so on, wrapping around to the next row once the index passes the number of columns in the tile map. If the array has fewer elements than the number of tiles in the map, the remaining tiles are initialized with the nil tile group. If the array has more elements than the number of tiles in the map, the extra tile groups are ignored.

Parameter tileSet: the tile set that is used to render the tiles

Parameter columns: the number of columns in the map that can hold tiles

Parameter rows: the number of rows in the map that can hold tiles

Parameter tileSize: the size of each tile in points

Parameter tileGroupLayout: an array of tile groups that we want to use to fill the tile map

Source

pub unsafe fn numberOfColumns(&self) -> NSUInteger

The number of columns in the tile map.

Source

pub unsafe fn setNumberOfColumns(&self, number_of_columns: NSUInteger)

Setter for numberOfColumns.

Source

pub unsafe fn numberOfRows(&self) -> NSUInteger

The number of rows in the tile map.

Source

pub unsafe fn setNumberOfRows(&self, number_of_rows: NSUInteger)

Setter for numberOfRows.

Source

pub unsafe fn tileSize(&self) -> CGSize

Available on crate feature objc2-core-foundation only.

The size of each tile in the map.

Source

pub unsafe fn setTileSize(&self, tile_size: CGSize)

Available on crate feature objc2-core-foundation only.

Setter for tileSize.

Source

pub unsafe fn mapSize(&self) -> CGSize

Available on crate feature objc2-core-foundation only.

The size of the tile map. This is dependent on the tileSize, the number of columns and rows in the map, and the tile set type.

Source

pub unsafe fn tileSet(&self) -> Retained<SKTileSet>

Available on crate feature SKTileSet only.

The tile set being used by this tile map.

Source

pub unsafe fn setTileSet(&self, tile_set: &SKTileSet)

Available on crate feature SKTileSet only.

Setter for tileSet.

Source

pub unsafe fn colorBlendFactor(&self) -> CGFloat

Available on crate feature objc2-core-foundation only.

Controls the blending between the texture and the tile map color. The valid interval of values is from 0.0 up to and including 1.0. A value above or below that interval is clamped to the minimum (0.0) if below or the maximum (1.0) if above.

Source

pub unsafe fn setColorBlendFactor(&self, color_blend_factor: CGFloat)

Available on crate feature objc2-core-foundation only.

Setter for colorBlendFactor.

Source

pub unsafe fn color(&self) -> Retained<NSColor>

Base color for the tile map (If no texture is present, the color still is drawn).

Source

pub unsafe fn setColor(&self, color: &NSColor)

Setter for color.

Source

pub unsafe fn blendMode(&self) -> SKBlendMode

Sets the blend mode to use when composing the tile map with the final framebuffer.

See: SKNode.SKBlendMode

Source

pub unsafe fn setBlendMode(&self, blend_mode: SKBlendMode)

Setter for blendMode.

Source

pub unsafe fn anchorPoint(&self) -> CGPoint

Available on crate feature objc2-core-foundation only.

Used to choose the location in the tile map that maps to its ‘position’ in the parent’s coordinate space. The valid interval for each input is from 0.0 up to and including 1.0.

Source

pub unsafe fn setAnchorPoint(&self, anchor_point: CGPoint)

Available on crate feature objc2-core-foundation only.

Setter for anchorPoint.

Source

pub unsafe fn shader(&self) -> Option<Retained<SKShader>>

Available on crate feature SKShader only.

A property that determines whether the tile map is rendered using a custom shader.

Source

pub unsafe fn setShader(&self, shader: Option<&SKShader>)

Available on crate feature SKShader only.

Setter for shader.

Source

pub unsafe fn attributeValues( &self, ) -> Retained<NSDictionary<NSString, SKAttributeValue>>

Available on crate feature SKAttribute only.

Optional dictionary of SKAttributeValues Attributes can be used with custom SKShaders.

Source

pub unsafe fn setAttributeValues( &self, attribute_values: &NSDictionary<NSString, SKAttributeValue>, )

Available on crate feature SKAttribute only.

Setter for attributeValues.

Source

pub unsafe fn valueForAttributeNamed( &self, key: &NSString, ) -> Option<Retained<SKAttributeValue>>

Available on crate feature SKAttribute only.
Source

pub unsafe fn setValue_forAttributeNamed( &self, value: &SKAttributeValue, key: &NSString, )

Available on crate feature SKAttribute only.
Source

pub unsafe fn lightingBitMask(&self) -> u32

Bitmask to indicate being lit by a set of lights using overlapping lighting categories.

A light whose category is set to a value that masks to non-zero using this mask will apply light to this sprite.

When used together with a normal texture, complex lighting effects can be used.

Source

pub unsafe fn setLightingBitMask(&self, lighting_bit_mask: u32)

Setter for lightingBitMask.

Source

pub unsafe fn enableAutomapping(&self) -> bool

Source

pub unsafe fn setEnableAutomapping(&self, enable_automapping: bool)

Setter for enableAutomapping.

Source

pub unsafe fn fillWithTileGroup(&self, tile_group: Option<&SKTileGroup>)

Available on crate feature SKTileSet only.

Fill the entire tile map with the provided tile group.

Parameter tileGroup: the tile group that will be used to fill the map

Source

pub unsafe fn tileDefinitionAtColumn_row( &self, column: NSUInteger, row: NSUInteger, ) -> Option<Retained<SKTileDefinition>>

Available on crate feature SKTileDefinition only.

Look up the tile definition at the specified tile index.

Parameter column: the column index of the tile

Parameter row: the row index of the tile

Source

pub unsafe fn tileGroupAtColumn_row( &self, column: NSUInteger, row: NSUInteger, ) -> Option<Retained<SKTileGroup>>

Available on crate feature SKTileSet only.

Look up the tile group at the specified tile index.

Parameter column: the column index of the tile

Parameter row: the row index of the tile

Source

pub unsafe fn setTileGroup_forColumn_row( &self, tile_group: Option<&SKTileGroup>, column: NSUInteger, row: NSUInteger, )

Available on crate feature SKTileSet only.

Set the tile group at the specified tile index. When automapping is enabled, the appropriate tile definitions will automatically be selected and placed, possibly modifying neighboring tiles. When automapping is disabled, it will simply place the default center tile definition for the group, and will not modify any of the neihboring tiles.

Parameter tileGroup: the tile group we want to place in the map

Parameter column: the column index of the tile

Parameter row: the row index of the tile

Source

pub unsafe fn setTileGroup_andTileDefinition_forColumn_row( &self, tile_group: &SKTileGroup, tile_definition: &SKTileDefinition, column: NSUInteger, row: NSUInteger, )

Available on crate features SKTileDefinition and SKTileSet only.

Set the tile group and tile defintion at the specified tile index. When automapping is enabled, it will attempt to resolve the surrounding tiles to allow the specified tile definition to be placed. When automapping is disabled, it will simply place the tile definition and not modify any of the neighboring tiles.

Parameter tileGroup: the tile group we want to place in the map

Parameter tileDefinition: the tile definition we want to place in the map

Parameter column: the column index of the tile

Parameter row: the row index of the tile

Source

pub unsafe fn tileColumnIndexFromPosition( &self, position: CGPoint, ) -> NSUInteger

Available on crate feature objc2-core-foundation only.

Returns the column index of the tile that lies under the specified position. Returns NSUIntegerMax if the position does not fall within the tile map.

Parameter position: the position we want to check against the tile map

Source

pub unsafe fn tileRowIndexFromPosition(&self, position: CGPoint) -> NSUInteger

Available on crate feature objc2-core-foundation only.

Returns the row index of the tile that lies under the specified position. Returns NSUIntegerMax if the position does not fall within the tile map.

Parameter position: the position we want to check against the tile map

Source

pub unsafe fn centerOfTileAtColumn_row( &self, column: NSUInteger, row: NSUInteger, ) -> CGPoint

Available on crate feature objc2-core-foundation only.

Returns the position of the center of the tile at the specified column and row.

Parameter column: the column index of the tile

Parameter row: the row index of the tile

Source§

impl SKTileMapNode

Methods declared on superclass SKNode.

Source

pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>

Source

pub unsafe fn initWithCoder( this: Allocated<Self>, a_decoder: &NSCoder, ) -> Option<Retained<Self>>

Support coding and decoding via NSKeyedArchiver.

Source

pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>

Source

pub unsafe fn nodeWithFileNamed( filename: &NSString, mtm: MainThreadMarker, ) -> Option<Retained<Self>>

Source

pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError( filename: &NSString, classes: &NSSet<AnyClass>, mtm: MainThreadMarker, ) -> Result<Retained<Self>, Retained<NSError>>

Source§

impl SKTileMapNode

Methods declared on superclass NSObject.

Source

pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>

Methods from Deref<Target = SKNode>§

Source

pub unsafe fn frame(&self) -> CGRect

Available on crate feature objc2-core-foundation only.
Source

pub unsafe fn calculateAccumulatedFrame(&self) -> CGRect

Available on crate feature objc2-core-foundation only.

Calculates the bounding box including all child nodes in parents coordinate system.

Source

pub unsafe fn position(&self) -> CGPoint

Available on crate feature objc2-core-foundation only.

The position of the node in the parent’s coordinate system

Source

pub unsafe fn setPosition(&self, position: CGPoint)

Available on crate feature objc2-core-foundation only.

Setter for position.

Source

pub unsafe fn zPosition(&self) -> CGFloat

Available on crate feature 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.

Source

pub unsafe fn setZPosition(&self, z_position: CGFloat)

Available on crate feature objc2-core-foundation only.

Setter for zPosition.

Source

pub unsafe fn zRotation(&self) -> CGFloat

Available on crate feature objc2-core-foundation only.

The Euler rotation about the z axis (in radians)

Source

pub unsafe fn setZRotation(&self, z_rotation: CGFloat)

Available on crate feature objc2-core-foundation only.

Setter for zRotation.

Source

pub unsafe fn xScale(&self) -> CGFloat

Available on crate feature objc2-core-foundation only.

The scaling in the X axis

Source

pub unsafe fn setXScale(&self, x_scale: CGFloat)

Available on crate feature objc2-core-foundation only.

Setter for xScale.

Source

pub unsafe fn yScale(&self) -> CGFloat

Available on crate feature objc2-core-foundation only.

The scaling in the Y axis

Source

pub unsafe fn setYScale(&self, y_scale: CGFloat)

Available on crate feature objc2-core-foundation only.

Setter for yScale.

Source

pub unsafe fn speed(&self) -> CGFloat

Available on crate feature objc2-core-foundation only.

The speed multiplier applied to all actions run on this node. Inherited by its children.

Source

pub unsafe fn setSpeed(&self, speed: CGFloat)

Available on crate feature objc2-core-foundation only.

Setter for speed.

Source

pub unsafe fn alpha(&self) -> CGFloat

Available on crate feature objc2-core-foundation only.

Alpha of this node (multiplied by the output color to give the final result)

Source

pub unsafe fn setAlpha(&self, alpha: CGFloat)

Available on crate feature objc2-core-foundation only.

Setter for alpha.

Source

pub unsafe fn isPaused(&self) -> bool

Controls whether or not the node’s actions is updated or paused.

Source

pub unsafe fn setPaused(&self, paused: bool)

Setter for isPaused.

Source

pub unsafe fn isHidden(&self) -> bool

Controls whether or not the node and its children are rendered.

Source

pub unsafe fn setHidden(&self, hidden: bool)

Setter for isHidden.

Source

pub unsafe fn isUserInteractionEnabled(&self) -> bool

Controls whether or not the node receives touch events

Source

pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool)

Source

pub unsafe fn focusBehavior(&self) -> SKNodeFocusBehavior

Determines how this node participates in the focus system. The default is SKNodeFocusBehaviorNone.

Source

pub unsafe fn setFocusBehavior(&self, focus_behavior: SKNodeFocusBehavior)

Setter for focusBehavior.

Source

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.

Source

pub unsafe fn children(&self) -> Retained<NSArray<SKNode>>

The children of this node.

Source

pub unsafe fn name(&self) -> Option<Retained<NSString>>

The client assignable name.

In general, this should be unique among peers in the scene graph.

Source

pub unsafe fn setName(&self, name: Option<&NSString>)

Setter for name.

Source

pub unsafe fn scene(&self) -> Option<Retained<SKScene>>

Available on crate features SKEffectNode and SKScene only.

The scene that the node is currently in.

Source

pub unsafe fn physicsBody(&self) -> Option<Retained<SKPhysicsBody>>

Available on crate feature SKPhysicsBody only.

Physics body attached to the node, with synchronized scale, rotation, and position

Source

pub unsafe fn setPhysicsBody(&self, physics_body: Option<&SKPhysicsBody>)

Available on crate feature SKPhysicsBody only.

Setter for physicsBody.

Source

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.

Source

pub unsafe fn setUserData(&self, user_data: Option<&NSMutableDictionary>)

Setter for userData.

Source

pub unsafe fn reachConstraints(&self) -> Option<Retained<SKReachConstraints>>

Available on crate feature SKReachConstraints only.

Kinematic constraints, used in IK solving

Source

pub unsafe fn setReachConstraints( &self, reach_constraints: Option<&SKReachConstraints>, )

Available on crate feature SKReachConstraints only.

Setter for reachConstraints.

Source

pub unsafe fn constraints(&self) -> Option<Retained<NSArray<SKConstraint>>>

Available on crate feature 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.

Source

pub unsafe fn setConstraints(&self, constraints: Option<&NSArray<SKConstraint>>)

Available on crate feature SKConstraint only.

Setter for constraints.

Source

pub unsafe fn attributeValues( &self, ) -> Retained<NSDictionary<NSString, SKAttributeValue>>

👎Deprecated
Available on crate feature 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.).

Source

pub unsafe fn setAttributeValues( &self, attribute_values: &NSDictionary<NSString, SKAttributeValue>, )

👎Deprecated
Available on crate feature SKAttribute only.

Setter for attributeValues.

Source

pub unsafe fn valueForAttributeNamed( &self, key: &NSString, ) -> Option<Retained<SKAttributeValue>>

👎Deprecated
Available on crate feature SKAttribute only.
Source

pub unsafe fn setValue_forAttributeNamed( &self, value: &SKAttributeValue, key: &NSString, )

👎Deprecated
Available on crate feature SKAttribute only.
Source

pub unsafe fn setScale(&self, scale: CGFloat)

Available on crate feature objc2-core-foundation only.

Sets both the x & y scale

Parameter scale: the uniform scale to set.

Source

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.

Source

pub unsafe fn insertChild_atIndex(&self, node: &SKNode, index: NSInteger)

Source

pub unsafe fn removeChildrenInArray(&self, nodes: &NSArray<SKNode>)

Source

pub unsafe fn removeAllChildren(&self)

Source

pub unsafe fn removeFromParent(&self)

Source

pub unsafe fn moveToParent(&self, parent: &SKNode)

Source

pub unsafe fn childNodeWithName( &self, name: &NSString, ) -> Option<Retained<SKNode>>

Source

pub unsafe fn enumerateChildNodesWithName_usingBlock( &self, name: &NSString, block: &DynBlock<dyn Fn(NonNull<SKNode>, NonNull<Bool>)>, )

Available on crate feature block2 only.
Source

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:

Source

pub unsafe fn inParentHierarchy(&self, parent: &SKNode) -> bool

Source

pub unsafe fn runAction(&self, action: &SKAction)

Available on crate feature SKAction only.
Source

pub unsafe fn runAction_completion( &self, action: &SKAction, block: &DynBlock<dyn Fn()>, )

Available on crate features SKAction and block2 only.
Source

pub unsafe fn runAction_withKey(&self, action: &SKAction, key: &NSString)

Available on crate feature SKAction only.
Source

pub unsafe fn hasActions(&self) -> bool

Source

pub unsafe fn actionForKey(&self, key: &NSString) -> Option<Retained<SKAction>>

Available on crate feature SKAction only.
Source

pub unsafe fn removeActionForKey(&self, key: &NSString)

Source

pub unsafe fn removeAllActions(&self)

Source

pub unsafe fn containsPoint(&self, p: CGPoint) -> bool

Available on crate feature objc2-core-foundation only.
Source

pub unsafe fn nodeAtPoint(&self, p: CGPoint) -> Retained<SKNode>

Available on crate feature 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.

Source

pub unsafe fn nodesAtPoint(&self, p: CGPoint) -> Retained<NSArray<SKNode>>

Available on crate feature objc2-core-foundation only.
Source

pub unsafe fn convertPoint_fromNode( &self, point: CGPoint, node: &SKNode, ) -> CGPoint

Available on crate feature objc2-core-foundation only.
Source

pub unsafe fn convertPoint_toNode( &self, point: CGPoint, node: &SKNode, ) -> CGPoint

Available on crate feature objc2-core-foundation only.
Source

pub unsafe fn intersectsNode(&self, node: &SKNode) -> bool

Source

pub unsafe fn isEqualToNode(&self, node: &SKNode) -> bool

Source

pub unsafe fn isAccessibilityElement(&self) -> bool

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn setAccessibilityElement(&self, accessibility_element: bool)

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn accessibilityRole(&self) -> Option<Retained<NSString>>

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn setAccessibilityRole(&self, accessibility_role: Option<&NSString>)

Available on crate feature SKNode_NSAccessibility only.

Setter for accessibilityRole.

Source

pub unsafe fn accessibilityRoleDescription(&self) -> Option<Retained<NSString>>

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn setAccessibilityRoleDescription( &self, accessibility_role_description: Option<&NSString>, )

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn accessibilitySubrole(&self) -> Option<Retained<NSString>>

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn setAccessibilitySubrole( &self, accessibility_subrole: Option<&NSString>, )

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn accessibilityFrame(&self) -> CGRect

Available on crate features SKNode_NSAccessibility and objc2-core-foundation only.
Source

pub unsafe fn setAccessibilityFrame(&self, accessibility_frame: CGRect)

Available on crate features SKNode_NSAccessibility and objc2-core-foundation only.

Setter for accessibilityFrame.

Source

pub unsafe fn accessibilityParent(&self) -> Option<Retained<AnyObject>>

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn setAccessibilityParent( &self, accessibility_parent: Option<&AnyObject>, )

Available on crate feature SKNode_NSAccessibility only.

This is a weak property. Setter for accessibilityParent.

Source

pub unsafe fn accessibilityChildren(&self) -> Option<Retained<NSArray>>

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn setAccessibilityChildren( &self, accessibility_children: Option<&NSArray>, )

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn accessibilityHelp(&self) -> Option<Retained<NSString>>

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn setAccessibilityHelp(&self, accessibility_help: Option<&NSString>)

Available on crate feature SKNode_NSAccessibility only.

Setter for accessibilityHelp.

Source

pub unsafe fn accessibilityLabel(&self) -> Option<Retained<NSString>>

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn setAccessibilityLabel( &self, accessibility_label: Option<&NSString>, )

Available on crate feature SKNode_NSAccessibility only.

Setter for accessibilityLabel.

Source

pub unsafe fn isAccessibilityEnabled(&self) -> bool

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn setAccessibilityEnabled(&self, accessibility_enabled: bool)

Available on crate feature SKNode_NSAccessibility only.
Source

pub unsafe fn accessibilityHitTest( &self, point: CGPoint, ) -> Option<Retained<AnyObject>>

Available on crate features SKNode_NSAccessibility and objc2-core-foundation only.

Methods from Deref<Target = NSResponder>§

Source

pub unsafe fn nextResponder(&self) -> Option<Retained<NSResponder>>

Source

pub unsafe fn setNextResponder(&self, next_responder: Option<&NSResponder>)

Setter for nextResponder.

Source

pub unsafe fn tryToPerform_with( &self, action: Sel, object: Option<&AnyObject>, ) -> bool

Source

pub unsafe fn performKeyEquivalent(&self, event: &NSEvent) -> bool

Source

pub unsafe fn mouseDown(&self, event: &NSEvent)

Source

pub unsafe fn rightMouseDown(&self, event: &NSEvent)

Source

pub unsafe fn otherMouseDown(&self, event: &NSEvent)

Source

pub unsafe fn mouseUp(&self, event: &NSEvent)

Source

pub unsafe fn rightMouseUp(&self, event: &NSEvent)

Source

pub unsafe fn otherMouseUp(&self, event: &NSEvent)

Source

pub unsafe fn mouseMoved(&self, event: &NSEvent)

Source

pub unsafe fn mouseDragged(&self, event: &NSEvent)

Source

pub unsafe fn scrollWheel(&self, event: &NSEvent)

Source

pub unsafe fn rightMouseDragged(&self, event: &NSEvent)

Source

pub unsafe fn otherMouseDragged(&self, event: &NSEvent)

Source

pub unsafe fn mouseEntered(&self, event: &NSEvent)

Source

pub unsafe fn mouseExited(&self, event: &NSEvent)

Source

pub unsafe fn keyDown(&self, event: &NSEvent)

Source

pub unsafe fn keyUp(&self, event: &NSEvent)

Source

pub unsafe fn flagsChanged(&self, event: &NSEvent)

Source

pub unsafe fn tabletPoint(&self, event: &NSEvent)

Source

pub unsafe fn tabletProximity(&self, event: &NSEvent)

Source

pub unsafe fn cursorUpdate(&self, event: &NSEvent)

Source

pub unsafe fn magnifyWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn rotateWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn swipeWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn beginGestureWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn endGestureWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn smartMagnifyWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn changeModeWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn touchesBeganWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn touchesMovedWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn touchesEndedWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn touchesCancelledWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn quickLookWithEvent(&self, event: &NSEvent)

Source

pub unsafe fn pressureChangeWithEvent(&self, event: &NSEvent)

Source

pub unsafe 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:

Source

pub unsafe fn noResponderFor(&self, event_selector: Sel)

Source

pub unsafe fn acceptsFirstResponder(&self) -> bool

Source

pub unsafe fn becomeFirstResponder(&self) -> bool

Source

pub unsafe fn resignFirstResponder(&self) -> bool

Source

pub unsafe fn interpretKeyEvents(&self, event_array: &NSArray<NSEvent>)

Source

pub unsafe fn flushBufferedKeyEvents(&self)

Source

pub unsafe fn showContextHelp(&self, sender: Option<&AnyObject>)

Source

pub unsafe fn helpRequested(&self, event_ptr: &NSEvent)

Source

pub unsafe fn shouldBeTreatedAsInkEvent(&self, event: &NSEvent) -> bool

Source

pub unsafe fn wantsScrollEventsForSwipeTrackingOnAxis( &self, axis: NSEventGestureAxis, ) -> bool

Source

pub unsafe fn wantsForwardedScrollEventsForAxis( &self, axis: NSEventGestureAxis, ) -> bool

Source

pub unsafe fn supplementalTargetForAction_sender( &self, action: Sel, sender: Option<&AnyObject>, ) -> Option<Retained<AnyObject>>

Source

pub unsafe fn undoManager(&self) -> Option<Retained<NSUndoManager>>

Source

pub unsafe fn validateProposedFirstResponder_forEvent( &self, responder: &NSResponder, event: Option<&NSEvent>, ) -> bool

Source

pub unsafe fn presentError(&self, error: &NSError) -> bool

Source

pub unsafe fn willPresentError(&self, error: &NSError) -> Retained<NSError>

Source

pub unsafe fn performTextFinderAction(&self, sender: Option<&AnyObject>)

Source

pub unsafe fn newWindowForTab(&self, sender: Option<&AnyObject>)

Source

pub unsafe fn showWritingTools(&self, sender: Option<&AnyObject>)

Source

pub unsafe fn performMnemonic(&self, string: &NSString) -> bool

👎Deprecated: This has always returned NO and had no effect on macOS

Methods from Deref<Target = NSObject>§

Source

pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !

Handle messages the object doesn’t recognize.

See Apple’s documentation for details.

Methods from Deref<Target = AnyObject>§

Source

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());
Source

pub unsafe fn get_ivar<T>(&self, name: &str) -> &T
where T: Encode,

👎Deprecated: this is difficult to use correctly, use 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.

Source

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 SKTileMapNode

Source§

fn as_ref(&self) -> &AnyObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<NSObject> for SKTileMapNode

Source§

fn as_ref(&self) -> &NSObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<NSResponder> for SKTileMapNode

Source§

fn as_ref(&self) -> &NSResponder

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<SKNode> for SKTileMapNode

Source§

fn as_ref(&self) -> &SKNode

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<SKTileMapNode> for SKTileMapNode

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<AnyObject> for SKTileMapNode

Source§

fn borrow(&self) -> &AnyObject

Immutably borrows from an owned value. Read more
Source§

impl Borrow<NSObject> for SKTileMapNode

Source§

fn borrow(&self) -> &NSObject

Immutably borrows from an owned value. Read more
Source§

impl Borrow<NSResponder> for SKTileMapNode

Source§

fn borrow(&self) -> &NSResponder

Immutably borrows from an owned value. Read more
Source§

impl Borrow<SKNode> for SKTileMapNode

Source§

fn borrow(&self) -> &SKNode

Immutably borrows from an owned value. Read more
Source§

impl ClassType for SKTileMapNode

Source§

const NAME: &'static str = "SKTileMapNode"

The name of the Objective-C class that this type represents. Read more
Source§

type Super = SKNode

The superclass of this class. Read more
Source§

type ThreadKind = <<SKTileMapNode as ClassType>::Super as ClassType>::ThreadKind

Whether the type can be used from any thread, or from only the main thread. Read more
Source§

fn class() -> &'static AnyClass

Get a reference to the Objective-C class that this type represents. Read more
Source§

fn as_super(&self) -> &Self::Super

Get an immutable reference to the superclass.
Source§

impl CopyingHelper for SKTileMapNode

Source§

type Result = SKTileMapNode

The immutable counterpart of the type, or Self if the type has no immutable counterpart. Read more
Source§

impl Debug for SKTileMapNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for SKTileMapNode

Source§

type Target = SKNode

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Hash for SKTileMapNode

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Message for SKTileMapNode

Source§

fn retain(&self) -> Retained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

impl NSCoding for SKTileMapNode

Source§

unsafe fn encodeWithCoder(&self, coder: &NSCoder)
where Self: Sized + Message,

Source§

unsafe fn initWithCoder( this: Allocated<Self>, coder: &NSCoder, ) -> Option<Retained<Self>>
where Self: Sized + Message,

Source§

impl NSCopying for SKTileMapNode

Source§

fn copy(&self) -> Retained<Self::Result>
where Self: Sized + Message + CopyingHelper,

Returns a new instance that’s a copy of the receiver. Read more
Source§

unsafe fn copyWithZone(&self, zone: *mut NSZone) -> Retained<Self::Result>
where Self: Sized + Message + CopyingHelper,

Returns a new instance that’s a copy of the receiver. Read more
Source§

impl NSObjectProtocol for SKTileMapNode

Source§

fn isEqual(&self, other: Option<&AnyObject>) -> bool
where Self: Sized + Message,

Check whether the object is equal to an arbitrary other object. Read more
Source§

fn hash(&self) -> usize
where Self: Sized + Message,

An integer that can be used as a table address in a hash table structure. Read more
Source§

fn isKindOfClass(&self, cls: &AnyClass) -> bool
where Self: Sized + Message,

Check if the object is an instance of the class, or one of its subclasses. Read more
Source§

fn is_kind_of<T>(&self) -> bool
where T: ClassType, Self: Sized + Message,

👎Deprecated: use isKindOfClass directly, or cast your objects with AnyObject::downcast_ref
Check if the object is an instance of the class type, or one of its subclasses. Read more
Source§

fn isMemberOfClass(&self, cls: &AnyClass) -> bool
where Self: Sized + Message,

Check if the object is an instance of a specific class, without checking subclasses. Read more
Source§

fn respondsToSelector(&self, aSelector: Sel) -> bool
where Self: Sized + Message,

Check whether the object implements or inherits a method with the given selector. Read more
Source§

fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
where Self: Sized + Message,

Check whether the object conforms to a given protocol. Read more
Source§

fn description(&self) -> Retained<NSObject>
where Self: Sized + Message,

A textual representation of the object. Read more
Source§

fn debugDescription(&self) -> Retained<NSObject>
where Self: Sized + Message,

A textual representation of the object to use when debugging. Read more
Source§

fn isProxy(&self) -> bool
where Self: Sized + Message,

Check whether the receiver is a subclass of the NSProxy root class instead of the usual NSObject. Read more
Source§

fn retainCount(&self) -> usize
where Self: Sized + Message,

The reference count of the object. Read more
Source§

impl NSSecureCoding for SKTileMapNode

Source§

unsafe fn supportsSecureCoding() -> bool
where Self: Sized + ClassType,

Source§

impl PartialEq for SKTileMapNode

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RefEncode for SKTileMapNode

Source§

const ENCODING_REF: Encoding = <SKNode as ::objc2::RefEncode>::ENCODING_REF

The Objective-C type-encoding for a reference of this type. Read more
Source§

impl DowncastTarget for SKTileMapNode

Source§

impl Eq for SKTileMapNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'a, T> MainThreadOnly for T
where T: ClassType<ThreadKind = dyn MainThreadOnly + 'a> + ?Sized,

Source§

fn mtm(&self) -> MainThreadMarker

Get a MainThreadMarker from the main-thread-only object. Read more
Source§

fn alloc(mtm: MainThreadMarker) -> Allocated<Self>
where Self: Sized + ClassType,

Allocate a new instance of the class on the main thread. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,