import sys import os import importlib from gameduino_spidriver import GameduinoSPIDriver import registers as gd3 import common if __name__ == "__main__": # gd = common.LoggingGameduinoSPIDriver() gd = GameduinoSPIDriver() gd.init() sys.path.append("loadable/") mod = "dance" mod = "grave" mod = "cube" mod = "celestial" mod = "photos" rmod = importlib.import_module(mod) renderer = rmod.Renderer(gd) ti = 0 while 1: try: st = os.stat("loadable/" + mod + ".py") if (st.st_size > 0) and (st.st_mtime > ti): print('reload') importlib.reload(rmod) ti = st.st_mtime
eve.VertexFormat(3) eve.Clear() eve.Begin(GD.BITMAPS) eve.BlendFunc(1, 0) eve.BitmapHandle(0) for i in range(1280 // 11): eve.Cell(i) eve.Vertex2f(11 * i, 0) eve.BitmapHandle(1) eve.Cell(0) eve.cmd_scale(w, h2) eve.cmd_setmatrix() eve.BlendFunc(GD.DST_ALPHA, 0) eve.Vertex2f(0, 0) eve.swap() eve.finish() if sys.implementation.name == "circuitpython": from gameduino_circuitpython import GameduinoCircuitPython eve = GameduinoCircuitPython() else: from gameduino_spidriver import GameduinoSPIDriver eve = GameduinoSPIDriver() eve.init() info(eve) asteroid(eve) # hqtext(eve)
def swap(self): GameduinoSPIDriver.swap(self) self.spool()
def write(self, s): GameduinoSPIDriver.write(self, s) self.cmd_dump.write(s)
def __init__(self): GameduinoSPIDriver.__init__(self) self.seq = 0 self.spool()
import gameduino as GD from eve import align4, EVE import zlib import dogfight if __name__ == '__main__': flashdata = open("unified.blob", "rb").read() + bytes(4096) atlas = {} (flashdata, atlas) = dogfight.flash(flashdata, atlas) flashdata = flashdata.ljust(2 ** 23, b'\xff') open("flash.bin", "wb").write(flashdata) from gameduino_spidriver import GameduinoSPIDriver gd = GameduinoSPIDriver() gd.init() BLK = 2**16 for i in range(8192, len(flashdata), BLK): print(i, len(flashdata)) b = flashdata[i:i + BLK] gd.cmd_inflate(0) gd.cc(align4(zlib.compress(b))) gd.cmd_flashupdate(i, 0, BLK) gd.finish()