So I’m trying to make an rtx program with the new Processing 4, but everything seems 100x harder than before on version 3 of Processing. Shapes are sometimes drawn, and sometimes not. It was also my understanding that if I drew a shape, and then ran a while loop, the shape would remain on the screen. It also seems that aside from syntax errors, Processing 4 no longer reports errors. Additionally, even when I only have 1 tab, it looks like I have to manually save before the code recompiles (I’m like 70% sure this was not a requirement in Processing 3).
Am I just tripping? Or is the new Processing just worse? Also, it seems that whenever I run the program, it takes an uncomfortably long time before the sketch actually opens (on top of sometimes, seemingly randomly, freezing, even without any changes being made to the code).
sc = PVector(700,700)
class Shape:
def __init__(self,x,y,dia):
self.pos = PVector(x,y)
self.dia = dia
def show(self):
circle(self.pos.x,self.pos.y,self.dia)
def setup():
size(int(sc.x),int(sc.y))
background(255)
obj_list = []
c1 = Shape(700,700,30)
obj_list.append(c1)
def draw():
background(255)
for obj in obj_list:
obj.show()
epsilon = 10
min_dist = 2*(sc.x+sc.y)
begin_pos = PVector(0,0)
current_pos = PVector(0,0)
while min_dist > epsilon:
for obj in obj_list:
obj.show()
if abs(dist(current_pos.x,current_pos.y,obj.pos.x,obj.pos.y))-obj.dia/2 < min_dist:
min_dist = abs(dist(current_pos.x,current_pos.y,obj.pos.x,obj.pos.y))-obj.dia/2
current_pos = PVector(mouseX,mouseY).limit(min_dist)
Also, the instantiation of c1 is really strange. Sometimes using PVector sc for its coordinates works, but then if I try to do sc.x/2 or sc.y/2, it doesn’t work. But substituting sc.x and sc.y with their literal values (both are 700) also makes the program stop working.