mini-arcade-core 0.7.1__py3-none-any.whl → 0.7.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mini_arcade_core/scene.py CHANGED
@@ -5,9 +5,14 @@ Base class for game scenes (states/screens).
5
5
  from __future__ import annotations
6
6
 
7
7
  from abc import ABC, abstractmethod
8
+ from typing import Callable, List
9
+
10
+ from mini_arcade_core.backend import Backend
8
11
 
9
12
  from .game import Game
10
13
 
14
+ OverlayFunc = Callable[[Backend], None]
15
+
11
16
 
12
17
  class Scene(ABC):
13
18
  """Base class for game scenes (states/screens)."""
@@ -18,6 +23,24 @@ class Scene(ABC):
18
23
  :type game: Game
19
24
  """
20
25
  self.game = game
26
+ # overlays drawn on top of the scene
27
+ self._overlays: List[OverlayFunc] = []
28
+
29
+ def add_overlay(self, overlay: OverlayFunc) -> None:
30
+ """Register an overlay (drawn every frame, after entities)."""
31
+ self._overlays.append(overlay)
32
+
33
+ def remove_overlay(self, overlay: OverlayFunc) -> None:
34
+ if overlay in self._overlays:
35
+ self._overlays.remove(overlay)
36
+
37
+ def clear_overlays(self) -> None:
38
+ self._overlays.clear()
39
+
40
+ def draw_overlays(self, surface: Backend) -> None:
41
+ """Call all overlays. Scenes should call this at the end of draw()."""
42
+ for overlay in self._overlays:
43
+ overlay(surface)
21
44
 
22
45
  @abstractmethod
23
46
  def on_enter(self):
@@ -38,3 +61,9 @@ class Scene(ABC):
38
61
  @abstractmethod
39
62
  def draw(self, surface: object):
40
63
  """Render to the main surface."""
64
+
65
+ def draw(self, surface: object):
66
+ """Render to the main surface."""
67
+
68
+ def draw(self, surface: object):
69
+ """Render to the main surface."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mini-arcade-core
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Summary: Tiny scene-based game loop core for small arcade games.
5
5
  License: Copyright (c) 2025 Santiago Rincón
6
6
 
@@ -2,8 +2,8 @@ mini_arcade_core/__init__.py,sha256=0PFa04KRSY3kT8YoD24zfFt92HYfrk6QrH8IlHbmeo4,
2
2
  mini_arcade_core/backend.py,sha256=DZUEO4zMlXIk3ctD9ZNqvgOo7n_ZKpC6x--hIede_YY,2946
3
3
  mini_arcade_core/entity.py,sha256=mAkedH0j14giBQFRpQjaym46uczbQDln6nbxy0WFAqU,1077
4
4
  mini_arcade_core/game.py,sha256=yRMy0IJVB_yuF9P_SKjcxJG0YVMs52khVFLomSUeVw8,3935
5
- mini_arcade_core/scene.py,sha256=FEtywrnOBU8p0-t8oWGDELYBRRXOs4-Phe0dF7iSjKI,927
6
- mini_arcade_core-0.7.1.dist-info/METADATA,sha256=KNIe3xKd_vY9eKTYdg6CujZL93-uznlqVXQaU3jl9M4,8296
7
- mini_arcade_core-0.7.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
8
- mini_arcade_core-0.7.1.dist-info/licenses/LICENSE,sha256=3lHAuV0584cVS5vAqi2uC6GcsVgxUijvwvtZckyvaZ4,1096
9
- mini_arcade_core-0.7.1.dist-info/RECORD,,
5
+ mini_arcade_core/scene.py,sha256=i8lmcTZ1IPcM-NDwVvKrvjCMcFVq1aD5nacOvU0ZONU,1883
6
+ mini_arcade_core-0.7.2.dist-info/METADATA,sha256=UNpZCJ0APedKmetmYqtENHGlSIgW2uDjsvr2eYxlidI,8296
7
+ mini_arcade_core-0.7.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
8
+ mini_arcade_core-0.7.2.dist-info/licenses/LICENSE,sha256=3lHAuV0584cVS5vAqi2uC6GcsVgxUijvwvtZckyvaZ4,1096
9
+ mini_arcade_core-0.7.2.dist-info/RECORD,,