Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. class SplashScreen:
  9. def __init__(self, g, width = 32, height = 32):
  10. self.gui = g
  11. self.width = width
  12. self.height = height
  13. def draw(self):
  14. for x in range(0, int(self.gui.width / self.width)):
  15. for y in range(0, int(self.gui.height / self.height)):
  16. self.drawOnce(x * self.width, y * self.height)
  17. def drawOnce(self, x, y):
  18. self.gui.set_pixel( x, y, (255, 255, 255))
  19. self.gui.set_pixel( x, self.height - 1 + y, ( 0, 0, 255))
  20. self.gui.set_pixel(self.width - 1 + x, y, (255, 0, 0))
  21. self.gui.set_pixel(self.width - 1 + x, self.height - 1 + y, ( 0, 255, 0))
  22. for i in range(0, int(min(self.width, self.height) / 3)):
  23. self.gui.set_pixel((self.width / 2) - 1 + i + x, (self.height / 2) - 1 + i + y, (255, 255, 255))
  24. self.gui.set_pixel((self.width / 2) - 1 - i + x, (self.height / 2) - 1 - i + y, (255, 255, 255))
  25. self.gui.set_pixel((self.width / 2) - 1 + i + x, (self.height / 2) - 1 - i + y, (255, 255, 255))
  26. self.gui.set_pixel((self.width / 2) - 1 - i + x, (self.height / 2) - 1 + i + y, (255, 255, 255))
  27. def finished(self):
  28. return True
  29. def restart(self):
  30. pass
  31. if __name__ == "__main__":
  32. import util
  33. t = util.getTarget()
  34. s = SplashScreen(t)
  35. t.debug_loop(s.draw)