|
| 1 | +import ugfx, appglue, hashlib, ubinascii, time, uos |
| 2 | + |
| 3 | +names = ["Kartoffel", "Sebastius", "tsd", "Sprite_TM", "Underhand", "MaruksBek", "Roosted", "the_JinX", "realitygaps", "raboof", "Alexandre Dulaunoy", " Eric Poulsen", "Damien P. George", "Renze Nicolai"] |
| 4 | + |
| 5 | +def action_exit(pushed): |
| 6 | + if (pushed): |
| 7 | + appglue.home() |
| 8 | + |
| 9 | +def fill_screen_with_crap(c): |
| 10 | + print("Filling screen...") |
| 11 | + for i in range(0,3): |
| 12 | + nr = int.from_bytes(uos.urandom(1), 1) |
| 13 | + sha = hashlib.sha1(str(nr)) |
| 14 | + s = ubinascii.hexlify(sha.digest()) |
| 15 | + for j in range(0,8): |
| 16 | + x = int.from_bytes(uos.urandom(1), 1) |
| 17 | + y = int.from_bytes(uos.urandom(1), 1) |
| 18 | + if (x<ugfx.width()) and (y<ugfx.height()): |
| 19 | + ugfx.string(x, y, s, "Roboto_Regular12", c) |
| 20 | + ugfx.flush() |
| 21 | + print("done.") |
| 22 | + |
| 23 | +def draw_name(x,y,name): |
| 24 | + print("Drawing name "+name) |
| 25 | + for i in range(1,5): |
| 26 | + ugfx.string(x-i, y-i, name, "PermanentMarker22", ugfx.WHITE) |
| 27 | + ugfx.string(x+i, y+i, name, "PermanentMarker22", ugfx.WHITE) |
| 28 | + ugfx.string(x-i, y+i, name, "PermanentMarker22", ugfx.WHITE) |
| 29 | + ugfx.string(x+i, y-i, name, "PermanentMarker22", ugfx.WHITE) |
| 30 | + ugfx.string(x-i, y, name, "PermanentMarker22", ugfx.WHITE) |
| 31 | + ugfx.string(x+i, y, name, "PermanentMarker22", ugfx.WHITE) |
| 32 | + ugfx.string(x, y-i, name, "PermanentMarker22", ugfx.WHITE) |
| 33 | + ugfx.string(x, y+i, name, "PermanentMarker22", ugfx.WHITE) |
| 34 | + ugfx.string(x, y, name, "PermanentMarker22", ugfx.BLACK) |
| 35 | + print("done.") |
| 36 | + ugfx.flush() |
| 37 | + |
| 38 | +def show_names(): |
| 39 | + global names |
| 40 | + c = False |
| 41 | + for n in range(0, len(names)): |
| 42 | + color = ugfx.BLACK |
| 43 | + #if (c): |
| 44 | + # c = False |
| 45 | + #else: |
| 46 | + # c = True |
| 47 | + # color = ugfx.WHITE |
| 48 | + fill_screen_with_crap(color) |
| 49 | + x = int.from_bytes(uos.urandom(1), 1) |
| 50 | + y = round(int.from_bytes(uos.urandom(1), 1)/2) |
| 51 | + w = ugfx.get_string_width(names[n],"PermanentMarker22") |
| 52 | + if (x+w > ugfx.width()): |
| 53 | + x = x+w |
| 54 | + if (y > ugfx.height()-22): |
| 55 | + y = ugfx.height()-22 |
| 56 | + if (x==0): |
| 57 | + x=1 |
| 58 | + if (y==0): |
| 59 | + y=1 |
| 60 | + print("NAME AT "+str(x)+", "+str(y)) |
| 61 | + draw_name(x,y,names[n]) |
| 62 | + time.sleep(1) |
| 63 | + |
| 64 | +def main(): |
| 65 | + #ugfx.init() |
| 66 | + ugfx.input_init() |
| 67 | + ugfx.input_attach(ugfx.BTN_B, action_exit) |
| 68 | + ugfx.input_attach(ugfx.BTN_START, action_exit) |
| 69 | + fill_screen_with_crap(ugfx.BLACK) |
| 70 | + show_names() |
| 71 | + |
| 72 | +while (True): |
| 73 | + main() |
0 commit comments