import Cursor from 'WTF-Adventure/WTF-Adventure/client/controllers/pointer.js'
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 a new cursor |
|
public |
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 the position of the cursor |
|
public |
setRelative(id: Number, x: Number, y: Number) 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 |
setToPosition(id: Number, x: Number, y: Number) 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 Members
Public Methods
public destroy(pointer: Pointer) source
Destroy a specific cursor
Params:
Name | Type | Attribute | Description |
pointer | Pointer | An instance of the cursor |
public get(id: Number): Pointer source
Return a specific pointer
Params:
Name | Type | Attribute | Description |
id | Number | the pointer's id |
public setRelative(id: Number, x: Number, y: Number) source
Set this pointer to a relative position based on the scale of the screen
public setSize(element: *) source
Set the size of the cursors
Params:
Name | Type | Attribute | Description |
element | * |
public setToEntity(entity: Entity) source
Set the cursor to a specific entity
Params:
Name | Type | Attribute | Description |
entity | Entity | an instance of the entity |