Skip to content

Fix GUI cam on_resize examples #2572

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

Merged
merged 2 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions arcade/examples/sprite_move_scrolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,12 @@ def on_resize(self, width: int, height: int):
"""
super().on_resize(width, height)
self.camera_sprites.match_window()
self.camera_gui.match_window()


def main():
""" Main function """
# Create a window class. This is what actually shows up on screen
window = arcade.Window(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE)
window = arcade.Window(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE, resizable=True)

# Create and setup the GameView
game = GameView()
Expand Down
7 changes: 2 additions & 5 deletions arcade/examples/sprite_move_scrolling_shake.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ def __init__(self):
# Physics engine so we don't run into walls.
self.physics_engine = None

# Create the cameras. One for the GUI, one for the sprites.
# We scroll the 'sprite world' but not the GUI.
# Create camera that will follow the player sprite.
self.camera_sprites = arcade.camera.Camera2D()
self.camera_gui = arcade.camera.Camera2D()

self.camera_shake = arcade.camera.grips.ScreenShake2D(
self.camera_sprites.view_data,
Expand Down Expand Up @@ -197,13 +195,12 @@ def on_resize(self, width: int, height: int):
"""
super().on_resize(width, height)
self.camera_sprites.match_window()
self.camera_gui.match_window(position=True)


def main():
""" Main function """
# Create a window class. This is what actually shows up on screen
window = arcade.Window(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE)
window = arcade.Window(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE, resizable=True)

# Create and setup the GameView
game = GameView()
Expand Down
Loading