c trop bieeeen
This commit is contained in:
parent
50d46d0f0c
commit
c6f5ab3438
6 changed files with 83 additions and 13 deletions
|
|
@ -1,15 +1,23 @@
|
|||
import { initSocket, socket, subscribe } from "../utils/streams";
|
||||
import { calculateLayout } from "./utils";
|
||||
import { authenticate, refreshToken } from "../utils/auth";
|
||||
import { initCanvas, renderCanvasUpdate } from "../rooms/canvas/utils";
|
||||
import { getCanvas } from "../rooms/canvas/index";
|
||||
import {
|
||||
getPlacementData,
|
||||
initCanvas,
|
||||
renderCanvasUpdate,
|
||||
} from "../rooms/canvas/utils";
|
||||
import { getCanvas, placePixel } from "../rooms/canvas/index";
|
||||
import { fetchRoomConfig, getCurrentRoomConfig } from "../rooms/index";
|
||||
|
||||
// Initialize the layout
|
||||
calculateLayout();
|
||||
|
||||
// Auth
|
||||
await authenticate();
|
||||
|
||||
////////////////////////////////////
|
||||
// Sockets
|
||||
//
|
||||
let room = window.location.pathname.split("/")[1];
|
||||
|
||||
if (!room) {
|
||||
|
|
@ -75,3 +83,21 @@ socket.on("pixel-update", async (msg) => {
|
|||
|
||||
renderCanvasUpdate(color, posX, posY);
|
||||
});
|
||||
|
||||
////////////////////////////////////
|
||||
// Buttons
|
||||
//
|
||||
async function placePixelButton() {
|
||||
const { posX, posY, color } = getPlacementData();
|
||||
|
||||
await placePixel(room, posX, posY, color);
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// HTML
|
||||
//
|
||||
const placeButtonElt = document.getElementById("color-place-button");
|
||||
|
||||
placeButtonElt.addEventListener("click", () => {
|
||||
placePixelButton();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue