Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

livingroom.py 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. pause = 2.0
  11. from splash import SplashScreen
  12. from scroll import ScrollText
  13. from solid import Solid
  14. from life import GameOfLife
  15. from net import CheckHTTP
  16. from image import ImageScreen
  17. from qr import QRScreen
  18. from snake import Snake
  19. from gamepad import InputWrapper
  20. from manager import Manager
  21. from tetris import Tetris
  22. from breakout import Breakout
  23. from config import Config
  24. import util
  25. # Need to import InputWrapper before initializing RGB Matrix on Pi
  26. i = util.getInput()
  27. t = util.getTarget(i)
  28. # Loading fonts and graphics takes a while.
  29. # So show a splash screen while the user waits.
  30. splash = SplashScreen(t)
  31. t.loop_start()
  32. splash.draw()
  33. t.loop_end()
  34. m = Manager(t, i, 2, True)
  35. if not util.isPi():
  36. # TODO weather does not run on Pi yet unfortunately :(
  37. from weather import WeatherScreen
  38. m.add(WeatherScreen(t, i, Config.weather_latlon))
  39. m.add(Solid(t, pause))
  40. m.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  41. m.add(Solid(t, pause))
  42. m.add(ImageScreen(t, "32_earth.gif", 0.2, 2))
  43. m.add(Solid(t, pause))
  44. m.add(ImageScreen(t, "aphex-twin-logo.png", 0.2, 1, 10.0, None, None, False))
  45. m.add(Solid(t, pause))
  46. m.add(ImageScreen(t, "cann.png", 0.2, 1, 10.0))
  47. m.add(Solid(t, pause))
  48. m.add(ImageScreen(t, "cann2.png", 0.2, 1, 10.0))
  49. m.add(Solid(t, pause))
  50. m.add(ImageScreen(t, "64_cloud.gif", 0.2, 1, 5.0, (0, 0, 0)))
  51. m.add(Solid(t, pause))
  52. m.add(ImageScreen(t, "64_sephiroth.gif", 0.2, 4, 5.0, (0, 0, 0)))
  53. m.add(Solid(t, pause))
  54. m.add(ImageScreen(t, "64_nlogospin.gif", 0.2, 2))
  55. m.add(Solid(t, pause))
  56. m.add(ImageScreen(t, "64_snake.gif", 0.1, 2))
  57. m.add(Solid(t, pause))
  58. m.add(ImageScreen(t, "64_snake2.gif", 0.2, 1))
  59. m.add(Solid(t, pause))
  60. m.add(Breakout(t, i))
  61. m.add(Solid(t, pause))
  62. m.add(Tetris(t, i,))
  63. m.add(Solid(t, pause))
  64. m.add(Snake(t, i, camp_pink, camp_green))
  65. m.add(Solid(t, pause))
  66. m.restart()
  67. util.loop(t, m.draw)