Reference Source Test
public class | source

Cursor

Handles the cursor on the HTML5 canvas, different pointers can be swapped out depending on the entity the player is interacting with, this holds all of the individual pointers whereas Pointer holds a specific/individual cursor

Constructor Summary

Public Constructor
public

constructor(game: Game)

Default constructor

Member Summary

Public Members
public

The camera used for the pointer

public

container: DOMElement

Jquery referencce to the bubble message box

public

Instance of the game

public

Pointer from the renderer

public

Scale of the device

Method Summary

Public Methods
public

clean()

Destroy all the cursors

public

create(id: Number, type: String)

Create a new cursor

public

destroy(pointer: Pointer)

Destroy a specific cursor

public

Return a specific pointer

public

Return the renderer's drawing scale

public

Return the current scale of the pointer

public

resize()

Handle resizing the cursors

public

set(pointer: Pointer, posX: Number, posY: Number)

Set the position of the cursor

public

Set this pointer to a relative position based on the scale of the screen

public

setSize(element: *)

Set the size of the cursors

public

setToEntity(entity: Entity)

Set the cursor to a specific entity

public

Set the pointer to this x and y position

public

update()

Update the pointer in the render loop

public

Update the camera reference with the game renderer camera reference

public

Update the scale of the pointer

Public Constructors

public constructor(game: Game) source

Default constructor

Params:

NameTypeAttributeDescription
game Game

instance of the game

Public Members

public camera: Camera source

The camera used for the pointer

public container: DOMElement source

Jquery referencce to the bubble message box

public game: Game source

Instance of the game

public pointers: Pointer source

Pointer from the renderer

public scale: Number source

Scale of the device

Public Methods

public clean() source

Destroy all the cursors

public create(id: Number, type: String) source

Create a new cursor

Params:

NameTypeAttributeDescription
id Number

ID of the cursor

type String

type of the pointer

public destroy(pointer: Pointer) source

Destroy a specific cursor

Params:

NameTypeAttributeDescription
pointer Pointer

An instance of the cursor

public get(id: Number): Pointer source

Return a specific pointer

Params:

NameTypeAttributeDescription
id Number

the pointer's id

Return:

Pointer

the pointer

public getDrawingScale(): Number source

Return the renderer's drawing scale

Return:

Number

the actual renderer calculated drawing scale

public getScale(): Number source

Return the current scale of the pointer

Return:

Number

the scale

public resize() source

Handle resizing the cursors

public set(pointer: Pointer, posX: Number, posY: Number) source

Set the position of the cursor

Params:

NameTypeAttributeDescription
pointer Pointer

Instance of the pointer to move

posX Number

X position

posY Number

Y position

public setRelative(id: Number, x: Number, y: Number) source

Set this pointer to a relative position based on the scale of the screen

Params:

NameTypeAttributeDescription
id Number

the pointer's id

x Number

the x coordinate

y Number

the y coordinate

public setSize(element: *) source

Set the size of the cursors

Params:

NameTypeAttributeDescription
element *

public setToEntity(entity: Entity) source

Set the cursor to a specific entity

Params:

NameTypeAttributeDescription
entity Entity

an instance of the entity

public setToPosition(id: Number, x: Number, y: Number) source

Set the pointer to this x and y position

Params:

NameTypeAttributeDescription
id Number

the pointer's id

x Number

the x coordinate

y Number

the y coordinate

public update() source

Update the pointer in the render loop

public updateCamera() source

Update the camera reference with the game renderer camera reference

public updateScale() source

Update the scale of the pointer