def drawcubeicon(): img = graphics.cube.img(zoom = settings.layout.organcountsize, edge0 = 0) rect1 = img.get_rect(center = settings.layout.cubeiconpos) vista.psurf.blit(img, rect1) color, size = (0,0,0), settings.layout.countsize img = font.img(str(status.state.ncubes), size=size, color=color) rect2 = img.get_rect(midleft = rect1.midright) vista.psurf.blit(img, rect2) iconrects["ncube"] = rect1.union(rect2).move(settings.px0, settings.py0)
def drawcontrolicon(): img = graphics.brain.img(zoom = settings.layout.organcountsize) rect1 = img.get_rect(bottomleft = settings.layout.brainiconpos) vista.rsurf.blit(img, rect1) color, size = (0,0,0), settings.layout.countsize if status.state.control >= status.state.maxcontrol: color, size = (128, 0, 0), int(size * 1.5) text = "%s/%s" % (status.state.control, status.state.maxcontrol) img = font.img(text, size=size, color=color) rect2 = img.get_rect(midleft = settings.layout.controlpos) vista.rsurf.blit(img, rect2) iconrects["control"] = rect1.union(rect2).move(settings.rx0, settings.ry0)
def nexttrack(): global track if settings.silent: return if track == len(tracks): # music off pygame.mixer.music.stop() track = 0 else: fname = data.filepath(tracks[track] + ".ogg") pygame.mixer.music.load(fname) pygame.mixer.music.play(-1) track += 1 vista.musicicontext = font.img(str(track), size = settings.layout.countsize, color=(0,0,0))
def nexttrack(): global track if settings.silent: return if track == len(tracks): # music off pygame.mixer.music.stop() track = 0 else: fname = data.filepath(tracks[track] + ".ogg") pygame.mixer.music.load(fname) pygame.mixer.music.play(-1) track += 1 vista.musicicontext = font.img(str(track), size=settings.layout.countsize, color=(0, 0, 0))
def flip(): _screen.blit(screen, vrect) _screen.blit(psurf, prect) _screen.blit(rsurf, rrect) for surf, rect in overlays: _screen.blit(surf, rect) for icon in icons.values(): icon.draw() import noise if noise.track: musicicontext = font.img(str(noise.track), size = settings.layout.countsize, color=(0,0,0)) rect = musicicontext.get_rect(midright = icons["music"].rect.center) _screen.blit(musicicontext, rect) tip.draw() pygame.display.flip()
def addsplash(): _screen.fill((0,0,0)) titleimg = font.img("Obb", size = settings.layout.titlesize, background = (0,0,0), constrainwidth = False) titlerect = titleimg.get_rect(midtop = settings.layout.titlepos) _screen.blit(titleimg, titlerect) try: splash = pygame.image.load("obb.png").convert() splash = pygame.transform.smoothscale(splash, (settings.sy, settings.sy)) w, h = splash.get_size() sheight = int(h * 0.6) subsplash = splash.subsurface((0, h - sheight, w, sheight)) _screen.blit(subsplash, subsplash.get_rect(midbottom = _screen.get_rect().midbottom)) except: # We're not about to crash the game over someone deleting the splash screen png pass x, y = settings.size for text in ["incompetech.com", _("music by Kevin MacLeod "), _("Universe Factory games"), _("by Christopher Night ")]: img = font.img(text, size = settings.layout.splashsize, color = (255, 255, 255), constrainwidth = False) rect = img.get_rect(bottomright = (x, y)) _screen.blit(img, rect) y -= rect.height pygame.display.flip()
def draw(self): self.mutagenmeter.draw() self.healmeter.draw() # Draw control tally color, size = (0, 0, 0), settings.layout.countsize if self.body.control >= self.body.maxcontrol: color, size = (128, 0, 0), int(size * 1.5) controlimg = font.img("%s/%s" % (self.body.control, self.body.maxcontrol), size=size, color=color) if not self.brainimg: self.brainimg = graphics.brain.img(zoom=settings.layout.organcountsize) self.brainrect = self.brainimg.get_rect(bottomleft=settings.layout.brainiconpos) self.controlrect = self.brainrect vista.rsurf.blit(self.brainimg, self.brainrect) self.controlrect = controlimg.get_rect(midleft=settings.layout.controlpos) vista.rsurf.blit(controlimg, self.controlrect)
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)
def draw(self): self.mutagenmeter.draw() self.healmeter.draw() # Draw control tally color, size = (0, 0, 0), settings.layout.countsize if self.body.control >= self.body.maxcontrol: color, size = (128, 0, 0), int(size * 1.5) controlimg = font.img("%s/%s" % (self.body.control, self.body.maxcontrol), size=size, color=color) if not self.brainimg: self.brainimg = graphics.brain.img( zoom=settings.layout.organcountsize) self.brainrect = self.brainimg.get_rect( bottomleft=settings.layout.brainiconpos) self.controlrect = self.brainrect vista.rsurf.blit(self.brainimg, self.brainrect) self.controlrect = controlimg.get_rect( midleft=settings.layout.controlpos) vista.rsurf.blit(controlimg, self.controlrect)