Closed villares closed 4 months ago
Proof of concept:
class BoolFuncKP():
def __bool__(self):
return keyIsPressed
def __call__(self):
background(0) # instead of this
# here we should call the user defined keyPressed() function
keyPressed = BoolFuncKP()
def setup():
size(400, 400)
def draw():
background(240)
if keyPressed:
keyPressed()
fill(255)
else:
fill(0)
rect(100, 100, 100, 100)
I changed my mind, now I think we should pursue py5 or p5js compatibility, or both, not Processing Python mode, which is dead.
I think we achieved a lot in terms of compatibility with Processing Python mode, so let's please have a look on making
keyPressed
andmousePressed
work as aliases forkeyIsPressed
andmouseIsPressed
.This might require some gymnastics to make sure
mousePressed()
andkeyPressed()
event functions are properly taken care of (p5js bindings) before the sketch actually runs, but I think it won't be a big deal.