window-config.ion 832 B

123456789101112131415161718192021222324
  1. echo 'Hey you!'
  2. echo 'Press any key to pause/resume the animation'
  3. echo 'Move the mouse over the screen to change its color'
  4. # Stop the animation up-front
  5. toggle
  6. # When the application registers a key, it calls the on_key function with the key number in parameter
  7. fn on_key key
  8. toggle # toggle the animation
  9. echo "${c::yellow}key: ${c::reset}$key" # Print colored text
  10. end
  11. fn on_mouse x y
  12. set_background $(( x / WINDOW_WIDTH )) $(( y / WINDOW_HEIGHT )) .5 # Change the background color
  13. echo "${c::green}position: ${c::reset}($x, $y)"
  14. end
  15. # Extra handlers can be defined, like on_render. The application defines the callbacks and the user
  16. # can decide which one to implement
  17. # Try it yourself: copy this file to the root of the git folder and modify the content: you have
  18. # now a completely reactive config file