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.

camp_pico.py 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. if True:#__name__ == "__main__":
  14. from solid import Solid
  15. from life import GameOfLife
  16. from net import CheckHTTP
  17. from qr import QRScreen
  18. from scroll import ScrollText
  19. from splash import SplashScreen
  20. from manager import Manager
  21. url = "http://ubabot.frubar.net"
  22. import util
  23. t = util.getTarget()
  24. # Loading fonts and graphics takes a while.
  25. # So show a splash screen while the user waits.
  26. splash = SplashScreen(t)
  27. t.loop_start()
  28. splash.draw()
  29. t.loop_end()
  30. # UbaBot is online
  31. success = Manager(t)
  32. success.add(ScrollText(t, "Visit UbaBot Cocktail machine at FruBar village for drinks!", "bitmap8", 1, 10, camp_green))
  33. success.add(Solid(t, 1.0))
  34. success.add(QRScreen(t, qr_data, 30.0, "Drinks", "bitmap6", camp_pink, (0, 0, 0)))
  35. success.add(Solid(t, 1.0))
  36. # UbaBot is offline
  37. fail = Manager(t)
  38. fail.add(ScrollText(t, "#CCCAMP23", "bitmap8", 1, 10, camp_green))
  39. fail.add(Solid(t, 1.0))
  40. fail.add(ScrollText(t, "The UbaBot Cocktail machine is closed. Please come back later!", "bitmap8", 1, 10, camp_green))
  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. 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))
  45. fail.add(Solid(t, 1.0))
  46. # UbaBot status checker
  47. d = CheckHTTP(url)
  48. d.success(success)
  49. d.fail(fail)
  50. # Main "Menu"
  51. m = Manager(t)
  52. m.add(QRScreen(t, img_data, 15.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.restart()
  57. t.loop(m.draw)