2022-06-27 00:17:22 +00:00
|
|
|
import App from "App.vue";
|
|
|
|
import projInfo from "data/projInfo.json";
|
|
|
|
import "game/notifications";
|
|
|
|
import { load } from "util/save";
|
2022-06-26 20:22:22 +00:00
|
|
|
import { useRegisterSW } from "virtual:pwa-register/vue";
|
2022-06-27 00:17:22 +00:00
|
|
|
import type { App as VueApp } from "vue";
|
|
|
|
import { createApp, nextTick } from "vue";
|
2022-06-26 20:22:22 +00:00
|
|
|
import { useToast } from "vue-toastification";
|
2022-01-14 04:25:47 +00:00
|
|
|
|
|
|
|
declare global {
|
2022-07-10 03:09:25 +00:00
|
|
|
/**
|
|
|
|
* Augment the window object so
|
|
|
|
* the vue app and project info can be accessed from the console
|
|
|
|
*/
|
2022-01-14 04:25:47 +00:00
|
|
|
interface Window {
|
|
|
|
vue: VueApp;
|
2022-03-03 02:12:56 +00:00
|
|
|
projInfo: typeof projInfo;
|
2022-01-14 04:25:47 +00:00
|
|
|
}
|
|
|
|
}
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-17 04:30:54 +00:00
|
|
|
|
2022-07-10 03:09:25 +00:00
|
|
|
document.title = projInfo.title;
|
|
|
|
window.projInfo = projInfo;
|
|
|
|
if (projInfo.id === "") {
|
|
|
|
throw "Project ID is empty! Please select a unique ID for this project in /src/data/projInfo.json";
|
|
|
|
}
|
|
|
|
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-17 04:30:54 +00:00
|
|
|
requestAnimationFrame(async () => {
|
2022-02-27 19:49:34 +00:00
|
|
|
console.log(
|
2022-02-27 20:24:48 +00:00
|
|
|
"%cMade in Profectus%c\nLearn more at www.moddingtree.com",
|
2022-02-27 19:49:34 +00:00
|
|
|
"font-weight: bold; font-size: 24px; color: #A3BE8C; background: #2E3440; padding: 4px 8px; border-radius: 8px;",
|
|
|
|
"padding: 4px;"
|
|
|
|
);
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-17 04:30:54 +00:00
|
|
|
await load();
|
2022-06-26 03:34:18 +00:00
|
|
|
const { globalBus, startGameLoop } = await import("./game/events");
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-17 04:30:54 +00:00
|
|
|
|
|
|
|
// Create Vue
|
2022-03-04 03:41:59 +00:00
|
|
|
const vue = (window.vue = createApp(App));
|
2022-01-14 04:25:47 +00:00
|
|
|
globalBus.emit("setupVue", vue);
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-17 04:30:54 +00:00
|
|
|
vue.mount("#app");
|
|
|
|
|
2022-06-26 20:22:22 +00:00
|
|
|
// Setup PWA update prompt
|
|
|
|
nextTick(() => {
|
|
|
|
const toast = useToast();
|
|
|
|
const { updateServiceWorker } = useRegisterSW({
|
|
|
|
onNeedRefresh() {
|
|
|
|
toast.info("New content available, click or reload to update.", {
|
|
|
|
timeout: false,
|
|
|
|
closeOnClick: false,
|
|
|
|
draggable: false,
|
|
|
|
icon: {
|
|
|
|
iconClass: "material-icons",
|
|
|
|
iconChildren: "refresh",
|
|
|
|
iconTag: "i"
|
|
|
|
},
|
|
|
|
rtl: false,
|
|
|
|
onClick() {
|
|
|
|
updateServiceWorker();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onOfflineReady() {
|
|
|
|
toast.info("App ready to work offline");
|
|
|
|
},
|
|
|
|
onRegisterError: console.warn,
|
|
|
|
onRegistered(r) {
|
|
|
|
if (r) {
|
|
|
|
setInterval(r.update, 60 * 60 * 1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-14 04:25:47 +00:00
|
|
|
startGameLoop();
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-17 04:30:54 +00:00
|
|
|
});
|