true), set by the scene before each frame */ public static array $held = []; /** joystick bits from the gamepad / touch pad (bit0 up, 1 down, 2 left, 3 right, 7 fire) */ public static int $pad = 0; /** milliseconds of game time */ public static int $msec = 0; /** @var array{0: float, 1: float, 2?: string}|null debugging (tools/run.php --lazy-delay=s,MBps[,regex]): a delay for the developer's copy */ public static ?array $lazyDelay = null; /** @var array when each file of the developer's copy is "downloaded" (game seconds) */ public static array $lazyReadyAt = []; /** state of sys_random() (C rand() without srand(): seed 1 at each start) */ public static int $randSeed = 1; /** the last frame as a BMP file in memory (sys_render) */ public static string $frameBmp = ''; public static int $frameW = 0; public static int $frameH = 0; public static int $frameCount = 0; /** mouse cursor: rows of palette indexes (-1 transparent) + hot spot, null = none (sys_dirty_mouse) */ public static ?array $cursor = null; public static int $cursorVersion = 0; /** JumPHP storage for the files the game writes (saves) */ public static ?Storage $storage = null; /** open write streams: (int) resource => storage name */ public static array $writeStreams = []; /** folder => [lower-case name => real name] */ public static array $dirIndex = []; /** files loaded on demand: lower-case name => [size, hash] (catalog/.json), their URL folder, a local full copy */ public static array $lazy = []; public static string $lazyBase = ''; public static string $lazyDev = ''; /** seconds spent running the scripts (Machine::loop(), the instructions and what they draw): speed checks */ public static float $scriptTime = 0.0; public static ?string $lazyPending = null; /** * name => true while downloading; name => why it failed; downloaded path => size * @var array */ public static array $fetching = []; /** @var array */ public static array $lazyFailed = []; /** @var array */ public static array $lazyLoaded = []; public const LAZY_CACHE = 64 * 1024 * 1024; /** * downloads by parts (fn/sys.php sys_lazy_download()): an answer reaches PHP in base64 inside the page's events, * and a string of 2 MB or more leaks in the browser; measured: 1 MB parts leak, 512 KB do not. 3 x 256 KB. */ public const LAZY_PART = 256 * 1024; public const LAZY_PARALLEL = 6; public static ?\JumPHP\Http\Http $http = null; /** true while the VM runs opcodes (Machine::loop): a missing download may then yield */ public static bool $inLoop = false; /** source edition: the folder of the ALIS sources (.als + .res) used instead of the .io scripts ('' = off) */ public static string $sourceDir = ''; /** @var array compiled sources: script name => the .io file made from it */ public static array $sourceCache = []; /** @var array script name => the packing byte its original .io had (Alis::$typepack) */ public static array $sourcePack = []; /** data files opened (diagnostics) */ public static array $opened = []; /** * the playground's externals (JumPHP\Externals\Externals, the jumphp/externals extension) when the game has them, * and its folder there (alis/): the big files come from it, by blocks (sys_lazy_download()) */ public static ?object $externals = null; public static string $externalsDir = ''; /** the externals answered no (not shared, missing): the private files are used */ public static bool $externalsOff = false; /** the game whose sources are compiled (its player's changed scripts are used: App\Editor\SourceStore) */ public static string $sourceGame = ''; /** HD edition: the game's font characters are drawn by the host (a real font), not in the 8-bit frame (fn/hd.php) */ public static bool $hdText = false; /** the character put_char() is putting (-1: not a character) */ public static int $hdChar = -1; /** @var array> sprite record => the glyph it drew (hd.php) */ public static array $hdGlyphs = []; /** @var array{x: int, y: int, w: int, h: int, key: int, bmp: string}|null HD edition: the land at twice the resolution (fn/hd3d.php) */ public static ?array $hdLand = null; /** @var list> the glyphs on the screen at the last sys_render(), for the host */ public static array $hdShown = []; public static function init(): void { self::$mouse = new MouseT(); self::$mouseOffX = self::$mouseOffY = 0; self::$randSeed = 1; self::$held = []; self::$button = 0; self::$shift = 0; self::$frameBmp = ''; self::$cursor = null; self::$writeStreams = []; self::$hdGlyphs = self::$hdShown = []; } }