mini-arcade-native-backend 0.4.5__tar.gz → 0.5.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_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/.vscode/settings.json +19 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/CHANGELOG.md +20 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/PKG-INFO +2 -2
- mini_arcade_native_backend-0.5.0/cpp/bindings.cpp +93 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/cpp/engine.cpp +7 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/cpp/engine.h +3 -0
- mini_arcade_native_backend-0.5.0/poetry.lock +1004 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/pyproject.toml +5 -2
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/src/mini_arcade_native_backend/__init__.py +30 -5
- mini_arcade_native_backend-0.5.0/tests/test_init.py +5 -0
- mini_arcade_native_backend-0.4.5/cpp/bindings.cpp +0 -89
- mini_arcade_native_backend-0.4.5/poetry.lock +0 -23
- mini_arcade_native_backend-0.4.5/tests/test_init.py +0 -339
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/.github/workflows/ci.yml +0 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/.github/workflows/create-release-branch.yml +0 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/.github/workflows/release-finalize.yml +0 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/.github/workflows/release-publish.yml +0 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/.gitignore +0 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/CMakeLists.txt +0 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/LICENSE +0 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/README.md +0 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/examples/native_backend_demo.py +0 -0
- {mini_arcade_native_backend-0.4.5 → mini_arcade_native_backend-0.5.0}/poetry.toml +0 -0
|
@@ -77,4 +77,23 @@
|
|
|
77
77
|
"python.analysis.autoImportCompletions": true,
|
|
78
78
|
"black-formatter.importStrategy": "fromEnvironment",
|
|
79
79
|
"isort.importStrategy": "fromEnvironment",
|
|
80
|
+
"cSpell.words": [
|
|
81
|
+
"etype",
|
|
82
|
+
"isort",
|
|
83
|
+
"keymaps",
|
|
84
|
+
"KEYUP",
|
|
85
|
+
"MOUSEBUTTONDOWN",
|
|
86
|
+
"MOUSEBUTTONUP",
|
|
87
|
+
"MOUSEMOTION",
|
|
88
|
+
"mypy",
|
|
89
|
+
"pybind",
|
|
90
|
+
"pylint",
|
|
91
|
+
"pytest",
|
|
92
|
+
"Rincon",
|
|
93
|
+
"rtype",
|
|
94
|
+
"scancode",
|
|
95
|
+
"scikit",
|
|
96
|
+
"venv",
|
|
97
|
+
"WINDOWRESIZED"
|
|
98
|
+
],
|
|
80
99
|
}
|
|
@@ -6,6 +6,26 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.5.0] - 2026-01-21
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- add set_window_title method to Engine and update init method to accept optional title
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Update dependencies and improve import handling for mini-arcade-core
|
|
16
|
+
- update import statements for Event and SDL_KEYCODE_TO_KEY to improve clarity
|
|
17
|
+
|
|
18
|
+
### Other
|
|
19
|
+
- Merge branch 'develop' into release/0.5
|
|
20
|
+
|
|
21
|
+
## [0.4.6] - 2025-12-26
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- update mini-arcade-core dependency version and improve import statements
|
|
25
|
+
|
|
26
|
+
### Other
|
|
27
|
+
- Merge branch 'release/0.4' of https://github.com/alexsc6955/mini-arcade-native-backend into release/0.4
|
|
28
|
+
|
|
9
29
|
## [0.4.5] - 2025-12-16
|
|
10
30
|
|
|
11
31
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mini-arcade-native-backend
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
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
|
|
@@ -24,7 +24,7 @@ License: Copyright (c) 2025 Santiago Rincón
|
|
|
24
24
|
SOFTWARE.
|
|
25
25
|
|
|
26
26
|
Requires-Python: <3.12,>=3.9
|
|
27
|
-
Requires-Dist: mini-arcade-core~=0
|
|
27
|
+
Requires-Dist: mini-arcade-core~=1.0
|
|
28
28
|
Provides-Extra: dev
|
|
29
29
|
Requires-Dist: pytest~=8.3; extra == "dev"
|
|
30
30
|
Requires-Dist: pytest-cov~=6.0; extra == "dev"
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#include <pybind11/pybind11.h>
|
|
2
|
+
#include <pybind11/stl.h> // so std::vector<Event> becomes a Python list
|
|
3
|
+
|
|
4
|
+
#include "engine.h"
|
|
5
|
+
|
|
6
|
+
namespace py = pybind11;
|
|
7
|
+
|
|
8
|
+
PYBIND11_MODULE(_native, m) {
|
|
9
|
+
m.doc() = "Mini arcade native SDL2 backend";
|
|
10
|
+
|
|
11
|
+
// Bind the EventType enum
|
|
12
|
+
py::enum_<mini::EventType>(m, "EventType")
|
|
13
|
+
.value("Unknown", mini::EventType::Unknown)
|
|
14
|
+
.value("Quit", mini::EventType::Quit)
|
|
15
|
+
.value("KeyDown", mini::EventType::KeyDown)
|
|
16
|
+
.value("KeyUp", mini::EventType::KeyUp)
|
|
17
|
+
.value("MouseMotion", mini::EventType::MouseMotion)
|
|
18
|
+
.value("MouseButtonDown", mini::EventType::MouseButtonDown)
|
|
19
|
+
.value("MouseButtonUp", mini::EventType::MouseButtonUp)
|
|
20
|
+
.value("MouseWheel", mini::EventType::MouseWheel)
|
|
21
|
+
.value("WindowResized", mini::EventType::WindowResized)
|
|
22
|
+
.value("TextInput", mini::EventType::TextInput)
|
|
23
|
+
.export_values();
|
|
24
|
+
|
|
25
|
+
// Bind the Event struct
|
|
26
|
+
py::class_<mini::Event>(m, "Event")
|
|
27
|
+
.def_readonly("type", &mini::Event::type)
|
|
28
|
+
.def_readonly("key", &mini::Event::key)
|
|
29
|
+
.def_readonly("scancode", &mini::Event::scancode)
|
|
30
|
+
.def_readonly("mod", &mini::Event::mod)
|
|
31
|
+
.def_readonly("repeat", &mini::Event::repeat)
|
|
32
|
+
.def_readonly("x", &mini::Event::x)
|
|
33
|
+
.def_readonly("y", &mini::Event::y)
|
|
34
|
+
.def_readonly("dx", &mini::Event::dx)
|
|
35
|
+
.def_readonly("dy", &mini::Event::dy)
|
|
36
|
+
.def_readonly("button", &mini::Event::button)
|
|
37
|
+
.def_readonly("wheel_x", &mini::Event::wheel_x)
|
|
38
|
+
.def_readonly("wheel_y", &mini::Event::wheel_y)
|
|
39
|
+
.def_readonly("width", &mini::Event::width)
|
|
40
|
+
.def_readonly("height", &mini::Event::height)
|
|
41
|
+
.def_readonly("text", &mini::Event::text);
|
|
42
|
+
|
|
43
|
+
// Bind the Engine class
|
|
44
|
+
py::class_<mini::Engine>(m, "Engine")
|
|
45
|
+
.def(py::init<>())
|
|
46
|
+
.def("init", &mini::Engine::init,
|
|
47
|
+
py::arg("width"), py::arg("height"), py::arg("title"))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
.def("set_window_title", &mini::Engine::set_window_title,
|
|
51
|
+
py::arg("title"))
|
|
52
|
+
|
|
53
|
+
.def("set_clear_color", &mini::Engine::set_clear_color,
|
|
54
|
+
py::arg("r"), py::arg("g"), py::arg("b"))
|
|
55
|
+
|
|
56
|
+
.def("begin_frame", &mini::Engine::begin_frame)
|
|
57
|
+
.def("end_frame", &mini::Engine::end_frame)
|
|
58
|
+
|
|
59
|
+
.def("draw_rect", &mini::Engine::draw_rect,
|
|
60
|
+
py::arg("x"), py::arg("y"),
|
|
61
|
+
py::arg("w"), py::arg("h"),
|
|
62
|
+
py::arg("r"), py::arg("g"), py::arg("b"), py::arg("a"))
|
|
63
|
+
|
|
64
|
+
.def("draw_sprite", &mini::Engine::draw_sprite,
|
|
65
|
+
py::arg("texture_id"), py::arg("x"), py::arg("y"),
|
|
66
|
+
py::arg("w"), py::arg("h"))
|
|
67
|
+
|
|
68
|
+
.def("load_font", &mini::Engine::load_font,
|
|
69
|
+
py::arg("path"), py::arg("pt_size"))
|
|
70
|
+
|
|
71
|
+
.def(
|
|
72
|
+
"draw_text",
|
|
73
|
+
&mini::Engine::draw_text,
|
|
74
|
+
py::arg("text"),
|
|
75
|
+
py::arg("x"),
|
|
76
|
+
py::arg("y"),
|
|
77
|
+
py::arg("r"),
|
|
78
|
+
py::arg("g"),
|
|
79
|
+
py::arg("b"),
|
|
80
|
+
py::arg("a"),
|
|
81
|
+
py::arg("font_id") = -1
|
|
82
|
+
)
|
|
83
|
+
.def("poll_events", &mini::Engine::poll_events)
|
|
84
|
+
|
|
85
|
+
.def("capture_frame", &mini::Engine::capture_frame,
|
|
86
|
+
py::arg("path"))
|
|
87
|
+
.def(
|
|
88
|
+
"measure_text",
|
|
89
|
+
&mini::Engine::measure_text,
|
|
90
|
+
py::arg("text"),
|
|
91
|
+
py::arg("font_id") = -1
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -105,6 +105,13 @@ namespace mini {
|
|
|
105
105
|
initialized_ = true;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
|
|
109
|
+
void Engine::set_window_title(const char* title)
|
|
110
|
+
{
|
|
111
|
+
if (!initialized_ || !window_) return;
|
|
112
|
+
SDL_SetWindowTitle(window_, title ? title : "");
|
|
113
|
+
}
|
|
114
|
+
|
|
108
115
|
void Engine::set_clear_color(int r, int g, int b)
|
|
109
116
|
{
|
|
110
117
|
auto clamp = [](int v) {
|
|
@@ -62,6 +62,9 @@ namespace mini {
|
|
|
62
62
|
// Initialize the engine with a window of given width, height, and title.
|
|
63
63
|
void init(int width, int height, const char* title);
|
|
64
64
|
|
|
65
|
+
// Set the window title.
|
|
66
|
+
void set_window_title(const char* title);
|
|
67
|
+
|
|
65
68
|
// Set the clear color for the screen.
|
|
66
69
|
void set_clear_color(int r, int g, int b);
|
|
67
70
|
|