fixing renderText script

This commit is contained in:
2026-06-11 15:14:00 +02:00
parent 3e922883f7
commit 9ad6b15130
302 changed files with 120914 additions and 20 deletions
+58
View File
@@ -0,0 +1,58 @@
class Port {
Session session;
Host host;
String line;
int id;
float x, y;
boolean session_running = false;
String name;
int port_num;
Port(int _id, Host _host) {
host = _host;
id = _id;
line = (String)host.output.get(id);
//println(line);
parseLine();
}
void parseLine() {
String [] params = splitTokens(line, "/ ");
port_num = parseInt(params[0]);
name = params[3];
}
void draw() {
y = host.y+id*10+2;
x = host.x+50-4;
if (over()) {
fill(#70A724);
if (mousePressed && !session_running) {
session_running = true;
Thread t = new Thread(new Session(host, this));
t.start();
}
}
else {
fill(#294305);
}
noStroke();
rect(x, y, textWidth(line)+8, -10);
}
boolean over() {
if (mouseX>x && mouseX < x+textWidth(line)+8 && mouseY > y-10 && mouseY < y)
return true;
else
return false;
}
}