Exemplo n.º 1
0
            self.assertEqual(obj, jbo)
        elif testname == 'del':
            killer = getattr(db, 'del' + suf)
            writer(*mkargs)
            self.assertTrue(knower(*keytup))
            killer(*keytup)
            self.assertFalse(knower(*keytup))

    def runTest(self):
        testl = ['make', 'save', 'get', 'del', 'make']
        db = Database(":memory:", default.stubs)
        db.mkschema()
        tabkey = [('place', default.places, Place),
                  ('portal', default.portals, Portal),
                  ('thing', default.things, Thing),
                  ('color', default.colors, Color),
                  ('style', default.styles, Style),
                  ('attribute', default.attributes, AttrCheck),
                  ('attribution', default.attributions, Attribution)]
        for pair in tabkey:
            suf = pair[0]
            for val in pair[1]:
                for test in testl:
                    print "Testing %s%s" % (test, suf)
                    self.testSomething(db, suf, pair[2],
                                       val[0], val[1], test)

db = Database(":memory:")
db.mkschema()
db.insert_defaults(default)
Exemplo n.º 2
0
            s = pyglet.sprite.Sprite(pawn.img, x - pawn.r, y, batch=self.batch, group=self.pawngroup)
        else:
            dim = pawn.board.dimension
            locn = pawn.thing.location.name
            spot = self.db.spotdict[dim][locn]
            # Pawns are centered horizontally, but not vertically, on
            # the spot they stand.  This prevents them from covering
            # the spot overmuch while still making them look like
            # they're "on top" of the spot.
            x = spot.x
            y = spot.y
            s = pyglet.sprite.Sprite(pawn.img, x - pawn.r, y, batch=self.batch, group=self.pawngroup)
        self.drawn[pawn] = s

    def pawns_on(self, spot):
        return [thing.pawn for thing in self.db.things_in_place(spot.place)]


db = Database(":memory:")
db.mkschema()
db.insert_defaults()
gamestate = GameState(db)
gw = GameWindow(db, gamestate, "Physical")


gamespeed = 1 / 60.0

# pyglet.clock.schedule_interval(gamestate.update, gamespeed, gamespeed)

pyglet.app.run()