*/ private array $held = []; /** @var array */ private array $pressed = []; /** @var array */ private array $released = []; public function move(float $x, float $y): void { $this->x = $x; $this->y = $y; } public function wheel(int $y): void { $this->wheelY += $y; } public function down(int $button): void { $this->held[$button] = true; $this->pressed[$button] = true; } public function up(int $button): void { unset($this->held[$button]); $this->released[$button] = true; } public function isHeld(int $button = 1): bool { return isset($this->held[$button]); } public function isPressed(int $button = 1): bool { return isset($this->pressed[$button]); } public function isReleased(int $button = 1): bool { return isset($this->released[$button]); } public function resetTransientStates(): void { $this->pressed = []; $this->released = []; $this->wheelY = 0; } }