Ejemplo n.º 1
0
 def __init__(self, board):
     toolbar.Tool.__init__(self)
     self.board = board
     pygame.draw.rect(self.image, bg_color, self.rect.inflate(-4, -4))
     symbol = text.render("x:", text_color)
     symbol.rect.topleft = (3, 3)
     self.image.blit(symbol.image, symbol.rect)
Ejemplo n.º 2
0
 def __init__(self):
     self.board = Board(self)
     self.clickables = []    
     self.cursor = cursor.Cursor() 
     
     self.toolbar = toolbar.Toolbar()
     self.toolbar.add_tool(components.display.DisplayTool(self.board))
     self.toolbar.add_tool(components.button.ButtonTool(self.board))
     self.clickables.append(self.toolbar)
     
     infotext = text.render('FlowSID v0.0.1')
     info = pygame.sprite.Sprite()
     info.image = pygame.Surface(infotext.rect.inflate(3, 3).size)
     info.rect = info.image.get_rect()
     info.image.fill(palette.color(0x10))
     pygame.draw.rect(info.image, palette.color(0x20), info.rect, 1)
     infotext.rect.move_ip(2, 2)
     info.image.blit(infotext.image, infotext.rect)
     colors = tuple(palette.color(x) for x in (0x10,0x20,0x30,0x20))
     def update_info(frame):
         info.rect.bottomright = graphics.screen.get_size()
         for x in range(info.rect.width - 2):
             color = colors[(x - 16*len(colors)*frame/255)/2%len(colors)]
             info.image.fill(color, pygame.Rect(x + 1, 1, 1, 1))
             info.image.fill(color, pygame.Rect(info.rect.width - x - 2, 
                                                info.rect.height - 2, 1, 1))
         
     info.update = update_info
     graphics.uilayer.add(info)
Ejemplo n.º 3
0
 def inp(self, value):
     self.text = text.render(pprint.saferepr(value), text_color)
     self.text.rect.topleft = (5, 4)
     self.scroll = True