Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

games.py 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env python3
  2. # ----------------------------------------------------------------------------
  3. # "THE BEER-WARE LICENSE" (Revision 42):
  4. # <xythobuz@xythobuz.de> wrote this file. As long as you retain this notice
  5. # you can do whatever you want with this stuff. If we meet some day, and you
  6. # think this stuff is worth it, you can buy me a beer in return. Thomas Buck
  7. # ----------------------------------------------------------------------------
  8. camp_pink = (251, 72, 196)
  9. camp_green = (63, 255, 33)
  10. from splash import SplashScreen
  11. from scroll import ScrollText
  12. from solid import Solid
  13. from life import GameOfLife
  14. from net import CheckHTTP
  15. from image import ImageScreen
  16. from qr import QRScreen
  17. from snake import Snake
  18. from gamepad import InputWrapper
  19. from manager import Manager
  20. from tetris import Tetris
  21. from breakout import Breakout
  22. import util
  23. url_uba = "http://ubabot.frubar.net"
  24. url_printer = "http://i3-am8.fritz.box"
  25. scroll_speed = 50
  26. # Need to import InputWrapper before initializing RGB Matrix on Pi
  27. i = util.getInput()
  28. t = util.getTarget(i)
  29. # Loading fonts and graphics takes a while.
  30. # So show a splash screen while the user waits.
  31. splash = SplashScreen(t)
  32. t.loop_start()
  33. splash.draw()
  34. t.loop_end()
  35. # Main "Menu"
  36. m = Manager(t, i)
  37. m.add(Breakout(t, i))
  38. m.add(Solid(t, 1.0))
  39. m.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  40. m.add(Solid(t, 1.0))
  41. m.add(Tetris(t, i,))
  42. m.add(Solid(t, 1.0))
  43. m.add(Snake(t, i, camp_pink, camp_green))
  44. m.add(Solid(t, 1.0))
  45. m.restart()
  46. util.loop(t, m.draw)