Exemple #1
0
    def config(self):
        gridpy.set_dim(self.dim)
        gridpy.set_square_size(GUI.SQUARE_SIZE)
        #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(GUI.FPS)
        #gridpy.set_style(gridpy.TRIPLE)
        #gridpy.set_style(gridpy.DOUBLE)
        #gridpy.set_style(gridpy.SINGLE)
        #gridpy.set_style(gridpy.NONE)

        gridpy.title(GUI.TITLE % self.dim)
Exemple #2
0
    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)
Exemple #3
0
# - How do we want to add keybindings?
#   - Use pygame.locals
#   - Use ord('K')
#       - Use 'K' and have ord() happen behind the scenes

import gridpy

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,