Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions arcade/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
import logging
import os
import sys
import time
from typing import Tuple, Optional

Expand Down Expand Up @@ -31,6 +32,7 @@

_window: 'Window'

_in_debugger = sys.gettrace() is not None

def get_screens():
"""
Expand Down Expand Up @@ -323,6 +325,10 @@ def _dispatch_updates(self, delta_time: float):
Internal function that is scheduled with Pyglet's clock, this function gets run by the clock, and
dispatches the on_update events.
"""
# Clamp delta_time in debugger, since long debugger pauses should not
# cause sky-high `delta_time` on the next frame.
if _in_debugger:
delta_time = min(delta_time, self._update_rate * 2.)
self.dispatch_event('on_update', delta_time)

def set_update_rate(self, rate: float):
Expand Down