π¦ JEMouseCode
Technical reference for the
JEMouseCodeclass of JarEngine.
Inherit from
β’>JEInternBaseClass<β’π
πΉ Overview
JEMouseCode is responsible for representing and managing mouse input codes in JarEngine.
Provides:
- Mouse button identification and comparison.
- Conversion between internal mouse codes and integer values.
- Mouse code grouping through operator overloading.
Represents a mouse input identifier used by JarEngineβs input system. It allows mouse buttons to be handled as structured objects instead of raw integer values, providing easier comparison, grouping, and debugging capabilities.
πΉ Location
JarEngine
β
βββ events
β βββ JEMouseCode
β
βββ ...
πΉ Data
| Field | Type | Description | Property? | Can be set? |
|---|---|---|---|---|
name |
str |
Human-readable mouse button name. | True | False |
πΉ API
| Function | Arguments | Returns | Description |
|---|---|---|---|
__init__ |
mouse: Optional[int] |
Β | Creates a mouse code object from an optional mouse identifier. |
__int__ |
Β | int |
Converts the mouse code into its integer representation. |
__str__ |
Β | str |
Human-readable mouse name. |
__or__ |
other: JEMouseCode |
JEMouseCodeGroup |
Creates a mouse group by combining two mouse codes. |
__eq__ |
other: JEMouseCode |
JEBool |
Compares two mouse codes and returns whether they represent the same button. |
__hash__ |
Β | int |
Generates a hash value from the mouse code for future usage. |
πΉ Usage
from jarengine import Events
left_click = Events.Mouse.JEMouseCode(1)
right_click = Events.Mouse.JEMouseCode(3)
if left_click == Events.Mouse.JEMouseCode(1):
print("Left mouse button pressed")
mouse_group = left_click | right_click