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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. # pre-converted images for Pico (required libraries not available)
  11. from qr_tmp import qr_data
  12. from img_tmp import img_data
  13. from solid import Solid
  14. from life import GameOfLife
  15. from net import CheckHTTP
  16. from qr import QRScreen
  17. from scroll import ScrollText
  18. from splash import SplashScreen
  19. from manager import Manager
  20. from pico import PicoBatt
  21. #url = "http://ubabot.frubar.net"
  22. url = "http://www.xythobuz.de"
  23. import util
  24. i = util.getInput()
  25. t = util.getTarget(i)
  26. # Loading fonts and graphics takes a while.
  27. # So show a splash screen while the user waits.
  28. splash = SplashScreen(t)
  29. t.loop_start()
  30. splash.draw()
  31. t.loop_end()
  32. # UbaBot is online
  33. success = Manager(t)
  34. success.add(ScrollText(t, "Visit UbaBot Cocktail machine at FruBar village for drinks!", "bitmap8", 1, 10, camp_green))
  35. success.add(Solid(t, 1.0))
  36. success.add(QRScreen(t, qr_data, 30.0, "Drinks", "bitmap6", camp_pink, (0, 0, 0)))
  37. success.add(Solid(t, 1.0))
  38. # UbaBot is offline
  39. fail = Manager(t)
  40. fail.add(ScrollText(t, "#CCCAMP23", "bitmap8", 1, 10, camp_green))
  41. fail.add(Solid(t, 1.0))
  42. fail.add(ScrollText(t, "The UbaBot Cocktail machine is closed. Please come back later!", "bitmap8", 1, 10, camp_green))
  43. fail.add(Solid(t, 1.0))
  44. fail.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  45. fail.add(Solid(t, 1.0))
  46. fail.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", "bitmap8", 1, 10, camp_green))
  47. fail.add(Solid(t, 1.0))
  48. # UbaBot status checker
  49. d = CheckHTTP(url)
  50. d.success(success)
  51. d.fail(fail)
  52. # Main "Menu"
  53. m = Manager(t, i)
  54. m.add(QRScreen(t, img_data, 15.0))
  55. m.add(Solid(t, 1.0))
  56. m.add(d) # HTTP Check, either "success" or "fail"
  57. m.add(Solid(t, 1.0))
  58. m.add(PicoBatt(t, 5.0, 5.0))
  59. m.add(Solid(t, 1.0))
  60. m.restart()
  61. util.loop(t, m.draw)