-
Notifications
You must be signed in to change notification settings - Fork 0
Docs Module Mouse
| Property | Description | Mouse Code | Shortcut Identifier |
|---|---|---|---|
| type | The flobtive's description type. readonly
|
||
| _visible | A value that indicates whether the mouse's cursor is visible. readonly
|
||
| LEFT | The mouse code property for the left mouse button | 0 |
"left" |
| MIDDLE | The mouse code property for the scroll wheel button | 1 |
"middle" |
| RIGHT | The mouse code property for the right mouse button | 2 |
"right" |
| Method | Description |
|---|---|
| hide() | Hides the mouse cursor. |
| isDown() | Checks if the mouse button specified is down or not. |
| isPressed() | Checks if the mouse button specified is pressed or not. |
| isReleased() | Checks if the mouse button specified is released or not. |
| isUp() | Checks if the mouse button specified is up or not. |
| lock() | Locks the cursor to the application. |
| show() | Shows the mouse cursor. |
| unlock() | Unlocks the cursor from the application. |
Hides the mouse cursor.
- The mouse cursor would only be hidden when in the bounds of the application.
Assuming const Mouse = flevar.Mouse;
/* Within a script or function */
// check if the left mouse button is down
if(Mouse.isDown(0)) {
// hide the mouse cursor
Mouse.hide();
}Checks if the mouse button specified is down or not.
- code
- Types:
number|string-
number: The mouse code value assigned to a specific mouse button or aMousemodule property associated with a specific mouse button. -
string: TheMousemodule property's shortcut identifier associated with a specific mouse button.
-
- Types:
- Type:
boolean-
trueif the mouse button specified is down;falseotherwise.
-
- A FlevaR application can only monitor mouse events that occur within its focus. A FlevaR application cannot detect mouse events in another application.
Assuming const Mouse = flevar.Mouse;
Using the mouse code:
/* Within a script or function added to a prefab */
// check if the left mouse button is down
if(Mouse.isDown(0)) {
// move the prefab to the left
prefab._x -= 8;
}Using a Mouse module property:
/* Within a script or function added to a prefab */
// check if the left mouse button is down
if(Mouse.isDown(Mouse.LEFT)) {
// move the prefab to the left
prefab._x -= 8;
}Using a Mouse module property's shortcut identifier:
/* Within a script or function added to a prefab */
// check if the left mouse button is down
if(Mouse.isDown("left")) {
// move the prefab to the left
prefab._x -= 8;
}Checks if the mouse button specified is pressed or not.
- code
- Types:
number|string-
number: The mouse code value assigned to a specific mouse button or aMousemodule property associated with a specific mouse button. -
string: TheMousemodule property's shortcut identifier associated with a specific mouse button.
-
- Types:
- Type:
boolean-
trueif the mouse button specified is pressed;falseotherwise.
-
- A FlevaR application can only monitor mouse events that occur within its focus. A FlevaR application cannot detect mouse events in another application.
- When a mouse button is pressed and captured in the script, the mouse button must be released before
isPressedis true again.
Assuming const Mouse = flevar.Mouse;
Using the mouse code:
/* Within a script or function */
// check if the scroll wheel button is pressed
if(Mouse.isPressed(1)) {
flevar.trace(`Scroll wheel button is pressed!`);
}Using a Mouse module property:
/* Within a script or function */
// check if the scroll wheel button is pressed
if(Mouse.isPressed(Mouse.MIDDLE)) {
flevar.trace(`Scroll wheel button is pressed!`);
}Using a Mouse module property's shortcut identifier:
/* Within a script or function */
// check if the scroll wheel button is pressed
if(Mouse.isPressed("middle")) {
flevar.trace(`Scroll wheel button is pressed!`);
}Checks if the mouse button specified is released or not.
- code
- Types:
number|string-
number: The mouse code value assigned to a specific mouse button or aMousemodule property associated with a specific mouse button. -
string: TheMousemodule property's shortcut identifier associated with a specific mouse button.
-
- Types:
- Type:
boolean-
trueif the mouse button specified is released;falseotherwise.
-
- A FlevaR application can only monitor mouse events that occur within its focus. A FlevaR application cannot detect mouse events in another application.
- When a mouse button is released and captured in the script, the mouse button must be pressed before
isReleasedis true again.
Assuming const Mouse = flevar.Mouse;
Using the mouse code:
/* Within a script or function */
// check if the right mouse button is released
if(Mouse.isReleased(2)) {
// takes screenshot of application
flevar.meta.takeScreenshot();
}Using a Mouse module property:
/* Within a script or function */
// check if the right mouse button is released
if(Mouse.isReleased(Mouse.RIGHT)) {
// takes screenshot of application
flevar.meta.takeScreenshot();
}Using a Mouse module property's shortcut identifier:
/* Within a script or function */
// check if the right mouse button is released
if(Mouse.isReleased("right")) {
// takes screenshot of application
flevar.meta.takeScreenshot();
}Checks if the mouse button specified is up or not.
- code
- Types:
number|string-
number: The mouse code value assigned to a specific mouse button or aMousemodule property associated with a specific mouse button. -
string: TheMousemodule property's shortcut identifier associated with a specific mouse button.
-
- Types:
- Type:
boolean-
trueif the mouse button specified is up;falseotherwise.
-
- A FlevaR application can only monitor mouse events that occur within its focus. A FlevaR application cannot detect mouse events in another application.
Assuming const Mouse = flevar.Mouse;
Using the mouse code:
/* Within a script or function */
// check if the left mouse button is up
if(Mouse.isUp(0)) {
flevar.trace(`Not holding "Left Click"`);
}Using a Mouse module property:
/* Within a script or function */
// check if the left mouse button is up
if(Mouse.isUp(Mouse.LEFT)) {
flevar.trace(`Not holding "Left Click"`);
}Using a Mouse module property's shortcut identifier:
/* Within a script or function */
// check if the left mouse button is up
if(Mouse.isUp("left")) {
flevar.trace(`Not holding "Left Click"`);
}Locks/Traps the cursor to the application.
- type
- Type:
boolean - Default:
true - Determines whether mouse cursor is restricted to the application's borders (
true) or if they freely loop from one side of the application to the other, when exceeding its bounds (false).
- Type:
- Positions the mouse coordinates in the application's center on method call.
Assuming const Mouse = flevar.Mouse;
/* Within a script or function */
// check if the scroll wheel button is pressed
if(Mouse.isPressed(1)) {
// lock mouse cursor to the application and restrict its movement to application borders
Mouse.lock(true);
}Shows the mouse cursor.
Assuming const Mouse = flevar.Mouse;
/* Within a script or function */
// check if the right mouse button is down
if(Mouse.isDown(2)) {
// show the mouse cursor
Mouse.show();
}Unlocks/Untraps the cursor from the application.
Assuming const Mouse = flevar.Mouse;
/* Within a script or function */
// check if the scroll wheel button is released
if(Mouse.isReleased(1)) {
// unlock mouse cursor from the application
Mouse.unlock();
}