Skip to content

Commit

Permalink
HOTFIX: Handling Vec2's being False when x=0 y=0 (#2497)
Browse files Browse the repository at this point in the history
Thank you @bunny-therapist for finding this bug, and sorry it took so long to find.
  • Loading branch information
DragonMoffon authored Jan 20, 2025
1 parent 9b3e42f commit 7be16ce
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions arcade/camera/camera_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ def __init__(
f"projection depth is 0 due to equal {near=}" f"and {far=} values"
)

_pos = position or (half_width, half_height)
pos_x = position[0] if position is not None else half_width
pos_y = position[1] if position is not None else half_height
self._camera_data = CameraData(
position=(_pos[0], _pos[1], 0.0),
position=(pos_x, pos_y, 0.0),
up=(up[0], up[1], 0.0),
forward=(0.0, 0.0, -1.0),
zoom=zoom,
Expand Down Expand Up @@ -240,9 +241,9 @@ def from_camera_data(
render_target=render_target, window=window, viewport=viewport, scissor=scissor
)

if camera_data:
if camera_data is not None:
new_camera._camera_data = camera_data
if projection_data:
if projection_data is not None:
new_camera._projection_data = projection_data

return new_camera
Expand Down

0 comments on commit 7be16ce

Please sign in to comment.