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 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. from apod import APOD
  25. import util
  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. m = Manager(t, i, 2, True)
  36. if not util.isPi():
  37. # TODO weather does not run on Pi yet unfortunately :(
  38. from weather import WeatherScreen
  39. m.add(WeatherScreen(t, i, Config.weather_latlon))
  40. m.add(Solid(t, pause))
  41. m.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  42. m.add(Solid(t, pause))
  43. m.add(APOD(t, i))
  44. m.add(Solid(t, pause))
  45. m.add(ImageScreen(t, "32_earth.gif", 0.2, 2))
  46. m.add(Solid(t, pause))
  47. m.add(ImageScreen(t, "aphex-twin-logo.png", 0.2, 1, 10.0, None, None, False))
  48. m.add(Solid(t, pause))
  49. m.add(ImageScreen(t, "gta.png", 0.2, 1, 10.0, None, None, False))
  50. m.add(Solid(t, pause))
  51. m.add(ImageScreen(t, "camp23.png", 0.2, 1, 10.0, None, None, False))
  52. m.add(Solid(t, pause))
  53. m.add(ImageScreen(t, "pest.jpg", 0.2, 1, 10.0, None, None, False))
  54. m.add(Solid(t, pause))
  55. m.add(ImageScreen(t, "ccc_stern.jpg", 0.2, 1, 10.0, None, None, False))
  56. m.add(Solid(t, pause))
  57. m.add(ImageScreen(t, "ccc.png", 0.2, 1, 10.0))
  58. m.add(Solid(t, pause))
  59. m.add(ImageScreen(t, "cann.png", 0.2, 1, 10.0))
  60. m.add(Solid(t, pause))
  61. m.add(ImageScreen(t, "cann2.png", 0.2, 1, 10.0))
  62. m.add(Solid(t, pause))
  63. m.add(ImageScreen(t, "64_cloud.gif", 0.2, 1, 5.0, (0, 0, 0)))
  64. m.add(Solid(t, pause))
  65. m.add(ImageScreen(t, "64_sephiroth.gif", 0.2, 4, 5.0, (0, 0, 0)))
  66. m.add(Solid(t, pause))
  67. m.add(ImageScreen(t, "64_nlogospin.gif", 0.2, 2))
  68. m.add(Solid(t, pause))
  69. m.add(ImageScreen(t, "64_snake.gif", 0.1, 2))
  70. m.add(Solid(t, pause))
  71. m.add(ImageScreen(t, "64_snake2.gif", 0.2, 1))
  72. m.add(Solid(t, pause))
  73. m.add(ImageScreen(t, "64_mantis.gif", 0.2, 2))
  74. m.add(Solid(t, pause))
  75. m.add(ImageScreen(t, "64_bot.gif", 0.1, 1))
  76. m.add(Solid(t, pause))
  77. m.add(Breakout(t, i))
  78. m.add(Solid(t, pause))
  79. m.add(Tetris(t, i,))
  80. m.add(Solid(t, pause))
  81. m.add(Snake(t, i, camp_pink, camp_green))
  82. m.add(Solid(t, pause))
  83. m.restart()
  84. util.loop(t, m.draw)