Updated to use typescript strict typing

This commit is contained in:
Renan LE CARO 2025-03-10 15:05:48 +01:00
parent 62d955a233
commit a136475f88
8 changed files with 3927 additions and 263 deletions

View file

@ -5,6 +5,7 @@ export const options = {
default: true,
name: `Game sounds`,
help: `Can slow down some phones.`,
afterChange:()=>{},
disabled: () => false,
},
"mobile-mode": {
@ -20,35 +21,39 @@ export const options = {
default: false,
name: `Basic graphics`,
help: `Better performance on older devices.`,
afterChange:()=>{},
disabled: () => false,
},
pointerLock: {
default: false,
name: `Mouse pointer lock`,
help: `Locks and hides the mouse cursor.`,
afterChange:()=>{},
disabled: () => !gameCanvas.requestPointerLock,
},
easy: {
default: false,
name: `Kids mode`,
help: `Start future runs with "slower ball".`,
afterChange:()=>{},
disabled: () => false,
}, // Could not get the sharing to work without loading androidx and all the modern android things so for now i'll just disable sharing in the android app
record: {
default: false,
name: `Record gameplay videos`,
help: `Get a video of each level.`,
afterChange:()=>{},
disabled() {
return window.location.search.includes("isInWebView=true");
},
},
} as { [k: string]: OptionDef };
} as const satisfies {[k:string]:OptionDef};
export type OptionDef = {
default: boolean;
name: string;
help: string;
disabled: () => boolean;
afterChange?: () => void;
afterChange: () => void;
};
export type OptionId = keyof typeof options;
export type OptionId = keyof typeof options ;