diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-29 16:46:50 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-29 16:46:50 +0200 |
commit | 43a58a7be48208f8d87ee5256c84008a02425ecf (patch) | |
tree | 8fee5e83861b7b1a382b26da4a089dc6872aa5b2 /src/sliceitoff/display/scaling.py | |
parent | 505ca2dead48d80b15f64f316218502bdc54daea (diff) |
docstring etc linting
Diffstat (limited to 'src/sliceitoff/display/scaling.py')
-rw-r--r-- | src/sliceitoff/display/scaling.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sliceitoff/display/scaling.py b/src/sliceitoff/display/scaling.py index ddc897f..b4292b4 100644 --- a/src/sliceitoff/display/scaling.py +++ b/src/sliceitoff/display/scaling.py @@ -1,8 +1,11 @@ +""" display.scaling - for converting internal resolution to actual screen """ + import pygame from .static import INTERNAL_WIDTH, INTERNAL_HEIGHT class Scaling(): + """ Holds data and methods needed for coordinate conversion """ factor = 0.02 left = 0 top = 0 @@ -10,7 +13,7 @@ class Scaling(): center = (0,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: """ converts area coordinates to pygame.Rect""" @@ -40,6 +43,8 @@ class Scaling(): @staticmethod def update_scaling(size: tuple) -> None: + """ Calculates new scaling and positionin according given + actual resolution """ __class__.resolution = size __class__.center = (size[0]/2,size[1]/2) if size[0] / size[1] <= INTERNAL_WIDTH / INTERNAL_HEIGHT: |