def idle(self): '''This function is called every frames. By default : * it "tick" the clock to the next frame * read all input and dispatch event * dispatch on_update + on_draw + on_flip on window ''' # update dt global frame_dt frame_dt = getClock().tick() # read and dispatch input from providers self.dispatch_input() if pymt_window: pymt_window.dispatch_events() pymt_window.dispatch_event('on_update') pymt_window.dispatch_event('on_draw') pymt_window.dispatch_event('on_flip') # don't loop if we don't have listeners ! if len(touch_event_listeners) == 0: self.exit() return False return self.quit
def idle(self): # update dt global frame_dt frame_dt = getClock().tick() # read and dispatch input from providers self.dispatch_input() if pymt_window: pymt_window.dispatch_events() pymt_window.dispatch_event('on_update') pymt_window.dispatch_event('on_draw') pymt_window.flip() # don't loop if we don't have listeners ! if len(touch_event_listeners) == 0: self.exit() return False return self.quit
Current loader is based on pyglet.image.load method, and can create only Sprite and Image pyglet object. .. note:: It'll be reworked in the next version to support loading of other object. ''' def __init__(self, loading_image, async=True): self.cache = {} self.loadlist = {} self.updatelist = [] self.thread = None self.loading_image = self.image(loading_image, async=False) self.default_async=async getClock().schedule_interval(self._run_update, .5) def image(self, name, async=None): '''Load an image, and return a ProxyImage''' # get data cache data = self.get_image(name) if data: return ProxyImage(name=name, loader=self, image=data, loading_image=self.loading_image) # no data ? user want data async or not ? if async is None: async = self.default_async if not async: return pyglet.image.load(name)