Skip to content

Camera code reorganization into SimpleCamera and Camera#1354

Merged
einarf merged 6 commits intopythonarcade:developmentfrom
alejcas:camera_changes_v2
Oct 11, 2022
Merged

Camera code reorganization into SimpleCamera and Camera#1354
einarf merged 6 commits intopythonarcade:developmentfrom
alejcas:camera_changes_v2

Conversation

@alejcas
Copy link
Member

@alejcas alejcas commented Oct 11, 2022

This is a new camera approach. Changes vs the previous PR:

  • AdvanceCamera is now just Camera. It’s meant to substitute the default arcade Camera. As we discussed in discord the constructor change and therefore it will break previous code with constructor params. The constructor implements a (*, params) approach, so params need to be set via keyword.
  • BaseCamera is now SimpleCamera (just a camera with viewport, projection and camera movement methods.
  • Camera now inherits from SimpleCamera.
  • Fixed a small bug inside Camera update method
  • The shake funcionality is still inside Camera. We can move that code into a “ShakeCamera” that will inherit from Camera if you think so.

If it’s ok to you, I can change all references to the old camera to comply with the new one. Also I can write some examples with camera zoom + rotation.

Camera now inherits from SimpleCamera
Fixed bug in Camera.update
@einarf
Copy link
Member

einarf commented Oct 11, 2022

Thanks! let's just get this merged.

@einarf
Copy link
Member

einarf commented Oct 11, 2022

... but maybe look into those failing tests first

@alejcas
Copy link
Member Author

alejcas commented Oct 11, 2022

... but maybe look into those failing tests first

It’s failing the self hosted… don’t know why

@einarf
Copy link
Member

einarf commented Oct 11, 2022

Things like this. It's not really necessary to pass in w and h here

/camera_platform.py", line 132, in setup
    self.camera = arcade.Camera(SCREEN_WIDTH, SCREEN_HEIGHT)
TypeError: Camera.__init__() takes 1 positional argument but 3 were given

@alejcas
Copy link
Member Author

alejcas commented Oct 11, 2022

Things like this. It's not really necessary to pass in w and h here

/camera_platform.py", line 132, in setup
    self.camera = arcade.Camera(SCREEN_WIDTH, SCREEN_HEIGHT)
TypeError: Camera.__init__() takes 1 positional argument but 3 were given

Oh, my bad, let me commit here changing all references to the new camera constructor.

@einarf
Copy link
Member

einarf commented Oct 11, 2022

Can probably just search "Camera(" and get most of the issues.

Alejandro Casanovas added 4 commits October 12, 2022 00:05
Sections now use a SimpleCamera instead.
Updated Camera init methods from examples, tests and tutorials to reflect new camera usage
@alejcas
Copy link
Member Author

alejcas commented Oct 11, 2022

Work done! note that I mainly change arcade.Camera with arcade.SimpleCamera in the examples.

@einarf einarf merged commit fcb6efb into pythonarcade:development Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants