2020
2121from ..logger import logger , Status as LoggerStatus
2222from .image import EntityImage
23+ from .errors import ABSFatalError
2324from .types import RGBType , EntityImageType
2425from ..version import __version__ as version
2526
@@ -268,7 +269,7 @@ def destroy(self) -> None:
268269 ValueError: If the entity cannot be removed from its parent.
269270 """
270271
271- parent = getattr (self , "parent" , None ) # See #29
272+ parent : Optional [ "Scene" ] = getattr (self , "parent" , None ) # See #29
272273
273274 if parent is None :
274275 return
@@ -418,6 +419,10 @@ def __init__(
418419 icon_path (Optional[str]): Path to window icon image. Defaults to None.
419420 IS_EDITOR (bool): Whether running in editor mode. Defaults to False.
420421 GP_BASE_PATH (str): Base path for game assets
422+
423+
424+ Raises:
425+ ABSFatalError: If the window size is invalid
421426 """
422427
423428 # For use by entities
@@ -429,6 +434,9 @@ def __init__(
429434 display_flags : int = pygame .FULLSCREEN if fullscreen else 0
430435 self .wsize : tuple [int , int ] = (width , height )
431436
437+ if width < 0 or height < 0 :
438+ raise ABSFatalError ("Window width and height must be positive" )
439+
432440 self .screen : pygame .Surface = pygame .display .set_mode (self .wsize , display_flags )
433441 pygame .display .set_caption (title )
434442
@@ -587,7 +595,6 @@ def run(self, fps: int = 60) -> None:
587595 self .step (dt )
588596
589597 pygame .quit ()
590- sys .exit (0 )
591598
592599 def quit (self ) -> None :
593600 """
0 commit comments