Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
11cc5c7
Setup primary files for experimental refactor of the Camera, Backgrou…
DragonMoffon Jun 10, 2023
fa06bc2
Merge branch 'pythonarcade:development' into scene-refactor-experiment
DragonMoffon Jun 10, 2023
882c83b
Completed the Camera2DOrthographic class with doc strings and comment…
DragonMoffon Jun 10, 2023
17d1a9b
Slight change to Cameras to allow for a perspective projection matrix…
DragonMoffon Jun 10, 2023
369545a
Completed Orthographic Camera. Had some issues with the view matrix, …
DragonMoffon Jun 16, 2023
1540f60
Update camera_refactor.py
DragonMoffon Jun 17, 2023
23041b2
PR cleanup
DragonMoffon Jun 18, 2023
dd7531c
New Camera Code Integration
DragonMoffon Jun 19, 2023
7bcc802
Code inspection Clean up
DragonMoffon Jun 19, 2023
f573ba8
Inspection Fix 2
DragonMoffon Jun 19, 2023
c741d08
Code inspection fix 3
DragonMoffon Jun 19, 2023
d4e6be5
Round 4
DragonMoffon Jun 19, 2023
05b624e
Writitng initial Unit Tests
DragonMoffon Jul 20, 2023
cd3469d
Merge branch 'pythonarcade:development' into scene-refactor-experiment
DragonMoffon Jul 21, 2023
b3900c0
Finished base of Camera2D class.
DragonMoffon Jul 31, 2023
ebbc606
Merge branch 'scene-refactor-experiment' of https://github.com/Dragon…
DragonMoffon Jul 31, 2023
b3aed09
code-inspection clean-up on Camera2D
DragonMoffon Jul 31, 2023
16bc0b9
Removed all reference to old camera system.
DragonMoffon Aug 1, 2023
69d81c2
whoops circular imports
DragonMoffon Aug 1, 2023
756297d
circular imports 2
DragonMoffon Aug 2, 2023
eb40fba
type checking
DragonMoffon Aug 2, 2023
7068c5f
Started work on some controllers
DragonMoffon Aug 4, 2023
04b6a41
fixing silly pycharm muck-up
DragonMoffon Aug 4, 2023
8d7dd21
removing doc ref
DragonMoffon Aug 4, 2023
0bc95ea
Updated Orthographic Unit Tests
DragonMoffon Aug 4, 2023
61dbbab
Fixed all the examples
DragonMoffon Aug 6, 2023
10c6a70
linting fix 1-million
DragonMoffon Aug 6, 2023
bff0c03
1-million and 1
DragonMoffon Aug 6, 2023
da72942
1-million and 2
DragonMoffon Aug 6, 2023
e2b1693
MOAR example fixing
DragonMoffon Aug 6, 2023
eafa68c
Setup 4 Splines for SplineController
DragonMoffon Aug 6, 2023
8818c22
Removed splines from this PR
DragonMoffon Aug 8, 2023
0d877a5
Merge branch 'pythonarcade:development' into scene-refactor-experiment
DragonMoffon Aug 15, 2023
4a70234
General work
DragonMoffon Aug 15, 2023
7e1659f
Merge branch 'scene-refactor-experiment' of https://github.com/Dragon…
DragonMoffon Aug 15, 2023
c946cc9
Cleaned up Offscreen renderer
DragonMoffon Aug 15, 2023
8daf88b
Merge branch 'pythonarcade:development' into camera-overhaul
DragonMoffon Aug 17, 2023
27066e0
Squashed commit of the following:
DragonMoffon Aug 17, 2023
4d19763
added screen shake doc
DragonMoffon Aug 17, 2023
d117572
lovely useless doc strings
DragonMoffon Aug 19, 2023
f94eed4
improving screen shake
DragonMoffon Sep 9, 2023
166cae3
Merge remote-tracking branch 'upstream/development' into camera-overhaul
DragonMoffon Sep 9, 2023
a2ce14f
touch-ups
DragonMoffon Sep 12, 2023
ff61534
Finalised Core camera functionality
DragonMoffon Sep 20, 2023
cca5091
Merge branch 'pythonarcade:development' into Camera-Overhaul-Core
DragonMoffon Sep 20, 2023
7383fff
Removed references to projection_2d
DragonMoffon Sep 20, 2023
6a178c3
Merge branch 'Camera-Overhaul-Core' of https://github.com/DragonMoffo…
DragonMoffon Sep 22, 2023
62db585
Fixing unit tests
DragonMoffon Sep 25, 2023
ca058df
Merge branch 'pythonarcade:development' into Camera-Overhaul-Core
DragonMoffon Sep 25, 2023
0a5f5f3
Solved pytest issues in GUI due to Camera Code
DragonMoffon Sep 25, 2023
049043e
Fixed small linting issue
DragonMoffon Sep 25, 2023
310b154
Fixed double brackets caused by find and replace
DragonMoffon Sep 25, 2023
a84fcac
Whoops didn't run integration tests
DragonMoffon Sep 25, 2023
96ffe34
Created Camera Shake Controller.
DragonMoffon Oct 8, 2023
867c9d1
Completed Doc Strings
DragonMoffon Oct 9, 2023
6dd22a1
Replacing all references of SimpleCamera with Camera2D
DragonMoffon Oct 10, 2023
e2fb247
Fixing integration test errors, and examples.
DragonMoffon Oct 11, 2023
190dc2f
attempting to fix gui part 1
DragonMoffon Oct 12, 2023
a70dcad
Fixed erroneous ui behaviour with new camera.
DragonMoffon Oct 16, 2023
cd13036
fixed linting issues
DragonMoffon Oct 16, 2023
1dadf56
Merge branch 'pythonarcade:development' into Camera-Overhaul-Core
DragonMoffon Nov 25, 2023
e40d2f7
Fixing Issues from pvcraven´s review
DragonMoffon Dec 10, 2023
1a44208
Merge branch 'Camera-Overhaul-Core' of https://github.com/DragonMoffo…
DragonMoffon Dec 10, 2023
e150906
Fixed issues pointed out by MiCurry
DragonMoffon Dec 10, 2023
5db234f
Improved Camera Shake and Unit Tests
DragonMoffon Dec 24, 2023
acd403b
Improved Orthographic and Perspective Unit Tests
DragonMoffon Dec 24, 2023
ef2749f
Added cull_mode to spritelists
DragonMoffon Dec 24, 2023
3a3e616
Started working on simple camera controller unit tests
DragonMoffon Dec 24, 2023
21ccfd3
continue perspective work
DragonMoffon Feb 4, 2024
030c630
Removed unfinished perspective camera
DragonMoffon Feb 4, 2024
1105e77
Merge branch 'development' into Camera-Overhaul-Simple
einarf Feb 24, 2024
e3d5d7a
Missing tuple import
einarf Feb 24, 2024
1644ec3
hwidth -> width
einarf Feb 24, 2024
73e154b
Revert cull_mode in SpriteList
einarf Feb 24, 2024
346b3f1
Merge remote-tracking branch 'origin/development' into Camera-Overhau…
Cleptomania Mar 1, 2024
34c48ec
Add & improve type annotations
pushfoo Feb 29, 2024
b4d005e
Merge pull request #1 from pushfoo/camera_add_annotations
pushfoo Mar 1, 2024
7523550
Remove pos from Camera2D
DragonMoffon Mar 1, 2024
5e91c23
Add method to duplicate CameraData
DragonMoffon Mar 3, 2024
e978baa
Merge branch 'pythonarcade:development' into Camera-Overhaul-Simple
DragonMoffon Mar 3, 2024
a255ea0
Fix typing for linting
DragonMoffon Mar 3, 2024
0bd4631
Merge branch 'pythonarcade:development' into Camera-Overhaul-Simple
DragonMoffon Mar 3, 2024
57670af
Working test_strafe
einarf Mar 9, 2024
0286a6f
Docstring fixes
einarf Mar 9, 2024
055f734
Improve camera docs, typing, and style (#2)
pushfoo Mar 11, 2024
17ebe42
Moving protocols and making the PoDs into slots classes
DragonMoffon Mar 11, 2024
fa97758
Fixing linting (Thanks Push)
DragonMoffon Mar 11, 2024
2948d4b
Extract non PoD arguments from the Camera2D init and add a RenderTarg…
DragonMoffon Mar 11, 2024
a54a570
Added an easy screenshot method to window commands
DragonMoffon Mar 11, 2024
1536ecd
created a depth of field example
DragonMoffon Mar 15, 2024
191b8df
Revert "created a depth of field example"
DragonMoffon Mar 15, 2024
7892e1a
Revert "Added an easy screenshot method to window commands"
DragonMoffon Mar 19, 2024
f49d0ec
Updating arcade.math
DragonMoffon Mar 29, 2024
de00c98
gave arcade.camera.Camera2D default init arguments
DragonMoffon Mar 29, 2024
dc4bf31
Added function to constrain arcade.camera.CameraData
DragonMoffon Mar 29, 2024
dc529b1
moved arcade.camera.controllers to arcade.camera.grips
DragonMoffon Mar 29, 2024
be46907
updated examples to use new functions for camera control
DragonMoffon Mar 29, 2024
bb2c1d8
remove example from arcade.math.quaternion_rotation
DragonMoffon Mar 29, 2024
94b3128
Merge branch 'development' into Camera-Overhaul-Simple
DragonMoffon Mar 29, 2024
3b118c8
improving typing for ui_manager
DragonMoffon Mar 29, 2024
4e4d08e
Revert "improving typing for ui_manager"
DragonMoffon Mar 29, 2024
788072e
Revert "Merge branch 'development' into Camera-Overhaul-Simple"
DragonMoffon Mar 29, 2024
6346f76
update map_coordiantes to map_screen_to_world_coordinates
DragonMoffon Mar 29, 2024
1beb25b
Adding a temporary README to cameras for documentation
DragonMoffon Mar 29, 2024
4cc94cf
Completed clean-up and sanity check
DragonMoffon Mar 29, 2024
f0e657c
Revert "Revert "Merge branch 'development' into Camera-Overhaul-Simple""
DragonMoffon Mar 29, 2024
be260c1
Fix typing issues in ui manager
DragonMoffon Mar 29, 2024
3de0a27
Fixed WindowProxy to use modern camera sensibilities
DragonMoffon Mar 29, 2024
9f026ee
Give the data PoDs __str__ and __repr__ methods
DragonMoffon Mar 30, 2024
4e773ee
Linting fix for __repr__ methods
DragonMoffon Mar 30, 2024
f05e46c
Updated unit tests to parameterize window size
DragonMoffon Mar 30, 2024
7af79b3
Improving the state reset between unit tests
DragonMoffon Mar 30, 2024
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: 1 addition & 5 deletions arcade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,11 @@ def configure_logging(level: Optional[int] = None):
from .window_commands import schedule
from .window_commands import run
from .window_commands import set_background_color
from .window_commands import set_viewport
from .window_commands import set_window
from .window_commands import start_render
from .window_commands import unschedule
from .window_commands import schedule_once

from .camera import SimpleCamera, Camera
from .sections import Section, SectionManager

from .application import MOUSE_BUTTON_LEFT
Expand Down Expand Up @@ -221,6 +219,7 @@ def configure_logging(level: Optional[int] = None):
# Module imports
from arcade import color as color
from arcade import csscolor as csscolor
from arcade import camera as camera
from arcade import key as key
from arcade import resources as resources
from arcade import types as types
Expand All @@ -243,8 +242,6 @@ def configure_logging(level: Optional[int] = None):
'TextureAnimation',
'TextureKeyframe',
'ArcadeContext',
'Camera',
'SimpleCamera',
'ControllerManager',
'FACE_DOWN',
'FACE_LEFT',
Expand Down Expand Up @@ -358,7 +355,6 @@ def configure_logging(level: Optional[int] = None):
'run',
'schedule',
'set_background_color',
'set_viewport',
'set_window',
'start_render',
'stop_sound',
Expand Down
51 changes: 18 additions & 33 deletions arcade/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@

import arcade
from arcade import get_display_size
from arcade import set_viewport
from arcade import set_window
from arcade.color import TRANSPARENT_BLACK
from arcade.context import ArcadeContext
from arcade.types import Color, RGBOrA255, RGBANormalized
from arcade import SectionManager
from arcade.utils import is_raspberry_pi
from arcade.camera import Projector
from arcade.camera.default import DefaultProjector

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -211,17 +212,17 @@ def __init__(
# self.invalid = False
set_window(self)

self._ctx: ArcadeContext = ArcadeContext(self, gc_mode=gc_mode, gl_api=gl_api)
self._background_color: Color = TRANSPARENT_BLACK

self._current_view: Optional[View] = None
self.current_camera: Optional[arcade.SimpleCamera] = None
self._default_camera = DefaultProjector(window=self)
self.current_camera: Projector = self._default_camera
self.textbox_time = 0.0
self.key: Optional[int] = None
self.flip_count: int = 0
self.static_display: bool = False

self._ctx: ArcadeContext = ArcadeContext(self, gc_mode=gc_mode, gl_api=gl_api)
set_viewport(0, self.width, 0, self.height)
self._background_color: Color = TRANSPARENT_BLACK

# See if we should center the window
if center_window:
self.center_window()
Expand Down Expand Up @@ -606,13 +607,8 @@ def on_resize(self, width: int, height: int):
# The arcade context is not created at that time
if hasattr(self, "_ctx"):
# Retain projection scrolling if applied
original_viewport = self._ctx.projection_2d
self.set_viewport(
original_viewport[0],
original_viewport[0] + width,
original_viewport[2],
original_viewport[2] + height
)
self._ctx.viewport = (0, 0, width, height)
self.default_camera.use()

def set_min_size(self, width: int, height: int):
""" Wrap the Pyglet window call to set minimum size
Expand Down Expand Up @@ -676,30 +672,19 @@ def set_visible(self, visible: bool = True):
"""
super().set_visible(visible)

# noinspection PyMethodMayBeStatic
def set_viewport(self, left: float, right: float, bottom: float, top: float):
"""
Set the viewport. (What coordinates we can see.
Used to scale and/or scroll the screen).

See :py:func:`arcade.set_viewport` for more detailed information.

:param left:
:param right:
:param bottom:
:param top:
"""
set_viewport(left, right, bottom, top)

# noinspection PyMethodMayBeStatic
def get_viewport(self) -> Tuple[float, float, float, float]:
""" Get the viewport. (What coordinates we can see.) """
return self.ctx.projection_2d

def use(self):
"""Bind the window's framebuffer for rendering commands"""
self.ctx.screen.use()

@property
def default_camera(self):
"""
Provides a reference to the default arcade camera.
Automatically sets projection and view to the size
of the screen. Good for resetting the screen.
"""
return self._default_camera

def test(self, frames: int = 10):
"""
Used by unit test cases. Runs the event loop a few times and stops.
Expand Down
Loading