Littluns

Littluns Commit Details

Date:2009-12-23 14:06:10 (4 years 11 months ago)
Author:Ciaran Gultnieks
Branch:master
Commit:49e58af940eb8157d58aa3ee0b2f87817f2b5723
Parents: ed38593bc634bc70a48c554edc9d0568cdbab0e7
Message:Crayon - use left button to draw, right to change colour

Changes:
Mcrayon.py (1 diff)

File differences

crayon.py
133133
134134
135135
136
136
137137
138
139
140138
141139
142140
143141
144142
145143
144
146145
147
146
148147
149148
150
151
149
150
152151
153152
154153
self.background.fill((0, 0, 0))
self.changed = True
elif event.type == MOUSEBUTTONDOWN:
if event.button == 1:
if event.button == 3:
self.crayon.up()
elif event.button == 3:
self.crayon.down()
self.changed = True
elif event.type == MOUSEMOTION:
self.crayon.move(event.rel, self.screen)
self.changed = True
def on_change(self):
b1, b2, b3 = pygame.mouse.get_pressed()
drawpos = self.crayon.get_drawpos()
if drawpos != self.mprev:
if b1:
if self.mprev:
self.line(self.background, self.mprev, drawpos,
self.crayon.color())
self.mprev = drawpos
self.crayon.color())
self.mprev = drawpos
self.allsprites.update()
self.screen.blit(self.background, (0, 0))
self.allsprites.draw(self.screen)

Archive Download the corresponding diff file

Branches