mini-arcade-native-backend 0.3.4__cp39-cp39-win_amd64.whl → 0.4.0__cp39-cp39-win_amd64.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.
- mini_arcade_native_backend/__init__.py +24 -4
- mini_arcade_native_backend/_native.cp39-win_amd64.pyd +0 -0
- {mini_arcade_native_backend-0.3.4.dist-info → mini_arcade_native_backend-0.4.0.dist-info}/METADATA +1 -1
- mini_arcade_native_backend-0.4.0.dist-info/RECORD +6 -0
- mini_arcade_native_backend-0.3.4.dist-info/RECORD +0 -6
- {mini_arcade_native_backend-0.3.4.dist-info → mini_arcade_native_backend-0.4.0.dist-info}/WHEEL +0 -0
- {mini_arcade_native_backend-0.3.4.dist-info → mini_arcade_native_backend-0.4.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,17 +6,31 @@ from __future__ import annotations
|
|
|
6
6
|
|
|
7
7
|
import os
|
|
8
8
|
import sys
|
|
9
|
+
from pathlib import Path
|
|
9
10
|
|
|
10
11
|
# --- 1) Make sure Windows can find SDL2.dll when using vcpkg ------------------
|
|
11
12
|
|
|
12
13
|
if sys.platform == "win32":
|
|
14
|
+
# a) If running as a frozen PyInstaller exe (e.g. DejaBounce.exe),
|
|
15
|
+
# SDL2.dll will live next to the executable. Add that dir.
|
|
16
|
+
if getattr(sys, "frozen", False):
|
|
17
|
+
exe_dir = Path(sys.executable).resolve().parent
|
|
18
|
+
try:
|
|
19
|
+
os.add_dll_directory(str(exe_dir))
|
|
20
|
+
except (FileNotFoundError, OSError):
|
|
21
|
+
# If this somehow fails, we still try other fallbacks.
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
# b) Dev / vcpkg fallback: use VCPKG_ROOT if available.
|
|
13
25
|
vcpkg_root = os.environ.get("VCPKG_ROOT")
|
|
14
26
|
if vcpkg_root:
|
|
15
27
|
# Typical vcpkg layout: <VCPKG_ROOT>/installed/x64-windows/bin/SDL2.dll
|
|
16
28
|
sdl_bin = os.path.join(vcpkg_root, "installed", "x64-windows", "bin")
|
|
17
29
|
if os.path.isdir(sdl_bin):
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
try:
|
|
31
|
+
os.add_dll_directory(sdl_bin)
|
|
32
|
+
except (FileNotFoundError, OSError):
|
|
33
|
+
pass
|
|
20
34
|
|
|
21
35
|
# --- 2) Now import native extension and core types ----------------------------
|
|
22
36
|
|
|
@@ -56,6 +70,7 @@ class NativeBackend(Backend):
|
|
|
56
70
|
self._engine = native.Engine()
|
|
57
71
|
self._font_path = font_path
|
|
58
72
|
self._font_size = font_size
|
|
73
|
+
self._default_font_id: int | None = None
|
|
59
74
|
|
|
60
75
|
def init(self, width: int, height: int, title: str):
|
|
61
76
|
"""
|
|
@@ -74,7 +89,9 @@ class NativeBackend(Backend):
|
|
|
74
89
|
|
|
75
90
|
# Load font if provided
|
|
76
91
|
if self._font_path is not None:
|
|
77
|
-
self._engine.load_font(
|
|
92
|
+
self._default_font_id = self._engine.load_font(
|
|
93
|
+
self._font_path, self._font_size
|
|
94
|
+
)
|
|
78
95
|
|
|
79
96
|
def set_clear_color(self, r: int, g: int, b: int):
|
|
80
97
|
"""
|
|
@@ -178,7 +195,10 @@ class NativeBackend(Backend):
|
|
|
178
195
|
"""
|
|
179
196
|
# We rely on C++ side to no-op if font is missing
|
|
180
197
|
r, g, b = color
|
|
181
|
-
|
|
198
|
+
font_id = (
|
|
199
|
+
self._default_font_id if self._default_font_id is not None else -1
|
|
200
|
+
)
|
|
201
|
+
self._engine.draw_text(text, x, y, int(r), int(g), int(b), font_id)
|
|
182
202
|
|
|
183
203
|
def capture_frame(self, path: str | None = None) -> bool:
|
|
184
204
|
"""
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
mini_arcade_native_backend/__init__.py,sha256=c5nVK2IazMmQs7-aWo4kAFW-JIN12gAs2blJWwgeHIk,6875
|
|
2
|
+
mini_arcade_native_backend/_native.cp39-win_amd64.pyd,sha256=IUWx0vkhqd5kMWkyKewj99FqJpM6REB8SWPMqnY-pVc,220672
|
|
3
|
+
mini_arcade_native_backend-0.4.0.dist-info/METADATA,sha256=Z8NcXEfzaLWgM3wRBflD7MlJv4HbsyYO_8A3tW3PfZg,10519
|
|
4
|
+
mini_arcade_native_backend-0.4.0.dist-info/WHEEL,sha256=9tsL4JT94eZPTkcS3bNng2riasYJMxXndrO9CxUfJHs,104
|
|
5
|
+
mini_arcade_native_backend-0.4.0.dist-info/licenses/LICENSE,sha256=cZRgTdRJ3YASekMxkGAvylB2nROh4ov228DxAogK3yY,1115
|
|
6
|
+
mini_arcade_native_backend-0.4.0.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
mini_arcade_native_backend/__init__.py,sha256=Wc8QcUb39AUnwJMy1XEykBadAybJNgncld2HLvKUPWw,6118
|
|
2
|
-
mini_arcade_native_backend/_native.cp39-win_amd64.pyd,sha256=3yy6T0rofRnzI-kNta0dC8_PN3ymfMTA5pdSnqheDeU,219648
|
|
3
|
-
mini_arcade_native_backend-0.3.4.dist-info/METADATA,sha256=le9rUOe-oCOXA_lL2EeHcDOhRL2qveWYc4mNNBQMMvo,10519
|
|
4
|
-
mini_arcade_native_backend-0.3.4.dist-info/WHEEL,sha256=9tsL4JT94eZPTkcS3bNng2riasYJMxXndrO9CxUfJHs,104
|
|
5
|
-
mini_arcade_native_backend-0.3.4.dist-info/licenses/LICENSE,sha256=cZRgTdRJ3YASekMxkGAvylB2nROh4ov228DxAogK3yY,1115
|
|
6
|
-
mini_arcade_native_backend-0.3.4.dist-info/RECORD,,
|
{mini_arcade_native_backend-0.3.4.dist-info → mini_arcade_native_backend-0.4.0.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|