summaryrefslogtreecommitdiff
path: root/scripts/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gui')
-rw-r--r--scripts/gui/lobby.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/scripts/gui/lobby.js b/scripts/gui/lobby.js
index 7d2b6cd..5939697 100644
--- a/scripts/gui/lobby.js
+++ b/scripts/gui/lobby.js
@@ -41,10 +41,22 @@ class TopBar{
// #############
// Game represents a single game in the lobby view. It has methods for setting up the elements and such.
-class Game{
- constructor (name, packs, maxp, id)
- {
- }
+function createGameEl (options = {id: 0, name: ""}, el)
+{
+ let e = document.createElement("div");
+ e.className = "game";
+
+ let title = document.createElement("h2");
+ title.textContent = options.name;
+ e.appendChild(title);
+
+ let join = document.createElement("button");
+ join.className = "join";
+ join.textContent = "Join";
+ join.addEventListener("click", game.joinGame.bind(game, options.id));
+ e.appendChild(join);
+
+ el.appendChild(e);
}
// ##############
@@ -130,7 +142,7 @@ class Lobby {
// { data.packs } list of the pack names used by this game
// { data.id } room identifier (uuid)
addGame (data) {
-
+ createGameEl(data, this.e.games);
}
// Called when a new public game is removed on the server