mini-arcade-native-backend 0.3.1__tar.gz → 0.3.2__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.
Files changed (23) hide show
  1. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/.changelog_section +3 -1
  2. mini_arcade_native_backend-0.3.2/.version_to_tag +1 -0
  3. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/CHANGELOG.md +11 -0
  4. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/PKG-INFO +1 -1
  5. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/cpp/bindings.cpp +5 -0
  6. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/cpp/engine.cpp +28 -0
  7. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/cpp/engine.h +3 -0
  8. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/pyproject.toml +1 -1
  9. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/src/mini_arcade_native_backend/__init__.py +11 -3
  10. mini_arcade_native_backend-0.3.1/.version_to_tag +0 -1
  11. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/.github/workflows/ci.yml +0 -0
  12. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/.github/workflows/create-release-branch.yml +0 -0
  13. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/.github/workflows/release-finalize.yml +0 -0
  14. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/.github/workflows/release-publish.yml +0 -0
  15. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/.gitignore +0 -0
  16. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/.vscode/settings.json +0 -0
  17. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/CMakeLists.txt +0 -0
  18. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/LICENSE +0 -0
  19. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/README.md +0 -0
  20. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/examples/native_backend_demo.py +0 -0
  21. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/poetry.lock +0 -0
  22. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/poetry.toml +0 -0
  23. {mini_arcade_native_backend-0.3.1 → mini_arcade_native_backend-0.3.2}/tests/test_init.py +0 -0
@@ -1,9 +1,11 @@
1
- ## [0.3.1] - 2025-12-05
1
+ ## [0.3.2] - 2025-12-05
2
2
 
3
3
  ### Added
4
+ - add draw_rect_rgba method to Engine for RGBA rectangle drawing and update Python bindings
4
5
  - add capture_frame method to Engine and expose it in Python bindings
5
6
  - add clear color customization and update draw_rect method
6
7
 
7
8
  ### Other
8
9
  - Merge branch 'release/0.3' of https://github.com/alexsc6955/mini-arcade-native-backend into release/0.3
10
+ - Merge branch 'release/0.3' of https://github.com/alexsc6955/mini-arcade-native-backend into release/0.3
9
11
 
@@ -0,0 +1 @@
1
+ 0.3.2
@@ -6,6 +6,17 @@ This project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.2] - 2025-12-05
10
+
11
+ ### Added
12
+ - add draw_rect_rgba method to Engine for RGBA rectangle drawing and update Python bindings
13
+ - add capture_frame method to Engine and expose it in Python bindings
14
+ - add clear color customization and update draw_rect method
15
+
16
+ ### Other
17
+ - Merge branch 'release/0.3' of https://github.com/alexsc6955/mini-arcade-native-backend into release/0.3
18
+ - Merge branch 'release/0.3' of https://github.com/alexsc6955/mini-arcade-native-backend into release/0.3
19
+
9
20
  ## [0.3.1] - 2025-12-05
10
21
 
11
22
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mini-arcade-native-backend
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Native SDL2 backend for mini-arcade-core using SDL2 + pybind11.
5
5
  Author-Email: Santiago Rincon <rincores@gmail.com>
6
6
  License: Copyright (c) 2025 Santiago Rincón
@@ -42,6 +42,11 @@ PYBIND11_MODULE(_native, m) {
42
42
  py::arg("texture_id"), py::arg("x"), py::arg("y"),
43
43
  py::arg("w"), py::arg("h"))
44
44
 
45
+ .def("draw_rect_rgba", &mini::Engine::draw_rect_rgba,
46
+ py::arg("x"), py::arg("y"),
47
+ py::arg("w"), py::arg("h"),
48
+ py::arg("r"), py::arg("g"), py::arg("b"), py::arg("a"))
49
+
45
50
  .def("load_font", &mini::Engine::load_font,
46
51
  py::arg("path"), py::arg("pt_size"))
47
52
 
@@ -84,6 +84,9 @@ namespace mini {
84
84
  throw std::runtime_error(msg);
85
85
  }
86
86
 
87
+ // Enable alpha blending for RGBA drawing
88
+ SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND);
89
+
87
90
  initialized_ = true;
88
91
  }
89
92
 
@@ -216,6 +219,31 @@ namespace mini {
216
219
  SDL_DestroyTexture(texture);
217
220
  }
218
221
 
222
+ void Engine::draw_rect_rgba(int x, int y, int w, int h, int r, int g, int b, int a)
223
+ {
224
+ if (!initialized_ || renderer_ == nullptr) {
225
+ return;
226
+ }
227
+
228
+ auto clamp = [](int v) {
229
+ if (v < 0) return 0;
230
+ if (v > 255) return 255;
231
+ return v;
232
+ };
233
+
234
+ SDL_Rect rect{ x, y, w, h };
235
+
236
+ SDL_SetRenderDrawColor(
237
+ renderer_,
238
+ static_cast<Uint8>(clamp(r)),
239
+ static_cast<Uint8>(clamp(g)),
240
+ static_cast<Uint8>(clamp(b)),
241
+ static_cast<Uint8>(clamp(a))
242
+ );
243
+ SDL_RenderFillRect(renderer_, &rect);
244
+ }
245
+
246
+
219
247
  bool Engine::capture_frame(const char* path)
220
248
  {
221
249
  if (!initialized_ || renderer_ == nullptr) {
@@ -58,6 +58,9 @@ namespace mini {
58
58
  // Returns true on success, false on failure.
59
59
  bool capture_frame(const char* path);
60
60
 
61
+ // Draw a filled rectangle with RGBA color (supports transparency).
62
+ void draw_rect_rgba(int x, int y, int w, int h, int r, int g, int b, int a);
63
+
61
64
  private:
62
65
  SDL_Window* window_;
63
66
  SDL_Renderer* renderer_;
@@ -8,7 +8,7 @@ build-backend = "scikit_build_core.build"
8
8
 
9
9
  [project]
10
10
  name = "mini-arcade-native-backend"
11
- version = "0.3.1"
11
+ version = "0.3.2"
12
12
  description = "Native SDL2 backend for mini-arcade-core using SDL2 + pybind11."
13
13
  authors = [
14
14
  { name = "Santiago Rincon", email = "rincores@gmail.com" },
@@ -100,7 +100,7 @@ class NativeBackend(Backend):
100
100
  y: int,
101
101
  w: int,
102
102
  h: int,
103
- color: tuple[int, int, int] = (255, 255, 255),
103
+ color: tuple[int, ...] = (255, 255, 255),
104
104
  ):
105
105
  """
106
106
  Draw a rectangle at the specified position with given width and height.
@@ -117,8 +117,16 @@ class NativeBackend(Backend):
117
117
  :param h: Height of the rectangle.
118
118
  :type h: int
119
119
  """
120
- r, g, b = color
121
- self._engine.draw_rect(x, y, w, h, int(r), int(g), int(b))
120
+ if len(color) == 3:
121
+ r, g, b = color
122
+ self._engine.draw_rect(x, y, w, h, r, g, b)
123
+ elif len(color) == 4:
124
+ r, g, b, a = color
125
+ self._engine.draw_rect_rgba(x, y, w, h, r, g, b, a)
126
+ else:
127
+ raise ValueError(
128
+ f"Color must be (r,g,b) or (r,g,b,a), got {color!r}"
129
+ )
122
130
 
123
131
  def draw_text(
124
132
  self,
@@ -1 +0,0 @@
1
- 0.3.1