Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

camp_small.py 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 = "http://ubabot.frubar.net"
  22. url = "http://www.xythobuz.de"
  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 = Manager(t)
  35. success.add(ImageScreen(t, "drinka.gif", 0.2, 2, 20.0, (0, 0, 0)))
  36. success.add(Solid(t, 1.0))
  37. success.add(ScrollText(t, "Visit the UbaBot Cocktail machine at FruBar village for drinks!", "lemon", 2, scroll_speed, camp_green))
  38. success.add(Solid(t, 1.0))
  39. success.add(QRScreen(t, url, 30.0, "Drinks:", "tom-thumb", camp_pink, (0, 0, 0)))
  40. success.add(Solid(t, 1.0))
  41. # UbaBot is offline
  42. fail = Manager(t)
  43. fail.add(ImageScreen(t, "attention.gif", 0.2, 2, 20.0, (0, 0, 0)))
  44. fail.add(Solid(t, 1.0))
  45. fail.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.add(Solid(t, 1.0))
  47. fail.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  48. fail.add(Solid(t, 1.0))
  49. # UbaBot status checker
  50. d = CheckHTTP(url)
  51. d.success(success)
  52. d.fail(fail)
  53. # Main "Menu"
  54. m = Manager(t, i)
  55. m.add(ScrollText(t, "#CCCAMP23", "lemon", 1, scroll_speed, camp_green))
  56. m.add(Solid(t, 1.0))
  57. m.add(ImageScreen(t, "Favicon.png", 0, 1, 10.0))
  58. m.add(Solid(t, 1.0))
  59. m.add(d) # HTTP Check, either "success" or "fail"
  60. m.add(Solid(t, 1.0))
  61. m.add(Snake(t, i, camp_pink, camp_green))
  62. m.add(Solid(t, 1.0))
  63. 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))
  64. m.add(Solid(t, 1.0))
  65. m.restart()
  66. util.loop(t, m.draw)