mini-arcade-core 0.3.2__tar.gz → 0.4.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mini-arcade-core
3
- Version: 0.3.2
3
+ Version: 0.4.0
4
4
  Summary: Tiny scene-based game loop core for small arcade games.
5
5
  License: Copyright (c) 2025 Santiago Rincón
6
6
 
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [project]
6
6
  name = "mini-arcade-core"
7
- version = "0.3.2"
7
+ version = "0.4.0"
8
8
  description = "Tiny scene-based game loop core for small arcade games."
9
9
  authors = [
10
10
  { name = "Santiago Rincon", email = "rincores@gmail.com" },
@@ -7,6 +7,8 @@ from __future__ import annotations
7
7
  from dataclasses import dataclass
8
8
  from typing import TYPE_CHECKING
9
9
 
10
+ from .backend import Backend
11
+
10
12
  if TYPE_CHECKING: # avoid runtime circular import
11
13
  from .scene import Scene
12
14
 
@@ -21,6 +23,7 @@ class GameConfig:
21
23
  :ivar title: Title of the game window.
22
24
  :ivar fps: Target frames per second.
23
25
  :ivar background_color: RGB background color.
26
+ :ivar backend: Optional backend class to use for rendering and input.
24
27
  """
25
28
 
26
29
  width: int = 800
@@ -28,6 +31,7 @@ class GameConfig:
28
31
  title: str = "Mini Arcade Game"
29
32
  fps: int = 60
30
33
  background_color: tuple[int, int, int] = (0, 0, 0)
34
+ backend: type[Backend] | None = None
31
35
 
32
36
 
33
37
  class Game:
@@ -40,6 +44,7 @@ class Game:
40
44
  self.config = config
41
45
  self._current_scene: Scene | None = None
42
46
  self._running: bool = False
47
+ self.backend: Backend | None = config.backend
43
48
 
44
49
  def change_scene(self, scene: Scene):
45
50
  """
@@ -52,6 +57,10 @@ class Game:
52
57
  "Game.change_scene must be implemented by a concrete backend."
53
58
  )
54
59
 
60
+ def quit(self):
61
+ """Request that the main loop stops."""
62
+ self._running = False
63
+
55
64
  def run(self, initial_scene: Scene):
56
65
  """
57
66
  Run the main loop starting with the given scene.