Skip to content

PointerStack

Hyomoto edited this page Dec 12, 2020 · 3 revisions
Jump To Go Back Arguments Methods Variables

PointerStack( x, y, width, height )

Implements: None

The PointerStack is used to create a list of PointerInterfaces that will be traversed in descending order to ensure only the top-most element is called. Thus, interfaces that are added later will be "above" those that were added earlier. In the given example, the second simple mouse pointer would be called rather than the first where the two overlap.

pointer = new PointerStack( 0, 0, room_width, room_height )

pointer.add( new PointerSimpleMouse( new ShapeRectangle( 10, 10, 20, 20 ) );
pointer.add( new PointerSimpleMouse( new ShapeRectangle( 20, 20, 20, 20 ) );

Arguments

Name Type Purpose
x int none provided
y int none provided
width int none provided
height int none provided

Methods

Jump To top update remove add draw is

update( _x, _y )

Returns: N/A undefined

Name Type Purpose
_x undef none provided
_y undef none provided

Calls for this PointerInterface to be updated, will check all instances and update the top-most interface that it finds. Any previous interactions will have their exit code called as well.


remove( interface )

Returns: N/A undefined

Name Type Purpose
interface mixed A PointerInterface or PointerStack.

Removes the specified interface from the stack.


add( interface )

Returns: N/A undefined

Name Type Purpose
interface mixed A PointerInterface or PointerStack.

Adds the specified interface to the stack.


draw( _x, _y, _color )

Returns: N/A undefined

Name Type Purpose
_x undef none provided
_y undef none provided
_color undef none provided

is( type )

Returns: boolean (true or false)

Name Type Purpose
type Constructor The Constructor to compare this against.

Returns true if the provided type is PointerStack.


Variables

Jump To top
  • last - The last interface to be interacted with.
  • content - The internal array of Interfaces being used.
  • x - The x position of the PointerStack.
  • y - The y position of the PointerStack.
  • width - The width of the PointerStack.
  • height - The height of the PointerStack.
  • active - Whether or not this stack is currently active
  • hold - When set to an interface element, it will not be released.

Clone this wiki locally