mini-arcade-native-backend 0.4.0__cp39-cp39-win_amd64.whl → 0.4.1__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.
@@ -53,6 +53,12 @@ _NATIVE_TO_CORE = {
53
53
  native.EventType.Quit: EventType.QUIT,
54
54
  native.EventType.KeyDown: EventType.KEYDOWN,
55
55
  native.EventType.KeyUp: EventType.KEYUP,
56
+ native.EventType.MouseMotion: EventType.MOUSEMOTION,
57
+ native.EventType.MouseButtonDown: EventType.MOUSEBUTTONDOWN,
58
+ native.EventType.MouseButtonUp: EventType.MOUSEBUTTONUP,
59
+ native.EventType.MouseWheel: EventType.MOUSEWHEEL,
60
+ native.EventType.WindowResized: EventType.WINDOWRESIZED,
61
+ native.EventType.TextInput: EventType.TEXTINPUT,
56
62
  }
57
63
 
58
64
 
@@ -108,6 +114,8 @@ class NativeBackend(Backend):
108
114
  """
109
115
  self._engine.set_clear_color(int(r), int(g), int(b))
110
116
 
117
+ # Justification: Many local variables needed for event mapping
118
+ # pylint: disable=too-many-locals
111
119
  def poll_events(self) -> list[Event]:
112
120
  """
113
121
  Poll for events from the backend and return them as a list of Event objects.
@@ -115,12 +123,54 @@ class NativeBackend(Backend):
115
123
  :return: List of Event objects representing the polled events.
116
124
  :rtype: list[Event]
117
125
  """
118
- events: list[Event] = []
126
+ out: list[Event] = []
119
127
  for ev in self._engine.poll_events():
120
- core_type = _NATIVE_TO_CORE.get(ev.type, EventType.UNKNOWN)
128
+ etype = _NATIVE_TO_CORE.get(ev.type, EventType.UNKNOWN)
129
+
130
+ # "0 means not present" convention from C++ side
121
131
  key = ev.key if getattr(ev, "key", 0) != 0 else None
122
- events.append(Event(type=core_type, key=key))
123
- return events
132
+
133
+ x = getattr(ev, "x", 0) or None
134
+ y = getattr(ev, "y", 0) or None
135
+ dx = getattr(ev, "dx", 0) or None
136
+ dy = getattr(ev, "dy", 0) or None
137
+ button = getattr(ev, "button", 0) or None
138
+
139
+ wheel_x = getattr(ev, "wheel_x", 0)
140
+ wheel_y = getattr(ev, "wheel_y", 0)
141
+ wheel = (wheel_x, wheel_y) if (wheel_x or wheel_y) else None
142
+
143
+ w = getattr(ev, "width", 0)
144
+ h = getattr(ev, "height", 0)
145
+ size = (w, h) if (w and h) else None
146
+
147
+ text = getattr(ev, "text", "") or None
148
+
149
+ scancode = getattr(ev, "scancode", 0) or None
150
+ mod = getattr(ev, "mod", 0) or None
151
+ repeat_raw = getattr(ev, "repeat", 0)
152
+ repeat = bool(repeat_raw) if repeat_raw else None
153
+
154
+ out.append(
155
+ Event(
156
+ type=etype,
157
+ key=key,
158
+ x=x,
159
+ y=y,
160
+ dx=dx,
161
+ dy=dy,
162
+ button=button,
163
+ wheel=wheel,
164
+ size=size,
165
+ text=text,
166
+ scancode=scancode,
167
+ mod=mod,
168
+ repeat=repeat,
169
+ )
170
+ )
171
+ return out
172
+
173
+ # pylint: enable=too-many-locals
124
174
 
125
175
  def begin_frame(self):
126
176
  """Begin a new frame for rendering."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mini-arcade-native-backend
3
- Version: 0.4.0
3
+ Version: 0.4.1
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.2.3
27
+ Requires-Dist: mini-arcade-core~=0.9
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,6 @@
1
+ mini_arcade_native_backend/__init__.py,sha256=CISb6F09IyBc8xg5gEoiG5hUgBjCSOtkw-4SNNzQMLM,8699
2
+ mini_arcade_native_backend/_native.cp39-win_amd64.pyd,sha256=d8dOv39HS3sVcnm88kT8fCW0dlwWGi3OMrZICt6nikE,224768
3
+ mini_arcade_native_backend-0.4.1.dist-info/METADATA,sha256=Ar02qqV_fKEgajUC3fF4DNOU2_xhRf8ZqiaNEDukyN8,10517
4
+ mini_arcade_native_backend-0.4.1.dist-info/WHEEL,sha256=9tsL4JT94eZPTkcS3bNng2riasYJMxXndrO9CxUfJHs,104
5
+ mini_arcade_native_backend-0.4.1.dist-info/licenses/LICENSE,sha256=cZRgTdRJ3YASekMxkGAvylB2nROh4ov228DxAogK3yY,1115
6
+ mini_arcade_native_backend-0.4.1.dist-info/RECORD,,
@@ -1,6 +0,0 @@
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,,