mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-25 02:57:24 +00:00
WIP
This commit is contained in:
parent
f9b4d7d1dc
commit
aeeb4133da
6 changed files with 15 additions and 10 deletions
4
main.go
4
main.go
|
|
@ -31,8 +31,8 @@ const wsIndex = "./static/index_ws.html"
|
|||
// var webRTC *webrtc.WebRTC
|
||||
var width = 256
|
||||
var height = 240
|
||||
var indexFN string = wsIndex
|
||||
var service string = "http"
|
||||
var indexFN string = gameboyIndex
|
||||
var service string = "ws"
|
||||
|
||||
type IndexPageData struct {
|
||||
Service string
|
||||
|
|
|
|||
|
|
@ -6919,4 +6919,4 @@ body {
|
|||
|
||||
a {
|
||||
color: lightblue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@
|
|||
|
||||
<link type="text/css" rel="stylesheet" href="/static/css/gameboy.css">
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
|
||||
<body scroll="no" style="overflow: hidden">
|
||||
<div id="gameboy" class="green">
|
||||
<div id="canvas"></div>
|
||||
<div id="border"></div>
|
||||
|
|
@ -88,8 +87,14 @@
|
|||
C is start (in game) <br />
|
||||
V is select game <br />
|
||||
Q is super quit <br />
|
||||
S to save <br />
|
||||
L to load <br />
|
||||
|
||||
Room ID: <input type="text" id="roomID"><br>
|
||||
Room ID: <input type="text" id="roomID"><br />
|
||||
Play as player(1,2): <select id="playerIndex">
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
</select>
|
||||
<!--Fullscreen media for better gaming experience<br /-->
|
||||
</div><br>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ textarea {
|
|||
<option value="zelda.rom">zelda.rom</option>
|
||||
</select>
|
||||
<button id="play" onclick="window.startGame()">Play</button>
|
||||
Room ID: <input type="text" id="roomID"><br>
|
||||
Room ID: <input type="text" id="roomID">
|
||||
Play as player(1,2): <select id="playerIndex">
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
function startGame() {
|
||||
log("Starting game screen");
|
||||
|
||||
|
||||
// clear
|
||||
endInput();
|
||||
document.getElementById('div').innerHTML = "";
|
||||
|
|
@ -15,7 +15,7 @@ function startGame() {
|
|||
conn.onopen = () => {
|
||||
log("WebSocket is opened. Send ping");
|
||||
roomID = document.getElementById('roomID').value
|
||||
conn.send(JSON.stringify({"id": "ping", "data": GAME_LIST[gameIdx].nes, "room_id": roomID}));
|
||||
conn.send(JSON.stringify({"id": "ping", "data": GAME_LIST[gameIdx].nes, "room_id": roomID, "player_index": parseInt(playerIndex.value, 10)}));
|
||||
}
|
||||
|
||||
conn.onerror = error => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue