Fix gameboy screen not change state

This commit is contained in:
giongto35 2019-04-14 15:08:13 +08:00
parent 4fcf67e05e
commit ebf1d93e4c
3 changed files with 7 additions and 6 deletions

View file

@ -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

View file

@ -88,9 +88,9 @@
<br />
Game: <br />
Use Up, Down, Left, Right to Move <br />
Z to jump (A) <br />
X to sprint (B) <br />
C is start (in game) <br />
Z (A butotn) <br />
X (B button) <br />
C is start (or pause in some games) <br />
V is select game <br />
Q is super quit <br />
S to save <br />

View file

@ -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