def display(self, screen): self.map.display(screen, self.camera.pos) self.cross.image.draw(screen, self.cross.rect) for entity in self.entities: entity.draw(screen, self.camera.pos) self.hud.display(screen)
def repaint(self): self.root.clear() self.root.blit(self._map, width=40) self.root.blit(self._text, x=41, y=1) for entity in self.entities: entity.draw() tdl.flush()
def render(self): self.screen.fill((0, 0, 0)) for entity in self.entities: entity.draw(self.screen) if self.ballAttached: label = self.font.render('Press SPACE to fire', True, (255, 255, 255)) self.renderImageCentered(label) pygame.display.flip()
def draw(self): for x in range(self.w): for y in range(self.h): self.lvl[x][y].draw(0) for room in self.rooms: print room.x ,room.y ,room.w ,room.h room.draw() for wall in self.walls: wall.draw() for croom in self.crooms: croom.draw() for entity in self.entities: entity.draw()
def draw(self, surface): ''' Draw the star field and all the entities on top, basically. draw info texts and hp bar as well ''' surface.fill((0,0,0)) self.star_field.draw(surface) for entity in self.entity_list: entity.draw(surface) if self.game_over == False: self.hp_bar.draw(surface) self.infodisplay.draw(surface) else: self.game_over_draw(surface)
def on_render(self, flag): if flag == "clear": for entity in self.entities: entity.clear(self.main_panel) elif flag == "draw": self.map.draw(self.main_panel, mode = self.drawing_mode) for entity in self.entities: entity.draw(self.main_panel) self.log.draw(self.bottom_panel) libtcod.console_blit(self.main_panel, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0) libtcod.console_blit(self.bottom_panel, 0, 0, self.width, BOTTOM_PANEL_HEIGHT, 0, 0, MAP_HEIGHT) libtcod.console_flush() else: print "Invalid flag passed to App.on_render: " + flag running = False
def draw(self, screen): self.blit(self.background, [0, 0]) gridy = range( max((0 - tilesize[1] - self.topleft[1]) / tilesize[1] + 1, 0), min((self.height - self.topleft[1]) / tilesize[1] + 1, self.mapheight), ) gridx = range( max((0 - tilesize[0] - self.topleft[0]) / tilesize[0] + 1, 0), min((self.width - self.topleft[0]) / tilesize[0] + 1, self.mapwidth), ) for y in gridy: # range(self.mapheight): posy = tilesize[1] * y + self.topleft[1] for x in gridx: # range(self.mapwidth): posx = tilesize[0] * x + self.topleft[0] tile = self.map[y][x] # if (posx+tilesize[0]) > 0 and (posy+tilesize[1] > 0) and posx < self.width and posy < self.height: self.blit(self.tiles[tile], [posx, posy]) if self.mode == "edit" and self.showgrid == True: pygame.draw.rect(self, pygame.color.Color("white"), rect(posx, posy, tilesize[0], tilesize[1]), 1) for entity in self.entities: entity.draw(self) screen.blit(self, [0, 0])
def draw_entities(self): # TODO: check if entities are visible before drawing (vpx, vpy, vpwidth, vpheight) = self.viewport for entity in self.entities: entity.position = (entity.gp.x - vpx, entity.gp.y - vpy) entity.draw()