Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

camp_small.py 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. from splash import SplashScreen
  11. from scroll import ScrollText
  12. from solid import Solid
  13. from life import GameOfLife
  14. from net import CheckHTTP
  15. from image import ImageScreen
  16. from qr import QRScreen
  17. from snake import Snake
  18. from gamepad import InputWrapper
  19. from manager import Manager
  20. import util
  21. url_uba = "http://ubabot.frubar.net"
  22. url_printer = "http://i3-am8.fritz.box"
  23. scroll_speed = 50
  24. # Need to import InputWrapper before initializing RGB Matrix on Pi
  25. i = util.getInput()
  26. t = util.getTarget(i)
  27. # Loading fonts and graphics takes a while.
  28. # So show a splash screen while the user waits.
  29. splash = SplashScreen(t)
  30. t.loop_start()
  31. splash.draw()
  32. t.loop_end()
  33. # UbaBot is online
  34. success_uba = Manager(t)
  35. success_uba.add(ImageScreen(t, "32_drinka.gif", 0.2, 2, 20.0, (0, 0, 0)))
  36. success_uba.add(Solid(t, 1.0))
  37. success_uba.add(ScrollText(t, "Visit the UbaBot Cocktail machine at FruBar village for drinks!", "lemon", 2, scroll_speed, camp_green))
  38. success_uba.add(Solid(t, 1.0))
  39. success_uba.add(QRScreen(t, url_uba, 30.0, "Drinks:", "tom-thumb", camp_pink, (0, 0, 0)))
  40. success_uba.add(Solid(t, 1.0))
  41. # UbaBot is offline
  42. fail_uba = Manager(t)
  43. fail_uba.add(ImageScreen(t, "32_attention.gif", 0.2, 2, 20.0, (0, 0, 0)))
  44. fail_uba.add(Solid(t, 1.0))
  45. fail_uba.add(ScrollText(t, "The UbaBot Cocktail machine is currently closed. Please come back later for more drinks!", "lemon", 2, scroll_speed, camp_pink))
  46. fail_uba.add(Solid(t, 1.0))
  47. fail_uba.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  48. fail_uba.add(Solid(t, 1.0))
  49. # UbaBot status checker
  50. d = CheckHTTP(url_uba)
  51. d.success(success_uba)
  52. d.fail(fail_uba)
  53. # 3D printer is online
  54. success_printer = Manager(t)
  55. success_printer.add(ScrollText(t, "Need to print something? FruBar village has a 3D printer. Come by!", "iv18x16u", 1, scroll_speed, camp_pink))
  56. success_printer.add(Solid(t, 1.0))
  57. # 3D printer is offline
  58. fail_printer = Manager(t)
  59. fail_printer.add(Solid(t, 1.0))
  60. fail_printer.add(Solid(t, 1.0))
  61. # Printer status checker
  62. d2 = CheckHTTP(url_printer)
  63. d2.success(success_printer)
  64. d2.fail(fail_printer)
  65. # Main "Menu"
  66. m = Manager(t, i)
  67. m.add(ScrollText(t, "#CCCAMP23", "lemon", 1, scroll_speed, camp_green))
  68. m.add(Solid(t, 1.0))
  69. m.add(ImageScreen(t, "camp23.png", 0, 1, 10.0))
  70. m.add(Solid(t, 1.0))
  71. m.add(ScrollText(t, "Grab a cold draft beer at FruBar village!", "iv18x16u", 1, scroll_speed, camp_green))
  72. m.add(d) # HTTP Check, either "success" or "fail"
  73. m.add(Solid(t, 1.0))
  74. m.add(d2) # HTTP Check, either "success" or "fail"
  75. m.add(Solid(t, 1.0))
  76. m.add(Snake(t, i, camp_pink, camp_green))
  77. m.add(Solid(t, 1.0))
  78. 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, scroll_speed, camp_green))
  79. m.add(Solid(t, 1.0))
  80. m.restart()
  81. util.loop(t, m.draw)