Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

livingroom.py 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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, "cann.png", 0.2, 1, 10.0))
  45. m.add(Solid(t, pause))
  46. m.add(ImageScreen(t, "cann2.png", 0.2, 1, 10.0))
  47. m.add(Solid(t, pause))
  48. m.add(ImageScreen(t, "64_cloud.gif", 0.2, 1, 5.0, (0, 0, 0)))
  49. m.add(Solid(t, pause))
  50. m.add(ImageScreen(t, "64_sephiroth.gif", 0.2, 4, 5.0, (0, 0, 0)))
  51. m.add(Solid(t, pause))
  52. m.add(ImageScreen(t, "64_nlogospin.gif", 0.2, 2))
  53. m.add(Solid(t, pause))
  54. m.add(Breakout(t, i))
  55. m.add(Solid(t, pause))
  56. m.add(Tetris(t, i,))
  57. m.add(Solid(t, pause))
  58. m.add(Snake(t, i, camp_pink, camp_green))
  59. m.add(Solid(t, pause))
  60. m.restart()
  61. util.loop(t, m.draw)