def initRenderer(self): pygame.init() if not 'Size' in self: size = (1000, 200) else: size = self['Size'] self.screen = pygame.display.set_mode(size) self.background = pygame.Surface(self.screen.get_size()) self.background = self.background.convert() self.background.fill(Color(0, 0, 0)) self.stopwatch = timeops.Stopwatch() self.stopwatch.start()
def __init__(self, configFileName): main_log.info("System Initialization began based on: " + str(configFileName)) self.timer = clock.Stopwatch() self.timer.start() self.inputs = {} #dict of inputs and their bound behaviors, keyed by InputId self.behaviors = {} self.lock = thread.allocate_lock() self.behaviorOutputs = {} #key: [list of output destinations] self.behaviorInputs = {} self.componentDict = {} self.inputBehaviorRegistry = {} #inputid -> behaviors listening to that self.dieNow = False #input self.screen = Screen() compReg.initRegistry() compReg.registerComponent(self.screen, 'Screen') #TODO: move to constants file bqs.initBQS() #initialize the behavior query system #read configs from xml config = configGetter.loadConfigFile(configFileName) rendererConfig = config.find('RendererConfiguration') self.initializeRenderers(rendererConfig) pixelConfig = config.find('PixelConfiguration') self.initializeScreen(pixelConfig) inputConfig = config.find('InputConfiguration') self.initializeInputs(inputConfig) behaviorConfig = config.find('BehaviorConfiguration') self.initializeBehaviors(behaviorConfig) mapperConfig = config.find('PixelMapperConfiguration') self.initializeMapper(mapperConfig) #inits main_log.info('All components initialized') # self.registerAllComponents() installationConfig = config.find('InstallationConfiguration') self.configureInstallation(installationConfig) #Done initializing. Lets start this thing! self.timer.stop() #main_log.info('Initialization done. Time: ', self.timer.elapsed(), 'ms') self.mainLoop()