Profectus/src/main.ts

48 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-01-14 04:25:47 +00:00
import { App as VueApp, createApp } from "vue";
import App from "./App.vue";
import modInfo from "./data/modInfo.json";
2022-01-14 04:25:47 +00:00
import { GenericLayer } from "./game/layers";
import { PlayerData } from "./game/player";
import { Settings } from "./game/settings";
import { Transient } from "./game/state";
import Decimal, { DecimalSource } from "./lib/break_eternity";
import { load } from "./util/save";
declare global {
interface Window {
vue: VueApp;
save: VoidFunction;
hardReset: VoidFunction;
hardResetSettings: VoidFunction;
2022-01-25 04:23:30 +00:00
layers: Record<string, Readonly<GenericLayer> | undefined>;
2022-01-14 04:25:47 +00:00
player: PlayerData;
state: Transient;
settings: Settings;
Decimal: typeof Decimal;
exponentialFormat: (num: DecimalSource, precision: number, mantissa: boolean) => string;
commaFormat: (num: DecimalSource, precision: number) => string;
regularFormat: (num: DecimalSource, precision: number) => string;
format: (num: DecimalSource, precision?: number, small?: boolean) => string;
formatWhole: (num: DecimalSource) => string;
formatTime: (s: number) => string;
toPlaces: (x: DecimalSource, precision: number, maxAccepted: DecimalSource) => string;
formatSmall: (x: DecimalSource, precision?: number) => string;
invertOOM: (x: DecimalSource) => Decimal;
}
}
requestAnimationFrame(async () => {
await load();
2022-01-25 04:23:30 +00:00
const { globalBus, startGameLoop } = await require("./game/events");
// Create Vue
const vue = (window.vue = createApp({
...App
}));
2022-01-14 04:25:47 +00:00
globalBus.emit("setupVue", vue);
vue.mount("#app");
document.title = modInfo.title;
2022-01-14 04:25:47 +00:00
startGameLoop();
});