diff --git a/main.go b/main.go index b49db9c7..5b4e5846 100644 --- a/main.go +++ b/main.go @@ -29,7 +29,7 @@ const ( debugIndex = "./static/index_ws.html" ) -var indexFN = debugIndex +var indexFN = gameboyIndex // Time allowed to write a message to the peer. var readWait = 30 * time.Second diff --git a/static/gameboy.html b/static/gameboy.html index 5f7684a7..685d608d 100644 --- a/static/gameboy.html +++ b/static/gameboy.html @@ -88,9 +88,9 @@
Game:
Use Up, Down, Left, Right to Move
- Z to jump (A)
- X to sprint (B)
- C is start (in game)
+ Z (A butotn)
+ X (B button)
+ C is start (or pause in some games)
V is select game
Q is super quit
S to save
diff --git a/static/js/ws.js b/static/js/ws.js index 047d0c28..8e8d6053 100644 --- a/static/js/ws.js +++ b/static/js/ws.js @@ -51,7 +51,7 @@ conn.onmessage = e => { function sendPing() { // TODO: format the package with time - //conn.send(JSON.stringify({"id": "pingpong", "data": "pingpong"})); + conn.send(JSON.stringify({"id": "pingpong", "data": "pingpong"})); } function startWebRTC() { @@ -77,7 +77,6 @@ function startWebRTC() { if (pc.iceConnectionState === "connected") { //conn.send(JSON.stringify({"id": "start", "data": ""})); - screenState = "game"; } else if (pc.iceConnectionState === "disconnected") { endInput(); @@ -117,6 +116,8 @@ function startWebRTC() { function startGame() { log("Starting game screen"); + screenState = "game"; + conn.send(JSON.stringify({"id": "start", "data": GAME_LIST[gameIdx].nes, "room_id": roomID.value, "player_index": parseInt(playerIndex.value, 10)}));inputTimer // clear menu screen