Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename viewOffsetX to viewMarginX, plus many more #2714

Merged
merged 2 commits into from
Jan 17, 2023

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented Jan 16, 2023

rename viewOffsetX/Y to viewMarginX/Y, also making all of these public, so you don't need to use the new getViewRect, to get the camera's view margin in world space, you can just use viewMarginLeft/Right/Top/Bottom. As well as various other helpers: viewX/Y/Width/Height to get the camera view in the world.

Important distinction:

  • view___ refers to the cameras view in world space. position a sprite at camera.viewLeft and it will be displayed on the left-most edge of the camera
  • viewMargin___ refers to the margin around the camera caused by zooming in/out. Camera's zoom into their center, cutting off a portion of the world so a simple camera.scroll.x + camera.width won't suffice to get the camera's right edge, but camera.scroll.x + camera.viewMarginX + camera.viewWidth will, as well as camera.scroll.x + camera.viewMarginRight (or simply camera.viewRight)

@Geokureli Geokureli merged commit a7e172c into HaxeFlixel:dev Jan 17, 2023
Geokureli added a commit that referenced this pull request Jan 17, 2023
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.

None yet

1 participant