Pong with Knob control #68
Replies: 1 comment
-
Very nice @b33zwaXer! Timers are the most robust way to implement anything in TSP so this is a nice change. The pong app was initially written as an endless while loop because it was hacked together. Indeed, the knob support and single player functionality was always intended. Designing a game of Breakout might be a nice challenge, that was another app thought of that would utilize the knob. The knob events should be included in the display API, it was simply an oversight. Though, by convention, this should be a .tspa file because it takes over the display with a custom GUI. I will start work on a PR that adds your files (likely replacing the current pong.tspa) and improves the display API. FYI @Little-LIZard |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I dont believe the pong app has ever supported the knob interface on the SMU or DMM7510. In the code it looks like there was an attempt but the knob interface was not supported in the versions when the app was built. I spent the day understanding the knob interface for V1.7.1+ and learnt how to control it, so I decided to update the pong.tsp script to work with the knob. One of the major issues I encountered while attempting this was the main 'while true' loop presents issues with knob control as it runs on display.setevents() to share the knob values, so I swapped the main while loop for a display.TIMER_FOREVER that runs the main loop as fast as allowed. This allows for the Pong script to be loaded and run into memory instead of running from .tsp app. Now the knob action events can to be interpreted and used to control player 1! I found this quite fun to figure out and I think it shows that an infinite while loop can be replaced with an infinite event timer. So I have attached here my version of the pong.tsp app as well as a simple .tsp script that shows how to control the knob thought action events and the display.EVENT_KNOB_PRESS and display.EVENT_KNOB_ROTATE events. These are not properly documented in the Display TTI API, though maybe that was on purpose, haha. Anyways, please take a look and tell me what you think
Pong.zip
Beta Was this translation helpful? Give feedback.
All reactions