Skip to content

Conversation

@HSMarieK
Copy link
Collaborator

Added zoom in visualisation via +/- on the keyboard.
Added camera movement via arrow keys.
Added option to set initial zoom on "line.run()".

@HSMarieK HSMarieK linked an issue Dec 15, 2025 that may be closed by this pull request
@HSMarieK HSMarieK closed this Dec 15, 2025
@HSMarieK HSMarieK reopened this Dec 15, 2025
@HSMarieK HSMarieK requested a review from windisch December 15, 2025 16:59
Signed-off-by: Tobias Windisch <[email protected]>
Signed-off-by: Tobias Windisch <[email protected]>
Copy link
Contributor

@windisch windisch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! I just have some comments we could also discuss synchronically for future refactorings.

o.register(self.env)

def _draw(self, screen, actions=None):
def _draw(self, actions=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved more stuff into the Viewpoint class. Maybe - after the refactoring - all pygame specific things can happen inside Viewpoint?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't put everything in the Viewpoint class. But the visualization.py is supposed to contain every pygame specific thing in the future.

if pygame.key.get_pressed()[pygame.K_RIGHT]:
self._view.x -= 10

for event in pygame.event.get():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HSMarieK: I moved that piece to here as well - I think we could collect all sorts of user input here - what do you think?

self.paper = pygame.Surface(size)


self.screen = pygame.display.set_mode((1280, 720))
Copy link
Contributor

@windisch windisch Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the screen an instance variable of the viewpoint. That way, a lot of things happen inside the viewpoint solely.

Signed-off-by: Tobias Windisch <[email protected]>
Copy link
Collaborator Author

@HSMarieK HSMarieK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good so far.

@HSMarieK HSMarieK requested a review from windisch December 20, 2025 14:50
Signed-off-by: Tobias Windisch <[email protected]>
Copy link
Contributor

@windisch windisch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! I added a tiny beautification and will merge this now - thanks a lot!

@windisch windisch merged commit dbc63b8 into main Dec 20, 2025
9 checks passed
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.

Allow to zoom in and out in pygame

3 participants