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