def display(self): g.screen.fill((255, 255, 192)) g.screen.blit(g.bgd, (g.x0, 0)) self.acr.draw() utils.centre_blit(g.screen, g.scores, g.scores_c) utils.display_number(g.score, g.score_c, g.font1) pygame.draw.rect(g.screen, utils.BLACK, g.vinc) utils.display_number(g.target, g.target_c, g.font1) utils.text_blit1(g.screen,g.percent,g.font1,g.percent_xy,\ utils.BLACK,False) if g.best > 0: s = 'Best: ' + str(g.best) + '%' utils.text_blit1(g.screen, s, g.font1, g.best_xy, utils.BLACK, False) if g.count == 2: utils.text_blit(g.screen, 'twice', g.font3, g.count_c, utils.ORANGE, False) if g.count > 2: s = str(g.count) + ' times' utils.text_blit(g.screen, s, g.font3, g.count_c, utils.ORANGE, False) buttons.draw() if self.acr.message != None: utils.message1(g.screen, g.font1, self.acr.message, g.message_c) if g.help_on: utils.centre_blit(g.screen, g.help_img, g.help_cxy)
def display(self): g.screen.blit(g.sky, g.sky_xy) self.soko.draw() buttons.draw() s = str(g.pattern) + ' / ' + str(g.puzzles_n) utils.text_blit1(g.screen, s, g.font2, (g.sx(.5), g.sy(.5)), utils.BLUE, False) if not g.demo_mode and self.soko.complete(): utils.centre_blit(g.screen, g.smiley, g.smiley_c)
def draw(self): g.screen.fill((100, 0, 100)) if self.current == None: self.current = 1 if self.img == None: file1 = str(self.current) + '.png' self.img = utils.load_image(file1, False, 'pages') g.screen.blit(self.img, self.xy) buttons.on(('fd', 'bk')) if self.current == 1: buttons.off('bk') if self.current == 10: buttons.off('fd') s = 'The Flags of the World page ' + str(self.current) utils.text_blit1(g.screen, s, g.font1, self.textxy, utils.CREAM, False)
def draw_legend(self): g.screen.blit(self.legend, self.legend_xy) x, y = self.legend_xy x += g.sy(2) y += g.sy(.05) utils.text_blit1(g.screen,'3 6 9 12',\ g.font2,(x,y),utils.BLUE,False) y += g.sy(1.25) utils.text_blit1(g.screen,'2 3 3 3',\ g.font2,(x,y),utils.BLACK,False) x = g.sx(14.2) y += g.sy(1.75) dx = g.sy(1.77) for n in g.scores: utils.display_number(n, (x, y), g.font2, utils.ORANGE) x += dx
def draw(self): # memory pygame.draw.rect(g.screen, utils.BLACK, self.memory_rect) for box in memory: rect = pygame.Rect(box.x, box.y, self.rect_w, self.rect_h) pygame.draw.rect(g.screen, utils.BLUE, rect, self.rect_t1) addr = str(box.ind) if box.ind < 10: addr = '0' + addr x = box.x + self.address_offset y = box.y + self.address_offset utils.text_blit1(g.screen, addr, g.font2, (x, y), utils.WHITE) value = str(box.value) x = box.x + self.dx2 y = box.y + self.dy2 utils.text_blit(g.screen, value, g.font3, (x, y), utils.WHITE) # program counter box = memory[self.pc] rect = pygame.Rect(box.x, box.y, self.rect_w, self.rect_h) pygame.draw.rect(g.screen, utils.YELLOW, rect, self.rect_t2) # AC rect = pygame.Rect(self.ac_xy, (self.rect_w, self.rect_h)) pygame.draw.rect(g.screen, utils.BLACK, rect) pygame.draw.rect(g.screen, utils.RED, rect, self.rect_t2) x, y = self.ac_xy x += self.address_offset y += self.address_offset utils.text_blit1(g.screen, 'AC', g.font2, (x, y), utils.WHITE) x, y = self.ac_xy x += self.dx2 y += self.dy2 utils.text_blit(g.screen, str(self.ac), g.font3, (x, y), utils.WHITE) # printer g.screen.blit(self.printer, self.printer_xy) x = self.nos_x y = self.nos_y for n in self.nos: if n <> None: utils.display_number1(n, (x, y), g.font3) y += self.nos_dy # input g.screen.blit(self.numbers, self.numbers_xy) if self.input_required: g.screen.blit(self.bright, self.bright_xy) x = self.inos_x y = self.inos_y for n in self.inos: g.screen.blit(nos_imgs[n], (x, y)) x += self.inos_dx
def display(): aim.do() aim.draw() if not aim.running: aim.draw_turtle_abs() player.delay = 100 * (6 - g.level) player.do() player.draw() g.screen.blit(g.basic_imgs[g.shape], (g.basic_x, g.basic_y)) g.screen.blit(g.bgd, (g.sx(0), 0)) if buttons.active('cyan'): g.screen.blit(g.magician, (g.sx(1), g.sy(1.5))) utils.centre_blit(g.screen, g.sparkle, (g.sx(4.5), g.sy(3.1))) angler.draw() s = str(g.repeats[g.repeat]) c = (g.repeat_cx, g.repeat_cy) g.text_rect = utils.text_blit(g.screen, s, g.font2, c, (0, 0, 200)) s = str(g.aim_n + 1) + ' / ' + str(len(my_turtle.aims)) utils.text_blit1(g.screen, s, g.font1, (g.sx(6.3), g.sy(8.3)), (0, 0, 255)) buttons.draw() g.slider.draw()
def draw(self): g.screen.blit(self.bgd,(g.sx(0),0)) cxy=(g.sx(30.5),g.sy(20)) utils.display_number(g.count,cxy,g.font2,utils.CREAM) for lf in lookFor: if not lf.found: utils.centre_blit(g.screen,lf.img,(lf.cx,lf.cy)) if not self.complete and not g.setup_on: img=lookFor[self.find_ind[self.current_ind]].img cxy=(self.frame_cx,self.frame_cy) utils.centre_blit(g.screen,self.frame,cxy) utils.centre_blit(g.screen,img,cxy) x,y=cxy; x-=self.frame.get_width()/2;x+=g.sy(.24) y+=self.frame.get_height()/2; y-=g.sy(.76) n=self.found; s=str(n)+' / '+str(self.find_n) utils.text_blit1(g.screen,s,g.font1,(x,y),utils.BLACK) if self.complete: cxy=(self.frame_cx,self.frame_cy) utils.centre_blit(g.screen,self.frame,cxy) utils.centre_blit(g.screen,self.smiley,cxy)
def draw(self): for pce in self.pieces: g.screen.blit(pce.img,(pce.x,pce.y)) x,y,w,h,d=self.xywhd utils.obox(g.screen,utils.CREAM,x,y,w,h,d) if not self.complete(): d=g.sy(.2); x=self.green.x; y=self.green.y; s=self.dd pygame.draw.rect(g.screen,utils.GREEN,(x,y,s,s),d) if self.count==0: utils.centre_blit(g.screen,g.target,self.target_c) self.number(self.target) else: s=str(self.count)+' / '+str(self.target) rect=utils.text_blit(g.screen,s,g.font2,g.score_c,utils.CREAM,False) if self.count>self.target: utils.text_blit1(g.screen,str(self.count),g.font2,\ (rect.x,rect.y),utils.RED,False) if self.count>self.target: for pce in self.pieces: if pce.state!=0: d=g.sy(.1); x=pce.x; y=pce.y; s=self.dd pygame.draw.rect(g.screen,utils.RED,(x,y,s,s),d)
def display(self): g.screen.fill((0, 180, 0)) buttons.draw() if g.state == 1: for i in range(g.display_last): n = self.cards.yes[i] c = self.cards.centres[i] utils.centre_blit(g.screen, self.cards.imgs[n - 1], c) else: for i in range(len(self.cards.yes)): n = self.cards.yes[i] c = self.cards.centres[i] utils.centre_blit(g.screen, self.cards.imgs[n - 1], c) self.cards.mouse_over() if g.state in [2, 4, 6]: utils.centre_blit(g.screen, self.cards.back, self.cards.back_c) if g.state in [2, 4, 6, 8]: if g.result <> None: ind = len(self.cards.yes) - 1 utils.centre_blit(g.screen, g.result, self.cards.centres[ind]) if g.state == 8: ind = 3 else: ind = (g.state / 2) - 1 yes = self.yes_bu[ind] no = self.no_bu[ind] if g.result == g.tick: if g.perfect: bu = self.yes_bu[ind - 1] else: bu = no else: if g.perfect: bu = no else: bu = yes bu.draw_down() s = str(self.cards.rule_n()) + ' / ' + str(19) utils.text_blit1(g.screen, s, g.font2, (g.sx(1), g.sy(1)), (255, 255, 192)) if g.state == 8: utils.centre_blit(g.screen, g.smiley, self.cards.back_c)
def display(self): if g.state == 1: # normal g.screen.fill(g.bgd_colour) self.castle.current_room.display() self.castle.health_display() utils.centre_blit(g.screen, g.bag_current_img, g.bag_cxy) if g.wishes > 0: utils.centre_blit(g.screen, g.wish_current_img, g.wish_cxy) x = g.wish_x y = g.wish_y utils.display_number(g.wishes, (x + g.sy(2.2), y + g.sy(.9)), g.font1) buttons.draw() if g.best > 0: x = g.sx(16) y = g.sy(20) utils.text_blit1(g.screen, str(g.best), g.font1, (x, y), (255, 128, 255)) x -= g.sy(1.5) y -= g.sy(.3) g.screen.blit(g.star, (x, y)) elif g.state == 2: # inside bag grey = 180 g.screen.fill((grey, grey, grey)) utils.centre_blit(g.screen, g.bag_base, (g.sx(16), g.sy(11.2))) ind = 0 for obj in g.bag: if obj <> None: utils.centre_blit(g.screen, obj.img0, g.inside_bag_cxy[ind]) ind += 1 g.screen.blit(g.inside_bag, (g.sx(0), g.sy(0))) elif g.state == 3: # wishes self.castle.wish_display() elif g.state == 4: # map self.castle.map_display()