mini-arcade-core 0.6.1__tar.gz → 0.7.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.
- {mini_arcade_core-0.6.1 → mini_arcade_core-0.7.0}/PKG-INFO +1 -1
- {mini_arcade_core-0.6.1 → mini_arcade_core-0.7.0}/pyproject.toml +1 -1
- {mini_arcade_core-0.6.1 → mini_arcade_core-0.7.0}/src/mini_arcade_core/backend.py +31 -1
- {mini_arcade_core-0.6.1 → mini_arcade_core-0.7.0}/src/mini_arcade_core/game.py +4 -1
- {mini_arcade_core-0.6.1 → mini_arcade_core-0.7.0}/LICENSE +0 -0
- {mini_arcade_core-0.6.1 → mini_arcade_core-0.7.0}/README.md +0 -0
- {mini_arcade_core-0.6.1 → mini_arcade_core-0.7.0}/src/mini_arcade_core/__init__.py +0 -0
- {mini_arcade_core-0.6.1 → mini_arcade_core-0.7.0}/src/mini_arcade_core/entity.py +0 -0
- {mini_arcade_core-0.6.1 → mini_arcade_core-0.7.0}/src/mini_arcade_core/scene.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "mini-arcade-core"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.7.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" },
|
|
@@ -57,6 +57,11 @@ class Backend(Protocol):
|
|
|
57
57
|
Concrete backends will translate their native events into core Event objects.
|
|
58
58
|
"""
|
|
59
59
|
|
|
60
|
+
def set_clear_color(self, r: int, g: int, b: int) -> None:
|
|
61
|
+
"""
|
|
62
|
+
Set the background/clear color used by begin_frame.
|
|
63
|
+
"""
|
|
64
|
+
|
|
60
65
|
def begin_frame(self) -> None:
|
|
61
66
|
"""
|
|
62
67
|
Prepare for drawing a new frame (e.g. clear screen).
|
|
@@ -67,9 +72,34 @@ class Backend(Protocol):
|
|
|
67
72
|
Present the frame to the user (swap buffers).
|
|
68
73
|
"""
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
# Justification: Simple drawing API for now
|
|
76
|
+
# pylint: disable=too-many-arguments,too-many-positional-arguments
|
|
77
|
+
def draw_rect(
|
|
78
|
+
self,
|
|
79
|
+
x: int,
|
|
80
|
+
y: int,
|
|
81
|
+
w: int,
|
|
82
|
+
h: int,
|
|
83
|
+
color: tuple[int, int, int] = (255, 255, 255),
|
|
84
|
+
) -> None:
|
|
71
85
|
"""
|
|
72
86
|
Draw a filled rectangle in some default color.
|
|
73
87
|
|
|
74
88
|
We'll keep this minimal for now; later we can extend with colors/sprites.
|
|
75
89
|
"""
|
|
90
|
+
|
|
91
|
+
# pylint: enable=too-many-arguments,too-many-positional-arguments
|
|
92
|
+
|
|
93
|
+
def draw_text(
|
|
94
|
+
self,
|
|
95
|
+
x: int,
|
|
96
|
+
y: int,
|
|
97
|
+
text: str,
|
|
98
|
+
color: tuple[int, int, int] = (255, 255, 255),
|
|
99
|
+
) -> None:
|
|
100
|
+
"""
|
|
101
|
+
Draw text at the given position in a default font and color.
|
|
102
|
+
|
|
103
|
+
Backends may ignore advanced styling for now; this is just to render
|
|
104
|
+
simple labels like menu items, scores, etc.
|
|
105
|
+
"""
|
|
@@ -32,7 +32,7 @@ class GameConfig:
|
|
|
32
32
|
title: str = "Mini Arcade Game"
|
|
33
33
|
fps: int = 60
|
|
34
34
|
background_color: tuple[int, int, int] = (0, 0, 0)
|
|
35
|
-
backend:
|
|
35
|
+
backend: Backend | None = None
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
class Game:
|
|
@@ -84,6 +84,9 @@ class Game:
|
|
|
84
84
|
backend = self.backend
|
|
85
85
|
backend.init(self.config.width, self.config.height, self.config.title)
|
|
86
86
|
|
|
87
|
+
br, bg, bb = self.config.background_color
|
|
88
|
+
backend.set_clear_color(br, bg, bb)
|
|
89
|
+
|
|
87
90
|
self.change_scene(initial_scene)
|
|
88
91
|
|
|
89
92
|
self._running = True
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|