Skip to content

Commit

Permalink
Renamed GameEngine.last_idle_event to GameEngine.last_idle_time
Browse files Browse the repository at this point in the history
  • Loading branch information
pathunstrom committed Apr 8, 2019
1 parent 084a792 commit 42d4242
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ppb/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, first_scene: Type, *,
self.event_extensions = defaultdict(dict)
self.running = False
self.entered = False
self.last_idle_event = None
self._last_idle_time = None

# Systems
self.systems_classes = systems
Expand Down Expand Up @@ -81,16 +81,16 @@ def run(self):

def start(self):
self.running = True
self.last_idle_event = time.monotonic()
self._last_idle_time = time.monotonic()
self.activate({"scene_class": self.first_scene,
"kwargs": self.scene_kwargs})

def main_loop(self):
while self.running:
time.sleep(0)
now = time.monotonic()
self.signal(events.Idle(now - self.last_idle_event))
self.last_idle_event = now
self.signal(events.Idle(now - self._last_idle_time))
self._last_idle_time = now
while self.events:
self.publish()
self.manage_scene()
Expand Down

0 comments on commit 42d4242

Please sign in to comment.