forked from Blendman974/faceclaw
Move and rename DashboardInputEvent->InputEvent
This commit is contained in:
1 parent
3e8be93833
commit
80d688dd4e
51 files changed
+299
-361
No files matched your search
@@ -14,7 +14,6 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { buildSoundSequencePayload, type Step } from "../../ui/sound-effects";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
@@ -23,6 +22,7 @@ import {
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_LONG_PRESS,
|
||||
GESTURE_SCROLL,
|
||||
type InputEvent,
|
||||
} from "../../ui/gestures";
|
||||
|
||||
declare const global: any;
|
||||
@@ -213,7 +213,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -302,7 +302,7 @@ function windowMenu(window: BlocksWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: BlocksWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: BlocksWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -319,7 +319,7 @@ function handleInput(window: BlocksWindow, event: DashboardInputEvent, frameId:
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlayingInput(window: BlocksWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handlePlayingInput(window: BlocksWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
tryMove(window, -1, 0);
|
||||
@@ -346,7 +346,7 @@ function handlePlayingInput(window: BlocksWindow, event: DashboardInputEvent, fr
|
||||
}
|
||||
|
||||
/** Input while paused or game over. */
|
||||
function handleIdleInput(window: BlocksWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleIdleInput(window: BlocksWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
if (window.phase === "game-over") resetGame(window);
|
||||
|
||||
Reference in new issue
Block a user