Skip to content

Commit

Permalink
Merge #487 #509
Browse files Browse the repository at this point in the history
487: Add time_delta property to PreRender event. r=pathunstrom a=ironfroggy



509: Add 3.9 to CI r=pathunstrom a=astronouth7303

Add 3.9 to CI

Co-authored-by: Calvin Spealman <ironfroggy@gmail.com>
Co-authored-by: ironfroggy <ironfroggy@gmail.com>
Co-authored-by: Jamie Bliss <jamie@ivyleav.es>
  • Loading branch information
3 people authored Aug 16, 2020
3 parents 0bf5e28 + 0238760 + 00328b6 commit 4ea46b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ task:
name: "Linux $IMAGE"
alias: Tests
skip: $CIRRUS_BRANCH =~ '.*\.tmp'
allow_failures: $IMAGE =~ '.*-rc-.*'
allow_failures: $IMAGE =~ '.*[-:]rc-.*'
env:
matrix:
- IMAGE: python:3.6-slim
- IMAGE: python:3.7-slim
- IMAGE: python:3.8-slim
- IMAGE: python:rc-slim
- IMAGE: pypy:3.6-slim

container:
Expand Down Expand Up @@ -121,7 +122,7 @@ task:
name: "Windows $IMAGE"
alias: Tests
skip: $CIRRUS_BRANCH =~ '.*\.tmp'
allow_failures: $IMAGE =~ '.*-rc-.*'
allow_failures: $IMAGE =~ '.*[-:]rc-.*'
windows_container:
os_version: 2019
image: $IMAGE
Expand All @@ -131,6 +132,7 @@ task:
- IMAGE: python:3.6-windowsservercore
- IMAGE: python:3.7-windowsservercore
- IMAGE: python:3.8-windowsservercore
- IMAGE: python:rc-windowsservercore

install_script:
- C:\Python\python.exe -m pip install --upgrade-strategy eager -U -r requirements-tests.txt
Expand Down
1 change: 1 addition & 0 deletions ppb/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class PreRender:
strictly for display purposes (like the text of a score board or the
position of the camera) should happen ``on_pre_render``.
"""
time_delta: float #: Seconds since last PreRender.
scene: BaseScene = None #: The currently running scene.


Expand Down
4 changes: 3 additions & 1 deletion ppb/systems/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def __init__(
self.target_frame_rate = target_frame_rate
self.target_frame_length = 1 / self.target_frame_rate
self.target_clock = get_time() + self.target_frame_length
self.last_frame = get_time()

self._texture_cache = ObjectSideData()

Expand Down Expand Up @@ -171,9 +172,10 @@ def __exit__(self, *exc):
def on_idle(self, idle_event: events.Idle, signal):
t = get_time()
if t >= self.target_clock:
signal(events.PreRender())
signal(events.PreRender(t - self.last_frame))
signal(events.Render())
self.target_clock = t + self.target_frame_length
self.last_frame = t

def on_scene_started(self, scene_started, signal):
scene = scene_started.scene
Expand Down

0 comments on commit 4ea46b4

Please sign in to comment.