Exemplo n.º 1
0
def color_regions(world):
    global foreground
    global all_regions
    for points in all_regions:
        if points.keys()[0] in world["players"][0]["regions"]:
            pygame.draw.polygon(foreground, hex_to_rgb("0052a5"), points.values()[0])
        if points.keys()[0] in world["players"][1]["regions"]:
            pygame.draw.polygon(foreground, hex_to_rgb("a80000"), points.values()[0])
Exemplo n.º 2
0
def draw_map(foreground):
    #get the china map but make sure they are polygons
    global china_regions
    global usa_regions
    china_regions = ([x for x in _map.get_map(1)
    if len(x.values()[0]) > 2])

    #draw the china map
    for points in china_regions:
        (pygame.draw.polygon(foreground, hex_to_rgb("a80000"),
        points.values()[0]))

    #get the usa map but make sure they are polygons
    usa_regions = ([x for x in _map.get_map(0)
    if len(x.values()[0]) > 2])

    #draw the usa map
    for points in usa_regions:
        (pygame.draw.polygon(foreground, hex_to_rgb("0052a5"),
        points.values()[0]))

    #todo: don't use global
    global all_regions
    all_regions = china_regions + usa_regions