Updated Sketchy-Etch
Added option to clear drawing, added initial dialog with instructions, added ability to create circlessammachin-gprs
parent
1d02cdbc8d
commit
10aaf19204
|
@ -1,25 +1,40 @@
|
|||
"""Accidentally created etcher sketch..."""
|
||||
|
||||
___name___ = "Sketchy Etch"
|
||||
___title___ = "Sketchy Etch"
|
||||
___name___ = "Sketchy-Etch"
|
||||
___title___ = "Sketchy-Etch"
|
||||
___license___ = "MIT"
|
||||
___dependencies___ = ["ugfx_helper"]
|
||||
___dependencies___ = ["ugfx_helper", "dialogs"]
|
||||
___categories___ = ["Games"]
|
||||
|
||||
import ugfx, ugfx_helper, app
|
||||
import ugfx, ugfx_helper, app, dialogs
|
||||
from tilda import Buttons
|
||||
from time import sleep
|
||||
|
||||
i = 0
|
||||
j = 0
|
||||
|
||||
def reset():
|
||||
global i
|
||||
global j
|
||||
i = int(ugfx.width() / 2)
|
||||
j = int(ugfx.height() / 2)
|
||||
ugfx.area(0, 0, ugfx.width(), ugfx.height(), ugfx.BLACK)
|
||||
ugfx.area((i - 1) if i > 0 else 0, (j - 1) if j > 0 else 0, 3 if (i > 0 and i < (ugfx.width() - 1)) else 2, 3 if (j > 0 and j < (ugfx.height() - 1)) else 2, ugfx.GREY)
|
||||
|
||||
ugfx_helper.init()
|
||||
ugfx.clear()
|
||||
|
||||
dialogs.notice("Draw with joystick arrows\nHold joystick centre for circle\nA to clear\nB to exit", title="Sketchy-Etch")
|
||||
|
||||
ugfx.area(0, 0, ugfx.width(), ugfx.height(), ugfx.BLACK)
|
||||
|
||||
|
||||
i = int(ugfx.width() / 2)
|
||||
j = int(ugfx.height() / 2)
|
||||
while (not Buttons.is_pressed(Buttons.BTN_A)) and (not Buttons.is_pressed(Buttons.BTN_B)) and (not Buttons.is_pressed(Buttons.BTN_Menu)):
|
||||
circleSize = 3
|
||||
reset()
|
||||
while not Buttons.is_pressed(Buttons.BTN_B):
|
||||
changed = False
|
||||
oldI = i
|
||||
oldJ = j
|
||||
|
||||
if Buttons.is_pressed(Buttons.JOY_Right) and (i < (ugfx.width() - 1)):
|
||||
i += 1
|
||||
|
@ -35,8 +50,19 @@ while (not Buttons.is_pressed(Buttons.BTN_A)) and (not Buttons.is_pressed(Button
|
|||
j -= 1
|
||||
changed = True
|
||||
|
||||
if Buttons.is_pressed(Buttons.JOY_Center):
|
||||
circleSize += 1
|
||||
ugfx.fill_circle(i, j, circleSize, ugfx.WHITE)
|
||||
changed = True
|
||||
else:
|
||||
circleSize = 3
|
||||
|
||||
if Buttons.is_pressed(Buttons.BTN_A):
|
||||
reset()
|
||||
|
||||
if changed:
|
||||
ugfx.area((i - 1) if i > 0 else 0, (j - 1) if j > 0 else 0, 3 if (i > 0 and i < (ugfx.width() - 1)) else 2, 3 if (j > 0 and j < (ugfx.height() - 1)) else 2, ugfx.WHITE)
|
||||
ugfx.area((oldI - 1) if oldI > 0 else 0, (oldJ - 1) if oldJ > 0 else 0, 3 if (oldI > 0 and oldI < (ugfx.width() - 1)) else 2, 3 if (oldJ > 0 and oldJ < (ugfx.height() - 1)) else 2, ugfx.WHITE)
|
||||
ugfx.area((i - 1) if i > 0 else 0, (j - 1) if j > 0 else 0, 3 if (i > 0 and i < (ugfx.width() - 1)) else 2, 3 if (j > 0 and j < (ugfx.height() - 1)) else 2, ugfx.GREY)
|
||||
|
||||
sleep(0.05)
|
||||
|
||||
|
|
Loading…
Reference in New Issue