From e1d62da7632f087840f6c10b97a994a2e6fef17e Mon Sep 17 00:00:00 2001 From: Brian Caine Date: Thu, 6 Dec 2007 23:23:44 -0500 Subject: [PATCH] Added Entity. Forgot to put this in the last commit. --- demo/Entity.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 demo/Entity.py diff --git a/demo/Entity.py b/demo/Entity.py new file mode 100644 index 0000000..dd397e9 --- /dev/null +++ b/demo/Entity.py @@ -0,0 +1,47 @@ +#!/usr/bin/python +# this is the Entity class + +from Dice3DS import * + +def main(): + print "Entity class...more documentation to come" + +class Entity: + + def __init__(self, engine, specs): + + self.functions = {} + + if specs.has_key('script'): + try: + self.script = engine.readZipfile(specs['script']) + exec(self.script) + except: + print "Entity.__init__(): Couldn't find/exec script" + + assert specs.has_key('name') + self.name = specs['name'] + + if specs.has_key('model'): + #try: + self.data = read_3ds_mem(engine.readZipfile(specs['model']), 1, 1) + #except: + # print "Entity.__init__(): Error reading model" + + def draw(self, engine): + + # implement this + + return + + def event(self, event, data): + + if self.functions.has_key(event): + try: + self.functions[event](data) + except: + print "Entity.event(): Error running event callback" + + return + +if __name__ == '__main__': main() -- 2.11.4.GIT