final commit
This commit is contained in:
@@ -7,15 +7,17 @@ const gui = new GUI();
|
||||
const params = {
|
||||
fps: 60,
|
||||
zoom: 1,
|
||||
backgroundTicks: 60,
|
||||
backgroundTicks: 900,
|
||||
textSpread: 0,
|
||||
maxSpawns: 1,
|
||||
textAlpha: 0.0,
|
||||
textTicks: 1,
|
||||
disableScreen: false,
|
||||
};
|
||||
gui.add(params, "fps", 0.1, 60);
|
||||
gui.add(params, "zoom", 1, 20);
|
||||
gui.add(params, "backgroundTicks", 1, 600).step(1);
|
||||
gui.add(params, "zoom", 1, 5);
|
||||
gui.add(params, "backgroundTicks", 1, 900).step(1);
|
||||
gui.add(params, "disableScreen", false);
|
||||
const textFolder = gui.addFolder("Text");
|
||||
textFolder.add(params, "textSpread", 0, 200);
|
||||
textFolder.add(params, "maxSpawns", 1, 20).step(1);
|
||||
|
||||
@@ -6,6 +6,7 @@ const params = {
|
||||
fps: 60,
|
||||
zoom: 1, //in pixels per pixel
|
||||
backgroundTicks: 60,
|
||||
disableScreen: false,
|
||||
textSpread: 0,
|
||||
maxSpawns: 1,
|
||||
textAlpha: 0.0,
|
||||
@@ -17,6 +18,11 @@ socket.on("paramUpdate", ({ key, value }) => {
|
||||
console.log(`Updated param ${key} to ${value}`);
|
||||
});
|
||||
|
||||
let bgTick = 0;
|
||||
socket.on("pulse", () => {
|
||||
bgTick = 0;
|
||||
});
|
||||
|
||||
const poem =
|
||||
"everybody is pretty ugly \
|
||||
lover \
|
||||
@@ -119,7 +125,6 @@ const sketch = (p) => {
|
||||
// const stream = c.elt.captureStream(60);
|
||||
};
|
||||
|
||||
let bgTick = 0;
|
||||
let textTick = 0;
|
||||
let sx, sy;
|
||||
let cw, ch;
|
||||
@@ -186,6 +191,7 @@ const sketch = (p) => {
|
||||
function drawTiles(x, y, width, height) {
|
||||
// clear screen
|
||||
p.background(p.color(1, 0, 0, 0));
|
||||
if (params.disableScreen) return;
|
||||
|
||||
p.shader(shaderProgram);
|
||||
// p.ortho(0, p.width, -p.height, 0);
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
|
||||
import express from 'express';
|
||||
import http from 'http';
|
||||
import { Server } from 'socket.io';
|
||||
import express from "express";
|
||||
import http from "http";
|
||||
import { Server } from "socket.io";
|
||||
|
||||
const app = express();
|
||||
const server = http.createServer(app);
|
||||
const io = new Server(server, {
|
||||
cors: {
|
||||
origin: "http://localhost:5173", // allow Vite frontend
|
||||
methods: ["GET", "POST"]
|
||||
}
|
||||
methods: ["GET", "POST"],
|
||||
},
|
||||
});
|
||||
|
||||
// Socket.IO events
|
||||
@@ -20,10 +19,14 @@ io.on("connection", (socket) => {
|
||||
socket.broadcast.emit("paramUpdate", data);
|
||||
});
|
||||
|
||||
socket.on("pulse", () => {
|
||||
socket.broadcast.emit("pulse");
|
||||
});
|
||||
|
||||
socket.on("disconnect", () => {
|
||||
console.log("Client disconnected:", socket.id);
|
||||
});
|
||||
});
|
||||
|
||||
app.use(express.static('frontend/dist'));
|
||||
server.listen(3000, () => console.log('Server running on http://localhost'));
|
||||
app.use(express.static("frontend/dist"));
|
||||
server.listen(3000, () => console.log("Server running on http://localhost"));
|
||||
|
||||
Reference in New Issue
Block a user