spritekit-0.9.0.2: Cocoa SpriteKit for Haskell

Copyright[2014] Manuel M T Chakravarty
LicenseBSD3
MaintainerManuel M T Chakravarty <chak@justtesting.org>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Graphics.SpriteKit

Contents

Description

Cocoa SpriteKit for Haskell

Concepts:

  • SpriteKit node trees are represented as conventional algebraic datatypes in Haskell.
  • For rendering, Haskell node trees are converted to native SKNode trees. For animated scenes, where all animation is driven by Haskell, the conversion of updated scenes works by updating the previous SKNode tree.
  • For interactive scenes and scenes using SceneKit's actions or physics, the Haskell scene code gets called with a Haskell tree representing the current SKNode tree, which, after Haskell side processing, is converted to an SKNode tree again by updating the version that was passed to the Haskell code.

Synopsis

Basic geometry and similar

Basic temporal definition

Basic geometry definitions

type GFloat #

Arguments

 = Double

FIXME: need to be set in dependence on the definition of CGFloat resp CGFLOAT_IS_DOUBLE

Graphics float (which is a Float or Double depending on whether we are on a 32 or 64 bit architecture)

data Point #

Point in a two-dimensional coordinate system.

Constructors

Point 

Fields

data Size #

Size of a two-dimensional geometry entity.

Constructors

Size 

Instances

Eq Size # 

Methods

(==) :: Size -> Size -> Bool #

(/=) :: Size -> Size -> Bool #

Ord Size # 

Methods

compare :: Size -> Size -> Ordering #

(<) :: Size -> Size -> Bool #

(<=) :: Size -> Size -> Bool #

(>) :: Size -> Size -> Bool #

(>=) :: Size -> Size -> Bool #

max :: Size -> Size -> Size #

min :: Size -> Size -> Size #

Read Size # 
Show Size # 

Methods

showsPrec :: Int -> Size -> ShowS #

show :: Size -> String #

showList :: [Size] -> ShowS #

data Rect #

Location and size of a rectangle.

Constructors

Rect 

Fields

Instances

Eq Rect # 

Methods

(==) :: Rect -> Rect -> Bool #

(/=) :: Rect -> Rect -> Bool #

Ord Rect # 

Methods

compare :: Rect -> Rect -> Ordering #

(<) :: Rect -> Rect -> Bool #

(<=) :: Rect -> Rect -> Bool #

(>) :: Rect -> Rect -> Bool #

(>=) :: Rect -> Rect -> Bool #

max :: Rect -> Rect -> Rect #

min :: Rect -> Rect -> Rect #

Read Rect # 
Show Rect # 

Methods

showsPrec :: Int -> Rect -> ShowS #

show :: Rect -> String #

showList :: [Rect] -> ShowS #

data Vector #

Two-dimensional vector.

Constructors

Vector 

Fields

pointZero :: Point #

Point at (0, 0).

Marshalling functions (internal)

pointToCGPoint :: Point -> IO CGPoint #

cgPointToPoint :: CGPoint -> IO Point #

sizeToCGSize :: Size -> IO CGSize #

cgSizeToSize :: CGSize -> IO Size #

rectToCGRect :: Rect -> IO CGRect #

cgRectToRect :: CGRect -> IO Rect #

vectorToCGVector :: Vector -> IO CGVector #

cgVectorToVector :: CGVector -> IO Vector #

Color representation

Colour representation

newtype Color #

Representation of color values.

Constructors

Color SKColor 

Colours in the sRGBA colour space

colorWithRGBA :: Float -> Float -> Float -> Float -> Color #

Create color with the specified red, green, blue, and alpha channel values in the sRGB color space.

rgbaOfColor :: Color -> Maybe (Float, Float, Float, Float) #

Extract the red, green, blue, and alpha channel values of a colour in the sRGB colour space.

Returns Nothing if the color is in a different color space.

Standard colours

Marshalling support (internal)

newtype SKColor #

Constructors

SKColor (ForeignPtr SKColor) 

Bit images and textures

Images

data Image #

Instances

IsImage Image # 

Methods

toImage :: Image -> Image #

Marshalling functions (internal)

newtype NSUIImage #

SpriteKit texture representation

newtype Texture #

A SpriteKit texture object

Constructors

Texture SKTexture 

Texture creation

textureWithImageNamed :: FilePath -> Texture #

Create a texture from an image in the app bundle (either a file or an image in a texture atlas) or external file.

A placeholder image is used if the specified image cannot be loaded.

In case of a relative name, the look up behaviour varies between a compiled application bundle and running in the interpreter. In case of a compiled application bundle, the standard SpriteKit bundle behaviour applies. In case of executing in the interpreter, we first look for assets relative to the current working directory.

textureWithImage :: Image -> Texture #

Create a texture from the given image.

textureWithRectInTexture :: Rect -> Texture -> Texture #

Create a texture from a subset of an existing texture.

The original and new texture share the same texture data. In further call to the same function, the rectangle is again specified in terms of the *original* texture.

Texture properties

textureSize :: Texture -> Size #

The size of the texture.

textureRect :: Texture -> Rect #

The rectangle (in the unit coordinate space) that defines the portion of the texture used to render its image.

The default is (0,0) — (1,1), but it may be different for textures created with textureWithRectInTexture.

Marshalling support

newtype SKTexture #

Vector paths

Core Graphics path representation

type Path = [PathElement] #

Description of a graphics path.

data PathElement #

Elementary components of a graphics path.

The constructors AddLineToPoint, AddQuadCurveToPoint, AddCurveToPoint may not start a graphics path.

Constructors

MoveToPoint !Point

Starts a new subpath at the given point.

AddLineToPoint !Point

Adds a line from the current to the given point.

AddQuadCurveToPoint !Point !Point

Adds a quadratic curve with control and destination point.

AddCurveToPoint !Point !Point !Point

Adds a cubic curve with two control and one destination point.

CloseSubpath

Closes and completes the current subpath. FIXME: we might to add field names (esp useful for the quadratic and cubic curves)

Marshalling functions (internal)

newtype CGPath #

Constructors

CGPath (ForeignPtr CGPath) 

Nodes and scenes

SpriteKit node representation

data Node u #

Tree structure of SpriteKit nodes that are used to assemble scenes, parameterised by the type of user data u.

Constructors

Node 

Fields

Label 

Fields

Shape 

Fields

Sprite 

Fields

data SDirective node children #

Specification of changes that should be made to a node's actions (might be a proper node or a scene).

Constructors

RunAction (SAction node children) (Maybe String)

Initiate a new action, possibly named.

RemoveActionForKey String

Remove a named action.

RemoveAllActions

Remove all current actions.

type Directive node = SDirective node node #

Directive for a proper node (not including scenes).

type TimedUpdate node = node -> GFloat -> node #

Function that computes an updated tree, given the time that elapsed since the start of the current animation.

The result will be ignored if the new node is not derived from the old node — i.e, it must be the same kind of node and it must preserve the nodeForeign field.

Generic SpriteKit node functionality

node :: [Node userData] -> Node userData #

Create a node that combines multiple child nodes, but doesn't have a visual representation of its own.

frame :: Node userData -> IO Rect #

Determine a rectangle in the parent’s coordinate system that contains the node’s content, ignoring the node’s children.

LIMITATION: The current implementation of this function can be quite costly due to superflous marshalling overhead.

calculateAccumulatedFrame :: Node userData -> IO Rect #

Calculate a rectangle in the parent’s coordinate system that contains the content of the node and all of its descendants.

Label nodes

labelNodeWithFontNamed :: String -> Node userData #

Creates a label node without any text, but using the specified font.

labelNodeWithText :: String -> Node userData #

Creates a label node with the given text (set in 32pt Helvetica Neue Ultralight).

Shape nodes

shapeNodeWithPath :: Path -> Node userData #

Creates a shape node from a graphics path relative to the nodes origin.

Sprite nodes

spriteNodeWithColorSize :: Color -> Size -> Node userData #

Create a coloured sprite of a given size.

spriteNodeWithImageNamed :: FilePath -> Node userData #

Create a texture sprite from an image in the app bundle (either a file or an image in a texture atlas).

A placeholder image is used if the image cannot be loaded.

spriteNodeWithTexture :: Texture -> Node userData #

Create a textured sprite from an in-memory texture.

spriteNodeWithTextureSize :: Texture -> Size -> Node userData #

