planet-wars/frontend/www/index.js

16 lines
441 B
JavaScript
Raw Normal View History

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