예제 #1
0
파일: search.py 프로젝트: wavebeem/gridpy
    def __init__(self, map):
        self.items = {}
        self.rows  = len(map)
        self.cols  = len(map[0])
        
        gridpy.set_fps(10)

        for r in xrange(self.rows):
            for c in xrange(self.cols):
                square = map[r][c]
                pos = (c, r)
                if square == 'A':
                    self.items[pos] = Player(pos, self)
                elif square == 'B':
                    self.items[pos] = Goal(pos, self)
                elif square == 'X':
                    self.items[pos] = Rock(pos, self)

        gridpy.title("Search demo")
        gridpy.show()

        for pos, thing in self.items.iteritems():
            gridpy.plot(thing.color(), pos)
예제 #2
0
파일: gui.py 프로젝트: wavebeem/gridpy
 def run(self):
     self.config()
     gridpy.show()
     self.main_loop()
예제 #3
0
size = (50, 50)

gridpy.set_dim(size)
#gridpy.set_square_size(1)
gridpy.set_square_size(2)
#gridpy.set_background_color(gridpy.BLACK)
#gridpy.set_border_colors(gridpy.BLUE, gridpy.BLACK)
#gridpy.set_border_colors(gridpy.GREY, gridpy.WHITE)
gridpy.set_fps(999999)
#gridpy.set_style(gridpy.TRIPLE)
#gridpy.set_style(gridpy.DOUBLE)
#gridpy.set_style(gridpy.SINGLE)
#gridpy.set_style(gridpy.NONE)

gridpy.title("A simple demo")
gridpy.show()

def cycle(list):
    while True:
        for item in list:
            yield item

rainbow = cycle([
    gridpy.CYAN,
    gridpy.YELLOW,
    gridpy.MAGENTA,
    gridpy.RED,
    gridpy.GREEN,
    gridpy.BLUE,
    gridpy.WHITE,
    gridpy.GREY,