mini-arcade-core 0.10.0__py3-none-any.whl → 1.0.1__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/__init__.py +51 -63
- mini_arcade_core/backend/__init__.py +2 -6
- mini_arcade_core/backend/backend.py +148 -8
- mini_arcade_core/backend/events.py +1 -1
- mini_arcade_core/{keymaps/sdl.py → backend/sdl_map.py} +1 -1
- mini_arcade_core/engine/__init__.py +0 -0
- mini_arcade_core/engine/commands.py +169 -0
- mini_arcade_core/engine/game.py +369 -0
- mini_arcade_core/engine/render/__init__.py +0 -0
- mini_arcade_core/engine/render/packet.py +56 -0
- mini_arcade_core/engine/render/pipeline.py +63 -0
- mini_arcade_core/engine/render/viewport.py +203 -0
- mini_arcade_core/managers/__init__.py +0 -22
- mini_arcade_core/managers/cheats.py +71 -240
- mini_arcade_core/managers/inputs.py +5 -3
- mini_arcade_core/runtime/__init__.py +0 -0
- mini_arcade_core/runtime/audio/__init__.py +0 -0
- mini_arcade_core/runtime/audio/audio_adapter.py +20 -0
- mini_arcade_core/runtime/audio/audio_port.py +36 -0
- mini_arcade_core/runtime/capture/__init__.py +0 -0
- mini_arcade_core/runtime/capture/capture_adapter.py +143 -0
- mini_arcade_core/runtime/capture/capture_port.py +51 -0
- mini_arcade_core/runtime/context.py +53 -0
- mini_arcade_core/runtime/file/__init__.py +0 -0
- mini_arcade_core/runtime/file/file_adapter.py +20 -0
- mini_arcade_core/runtime/file/file_port.py +31 -0
- mini_arcade_core/runtime/input/__init__.py +0 -0
- mini_arcade_core/runtime/input/input_adapter.py +49 -0
- mini_arcade_core/runtime/input/input_port.py +31 -0
- mini_arcade_core/runtime/input_frame.py +71 -0
- mini_arcade_core/runtime/scene/__init__.py +0 -0
- mini_arcade_core/runtime/scene/scene_adapter.py +97 -0
- mini_arcade_core/runtime/scene/scene_port.py +149 -0
- mini_arcade_core/runtime/services.py +35 -0
- mini_arcade_core/runtime/window/__init__.py +0 -0
- mini_arcade_core/runtime/window/window_adapter.py +90 -0
- mini_arcade_core/runtime/window/window_port.py +109 -0
- mini_arcade_core/scenes/__init__.py +0 -22
- mini_arcade_core/scenes/autoreg.py +1 -1
- mini_arcade_core/scenes/registry.py +21 -19
- mini_arcade_core/scenes/sim_scene.py +41 -0
- mini_arcade_core/scenes/systems/__init__.py +0 -0
- mini_arcade_core/scenes/systems/base_system.py +40 -0
- mini_arcade_core/scenes/systems/system_pipeline.py +57 -0
- mini_arcade_core/sim/__init__.py +0 -0
- mini_arcade_core/sim/protocols.py +41 -0
- mini_arcade_core/sim/runner.py +222 -0
- mini_arcade_core/spaces/__init__.py +0 -12
- mini_arcade_core/spaces/d2/__init__.py +0 -30
- mini_arcade_core/spaces/d2/boundaries2d.py +10 -1
- mini_arcade_core/spaces/d2/collision2d.py +25 -28
- mini_arcade_core/spaces/d2/geometry2d.py +18 -0
- mini_arcade_core/spaces/d2/kinematics2d.py +2 -8
- mini_arcade_core/spaces/d2/physics2d.py +9 -0
- mini_arcade_core/ui/__init__.py +0 -26
- mini_arcade_core/ui/menu.py +271 -85
- mini_arcade_core/utils/__init__.py +10 -0
- mini_arcade_core/utils/deprecated_decorator.py +45 -0
- mini_arcade_core/utils/logging.py +168 -0
- {mini_arcade_core-0.10.0.dist-info → mini_arcade_core-1.0.1.dist-info}/METADATA +1 -1
- mini_arcade_core-1.0.1.dist-info/RECORD +66 -0
- {mini_arcade_core-0.10.0.dist-info → mini_arcade_core-1.0.1.dist-info}/WHEEL +1 -1
- mini_arcade_core/commands.py +0 -84
- mini_arcade_core/entity.py +0 -72
- mini_arcade_core/game.py +0 -287
- mini_arcade_core/keymaps/__init__.py +0 -15
- mini_arcade_core/managers/base.py +0 -132
- mini_arcade_core/managers/entities.py +0 -38
- mini_arcade_core/managers/overlays.py +0 -53
- mini_arcade_core/managers/system.py +0 -26
- mini_arcade_core/scenes/model.py +0 -34
- mini_arcade_core/scenes/runtime.py +0 -29
- mini_arcade_core/scenes/scene.py +0 -109
- mini_arcade_core/scenes/system.py +0 -69
- mini_arcade_core/ui/overlays.py +0 -41
- mini_arcade_core-0.10.0.dist-info/RECORD +0 -40
- /mini_arcade_core/{keymaps → backend}/keys.py +0 -0
- {mini_arcade_core-0.10.0.dist-info → mini_arcade_core-1.0.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Keymaps for Mini Arcade Core.
|
|
3
|
-
Includes key definitions and default key mappings.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from __future__ import annotations
|
|
7
|
-
|
|
8
|
-
from .keys import Key, keymap
|
|
9
|
-
from .sdl import SDL_KEYCODE_TO_KEY
|
|
10
|
-
|
|
11
|
-
__all__ = [
|
|
12
|
-
"Key",
|
|
13
|
-
"keymap",
|
|
14
|
-
"SDL_KEYCODE_TO_KEY",
|
|
15
|
-
]
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Base manager classes for handling collections of items.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
from dataclasses import dataclass, field
|
|
8
|
-
from typing import Callable, Generic, Iterable, List, Protocol, TypeVar
|
|
9
|
-
|
|
10
|
-
from mini_arcade_core.backend.backend import Backend
|
|
11
|
-
|
|
12
|
-
# ---- shared types ----
|
|
13
|
-
T = TypeVar("T")
|
|
14
|
-
OverlayFunc = Callable[[Backend], None]
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class Overlay(Protocol):
|
|
18
|
-
"""
|
|
19
|
-
Defines an overlay function.
|
|
20
|
-
|
|
21
|
-
:ivar enabled (bool): Whether the overlay is enabled.
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
enabled: bool
|
|
25
|
-
|
|
26
|
-
def update(self, dt: float):
|
|
27
|
-
"""
|
|
28
|
-
Update the overlay state.
|
|
29
|
-
|
|
30
|
-
:param dt: Time delta in seconds.
|
|
31
|
-
:type dt: float
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
def draw(self, surface: "Backend"):
|
|
35
|
-
"""
|
|
36
|
-
Draw the overlay on the given surface.
|
|
37
|
-
|
|
38
|
-
:param surface: The backend surface to draw on.
|
|
39
|
-
:type surface: Backend
|
|
40
|
-
"""
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class Drawable(Protocol):
|
|
44
|
-
"""Defines a drawable entity."""
|
|
45
|
-
|
|
46
|
-
def draw(self, surface: Backend):
|
|
47
|
-
"""
|
|
48
|
-
Draw the entity on the given surface.
|
|
49
|
-
|
|
50
|
-
:param surface: The backend surface to draw on.
|
|
51
|
-
:type surface: Backend
|
|
52
|
-
"""
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class Updatable(Protocol):
|
|
56
|
-
"""Defines an updatable entity."""
|
|
57
|
-
|
|
58
|
-
def update(self, dt: float):
|
|
59
|
-
"""
|
|
60
|
-
Update the entity state.
|
|
61
|
-
|
|
62
|
-
:param dt: Time delta in seconds.
|
|
63
|
-
:type dt: float
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class EntityLike(Drawable, Updatable, Protocol):
|
|
68
|
-
"""Defines a game entity."""
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@dataclass
|
|
72
|
-
class ListManager(Generic[T]):
|
|
73
|
-
"""
|
|
74
|
-
Generic manager for a list of items.
|
|
75
|
-
|
|
76
|
-
:ivar items (List[T]): List of managed items.
|
|
77
|
-
"""
|
|
78
|
-
|
|
79
|
-
items: List[T] = field(default_factory=list)
|
|
80
|
-
|
|
81
|
-
def add(self, *items: T):
|
|
82
|
-
"""
|
|
83
|
-
Add one or more items to the manager.
|
|
84
|
-
|
|
85
|
-
:param items: One or more items to add.
|
|
86
|
-
:type items: T
|
|
87
|
-
"""
|
|
88
|
-
self.items.extend(items)
|
|
89
|
-
|
|
90
|
-
def add_many(self, items: Iterable[T]):
|
|
91
|
-
"""
|
|
92
|
-
Add multiple items to the manager.
|
|
93
|
-
|
|
94
|
-
:param items: An iterable of items to add.
|
|
95
|
-
:type items: Iterable[T]
|
|
96
|
-
"""
|
|
97
|
-
self.items.extend(items)
|
|
98
|
-
|
|
99
|
-
def remove(self, item: T):
|
|
100
|
-
"""
|
|
101
|
-
Remove a single item from the manager, if present.
|
|
102
|
-
|
|
103
|
-
:param item: The item to remove.
|
|
104
|
-
:type item: T
|
|
105
|
-
"""
|
|
106
|
-
if item in self.items:
|
|
107
|
-
self.items.remove(item)
|
|
108
|
-
|
|
109
|
-
def get(self, item: T) -> T | None:
|
|
110
|
-
"""
|
|
111
|
-
Get an item from the manager.
|
|
112
|
-
|
|
113
|
-
:param item: The item to get.
|
|
114
|
-
:type item: T
|
|
115
|
-
|
|
116
|
-
:return: The item if found, else None.
|
|
117
|
-
:rtype: T | None
|
|
118
|
-
"""
|
|
119
|
-
for it in self.items:
|
|
120
|
-
if it == item:
|
|
121
|
-
return it
|
|
122
|
-
return None
|
|
123
|
-
|
|
124
|
-
def clear(self):
|
|
125
|
-
"""Clear all items from the manager."""
|
|
126
|
-
self.items.clear()
|
|
127
|
-
|
|
128
|
-
def __iter__(self):
|
|
129
|
-
return iter(self.items)
|
|
130
|
-
|
|
131
|
-
def __len__(self) -> int:
|
|
132
|
-
return len(self.items)
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Entity manager for handling a collection of entities.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
from dataclasses import dataclass
|
|
8
|
-
|
|
9
|
-
from mini_arcade_core.backend import Backend
|
|
10
|
-
|
|
11
|
-
from .base import EntityLike, ListManager
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@dataclass
|
|
15
|
-
class EntityManager(ListManager[EntityLike]):
|
|
16
|
-
"""
|
|
17
|
-
Manages a collection of entities within a scene.
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
def update(self, dt: float):
|
|
21
|
-
"""
|
|
22
|
-
Update all managed entities.
|
|
23
|
-
|
|
24
|
-
:param dt: Time delta in seconds.
|
|
25
|
-
:type dt: float
|
|
26
|
-
"""
|
|
27
|
-
for ent in list(self.items):
|
|
28
|
-
ent.update(dt)
|
|
29
|
-
|
|
30
|
-
def draw(self, surface: "Backend"):
|
|
31
|
-
"""
|
|
32
|
-
Draw all managed entities.
|
|
33
|
-
|
|
34
|
-
:param surface: The backend surface to draw on.
|
|
35
|
-
:type surface: Backend
|
|
36
|
-
"""
|
|
37
|
-
for ent in list(self.items):
|
|
38
|
-
ent.draw(surface)
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Overlay manager for handling a collection of overlays.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
from dataclasses import dataclass
|
|
8
|
-
from typing import Union
|
|
9
|
-
|
|
10
|
-
from mini_arcade_core.backend import Backend
|
|
11
|
-
from mini_arcade_core.managers.base import ListManager, Overlay, OverlayFunc
|
|
12
|
-
|
|
13
|
-
OverlayType = Union[Overlay, OverlayFunc]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@dataclass
|
|
17
|
-
class OverlayManager(ListManager[OverlayType]):
|
|
18
|
-
"""
|
|
19
|
-
Manages a collection of overlays within a scene.
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
def update(self, dt: float):
|
|
23
|
-
"""
|
|
24
|
-
Update all managed overlays.
|
|
25
|
-
|
|
26
|
-
:param dt: Time delta in seconds.
|
|
27
|
-
:type dt: float
|
|
28
|
-
"""
|
|
29
|
-
for ov in list(self.items):
|
|
30
|
-
# class overlays only
|
|
31
|
-
if hasattr(ov, "update") and hasattr(ov, "draw"):
|
|
32
|
-
if getattr(ov, "enabled", True):
|
|
33
|
-
ov.update(dt)
|
|
34
|
-
|
|
35
|
-
def draw(self, surface: "Backend"):
|
|
36
|
-
"""
|
|
37
|
-
Call all overlays. Scenes should call this at the end of draw().
|
|
38
|
-
|
|
39
|
-
:param surface: The backend surface to draw on.
|
|
40
|
-
:type surface: Backend
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
def prio(o: OverlayType) -> int:
|
|
44
|
-
"""Priority for sorting overlays."""
|
|
45
|
-
return getattr(o, "priority", 0)
|
|
46
|
-
|
|
47
|
-
for ov in sorted(list(self.items), key=prio):
|
|
48
|
-
if hasattr(ov, "draw"):
|
|
49
|
-
if getattr(ov, "enabled", True):
|
|
50
|
-
ov.draw(surface)
|
|
51
|
-
else:
|
|
52
|
-
# function overlay
|
|
53
|
-
ov(surface)
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Manager for scene systems.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
from dataclasses import dataclass
|
|
8
|
-
|
|
9
|
-
from mini_arcade_core.managers.base import ListManager
|
|
10
|
-
from mini_arcade_core.scenes.system import BaseSceneSystem
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@dataclass
|
|
14
|
-
class SystemManager(ListManager[BaseSceneSystem]):
|
|
15
|
-
"""
|
|
16
|
-
Manager for scene systems.
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
def sorted(self) -> list[BaseSceneSystem]:
|
|
20
|
-
"""
|
|
21
|
-
Get systems sorted by priority.
|
|
22
|
-
|
|
23
|
-
:return: List of systems sorted by priority.
|
|
24
|
-
:rtype: list[BaseSceneSystem]
|
|
25
|
-
"""
|
|
26
|
-
return sorted(self.items, key=lambda s: getattr(s, "priority", 0))
|
mini_arcade_core/scenes/model.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Scene base model module.
|
|
3
|
-
Provides the Scene class and related services.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from __future__ import annotations
|
|
7
|
-
|
|
8
|
-
from dataclasses import dataclass, fields
|
|
9
|
-
from typing import Any
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@dataclass
|
|
13
|
-
class SceneModel:
|
|
14
|
-
"""
|
|
15
|
-
Basic data model for a scene.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
@staticmethod
|
|
19
|
-
def _serialize_dataclass(obj) -> dict[str, Any]:
|
|
20
|
-
out = {}
|
|
21
|
-
for f in fields(obj):
|
|
22
|
-
if f.metadata.get("serialize", True) is False:
|
|
23
|
-
continue
|
|
24
|
-
out[f.name] = getattr(obj, f.name)
|
|
25
|
-
return out
|
|
26
|
-
|
|
27
|
-
def to_dict(self) -> dict:
|
|
28
|
-
"""
|
|
29
|
-
Convert the SceneModel to a dictionary.
|
|
30
|
-
|
|
31
|
-
:return: Dictionary representation of the SceneModel.
|
|
32
|
-
:rtype: dict
|
|
33
|
-
"""
|
|
34
|
-
return self._serialize_dataclass(self)
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Container for scene services like entity and overlay managers.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
from dataclasses import dataclass, field
|
|
8
|
-
|
|
9
|
-
from mini_arcade_core.managers.entities import EntityManager
|
|
10
|
-
from mini_arcade_core.managers.inputs import InputManager
|
|
11
|
-
from mini_arcade_core.managers.overlays import OverlayManager
|
|
12
|
-
from mini_arcade_core.managers.system import SystemManager
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@dataclass
|
|
16
|
-
class SceneRuntime:
|
|
17
|
-
"""
|
|
18
|
-
Container for scene services like entity and overlay managers.
|
|
19
|
-
|
|
20
|
-
:ivar input (InputManager): InputManager for handling input bindings and commands.
|
|
21
|
-
:ivar entities (EntityManager): EntityManager for managing scene entities.
|
|
22
|
-
:ivar overlays (OverlayManager): OverlayManager for managing scene overlays.
|
|
23
|
-
:ivar systems (SystemManager): SystemManager for managing scene systems.
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
input: InputManager = field(default_factory=InputManager)
|
|
27
|
-
entities: EntityManager = field(default_factory=EntityManager)
|
|
28
|
-
overlays: OverlayManager = field(default_factory=OverlayManager)
|
|
29
|
-
systems: SystemManager = field(default_factory=SystemManager)
|
mini_arcade_core/scenes/scene.py
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Base class for game scenes (states/screens).
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
from abc import ABC, abstractmethod
|
|
8
|
-
from typing import TYPE_CHECKING, List, Optional
|
|
9
|
-
|
|
10
|
-
from mini_arcade_core.backend import Backend, Event
|
|
11
|
-
from mini_arcade_core.entity import Entity
|
|
12
|
-
from mini_arcade_core.scenes.model import SceneModel
|
|
13
|
-
from mini_arcade_core.spaces.d2 import Size2D
|
|
14
|
-
|
|
15
|
-
from .runtime import SceneRuntime
|
|
16
|
-
|
|
17
|
-
if TYPE_CHECKING:
|
|
18
|
-
from mini_arcade_core.game import Game
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class Scene(ABC):
|
|
22
|
-
"""Base class for game scenes (states/screens)."""
|
|
23
|
-
|
|
24
|
-
model: SceneModel
|
|
25
|
-
|
|
26
|
-
def __init__(
|
|
27
|
-
self,
|
|
28
|
-
game: Game,
|
|
29
|
-
*,
|
|
30
|
-
services: Optional[SceneRuntime] = None,
|
|
31
|
-
):
|
|
32
|
-
"""
|
|
33
|
-
:param game: Reference to the main Game object.
|
|
34
|
-
:type game: Game
|
|
35
|
-
"""
|
|
36
|
-
self.game = game
|
|
37
|
-
self.entities: List[Entity] = []
|
|
38
|
-
self.size: Size2D = Size2D(game.config.width, game.config.height)
|
|
39
|
-
|
|
40
|
-
self.services: SceneRuntime = (
|
|
41
|
-
services if services is not None else SceneRuntime()
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
@abstractmethod
|
|
45
|
-
def on_enter(self):
|
|
46
|
-
"""Called when the scene becomes active."""
|
|
47
|
-
|
|
48
|
-
@abstractmethod
|
|
49
|
-
def on_exit(self):
|
|
50
|
-
"""Called when the scene is replaced."""
|
|
51
|
-
|
|
52
|
-
@abstractmethod
|
|
53
|
-
def handle_event(self, event: Event):
|
|
54
|
-
"""
|
|
55
|
-
Handle input / events (e.g. pygame.Event).
|
|
56
|
-
|
|
57
|
-
:param event: The event to handle.
|
|
58
|
-
:type event: Event
|
|
59
|
-
"""
|
|
60
|
-
|
|
61
|
-
@abstractmethod
|
|
62
|
-
def update(self, dt: float):
|
|
63
|
-
"""
|
|
64
|
-
Update game logic. ``dt`` is the delta time in seconds.
|
|
65
|
-
|
|
66
|
-
:param dt: Time delta in seconds.
|
|
67
|
-
:type dt: float
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
@abstractmethod
|
|
71
|
-
def draw(self, surface: Backend):
|
|
72
|
-
"""
|
|
73
|
-
Render to the main surface.
|
|
74
|
-
|
|
75
|
-
:param surface: The backend surface to draw on.
|
|
76
|
-
:type surface: Backend
|
|
77
|
-
"""
|
|
78
|
-
|
|
79
|
-
def _systems_on_enter(self):
|
|
80
|
-
for sys in self.services.systems.sorted():
|
|
81
|
-
if getattr(sys, "enabled", True):
|
|
82
|
-
sys.on_enter()
|
|
83
|
-
|
|
84
|
-
def _systems_on_exit(self):
|
|
85
|
-
for sys in self.services.systems.sorted():
|
|
86
|
-
if getattr(sys, "enabled", True):
|
|
87
|
-
sys.on_exit()
|
|
88
|
-
|
|
89
|
-
def _systems_handle_event(self, event: Event) -> bool:
|
|
90
|
-
for sys in self.services.systems.sorted():
|
|
91
|
-
if getattr(sys, "enabled", True) and sys.handle_event(event):
|
|
92
|
-
return True
|
|
93
|
-
return False
|
|
94
|
-
|
|
95
|
-
def _systems_update(self, dt: float):
|
|
96
|
-
for sys in self.services.systems.sorted():
|
|
97
|
-
if getattr(sys, "enabled", True):
|
|
98
|
-
sys.update(dt)
|
|
99
|
-
|
|
100
|
-
def _systems_draw(self, surface: Backend):
|
|
101
|
-
for sys in self.services.systems.sorted():
|
|
102
|
-
if getattr(sys, "enabled", True):
|
|
103
|
-
sys.draw(surface)
|
|
104
|
-
|
|
105
|
-
def on_pause(self):
|
|
106
|
-
"""Called when the game is paused."""
|
|
107
|
-
|
|
108
|
-
def on_resume(self):
|
|
109
|
-
"""Called when the game is resumed."""
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Protocol for scene systems.
|
|
3
|
-
A scene system is a modular component that can hook into the scene lifecycle
|
|
4
|
-
methods (on_enter, on_exit, handle_event, update, draw) to provide additional
|
|
5
|
-
functionality.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from __future__ import annotations
|
|
9
|
-
|
|
10
|
-
from dataclasses import dataclass
|
|
11
|
-
from typing import TYPE_CHECKING
|
|
12
|
-
|
|
13
|
-
from mini_arcade_core.backend import Backend, Event
|
|
14
|
-
|
|
15
|
-
if TYPE_CHECKING:
|
|
16
|
-
from mini_arcade_core.scenes.scene import Scene
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@dataclass
|
|
20
|
-
class BaseSceneSystem:
|
|
21
|
-
"""
|
|
22
|
-
Protocol for scene systems.
|
|
23
|
-
|
|
24
|
-
:ivar enabled (bool): Whether the system is enabled.
|
|
25
|
-
:ivar priority (int): Priority of the system (lower runs first).
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
enabled: bool = True
|
|
29
|
-
priority: int = 0 # lower runs first
|
|
30
|
-
|
|
31
|
-
def __init__(self, scene: "Scene"):
|
|
32
|
-
self.scene = scene
|
|
33
|
-
|
|
34
|
-
def on_enter(self):
|
|
35
|
-
"""
|
|
36
|
-
Called when the scene is entered.
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
def on_exit(self):
|
|
40
|
-
"""
|
|
41
|
-
Called when the scene is exited.
|
|
42
|
-
"""
|
|
43
|
-
|
|
44
|
-
def handle_event(self, event: "Event") -> bool:
|
|
45
|
-
"""
|
|
46
|
-
Handle an event.
|
|
47
|
-
|
|
48
|
-
:param event: The event to handle.
|
|
49
|
-
:type event: Event
|
|
50
|
-
|
|
51
|
-
:return: True if the event was handled, False otherwise.
|
|
52
|
-
:rtype: bool
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
def update(self, dt: float):
|
|
56
|
-
"""
|
|
57
|
-
Update the system.
|
|
58
|
-
|
|
59
|
-
:param dt: Delta time since last update.
|
|
60
|
-
:type dt: float
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
def draw(self, surface: "Backend"):
|
|
64
|
-
"""
|
|
65
|
-
Draw the system.
|
|
66
|
-
|
|
67
|
-
:param surface: The backend surface to draw on.
|
|
68
|
-
:type surface: Backend
|
|
69
|
-
"""
|
mini_arcade_core/ui/overlays.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Overlay base classes.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
from mini_arcade_core.backend import Backend
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class BaseOverlay:
|
|
11
|
-
"""
|
|
12
|
-
Base class for overlays.
|
|
13
|
-
|
|
14
|
-
:ivar enabled (bool): Whether the overlay is enabled.
|
|
15
|
-
:ivar priority (int): Drawing priority; lower values draw first.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
enabled: bool = True
|
|
19
|
-
priority: int = 0 # lower draws first
|
|
20
|
-
|
|
21
|
-
# Justification for unused argument: method is intended to be overridden.
|
|
22
|
-
# pylint: disable=unused-argument
|
|
23
|
-
def update(self, dt: float):
|
|
24
|
-
"""
|
|
25
|
-
Update the overlay state.
|
|
26
|
-
|
|
27
|
-
:param dt: Time delta in seconds.
|
|
28
|
-
:type dt: float
|
|
29
|
-
"""
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
# pylint: enable=unused-argument
|
|
33
|
-
|
|
34
|
-
def draw(self, surface: "Backend"):
|
|
35
|
-
"""
|
|
36
|
-
Draw the overlay on the given surface.
|
|
37
|
-
|
|
38
|
-
:param surface: The backend surface to draw on.
|
|
39
|
-
:type surface: Backend
|
|
40
|
-
"""
|
|
41
|
-
raise NotImplementedError("draw() must be implemented by subclasses.")
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
mini_arcade_core/__init__.py,sha256=3b7F3LyUg7T8qFEy0USDMhgBpV6LCCcxxDvQ8FbaTeo,3588
|
|
2
|
-
mini_arcade_core/backend/__init__.py,sha256=w-6QTUngdIYZuvEU3B8zL-vXyKbyLDVucbt7yKZdLlc,379
|
|
3
|
-
mini_arcade_core/backend/backend.py,sha256=dLXTtLn5qURftWOWOVQd2ouuZmJpbiOl11KMIDRk2us,4026
|
|
4
|
-
mini_arcade_core/backend/events.py,sha256=usn2HTk5-5ZiaU2IjbrNRpEj_4uoaiqfY3qufQLYy0w,2929
|
|
5
|
-
mini_arcade_core/backend/types.py,sha256=SuiwXGNmXCZxfPsww6zj3V_NK7k4jpoCuzMn19afS-g,175
|
|
6
|
-
mini_arcade_core/bus.py,sha256=2Etpoa-UWhk33xJjqDlY5YslPDJEjxNoIEVtF3C73vs,1558
|
|
7
|
-
mini_arcade_core/commands.py,sha256=EpkiyJHuSVrSn410Z5MaeI64fzMoBi0WWA1HG8CQCG8,2185
|
|
8
|
-
mini_arcade_core/entity.py,sha256=5GM3woFrBa6iDwuRbbXNQhUFyCIzpvlh5yI4yrOKZUo,1833
|
|
9
|
-
mini_arcade_core/game.py,sha256=FipqmTMn3g5BB64dQ_VtoA6rssc3N9et90Mg6RKNflM,8535
|
|
10
|
-
mini_arcade_core/keymaps/__init__.py,sha256=_5Y5_61XT5TsOhbb6p2EPzvjCNN9hCPoxTgj_TAfBvA,258
|
|
11
|
-
mini_arcade_core/keymaps/keys.py,sha256=LTg20SwLBI3kpPIiTNpq2yBft_QUGj-iNFSNm9M-Fus,3010
|
|
12
|
-
mini_arcade_core/keymaps/sdl.py,sha256=Tb0amkbmYjYkEkYnMZ6i9QWjwXBkEHIm13-gEMUYENM,2060
|
|
13
|
-
mini_arcade_core/managers/__init__.py,sha256=rLSNjilmAyNTR6djGfpFTahdwKQIBuNUTdZ8sQNjUoI,520
|
|
14
|
-
mini_arcade_core/managers/base.py,sha256=8mfPaOO9j-lx3Uw4a2YJStdwZ5PjRaDCWusfxu5LcyM,2876
|
|
15
|
-
mini_arcade_core/managers/cheats.py,sha256=2tVvEwLmSwyYfmyvTYcauyQ4ZUItwoeES0hG0KS99NQ,10265
|
|
16
|
-
mini_arcade_core/managers/entities.py,sha256=mBgSFgdZ73f5ZZ-_GtvnqOFWuSySX5QJZrZ77sH4qes,831
|
|
17
|
-
mini_arcade_core/managers/inputs.py,sha256=MZ1dTnVDTwvw6nOE3WIB0gUAnSfgIYzfjc68wEuTCpU,8414
|
|
18
|
-
mini_arcade_core/managers/overlays.py,sha256=4DdBExRqoZgXYCDUkBJ_fw3EOpiJ2YqIqadKxS7Cwrg,1452
|
|
19
|
-
mini_arcade_core/managers/system.py,sha256=_nFtHK1wH3xVdqhKco0UUEeUhloyCoHrgz6iDfEt4m4,611
|
|
20
|
-
mini_arcade_core/scenes/__init__.py,sha256=4r8MuW64hJk3rIX5xQxz0FFw4VT2qUq40e0Ot-F_jl0,467
|
|
21
|
-
mini_arcade_core/scenes/autoreg.py,sha256=b4V0jaA65I2hnT2f___rg_pT556OjrtoNjIRdZrXBaI,1009
|
|
22
|
-
mini_arcade_core/scenes/model.py,sha256=ljNlyDf_DenwHuxXZCP5w-WxBg5jg3qtefoNdUulQEA,767
|
|
23
|
-
mini_arcade_core/scenes/registry.py,sha256=0B3iSvepydwMpELQz8cRaQeAU0pR1Fz9O1YtWshLjQw,3226
|
|
24
|
-
mini_arcade_core/scenes/runtime.py,sha256=O1Gc9JJlV3ko9clC4ta1jzJNT7yaQDQDmKuWHAaDkIQ,1096
|
|
25
|
-
mini_arcade_core/scenes/scene.py,sha256=6oAK_RGsh23drKnQo3My88WMVAGC_Uqls7Gixc8iXN4,2911
|
|
26
|
-
mini_arcade_core/scenes/system.py,sha256=clFLFAEVC_RADC9nklF4aT8LPIdovm0miZs5pMJHu2A,1558
|
|
27
|
-
mini_arcade_core/spaces/__init__.py,sha256=i7J7UldFyXPsA98bycrDLarzL7QzwhHBhB3yVP4O_WA,203
|
|
28
|
-
mini_arcade_core/spaces/d2/__init__.py,sha256=iWjm39RYDEshxSmiIWyGWa6Qr9O2gnHfOpzrl63FUro,626
|
|
29
|
-
mini_arcade_core/spaces/d2/boundaries2d.py,sha256=H1HkCR1422MkQIEve2DFKvnav4RpvtLx-qTMxzmdDMQ,2610
|
|
30
|
-
mini_arcade_core/spaces/d2/collision2d.py,sha256=jR5bOmqUaedxRzwFoKBgn7k-ozwklB4RP9pUTVk6aUw,1716
|
|
31
|
-
mini_arcade_core/spaces/d2/geometry2d.py,sha256=js791mMpsE_YbEoqtTOsOxNSflvKgSk6VeVKhj9N318,1282
|
|
32
|
-
mini_arcade_core/spaces/d2/kinematics2d.py,sha256=Lw6WcxpLlw3E-_ZW2iC1WdjSItTIu7K3tam7LuHBabI,2198
|
|
33
|
-
mini_arcade_core/spaces/d2/physics2d.py,sha256=qIq86qWVuvcnLIMEPH6xx7XQO4tQhfiMZY6FseuVOR8,1636
|
|
34
|
-
mini_arcade_core/ui/__init__.py,sha256=_10Z4FYhaPb6LkPaYwvzIj13D7Boy5pYEl7XS_Zfuto,424
|
|
35
|
-
mini_arcade_core/ui/menu.py,sha256=xbpJ_Bf-C8eg2w2frTMCq1pjqMbS6q8G_gSSux4H5ro,18965
|
|
36
|
-
mini_arcade_core/ui/overlays.py,sha256=4f9xJXFVg-NIRoCl1u0Jz4bnxR_C2FueIWPGpguNWc0,982
|
|
37
|
-
mini_arcade_core-0.10.0.dist-info/METADATA,sha256=y9oy4yfi5k9z659kmUsDr_LCqLtz3NUCFbQ7xetJCEo,8189
|
|
38
|
-
mini_arcade_core-0.10.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
39
|
-
mini_arcade_core-0.10.0.dist-info/licenses/LICENSE,sha256=3lHAuV0584cVS5vAqi2uC6GcsVgxUijvwvtZckyvaZ4,1096
|
|
40
|
-
mini_arcade_core-0.10.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|