diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-16 12:35:07 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-16 12:35:07 +0200 |
commit | a23b6647b0ca2cd9f2ccbbe12360c3fa0f96a554 (patch) | |
tree | bab154622f9767fd340278ab275babb76fc569d5 /src/sliceitoff/display/display.py | |
parent | 1ad8357f0039292b929e66cf703b4314660aded2 (diff) |
scaling as class
Diffstat (limited to 'src/sliceitoff/display/display.py')
-rw-r--r-- | src/sliceitoff/display/display.py | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/sliceitoff/display/display.py b/src/sliceitoff/display/display.py index af61d49..ae98134 100644 --- a/src/sliceitoff/display/display.py +++ b/src/sliceitoff/display/display.py @@ -1,10 +1,6 @@ import pygame -from .static import ( - Scaling, - INTERNAL_WIDTH, - INTERNAL_HEIGHT, - INTERNAL_ASPECT) +from .scaling import Scaling class Display(): def __init__(self): @@ -13,18 +9,7 @@ class Display(): self.screen = pygame.display.set_mode( (mode_info.current_w, mode_info.current_h), pygame.FULLSCREEN | pygame.SCALED ) - - def get_scaling(self): - w, h = self.screen.get_size() - if w/h <= INTERNAL_ASPECT: - scale = w / INTERNAL_WIDTH - left = 0 - top = int((h - INTERNAL_HEIGHT * scale) / 2) - else : - scale = h / INTERNAL_HEIGHT - left = int((w - INTERNAL_WIDTH * scale) / 2) - top = 0 - return Scaling(scale, left, top) + Scaling.update_scaling(self.screen.get_size()) def update(self, groups = None): """ Updates the screen: clear, blit gropus and flip """ |