visualizer show first game at start

This commit is contained in:
ajuvercr 2020-04-07 14:13:38 +02:00
parent a1e0279d73
commit f646d83b0e
2 changed files with 17 additions and 27 deletions

View file

@ -7,15 +7,24 @@ const OPTIONS = document.getElementById("options");
const game_location = LOCATION + "static/games/mod.ini"; const game_location = LOCATION + "static/games/mod.ini";
if (OPTIONS) {
fetch(game_location) fetch(game_location)
.then((r) => r.text()) .then((r) => r.text())
.then((response) => { .then((response) => {
if (OPTIONS) {
parse_ini(response); parse_ini(response);
} else {
console.log("Options is not defined, tera?");
}
}).catch(console.error); }).catch(console.error);
} else {
const options = document.getElementsByClassName("options");
if (options[0]) {
const options_div = <HTMLDivElement> options[0];
if (options_div.children[0]) {
setTimeout(
() => options_div.children[0].dispatchEvent(new Event('click')),
200,
);
}
}
}
export function handle(location, name: string) { export function handle(location, name: string) {
set_loading(true); set_loading(true);

View file

@ -373,25 +373,6 @@ function step(time: number) {
requestAnimationFrame(step); requestAnimationFrame(step);
} }
set_loading(true); // set_loading(false);
requestAnimationFrame(step); requestAnimationFrame(step);
// import { voronoi, Point } from './voronoi'
// function test() {
// const points = [
// new Point(14, 6),
// new Point(13, 11),
// new Point(8, 7.5),
// new Point(7, 4),
// new Point(4, 11),
// ];
// console.log(voronoi(points));
// }
// import { test as dcelt_test } from './dcel';
// // dcelt_test();
// test();