Quantcast
Viewing all articles
Browse latest Browse all 40524

How to run update() and draw() in keyPressed() event

@hyro, what are you doing within draw()?

i think this approach wouldn't work, you would only see the results of the last call to draw(). also calling draw() there is actually redundant, since draw() is being called automatically every frame.

if you want to limit when shapes are being drawn, i recommend creating a different function to draw into your world or, again, use booleans in your draw function().


Viewing all articles
Browse latest Browse all 40524

Trending Articles