We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e672a02 commit e01e51aCopy full SHA for e01e51a
1 file changed
crates/processing_pyo3/examples/flocking.py
@@ -11,17 +11,29 @@
11
12
flock = None
13
14
+title_last_time = 0.0
15
+title_last_frame = 0
16
+boid_count = 150
17
18
def setup():
19
global flock
20
size(640, 360)
21
flock = Flock()
22
# Add an initial set of boids into the system
- for i in range(150):
23
+ for i in range(boid_count):
24
flock.add_boid(Boid(width / 2, height / 2))
25
26
27
def draw():
28
+ global title_last_time, title_last_frame
29
+
30
+ title_elapsed = elapsed_time - title_last_time
31
+ if title_elapsed >= 0.5:
32
+ fps = (frame_count - title_last_frame) / title_elapsed
33
+ window_title(f"GPU Flocking Duck — {boid_count:,} boids — {fps:.0f} FPS")
34
+ title_last_time = elapsed_time
35
+ title_last_frame = frame_count
36
37
background(50)
38
flock.run()
39
0 commit comments