Skip to content

Commit

Permalink
fixed default camera behaviour (#2179)
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonMoffon authored Jul 2, 2024
1 parent 763be12 commit 55037f3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion arcade/camera/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,17 @@ def use(self) -> None:
cache's the window viewport to determine the projection matrix.
"""

if self._ctx.viewport != self.viewport:
# If the viewport is correct and the default camera is in use,
# then don't waste time resetting the view and projection matrices
if self._ctx.viewport == self.viewport and self._ctx.current_camera == self:
return

# If the viewport has changed while the default camera is active then the default needs to update itself.
# If it was another camera's viewport being used the default camera should not update.
if self._ctx.viewport != self.viewport and self._ctx.current_camera == self:
self.viewport = self._ctx.viewport
else:
self._ctx.viewport = self.viewport

self._ctx.current_camera = self

Expand Down

0 comments on commit 55037f3

Please sign in to comment.