Esempio n. 1
0
    def run_main(self):
        info("Initializing PygameCore")
        frame.pygame.init()
        frame.screen=frame.pygame.display.set_mode((800,600))
        frame.pygame.display.set_caption(frame.loader["window_title"])
        self.clock=frame.pygame.time.Clock()
        running=True

        debug("Creating a PyConsole (enabled ="+str(frame.loader["enable_pyconsole"])+")")
        self.pyconsole=frame._pyconsole_Console(frame.screen, (0,0,800,200), localsx={"frame":frame})

        frame.send_event("core_loaded")

        while running:
            self.clock.tick(frame.loader["target_fps"]) if frame.loader["target_fps"]!=-1 else self.clock.tick()
            dt=(1/self.clock.get_fps() if self.clock.get_fps()>0 else 0)
            frame.screen.fill((0,0,0))
            frame.send_event("render", dt)
            self.pyconsole.draw()
            frame.pygame.display.update()
            events=frame.pygame.event.get()
            frame.send_event("pygame_batch_events", events)
            self.pyconsole.process_input(events)

            for event in events:
                frame.send_event("pygame_event", event)
                if event.type==frame.pygame.KEYDOWN:
                    if event.key==frame.pygame.K_BACKQUOTE:
                        if frame.loader["enable_pyconsole"]:self.pyconsole.set_active()
                if event.type==frame.pygame.QUIT:
                    frame.send_event("shutdown")
                    running=False
Esempio n. 2
0
 def run_main(self):
     print("DummyCore Invoked")
     info("DummyCore started!")
     frame.send_event("core_loaded")
     while 1:
         try:
             frame.send_event("render", 0)
         except BaseException as e:
             exception("Error in render call")
Esempio n. 3
0
File: tmx.py Progetto: 602p/JT3
 def load_map(self, fn):
     info("Loading map "+fn)
     frame.send_event("tmx_will_load_map", fn)
     self.current=TMXMap(fn)
     self.current.add_entities_to(frame.entities)
     frame.send_event("tmx_loaded_map", fn)
Esempio n. 4
0
File: state.py Progetto: 602p/JT3
 def pop(self):
     frame.send_event("state_ending", self.current)
     self.stack.pop()
Esempio n. 5
0
File: state.py Progetto: 602p/JT3
 def push(self, state):
     debug("Entering state " + state)
     if self.current:
         frame.send_event("state_suspending", self.current)
     self.stack.append([state, StateData()])
     frame.send_event("state_starting", self.current)