Started separating everything away from __init__
This commit is contained in:
4
src/__init__.py
Normal file
4
src/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
from .base import Game
|
||||
from .utils import centre
|
||||
from .anim import AnimatedHandler
|
||||
from .anim import AnimatedObject
|
||||
@ -1,11 +1,4 @@
|
||||
import pygame
|
||||
import time
|
||||
|
||||
# Oclaim, I know we talked about putting everything
|
||||
# in __init__.py and how it's a bad thing, and I
|
||||
# will move things at some point, but as of right now,
|
||||
# I'm still unsure exactly how I'm supposed to
|
||||
# separate all of this.
|
||||
|
||||
class AnimationHandler(pygame.Surface):
|
||||
"""
|
||||
@ -72,35 +65,3 @@ class AnimatedObject:
|
||||
def copy(self):
|
||||
print(f'copy called')
|
||||
return super().copy()
|
||||
|
||||
def centre(surface: pygame.Surface, rect: tuple[int, int, int, int]) -> pygame.Surface:
|
||||
"""
|
||||
Centres a surface within a given rectangle.
|
||||
|
||||
Args:
|
||||
surface: The surface to be centred.
|
||||
rect: The rectangle the surface will be centred in.
|
||||
|
||||
Returns:
|
||||
pygame.Surface
|
||||
"""
|
||||
pass
|
||||
|
||||
class Game:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
def onEvent(self, event):
|
||||
pass
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
screen = pygame.display.set_mode((500, 500))
|
||||
anim = AnimatedObject('')
|
||||
screen.blit(anim.getFrame(), (0, 0))
|
||||
pygame.quit()
|
||||
12
src/base.py
Normal file
12
src/base.py
Normal file
@ -0,0 +1,12 @@
|
||||
class Game:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
def onEvent(self, event):
|
||||
pass
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
14
src/utils.py
Normal file
14
src/utils.py
Normal file
@ -0,0 +1,14 @@
|
||||
import pygame
|
||||
|
||||
def centre(surface: pygame.Surface, rect: tuple[int, int, int, int]) -> pygame.Surface:
|
||||
"""
|
||||
Centres a surface within a given rectangle.
|
||||
|
||||
Args:
|
||||
surface: The surface to be centred.
|
||||
rect: The rectangle the surface will be centred in.
|
||||
|
||||
Returns:
|
||||
pygame.Surface
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user