- Added dice to server

- Added get random card function to server
This commit is contained in:
2021-06-08 09:34:55 +02:00
parent 98177f6b5b
commit 9e054ddd91
2 changed files with 93 additions and 16 deletions

View File

@@ -1,22 +1,27 @@
const app = new PIXI.Application({
autoResize: true,
resolution: devicePixelRatio,
backgroundColor: 0x0073db
});
document.getElementById('game').appendChild(app.view);
let app;
// -------------------------------------- code --------------------------------------
// ------------------------------------ end code ------------------------------------
// Resize (Do Not modify)
window.addEventListener('resize', resize);
window.addEventListener('load', function () {
app = new PIXI.Application({
autoResize: true,
resolution: devicePixelRatio,
backgroundColor: 0x0073db
});
document.getElementById('game').appendChild(app.view);
socket.on('dice', function (data) {
console.log(data);
});
socket.on('card', function (data) {
console.log(data);
});
resize();
});
function resize() {
let game = document.getElementById('game');
app.renderer.resize(game.offsetWidth, game.offsetHeight);
}
resize();
}