예제 #1
0
 def __init__(self, name, color = (255, 255, 255)):  # TODO: replace with a real icon
     import graphics
     self.name = name
     size = settings.iconsize
     try:
         self.img = pygame.image.load(data.filepath(name + ".png")).convert_alpha()
         self.img = pygame.transform.smoothscale(self.img, (size, size))
     except:
         self.img = Surface(size, size, color)
     self.rect = self.img.get_rect()
     self.rect.center = settings.iconpos[self.name]
     self.ghost = graphics.ghostify(self.img)
     self.select = graphics.brighten(self.img)
     self.active = True
     self.selected = False
예제 #2
0
파일: vista.py 프로젝트: wolmir/cristina
 def __init__(self, name,
              color=(255, 255, 255)):  # TODO: replace with a real icon
     import graphics
     self.name = name
     size = settings.iconsize
     try:
         self.img = pygame.image.load(
             data.filepath(name + ".png")).convert_alpha()
         self.img = pygame.transform.smoothscale(self.img, (size, size))
     except:
         self.img = Surface(size, size, color)
     self.rect = self.img.get_rect()
     self.rect.center = settings.iconpos[self.name]
     self.ghost = graphics.ghostify(self.img)
     self.select = graphics.brighten(self.img)
     self.active = True
     self.selected = False
예제 #3
0
 def think(self, dt):
     active = self.meter.amount >= self.amount
     self.visible = self.meter.height >= self.amount
     if not self.visible: return
     self.active = active
     if self.x is None:
         self.x = settings.layout.buildiconxs[self.number % len(settings.layout.buildiconxs)]
         _, self.y = self.meter.meterpos(self.amount, bounded = False)
         self.img = None
     if not self.img:
         self.img = graphics.icon(self.name)
         self.ghost = graphics.ghostify(self.img)
         self.select = graphics.brighten(self.img)
         self.currentimg = self.img
         self.rect = self.currentimg.get_rect(center = (self.x, self.y))
     self.currentimg = (self.select if self.selected else self.img) if self.active else self.ghost
     self.linepos = x,y = self.meter.meterpos(self.amount)
     self.pointedto = False
예제 #4
0
파일: status.py 프로젝트: wolmir/cristina
 def think(self, dt):
     active = self.meter.amount >= self.amount
     self.visible = self.meter.height >= self.amount
     if not self.visible: return
     self.active = active
     if self.x is None:
         self.x = settings.layout.buildiconxs[self.number % len(
             settings.layout.buildiconxs)]
         _, self.y = self.meter.meterpos(self.amount, bounded=False)
         self.img = None
     if not self.img:
         self.img = graphics.icon(self.name)
         self.ghost = graphics.ghostify(self.img)
         self.select = graphics.brighten(self.img)
         self.currentimg = self.img
         self.rect = self.currentimg.get_rect(center=(self.x, self.y))
     self.currentimg = (self.select if self.selected else
                        self.img) if self.active else self.ghost
     self.linepos = x, y = self.meter.meterpos(self.amount)
     self.pointedto = False
예제 #5
0
파일: panel.py 프로젝트: pombredanne/Obb
    def draw(self):
        for j, (age, appspec, (cx, cy)) in enumerate(zip(self.ages, self.tiles, self.centers)):
            color = "app%s" % int(j / 2)
            if age < -1:
                img = graphics.loadbar(1 - ((-age - 1) / 5), color)
                rect = img.get_rect(center=(cx, cy))
            else:
                img = graphics.drawpaneltile(appspec.dedges, color, tilt=age * 450)
                if self.selected == j:
                    img = graphics.brighten(img)
                    # pygame.draw.circle(vista.psurf, (255, 255, 255), self.centers[self.selected], settings.layout.ptilesize, 2)
                rect = img.get_rect(center=(cx + age * 300, cy))
            vista.psurf.blit(img, rect)

            # Draw cube tally
        color, size = (0, 0, 0), settings.layout.countsize
        img = font.img("%s" % (self.body.ncubes), size=size, color=color)
        vista.psurf.blit(self.cubeimg, self.cuberect)
        self.ncuberect = img.get_rect(midleft=self.cuberect.midright)
        vista.psurf.blit(img, self.ncuberect)
예제 #6
0
파일: panels.py 프로젝트: pombredanne/Obb
def drawtiles():
	loadrate = status.state.tileloadrate
	for j in range(mechanics.ntiles):
		tiletime = status.state.tiletimes[j]
		color = "app" + str(mechanics.tilecolors[j])
		appspec = status.state.tiles[j]
		cx, cy = tilepos(j)
		if tiletime <= 0:  # Draw it in its normal place
			img = graphics.drawpaneltile(appspec.dedges, color)
			if j == selectedtile:
				img = graphics.brighten(img)
		elif tiletime <= loadrate:  # Draw it rolling in from the left
			frac = float(tiletime) / loadrate
			cx -= int(frac * settings.layout.tilerollx)
			img = graphics.drawpaneltile(appspec.dedges, color, tilt = -450 * frac)
		else:  # Draw the progress bar
			part = float(mechanics.tileloadtime - tiletime)
			full = float(mechanics.tileloadtime - loadrate)
			assert 0 <= part <= full
			img = graphics.loadbar(part / full if full else 0, color)
		rect = img.get_rect(center = (cx, cy))
		vista.psurf.blit(img, rect)
예제 #7
0
파일: panel.py 프로젝트: wolmir/cristina
    def draw(self):
        for j, (age, appspec,
                (cx, cy)) in enumerate(zip(self.ages, self.tiles,
                                           self.centers)):
            color = "app%s" % int(j / 2)
            if age < -1:
                img = graphics.loadbar(1 - ((-age - 1) / 5), color)
                rect = img.get_rect(center=(cx, cy))
            else:
                img = graphics.drawpaneltile(appspec.dedges,
                                             color,
                                             tilt=age * 450)
                if self.selected == j:
                    img = graphics.brighten(img)
#                    pygame.draw.circle(vista.psurf, (255, 255, 255), self.centers[self.selected], settings.layout.ptilesize, 2)
                rect = img.get_rect(center=(cx + age * 300, cy))
            vista.psurf.blit(img, rect)

        # Draw cube tally
        color, size = (0, 0, 0), settings.layout.countsize
        img = font.img("%s" % (self.body.ncubes), size=size, color=color)
        vista.psurf.blit(self.cubeimg, self.cuberect)
        self.ncuberect = img.get_rect(midleft=self.cuberect.midright)
        vista.psurf.blit(img, self.ncuberect)