From 1e00234eb98fd7e6839048c465fb08bfc5a4325e Mon Sep 17 00:00:00 2001 From: Raúl Gutiérrez S Date: Tue, 08 Dec 2009 20:35:51 +0000 Subject: More cleanup. Now we have the Sprite class where all the selected, copied, paste, etc. logic should go. Cleaned the corresponding client code as well, not thoroughfully tested , though --- (limited to 'taturtle.py') diff --git a/taturtle.py b/taturtle.py index 42447c3..524a35f 100644 --- a/taturtle.py +++ b/taturtle.py @@ -54,14 +54,14 @@ color_table = ( def tNew(tw,w,h): t = taTurtle() t.tw, t.width, t.height = tw, w, h - t.canvas = sprNew(tw,0,0,gtk.gdk.Pixmap(tw.area,w,h,-1)) + t.canvas = Sprite(tw,0,0,gtk.gdk.Pixmap(tw.area,w,h,-1)) t.canvas.type = 'canvas' - setlayer(t.canvas,600) + t.canvas.setlayer(600) t.shapelist = \ [load_image(tw, tw.path, 'shapes','t'+str(i)) for i in range(36)] - t.spr = sprNew(tw,100,100,t.shapelist[0]) + t.spr = Sprite(tw,100,100,t.shapelist[0]) t.spr.type = 'turtle' - setlayer(t.spr, 630) + t.spr.setlayer(630) t.gc = t.canvas.image.new_gc() t.shade = 0 clearscreen(t) @@ -292,11 +292,11 @@ def draw_line(t,x1,y1,x2,y2): h+t.pensize*t.tw.coord_scale+6) def turn_turtle(t): - setshape(t.spr, t.shapelist[(int(t.heading+5)%360)/10]) + t.spr.setshape(t.shapelist[(int(t.heading+5)%360)/10]) def move_turtle(t): x,y = t.width/2+int(t.xcor), t.height/2-int(t.ycor) - move(t.spr, (t.canvas.x+x-30,t.canvas.y+y-30)) + t.spr.move((t.canvas.x+x-30,t.canvas.y+y-30)) invalt(t,x-30,y-30,60,60) def invalt(t,x,y,w,h): -- cgit v0.9.1