breakout71/src/options.ts

60 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-03-14 12:23:19 +01:00
import { fitSize } from "./game";
2025-03-07 11:34:11 +01:00
export const options = {
2025-03-07 20:18:18 +01:00
sound: {
default: true,
name: `Game sounds`,
help: `Can slow down some phones.`,
2025-03-11 13:56:42 +01:00
afterChange: () => {},
2025-03-07 20:18:18 +01:00
disabled: () => false,
},
"mobile-mode": {
default: window.innerHeight > window.innerWidth,
name: `Mobile mode`,
help: `Leaves space for your thumb.`,
afterChange() {
fitSize();
2025-03-07 11:34:11 +01:00
},
2025-03-07 20:18:18 +01:00
disabled: () => false,
},
basic: {
default: false,
name: `Basic graphics`,
help: `Better performance on older devices.`,
2025-03-11 13:56:42 +01:00
afterChange: () => {},
2025-03-07 20:18:18 +01:00
disabled: () => false,
},
pointerLock: {
default: false,
name: `Mouse pointer lock`,
help: `Locks and hides the mouse cursor.`,
2025-03-11 13:56:42 +01:00
afterChange: () => {},
2025-03-14 12:23:19 +01:00
disabled: () => !document.body.requestPointerLock,
2025-03-07 20:18:18 +01:00
},
easy: {
default: false,
name: `Kids mode`,
help: `Start future runs with "slower ball".`,
2025-03-11 13:56:42 +01:00
afterChange: () => {},
2025-03-07 20:18:18 +01:00
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.`,
2025-03-11 13:56:42 +01:00
afterChange: () => {},
2025-03-07 20:18:18 +01:00
disabled() {
return window.location.search.includes("isInWebView=true");
2025-03-07 11:34:11 +01:00
},
2025-03-14 20:12:02 +01:00
}
2025-03-11 13:56:42 +01:00
} as const satisfies { [k: string]: OptionDef };
2025-03-07 11:34:11 +01:00
export type OptionDef = {
2025-03-07 20:18:18 +01:00
default: boolean;
name: string;
help: string;
disabled: () => boolean;
afterChange: () => void;
2025-03-07 20:18:18 +01:00
};
2025-03-11 13:56:42 +01:00
export type OptionId = keyof typeof options;