diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-20 16:59:13 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-20 16:59:13 +0200 |
commit | 398eebe7829622c6983cb28528f2208b4d596f32 (patch) | |
tree | 411f5d2fa3b7fc8b5352bc3cda49621fbd858919 /src/sliceitoff/display/scaling.py | |
parent | 191110be33196866998da385fbc3107344d2bf73 (diff) |
text to srites. cache scaled font sprites...
Diffstat (limited to 'src/sliceitoff/display/scaling.py')
-rw-r--r-- | src/sliceitoff/display/scaling.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/sliceitoff/display/scaling.py b/src/sliceitoff/display/scaling.py index af307d1..f40d33c 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 + borders = (pygame.Rect(0,0,0,0), pygame.Rect(0,0,0,0)) + active = pygame.Rect(0,0,0,0) @staticmethod def area_to_rect(area: tuple) -> pygame.Rect: @@ -40,8 +42,36 @@ class Scaling(): __class__.factor = size[0] / INTERNAL_WIDTH __class__.left = 0 __class__.top = (size[1] - INTERNAL_HEIGHT * __class__.factor) // 2 + __class__.border = ( + pygame.Rect( + 0, + 0, + size[0], + __class__.top), + pygame.Rect( + 0, + size[1] - __class__.top, + size[0], + __class__.top), + ) else: __class__.factor = size[1] / INTERNAL_HEIGHT __class__.left = (size[0] - INTERNAL_WIDTH * __class__.factor) // 2 __class__.top = 0 -
\ No newline at end of file + __class__.border = ( + pygame.Rect( + 0, + 0, + __class__.left, + size[1]), + pygame.Rect( + size[0] - __class__.left, + 0, + __class__.left, + size[1]), + ) + __class__.active = pygame.Rect( + __class__.left, + __class__.top, + INTERNAL_WIDTH * __class__.factor, + INTERNAL_HEIGHT * __class__.factor) |