mini-arcade-core 0.10.0__py3-none-any.whl → 1.0.0__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.
Files changed (76) hide show
  1. mini_arcade_core/__init__.py +43 -60
  2. mini_arcade_core/backend/__init__.py +0 -5
  3. mini_arcade_core/backend/backend.py +9 -0
  4. mini_arcade_core/backend/events.py +1 -1
  5. mini_arcade_core/{keymaps/sdl.py → backend/sdl_map.py} +1 -1
  6. mini_arcade_core/engine/__init__.py +0 -0
  7. mini_arcade_core/engine/commands.py +169 -0
  8. mini_arcade_core/engine/game.py +354 -0
  9. mini_arcade_core/engine/render/__init__.py +0 -0
  10. mini_arcade_core/engine/render/packet.py +56 -0
  11. mini_arcade_core/engine/render/pipeline.py +39 -0
  12. mini_arcade_core/managers/__init__.py +0 -22
  13. mini_arcade_core/managers/cheats.py +71 -240
  14. mini_arcade_core/managers/inputs.py +5 -1
  15. mini_arcade_core/runtime/__init__.py +0 -0
  16. mini_arcade_core/runtime/audio/__init__.py +0 -0
  17. mini_arcade_core/runtime/audio/audio_adapter.py +13 -0
  18. mini_arcade_core/runtime/audio/audio_port.py +17 -0
  19. mini_arcade_core/runtime/capture/__init__.py +0 -0
  20. mini_arcade_core/runtime/capture/capture_adapter.py +143 -0
  21. mini_arcade_core/runtime/capture/capture_port.py +32 -0
  22. mini_arcade_core/runtime/context.py +53 -0
  23. mini_arcade_core/runtime/file/__init__.py +0 -0
  24. mini_arcade_core/runtime/file/file_adapter.py +20 -0
  25. mini_arcade_core/runtime/file/file_port.py +31 -0
  26. mini_arcade_core/runtime/input/__init__.py +0 -0
  27. mini_arcade_core/runtime/input/input_adapter.py +49 -0
  28. mini_arcade_core/runtime/input/input_port.py +31 -0
  29. mini_arcade_core/runtime/input_frame.py +71 -0
  30. mini_arcade_core/runtime/scene/__init__.py +0 -0
  31. mini_arcade_core/runtime/scene/scene_adapter.py +97 -0
  32. mini_arcade_core/runtime/scene/scene_port.py +149 -0
  33. mini_arcade_core/runtime/services.py +35 -0
  34. mini_arcade_core/runtime/window/__init__.py +0 -0
  35. mini_arcade_core/runtime/window/window_adapter.py +26 -0
  36. mini_arcade_core/runtime/window/window_port.py +47 -0
  37. mini_arcade_core/scenes/__init__.py +0 -22
  38. mini_arcade_core/scenes/autoreg.py +1 -1
  39. mini_arcade_core/scenes/registry.py +21 -19
  40. mini_arcade_core/scenes/sim_scene.py +41 -0
  41. mini_arcade_core/scenes/systems/__init__.py +0 -0
  42. mini_arcade_core/scenes/systems/base_system.py +40 -0
  43. mini_arcade_core/scenes/systems/system_pipeline.py +57 -0
  44. mini_arcade_core/sim/__init__.py +0 -0
  45. mini_arcade_core/sim/protocols.py +41 -0
  46. mini_arcade_core/sim/runner.py +222 -0
  47. mini_arcade_core/spaces/__init__.py +0 -12
  48. mini_arcade_core/spaces/d2/__init__.py +0 -30
  49. mini_arcade_core/spaces/d2/collision2d.py +25 -28
  50. mini_arcade_core/spaces/d2/geometry2d.py +18 -0
  51. mini_arcade_core/spaces/d2/kinematics2d.py +2 -8
  52. mini_arcade_core/spaces/d2/physics2d.py +9 -0
  53. mini_arcade_core/ui/__init__.py +0 -26
  54. mini_arcade_core/ui/menu.py +265 -84
  55. mini_arcade_core/utils/__init__.py +10 -0
  56. mini_arcade_core/utils/deprecated_decorator.py +45 -0
  57. mini_arcade_core/utils/logging.py +174 -0
  58. {mini_arcade_core-0.10.0.dist-info → mini_arcade_core-1.0.0.dist-info}/METADATA +1 -1
  59. mini_arcade_core-1.0.0.dist-info/RECORD +65 -0
  60. {mini_arcade_core-0.10.0.dist-info → mini_arcade_core-1.0.0.dist-info}/WHEEL +1 -1
  61. mini_arcade_core/commands.py +0 -84
  62. mini_arcade_core/entity.py +0 -72
  63. mini_arcade_core/game.py +0 -287
  64. mini_arcade_core/keymaps/__init__.py +0 -15
  65. mini_arcade_core/managers/base.py +0 -132
  66. mini_arcade_core/managers/entities.py +0 -38
  67. mini_arcade_core/managers/overlays.py +0 -53
  68. mini_arcade_core/managers/system.py +0 -26
  69. mini_arcade_core/scenes/model.py +0 -34
  70. mini_arcade_core/scenes/runtime.py +0 -29
  71. mini_arcade_core/scenes/scene.py +0 -109
  72. mini_arcade_core/scenes/system.py +0 -69
  73. mini_arcade_core/ui/overlays.py +0 -41
  74. mini_arcade_core-0.10.0.dist-info/RECORD +0 -40
  75. /mini_arcade_core/{keymaps → backend}/keys.py +0 -0
  76. {mini_arcade_core-0.10.0.dist-info → mini_arcade_core-1.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -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
- """
@@ -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