Namespace

Mouse

Mouse

Methods

# registerMouseClick(callback, globalScopeopt)

Registers a mouse move event callback, when the mouse is moved the supplied callback function will be called and provided with the current mouse state. The callback function will continue to be invoked for every mouse move event until it is unregistered.
Parameters:
Name Type Attributes Default Description
callback Callback The callback function to invoke when the event fires.
globalScope boolean <optional>
false Is this for use outside of the program itself?

View Source rpgcode.js, line 2476

Example
rpgcode.registerMouseClick(function(e) {
 // Log the x and y coordinates of the mouse.
 rpgcode.log(e.realX);
 rpgcode.log(e.realY);
 
 // Log the mouse button that has been clicked.
 rpgcode.log(e.mouseButton); // LEFT: 0, MIDDLE: 1, RIGHT: 2
});

# registerMouseDoubleClick(callback, globalScopeopt)

Registers a mouse move event callback, when the mouse is moved the supplied callback function will be called and provided with the current mouse state. The callback function will continue to be invoked for every mouse move event until it is unregistered.
Parameters:
Name Type Attributes Default Description
callback Callback The callback function to invoke when the event fires.
globalScope boolean <optional>
false Is this for use outside of the program itself?

View Source rpgcode.js, line 2506

Example
rpgcode.registerMouseDoubleClick(function(e) {
 // Log the x and y coordinates of the mouse.
 rpgcode.log(e.realX);
 rpgcode.log(e.realY);
 
 // Log the mouse button that has been double clicked.
 rpgcode.log(e.mouseButton); // LEFT: 0, MIDDLE: 1, RIGHT: 2
});

# registerMouseDown(callback, globalScopeopt)

Registers a mouse down event callback, when the mouse is pressed down the supplied callback function will be called and provided with the current mouse state. The callback function will continue to be invoked for every mouse move event until it is unregistered.
Parameters:
Name Type Attributes Default Description
callback Callback The callback function to invoke when the event fires.
globalScope boolean <optional>
false Is this for use outside of the program itself?

View Source rpgcode.js, line 2416

Example
rpgcode.registerMouseDown(function(e) {
 // Log the x and y coordinates of the mouse.
 rpgcode.log(e.realX);
 rpgcode.log(e.realY);
 
 // Log the mouse button that has been pressed down.
 rpgcode.log(e.mouseButton); // LEFT: 0, MIDDLE: 1, RIGHT: 2
});

# registerMouseMove(callback, globalScopeopt)

Registers a mouse move event callback, when the mouse is moved the supplied callback function will be called and provided with the current mouse state. The callback function will continue to be invoked for every mouse move event until it is unregistered.
Parameters:
Name Type Attributes Default Description
callback Callback The callback function to invoke when the event fires.
globalScope boolean <optional>
false Is this for use outside of the program itself?

View Source rpgcode.js, line 2533

Example
rpgcode.registerMouseMove(function(e) {
 // Log the x and y coordinates of the mouse.
 rpgcode.log(e.realX);
 rpgcode.log(e.realY);
});

# registerMouseUp(callback, globalScopeopt)

Registers a mouse move event callback, when the mouse is moved the supplied callback function will be called and provided with the current mouse state. The callback function will continue to be invoked for every mouse move event until it is unregistered.
Parameters:
Name Type Attributes Default Description
callback Callback The callback function to invoke when the event fires.
globalScope boolean <optional>
false Is this for use outside of the program itself?

View Source rpgcode.js, line 2446

Example
rpgcode.registerMouseUp(function(e) {
 // Log the x and y coordinates of the mouse.
 rpgcode.log(e.realX);
 rpgcode.log(e.realY);
 
 // Log the mouse button that has been released.
 rpgcode.log(e.mouseButton); // LEFT: 0, MIDDLE: 1, RIGHT: 2
});

# unregisterMouseClick(globalScopeopt)

Removes a previously registered mouse click handler.
Parameters:
Name Type Attributes Default Description
globalScope boolean <optional>
false Is this a global scope mouse handler.

View Source rpgcode.js, line 3455

Example
// Removes the mouse click handler local to this program.
rpgcode.unregisterMouseClick();

// Removes the global engine mouse click handler.
rpgcode.unregisterMouseClick(true);

# unregisterMouseDoubleClick(globalScopeopt)

Removes a previously registered mouse double click handler.
Parameters:
Name Type Attributes Default Description
globalScope boolean <optional>
false Is this a global scope mouse handler.

View Source rpgcode.js, line 3477

Example
// Removes the mouse double click handler local to this program.
rpgcode.unregisterMouseDoubleClick();

// Removes the global engine mouse double click handler.
rpgcode.unregisterMouseDoubleClick(true);

# unregisterMouseDown(globalScopeopt)

Removes a previously registered mouse down handler.
Parameters:
Name Type Attributes Default Description
globalScope boolean <optional>
false Is this a global scope mouse handler.

View Source rpgcode.js, line 3411

Example
// Removes the mouse down handler local to this program.
rpgcode.unregisterMouseDown();

// Removes the global engine mouse down handler.
rpgcode.unregisterMouseDown(true);

# unregisterMouseMove(globalScopeopt)

Removes a previously registered mouse move handler.
Parameters:
Name Type Attributes Default Description
globalScope boolean <optional>
false Is this a global scope mouse handler.

View Source rpgcode.js, line 3499

Example
// Removes the mouse move handler local to this program.
rpgcode.unregisterMouseMove();

// Removes the global engine mouse move handler.
rpgcode.unregisterMouseMove(true);

# unregisterMouseUp(globalScopeopt)

Removes a previously registered mouse up handler.
Parameters:
Name Type Attributes Default Description
globalScope boolean <optional>
false Is this a global scope mouse handler.

View Source rpgcode.js, line 3433

Example
// Removes the mouse up handler local to this program.
rpgcode.unregisterMouseUp();

// Removes the global engine mouse move handler.
rpgcode.unregisterMouseUp(true);