Skip to content

Commit 2609103

Browse files
committed
FIX: Update Node implementation to match viz eye controller
1 parent 874ef5e commit 2609103

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

coffee_ws/src/coffee_expressions/coffee_expressions/plaipin_expressive_eyes.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,34 @@ def update_animation(self):
104104
if event.type == pygame.QUIT:
105105
self.destroy_node()
106106
return
107+
elif event.type == pygame.KEYDOWN:
108+
if event.key == pygame.K_ESCAPE:
109+
self.destroy_node()
110+
return
111+
112+
# Let the application handle other events
113+
self.app.input_handler.handle_keyboard(event)
114+
115+
# Handle UI events
116+
ui_result = self.app.ui_manager.handle_event(event)
117+
if ui_result:
118+
if ui_result == "control_points_changed":
119+
self.app.animated_eyes.update_control_points()
120+
elif ui_result == "config_changed":
121+
self.app.animated_eyes.update_eye_positions()
122+
123+
# Update the eye controller
124+
self.eye_controller.update()
125+
126+
# Update animated eyes
127+
self.app.animated_eyes.update()
107128

108-
# Update plaipin animation
109-
self.app.update()
129+
# Drawing
130+
self.app.screen.fill(self.app.config.background_color)
131+
self.app.ui_manager.draw_grid()
132+
self.app.animated_eyes.draw()
110133

111-
# Render
112-
self.screen.fill((0, 0, 0)) # Clear screen
113-
self.app.render()
134+
# Update display
114135
pygame.display.flip()
115136

116137
def destroy_node(self):

0 commit comments

Comments
 (0)