planet-wars/frontend/www/index.js

16 lines
437 B
JavaScript
Raw Normal View History

2019-09-14 10:48:20 +02:00
import { Game } from "planetwars";
2019-09-16 21:18:01 +02:00
import { Shader } from "./webgl/shader"
2019-09-13 22:54:21 +02:00
2019-09-17 20:19:04 +02:00
import { set_instance } from './index.ts'
2019-09-17 14:03:16 +02:00
2019-09-14 10:48:20 +02:00
const URL = window.location.origin+window.location.pathname;
const LOCATION = URL.substring(0, URL.lastIndexOf("/") + 1);
2019-09-21 11:20:07 +02:00
const game_location = LOCATION + "static/games/game.json";
2019-09-14 10:48:20 +02:00
2019-09-17 14:03:16 +02:00
fetch(game_location)
.then((r) => r.text())
.then((response) => {
set_instance(response);
2019-09-17 14:03:16 +02:00
}).catch(console.error);