From b03cb075e7a2042764a355a46d649b187f66343b Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Sat, 23 Mar 2024 18:42:26 +0200 Subject: Field as sprite group. --- src/sliceitoff/display/scaling.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/sliceitoff/display') diff --git a/src/sliceitoff/display/scaling.py b/src/sliceitoff/display/scaling.py index 53a9fb1..ddc897f 100644 --- a/src/sliceitoff/display/scaling.py +++ b/src/sliceitoff/display/scaling.py @@ -6,6 +6,8 @@ class Scaling(): factor = 0.02 left = 0 top = 0 + resolution = (0,0) + center = (0,0) borders = (pygame.Rect(0,0,0,0), pygame.Rect(0,0,0,0)) active = pygame.Rect(0,0,0,0) @@ -38,11 +40,13 @@ class Scaling(): @staticmethod def update_scaling(size: tuple) -> None: + __class__.resolution = size + __class__.center = (size[0]/2,size[1]/2) if size[0] / size[1] <= INTERNAL_WIDTH / INTERNAL_HEIGHT: __class__.factor = size[0] / INTERNAL_WIDTH __class__.left = 0 __class__.top = (size[1] - INTERNAL_HEIGHT * __class__.factor) // 2 - __class__.border = ( + __class__.borders = ( pygame.Rect( 0, 0, -- cgit v1.2.3