diff --git a/frontend/www/games.ts b/frontend/www/games.ts index 0d4b3df..eb5e647 100644 --- a/frontend/www/games.ts +++ b/frontend/www/games.ts @@ -1,5 +1,5 @@ -import { set_loading, LOCATION, set_instance } from './index' +import { set_game_name, set_loading, LOCATION, set_instance } from './index' import { ConfigIniParser } from 'config-ini-parser' const OPTIONS = document.getElementById("options"); @@ -13,13 +13,14 @@ fetch(game_location) parse_ini(response); }).catch(console.error); -export function handle(location) { +export function handle(location, name: string) { set_loading(true); fetch(location) .then((r) => r.text()) .then((response) => { set_instance(response); + set_game_name(name); }).catch(console.error); } @@ -27,7 +28,7 @@ export function handle(location) { function create_option(location: string, name: string, turns: string, players: string): HTMLElement { const div = document.createElement("div"); div.className = "option"; - div.onclick = (_) => handle(location); + div.onclick = (_) => handle(location, name); let ps = ""; @@ -38,7 +39,6 @@ function create_option(location: string, name: string, turns: string, players: s if (index % 2 == 0) { continue; } - console.log(player); ps += `

${player}

`; } } diff --git a/frontend/www/index.html b/frontend/www/index.html index eb9cfda..cdf9660 100644 --- a/frontend/www/index.html +++ b/frontend/www/index.html @@ -11,7 +11,7 @@
- +
diff --git a/frontend/www/index.js b/frontend/www/index.js index 1714e05..352a10b 100644 --- a/frontend/www/index.js +++ b/frontend/www/index.js @@ -1,5 +1,5 @@ -import { set_instance } from './index.ts' +import { set_game_name, set_instance } from './index.ts' import { } from './games.ts' // IMPORT GAMES PLEASE, thank you webpack <3 const URL = window.location.origin+window.location.pathname; @@ -11,4 +11,5 @@ fetch(game_location) .then((r) => r.text()) .then((response) => { set_instance(response); + set_game_name("Chandra Garrett"); }).catch(console.error); diff --git a/frontend/www/index.ts b/frontend/www/index.ts index a038652..a4a79d5 100644 --- a/frontend/www/index.ts +++ b/frontend/www/index.ts @@ -15,6 +15,12 @@ function i32v(ptr: number, size: number): Int32Array { return new Int32Array(memory.buffer, ptr, size); } +export function set_game_name(name: string) { + GAMENAME.innerHTML = name; +} + +const GAMENAME = document.getElementById("name"); + const TURNCOUNTER = document.getElementById("turnCounter"); const COUNTER = new FPSCounter(); diff --git a/frontend/www/static/res/style.css b/frontend/www/static/res/style.css index 65e1fdf..c3f0255 100644 --- a/frontend/www/static/res/style.css +++ b/frontend/www/static/res/style.css @@ -29,6 +29,13 @@ p { position: relative; } +#name { + position: absolute; + top: 10px; + left: 10px; + color: white; +} + #meta{ padding: 10px 2%; color: white;