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