Create a textured sprite from an in-memory texture, but also set an explicit size (instead of using the texture's size).

spriteNodeWithTextureColorSize :: Texture -> Color -> Size -> Node userData #

Create a textured sprite from an in-memory texture, but also set an explicit size (instead of using the texture's size).

NB: To colourise the texture, you also need to set the colorBlendFactor field of the sprite.

Short forms

spriteWithColorSize :: Color -> Size -> Node userData #

Create a coloured sprite of a given size.

spriteWithImageNamed :: FilePath -> Node userData #

Create a texture sprite from an image in the app bundle (either a file or an image in a texture atlas).

A placeholder image is used if the image cannot be loaded.

spriteWithTexture :: Texture -> Node userData #

Create a textured sprite from an in-memory texture.

spriteWithTextureSize :: Texture -> Size -> Node userData #

Create a textured sprite from an in-memory texture, but also set an explicit size (instead of using the texture's size).

spriteWithTextureColorSize :: Texture -> Color -> Size -> Node userData #

Create a textured sprite from an in-memory texture, but also set an explicit size (instead of using the texture's size).

NB: To colourise the texture, you also need to set the colorBlendFactor field of the sprite.

Internal marshalling support

newtype SKNode #

Constructors

SKNode (ForeignPtr SKNode) 

skNodeToNode :: SKNode -> IO (Node userData) #

nodeToSKNode :: Node userData -> IO SKNode #

mergeSKNode :: Node userData -> Node userData -> IO SKNode #

addChildren :: Bool -> SKNode -> [Node userData] -> IO () #

addActionDirectives :: SKNode -> [SDirective node children] -> IO () #

updateChildren :: SKNode -> [Node userData] -> [Node userData] -> IO () #

Scene representation

data Scene sceneData nodeData #

SpriteKit scene description.

Constructors

Scene 

Fields

type SceneUpdate sceneData nodeData = Scene sceneData nodeData -> TimeInterval -> Scene sceneData nodeData #

Scene update functions called before any actions are executed.

The second argument contains the current system time.

type EventHandler userData = Event -> userData -> Maybe userData #

Event handler that given an input event and node data decides whether to handle the event and how to update the node data.

If the handler chooses not to handle the presented event, it returns Nothing. In this case, the event will be forwarded to the next item in the responder chain.

Scene creation

sceneWithSize :: Size -> Scene sceneData nodeData #

A new scene of the given size.

Marshalling functions (internal)

sceneToSKNode :: Scene sceneData nodeData -> IO SKNode #

sceneToForeignPtr :: Scene sceneData nodeData -> IO (ForeignPtr SKNode) #

Actions animating nodes

Action directives

runAction :: SAction node children -> SDirective node children #

Initiate a new action.

runActionWithKey :: SAction node children -> String -> SDirective node children #

Initiate a new action and give it a name.

If an action with the same name is currently underway on a node that receives this action, the old action is removed first.

removeActionForKey :: String -> SDirective node children #

Instructs to remove any action with the give name.

removeAllActions :: SDirective node children #

Instructs to remove all actions from any node that receives this directive.

Animation actions

data SActionSpecification node children #

Specification of an action that can be applied to a SpriteKit node or scene.

The first type parameter is the type of node on which the action operates. The second is the type of node of its children. This distinction is required as actions operating on a scene may include RunActionOnChildWithName actions that will operate on nodes (which are of a different type).

Most actions will be animated over time, given a duration.

Constructors

MoveBy !Vector

Move relative to current position (reversible).

MoveTo !Point

Move to an absolute position (irreversible).

MoveToX !GFloat

Move horizontally to an absolute x-position (irreversible).

MoveToY !GFloat

Move vertically to an absolute y-position (irreversible).

FollowPath Path !Bool !Bool

Follow path, maybe use relative offsets & maybe orient according to path (reversible).

FollowPathSpeed Path !Bool !Bool !GFloat

As above, but specifying speed in points per sec (reversible; OS X 10.10+ & iOS 8+).

RotateByAngle !GFloat

Rotate by a relative value, in radians (reversible).

RotateToAngle !GFloat

Rotate counterclockwise to an absolute angle, in radians (irreversible).

RotateToAngleShortestUnitArc !GFloat !Bool

Rotate to an absolute angle. If second argument '== True', in the direction resulting in the smallest rotation; otherwise, interpolated (irreversible).

SpeedBy !GFloat

Changes how fast the node executes actions by a relative value (reversible).

SpeedTo !GFloat

Changes how fast the node executes actions to an absolute value (irreversible).

ScaleBy !GFloat !GFloat

Relative change of x and y scale values (reversible).

ScaleTo !GFloat !GFloat

Change x and y scale values to an absolute values (irreversible).

ScaleXTo !GFloat

Change x scale value to an absolute value (irreversible).

ScaleYTo !GFloat

Change y scale value to an absolute value (irreversible).

Unhide

Makes a node visible (reversible; instantaneous; OS X 10.10+ & iOS 8+).

Hide

Hides a node (reversible; instantaneous; OS X 10.10+ & iOS 8+).

FadeIn

Changes the alpha value to 1.0 (reversible).

FadeOut

Changes the alpha value to 0.0 (reversible).

FadeAlphaBy !GFloat

Relative change of the alpha value (reversible).

FadeAlphaTo !GFloat

Change the alpha value to an absolute value (irreversible).

ResizeByWidthHeight !GFloat !GFloat

Adjust the size of a sprite (reversible).

ResizeToHeight !GFloat

Change height of a sprite to an absolute value (irreversible).

ResizeToWidth !GFloat

Change width of a sprite to an absolute value (irreversible).

ResizeToWidthHeight !GFloat !GFloat

Change width and height of a sprite to an absolute value (irreversible).

SetTexture Texture !Bool

Change a sprite's texture, maybe resizing the sprite (irreversible; instantaneous; without resizing only OS X 10.10+ & iOS 7.1+).

AnimateWithTextures [Texture] !TimeInterval !Bool !Bool

Animate setting the textures, pausing by the given time interval between textures. If first Bool '== True', resize sprite to match each texture. If second Bool is True, the original texture is restored (reversible).

SetNormalTexture Texture !Bool

Change a sprite's normal texture, maybe resizing (irreversible; instantaneous; OS X 10.11+ & iOS 9+).

AnimateWithNormalTextures [Texture] !TimeInterval !Bool !Bool

Animate normal textures, pausing by the given time interval between textures. If first Bool '== True', resize sprite to match each normal texture. If second Bool is True, the original texture is restored (reversible; OS X 10.11+ & iOS 9+).

ColorizeWithColor Color !GFloat

Animate a sprite's color and blend factor (irreversible).

ColorizeWithColorBlendFactor !GFloat

Animate a sprite's blend factor (irreversible).

ApplyForceImpulse ForceImpulse

Apply the specified force or impulse to the physics body (reverible). FIXME: not yet implemented: change of charge

ChangeMassTo GFloat

Change the mass of the node's physics body to the new value (irreversible).

ChangeMassBy GFloat

Change the mass of the node's physics body by the given value (reversible). FIXME: not yet implemented: physics field strength change and falloff

PlaySoundFileNamed String !Bool

Play a sound, maybe waiting until the sound finishes playing (irreversible). FIXME: not yet implemented: actions acting on sound nodes

RemoveFromParent

Removes the animated node from its parent (irreversible; instantaneous).

RunActionOnChildWithName (Action children) String

Run an action on a named child node (reversible; instantaneous).

Group [SAction node children]

Run all actions in the group in parallel (reversible).

Sequence [SAction node children]

Run all actions in the group in sequence (reversible).

RepeatActionCount (SAction node children) !Int

Repeat an action a fixed number of times (reversible).

RepeatActionForever (SAction node children)

Repeat an action undefinitely (reversible).

WaitForDuration !TimeInterval

Waits for the action's duration +/- half the given range value (irreversible).

CustomAction (TimedUpdate node)

Repeatedly invoke the update function over the action duration (irreversible).

type ActionSpecification node = SActionSpecification node node #

Action specifications on proper nodes have the same type for the node to which the action is attached and its children.

data SAction node children #

SpriteKit action.

NB: actionTimingFunction not yet supported.

Constructors

Action 

Fields

type Action node = SAction node node #

Action on a proper node (not a scene).

data ActionTimingMode #

Determines the temporal progression of an action.

type ActionTimingFunction = Float -> Float #

Projects an input value between 0.0 and 1.0, inclusive, to another value between 0.0 and 1.0 to indicate the temporal progression of an action. The input 0.0 must be mapped to 0.0, and 1.0 to 1.0. Inbetween those bounds, the timing function can adjust the timing of the action.

action :: SActionSpecification node children -> SAction node children #

Construct an action.

Convenience functions to construct specifications of the same name

moveBy :: Vector -> SAction node children #

moveTo :: Point -> SAction node children #

moveToX :: GFloat -> SAction node children #

moveToY :: GFloat -> SAction node children #

followPath :: Path -> SAction node children #

followPathSpeed :: Path -> GFloat -> SAction node children #

rotateByAngle :: GFloat -> SAction node children #

rotateToAngle :: GFloat -> SAction node children #

speedBy :: GFloat -> SAction node children #

speedTo :: GFloat -> SAction node children #

scaleBy :: GFloat -> SAction node children #

scaleTo :: GFloat -> SAction node children #

scaleXByY :: GFloat -> GFloat -> SAction node children #

scaleXToX :: GFloat -> GFloat -> SAction node children #

scaleXTo :: GFloat -> SAction node children #

scaleYTo :: GFloat -> SAction node children #

hide :: SAction node children #

unhide :: SAction node children #

fadeIn :: SAction node children #

fadeOut :: SAction node children #

fadeAlphaBy :: GFloat -> SAction node children #

fadeAlphaTo :: GFloat -> SAction node children #

resizeByWidthHeight :: GFloat -> GFloat -> SAction node children #

resizeToHeight :: GFloat -> SAction node children #

resizeToWidth :: GFloat -> SAction node children #

resizeToWidthHeight :: GFloat -> GFloat -> SAction node children #

setTexture :: Texture -> SAction node children #

setTextureResize :: Texture -> Bool -> SAction node children #

setNormalTexture :: Texture -> SAction node children #

animateWithTexturesTimePerFrame :: [Texture] -> TimeInterval -> SAction node children #

animateWithTextures is a shorthand for convenience.

animateWithTextures :: [Texture] -> TimeInterval -> SAction node children #

animateWithTextures is a shorthand for convenience.

animateWithTexturesResizeRestore :: [Texture] -> TimeInterval -> Bool -> Bool -> SAction node children #

animateWithTexturesResizeRestore is a shorthand for convenience.

animateWithNormalTexturesTimePerFrame :: [Texture] -> TimeInterval -> SAction node children #

animateWithNormalTextures is a shorthand for convenience.

animateWithNormalTextures :: [Texture] -> TimeInterval -> SAction node children #

animateWithNormalTextures is a shorthand for convenience.

colorizeWithColorColorBlendFactor :: Color -> GFloat -> SAction node children #

colorizeWithColor is a shorthand for convenience.

colorizeWithColor :: Color -> GFloat -> SAction node children #

colorizeWithColor is a shorthand for convenience.

applyForce :: Vector -> SAction node children #

applyTorque :: GFloat -> SAction node children #

applyForceAtPoint :: Vector -> Point -> SAction node children #

applyImpulse :: Vector -> SAction node children #

applyAngularImpulse :: GFloat -> SAction node children #

applyImpulseAtPoint :: Vector -> Point -> SAction node children #

changeMassTo :: GFloat -> SAction node children #

changeMassBy :: GFloat -> SAction node children #

playSoundFileNamedWaitForCompletion :: String -> Bool -> SAction node children #

playSoundFileName is a shorthand for convenience.

playSoundFileNamed :: String -> Bool -> SAction node children #

playSoundFileName is a shorthand for convenience.

removeFromParent :: SAction node children #

runActionOnChildWithName :: Action children -> String -> SAction node children #

group :: [SAction node children] -> SAction node children #

groupActions is to be symmetric with sequenceActions.

groupActions :: [SAction node children] -> SAction node children #

groupActions is to be symmetric with sequenceActions.

sequence :: [SAction node children] -> SAction node children #

sequenceActions is for convenience in the face of sequence.

sequenceActions :: [SAction node children] -> SAction node children #

sequenceActions is for convenience in the face of sequence.

repeatActionCount :: SAction node children -> Int -> SAction node children #

repeatActionForever :: SAction node children -> SAction node children #

waitForDuration :: SAction node children #

customAction :: TimedUpdate node -> SAction node children #

Perform the given update function once per frame for the given duration. If the duration is 0, the function is only invoked once.

The node on which the action is run is passed to the update function and gets replaced by the updated node.

FIXME: We need to document the tree merging algorithm.

Marshalling support (internal)

newtype SKAction #

Constructors

SKAction (ForeignPtr SKAction) 

actionToSKAction :: SAction node children -> IO SKAction #

data TimedUpdateBox node #

Constructors

TimedUpdateBox (TimedUpdate node) 

Physics simulation

Representation of a physics simulation for one scene

data PhysicsWorld sceneData nodeData #

SpriteKit physics world.

Constructors

PhysicsWorld 

Fields

data PhysicsContact nodeData #

Information that chracterises the nature of a given contact between two physics bodies.

Constructors

PhysicsContact 

Fields

type PhysicsContactHandler sceneData nodeData #

Arguments

 = sceneData

Current scene data

-> PhysicsContact nodeData

Contact information

-> (Maybe sceneData, Maybe (Node nodeData), Maybe (Node nodeData)) 

The function invoked when contact between two physics bodies either begins or ends.

This handler function gets access to the current scene user data as well as the two nodes associated with the contacting physics bodies. It can modify the scene user data and/or these two nodes to affect any changes that need to be made to the scene due to the beginning or ending of the contact. Only modified data needs to be returned.

physicsWorld :: PhysicsWorld sceneData nodeData #

Marshalling functions (internal)

Representation of the physics properties of a node

data PhysicsBody #

Physics bodies are used to add physics simulation to a node.

Constructors

PhysicsBody 

Fields

data MassOrDensity #

How strongly a body is affected by gravity is determined either by giving its mass or by giving its density, in turn determines its mass in combination with the body's area.

Constructors

Mass GFloat 
Density GFloat 

data ForceImpulse #

Constructors

ApplyForce Vector (Maybe Point)

Applies a force to a specific point or center of gravity of a body

ApplyTorque GFloat

Applies an angular acceleration to a pysics body

ApplyImpulse Vector (Maybe Point)

Applies an impulse to a specific point or center of gravity of a body

ApplyAngularImpulse GFloat

Applies an impulse that imparts angular momentum

Creation of volume-based physics bodies

bodyWithCircleOfRadius #

Arguments

:: GFloat

Radius of the circle volume

-> Maybe Point

Optional center (default: centered on owning node’s origin)

-> PhysicsBody 

Creates a circular physics body.

bodyWithRectangleOfSize #

Arguments

:: Size

Size of the rectangle volume

-> Maybe Point

Optional center (default: centered on owning node’s origin)

-> PhysicsBody 

Creates a rectangular physics body.

bodyOfBodies #

Arguments

:: [PhysicsBody]

Component bodies

-> PhysicsBody 

Creates a physics body by performing a union of a group of volume-based physics bodies.

NB: The argument list may not contain a body constructed by this very function.

bodyWithPolygonFromPath #

Arguments

:: Path

Convex polygonal path with counterclockwise winding & no self intersections

-> PhysicsBody 

Creates a polygon-shaped physics body.

The points are specified relative to the owning node’s origin.

bodyWithTextureSize #

Arguments

:: Texture

Texture to convert into a physics body

-> Maybe GFloat

Optional alpha threshold (default: 0)

-> Size

Size of the physics body to return

-> PhysicsBody 

Creates a physics body from the contents of a texture.

The texels in the texture whose alpha values equal or exceed the given alpha threshold are included in the physics body.

Creation of edge-based physics bodies

bodyWithEdgeLoopFromRect #

Arguments

:: Rect

Rectangle that defines the edges

-> PhysicsBody 

Creates an edge loop from a rectangle.

The rectangle is specified relative to the owning node’s origin.

bodyWithEdgeFromPointToPoint #

Arguments

:: Point

Starting point for the edge

-> Point

Ending point for the edge

-> PhysicsBody 

Creates an edge between two points.

The points are specified relative to the owning node’s origin.

bodyWithEdgeLoopFromPath #

Arguments

:: Path

Path without self intersections

-> PhysicsBody 

bodyWithEdgeChainFromPath #

Arguments

:: Path

Path without self intersections

-> PhysicsBody 

Physics body queries

bodyDensity :: PhysicsBody -> GFloat #

Determine a physics body's density. (Marshalling will by default provide the body mass.)

bodyArea :: PhysicsBody -> GFloat #

Determine the area covered by a physics body.

Marshalling functions (internal)

User events

Event information

data Event #

Cocoa events.

NB: Not all event types are supported. Usually, because they would require functionality from other parts of Cocoa, which are not supported here (yet).

Constructors

KeyEvent 

Fields

MouseEvent 

Fields

EnterExitEvent 

Fields

OtherEvent 

Fields

  • eventLocationInNode :: !Point

    Location within the SpriteKit node receiving the event. , eventModifierFlags :: ?? -- ^Modifier keys that were in effect at the time of the event.

  • eventTimestamp :: !TimeInterval

    Time when the event occured in seconds since system startup.

  • otherEventType :: OtherEvent

    The specific type of a tracking-rectangle or cursor-update event. , otherEventSubtype :: Int16 , otherEventData1 :: Int , otherEventData2 :: Int

Instances

Marshalling functions (internal)

mouseEvent :: Point -> Double -> CLong -> Int -> Int -> Int -> Float -> Event #

Internal