示例#1
0
文件: gui.py 项目: aruse/Bludgeon
def render_map():
    """Draw all the map Cells onto the map surface."""
    CS.map_surf.fill(CLR["black"])

    for x in xrange(CS.map.w):
        for y in xrange(CS.map.h):
            if CS.u.fov_map.in_fov(x, y):
                CS.map.grid[x][y].draw(x, y)
                CS.map.grid[x][y].explored = True
            else:
                if CS.map.grid[x][y].explored:
                    CS.map.grid[x][y].draw_gray(x, y)
                else:
                    CS.map_surf.blit(CS.tiles_img, cell2pixel(x, y), CS.blank_tile)
示例#2
0
文件: gui.py 项目: aruse/Bludgeon
def render_map():
    """Draw all the map Cells onto the map surface."""
    CS.map_surf.fill(CLR['black'])

    for x in xrange(CS.map.w):
        for y in xrange(CS.map.h):
            if CS.u.fov_map.in_fov(x, y):
                CS.map.grid[x][y].draw(x, y)
                CS.map.grid[x][y].explored = True
            else:
                if CS.map.grid[x][y].explored:
                    CS.map.grid[x][y].draw_gray(x, y)
                else:
                    CS.map_surf.blit(CS.tiles_img,
                                     cell2pixel(x, y), CS.blank_tile)
示例#3
0
文件: gui.py 项目: aruse/Bludgeon
def draw_line_between(x1, y1, x2, y2, color):
    """Draw a line between the two given adjacent cells."""
    # Horizontal line, (x1, y1) on the left
    if x1 < x2:
        coords1 = cell2pixel(x2, y2)
        coords2 = cell2pixel(x2, y2 + 1)
    # Horizontal line, (x2, y2) on the left
    elif x2 < x1:
        coords1 = cell2pixel(x1, y1)
        coords2 = cell2pixel(x1, y1 + 1)
    # Vertical line, (x1, y1) on the top
    elif y1 < y2:
        coords1 = cell2pixel(x2, y2)
        coords2 = cell2pixel(x2 + 1, y2)
    # Vertical line, (x2, y2) on the top
    elif y2 < y1:
        coords1 = cell2pixel(x1, y1)
        coords2 = cell2pixel(x1 + 1, y1)

    pygame.draw.line(CS.map_surf, color, coords1, coords2, 1)
示例#4
0
文件: gui.py 项目: aruse/Bludgeon
def draw_line_between(x1, y1, x2, y2, color):
    """Draw a line between the two given adjacent cells."""
    # Horizontal line, (x1, y1) on the left
    if x1 < x2:
        coords1 = cell2pixel(x2, y2)
        coords2 = cell2pixel(x2, y2 + 1)
    # Horizontal line, (x2, y2) on the left
    elif x2 < x1:
        coords1 = cell2pixel(x1, y1)
        coords2 = cell2pixel(x1, y1 + 1)
    # Vertical line, (x1, y1) on the top
    elif y1 < y2:
        coords1 = cell2pixel(x2, y2)
        coords2 = cell2pixel(x2 + 1, y2)
    # Vertical line, (x2, y2) on the top
    elif y2 < y1:
        coords1 = cell2pixel(x1, y1)
        coords2 = cell2pixel(x1 + 1, y1)

    pygame.draw.line(CS.map_surf, color, coords1, coords2, 1)
示例#5
0
 def draw_gray(self, x, y):
     """Draw this Cell on the map at the given coords, grayed out."""
     CS.map_surf.blit(CS.gray_tiles_img, cell2pixel(x, y), self.tile)
示例#6
0
 def draw(self, x, y):
     """Draw this Cell on the map at the given coords."""
     CS.map_surf.blit(CS.tiles_img, cell2pixel(x, y), self.tile)
示例#7
0
文件: gui.py 项目: aruse/Bludgeon
def draw_box(x, y, color):
    """Draw a box around the cell at the given coords."""
    coords = cell2pixel(x, y)
    pygame.draw.rect(CS.map_surf, color, Rect(coords[0], coords[1], cfg.TILE_W, cfg.TILE_H), 1)
示例#8
0
 def draw_gray(self):
     """Draw this Object on the map at the current location, grayed out."""
     CS.map_surf.blit(CS.gray_tiles_img,
                      cell2pixel(self.x, self.y),
                      self.tile)
示例#9
0
 def draw(self):
     """Draw this Object on the map at the current location."""
     CS.map_surf.blit(CS.tiles_img,
                      cell2pixel(self.x, self.y),
                      self.tile)
示例#10
0
 def draw_gray(self):
     """Draw this Object on the map at the current location, grayed out."""
     CS.map_surf.blit(CS.gray_tiles_img, cell2pixel(self.x, self.y),
                      self.tile)
示例#11
0
 def draw(self):
     """Draw this Object on the map at the current location."""
     CS.map_surf.blit(CS.tiles_img, cell2pixel(self.x, self.y), self.tile)
示例#12
0
 def draw_gray(self, x, y):
     """Draw this Cell on the map at the given coords, grayed out."""
     CS.map_surf.blit(CS.gray_tiles_img, cell2pixel(x, y), self.tile)
示例#13
0
 def draw(self, x, y):
     """Draw this Cell on the map at the given coords."""
     CS.map_surf.blit(CS.tiles_img, cell2pixel(x, y), self.tile)
示例#14
0
文件: gui.py 项目: aruse/Bludgeon
def draw_box(x, y, color):
    """Draw a box around the cell at the given coords."""
    coords = cell2pixel(x, y)
    pygame.draw.rect(CS.map_surf, color,
                     Rect(coords[0], coords[1], cfg.TILE_W, cfg.TILE_H), 1)