Skip to content

Instantly share code, notes, and snippets.

@SebastianJarsve
Created April 3, 2013 01:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SebastianJarsve/5297697 to your computer and use it in GitHub Desktop.
Save SebastianJarsve/5297697 to your computer and use it in GitHub Desktop.
from scene import *
class MyScene (Scene):
def setup(self):
self.xybegin = Point(0,0)
self.lines = []
def draw(self):
background(0, 0, 0)
fill(0, 0, 1)
stroke(0, 0, 1)
stroke_weight(3)
for l in self.lines:
line(*l)
text(str(len(self.lines)), x=100,y=100)
def touch_began(self, touch):
x = touch.location.x
y = touch.location.y
self.xybegin = Point(x,y)
def touch_moved(self, touch):
x = touch.location.x
y = touch.location.y
ppos = touch.prev_location
self.lines.append((ppos.x, ppos.y, x, y))
def touch_ended(self, touch):
x = touch.location.x
y = touch.location.y
ppos = touch.prev_location
self.lines.append((ppos.x, ppos.y, x, y))
run(MyScene())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment