initial commit

This commit is contained in:
armel committed 2026-09-07 20:37:40 +02:00
commit e8c3f9862a
193 files changed
+29795

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace App\Game;
final class InputState
{
/** @var array<string> Currently-held keys (lowercase: w/a/s/d/space/shift). */
public array $keys;
/** Normalized aim direction in world space, sent by the client. */
public Vector2 $aim;
public bool $fire;
public bool $autoAim;
public function __construct(
array $keys = [],
?Vector2 $aim = null,
bool $fire = false,
bool $autoAim = false,
) {
$this->keys = $keys;
$this->aim = $aim ?? new Vector2(1.0, 0.0);
$this->fire = $fire;
$this->autoAim = $autoAim;
}
public function reset(?Vector2 $aim = null): void
{
$this->keys = [];
$this->aim = $aim ?? new Vector2(1.0, 0.0);
$this->fire = false;
$this->autoAim = false;
}
}