Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. if __name__ == "__main__":
  11. from splash import SplashScreen
  12. from draw 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. url = "http://ubabot.frubar.net"
  22. import util
  23. t = util.getTarget()
  24. i = InputWrapper()
  25. # Loading fonts and graphics takes a while.
  26. # So show a splash screen while the user waits.
  27. splash = SplashScreen(t)
  28. t.loop_start()
  29. splash.draw()
  30. t.loop_end()
  31. # UbaBot is online
  32. success = Manager(t)
  33. success.add(ImageScreen(t, "drinka.gif", 0.2, 2, 20.0))
  34. success.add(Solid(t, 1.0))
  35. success.add(QRScreen(t, url, 30.0, "Drinks:", "tom-thumb", (255, 255, 255), (0, 0, 0)))
  36. success.add(Solid(t, 1.0))
  37. # UbaBot is offline
  38. fail = Manager(t)
  39. fail.add(ImageScreen(t, "attention.gif", 0.2, 2, 20.0, (0, 0, 0)))
  40. fail.add(ScrollText(t, "The UbaBot Cocktail machine is currently closed. Please come back later for more drinks!", "lemon", 2, 75, camp_pink))
  41. fail.add(Solid(t, 1.0))
  42. fail.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  43. fail.add(Solid(t, 1.0))
  44. # UbaBot status checker
  45. d = CheckHTTP(url)
  46. d.success(success)
  47. d.fail(fail)
  48. # Main "Menu"
  49. m = Manager(t)
  50. m.add(ScrollText(t, "#CCCAMP23", "lemon", 1, 75, camp_green))
  51. m.add(Solid(t, 1.0))
  52. m.add(ImageScreen(t, "Favicon.png", 0, 1, 10.0))
  53. m.add(Solid(t, 1.0))
  54. m.add(d) # HTTP Check, either "success" or "fail"
  55. m.add(Solid(t, 1.0))
  56. m.add(Snake(t, i, camp_pink, camp_green))
  57. m.add(Solid(t, 1.0))
  58. m.add(ScrollText(t, "Your advertisement could appear here. Open a Pull Request on git.xythobuz.de/thomas/rgb-matrix-visualizer or send an e-mail to thomas@xythobuz.de", "iv18x16u", 2, 70, camp_green))
  59. m.add(Solid(t, 1.0))
  60. m.restart()
  61. t.loop(m.draw)