mini-arcade-core 0.8.1__tar.gz → 0.9.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mini-arcade-core
3
- Version: 0.8.1
3
+ Version: 0.9.0
4
4
  Summary: Tiny scene-based game loop core for small arcade games.
5
5
  License: Copyright (c) 2025 Santiago Rincón
6
6
 
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [project]
6
6
  name = "mini-arcade-core"
7
- version = "0.8.1"
7
+ version = "0.9.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" },
@@ -7,7 +7,7 @@ from __future__ import annotations
7
7
 
8
8
  from dataclasses import dataclass
9
9
  from enum import Enum, auto
10
- from typing import Iterable, Protocol, Tuple, Union
10
+ from typing import Iterable, Optional, Protocol, Tuple, Union
11
11
 
12
12
  Color = Union[Tuple[int, int, int], Tuple[int, int, int, int]]
13
13
 
@@ -20,14 +20,33 @@ class EventType(Enum):
20
20
  :cvar QUIT: User requested to quit the game.
21
21
  :cvar KEYDOWN: A key was pressed.
22
22
  :cvar KEYUP: A key was released.
23
+ :cvar MOUSEMOTION: The mouse was moved.
24
+ :cvar MOUSEBUTTONDOWN: A mouse button was pressed.
25
+ :cvar MOUSEBUTTONUP: A mouse button was released.
26
+ :cvar MOUSEWHEEL: The mouse wheel was scrolled.
27
+ :cvar WINDOWRESIZED: The window was resized.
28
+ :cvar TEXTINPUT: Text input event (for IME support).
23
29
  """
24
30
 
25
31
  UNKNOWN = auto()
26
32
  QUIT = auto()
33
+
27
34
  KEYDOWN = auto()
28
35
  KEYUP = auto()
29
36
 
37
+ # Mouse
38
+ MOUSEMOTION = auto()
39
+ MOUSEBUTTONDOWN = auto()
40
+ MOUSEBUTTONUP = auto()
41
+ MOUSEWHEEL = auto()
42
+
43
+ # Window / text
44
+ WINDOWRESIZED = auto()
45
+ TEXTINPUT = auto()
46
+
30
47
 
48
+ # Justification: Simple data container for now
49
+ # pylint: disable=too-many-instance-attributes
31
50
  @dataclass(frozen=True)
32
51
  class Event:
33
52
  """
@@ -39,10 +58,43 @@ class Event:
39
58
 
40
59
  :ivar type (EventType): The type of event.
41
60
  :ivar key (int | None): The key code associated with the event, if any.
61
+ :ivar scancode (int | None): The hardware scancode of the key, if any.
62
+ :ivar mod (int | None): Modifier keys bitmask, if any.
63
+ :ivar repeat (bool | None): Whether this key event is a repeat, if any.
64
+ :ivar x (int | None): Mouse X position, if any.
65
+ :ivar y (int | None): Mouse Y position, if any.
66
+ :ivar dx (int | None): Mouse delta X, if any.
67
+ :ivar dy (int | None): Mouse delta Y, if any.
68
+ :ivar button (int | None): Mouse button number, if any.
69
+ :ivar wheel (Tuple[int, int] | None): Mouse wheel scroll (x, y), if any.
70
+ :ivar size (Tuple[int, int] | None): New window size (width, height), if any.
71
+ :ivar text (str | None): Text input, if any.
42
72
  """
43
73
 
44
74
  type: EventType
45
- key: int | None = None
75
+ key: Optional[int] = None
76
+
77
+ # Keyboard extras (optional)
78
+ scancode: Optional[int] = None
79
+ mod: Optional[int] = None
80
+ repeat: Optional[bool] = None
81
+
82
+ # Mouse (optional)
83
+ x: Optional[int] = None
84
+ y: Optional[int] = None
85
+ dx: Optional[int] = None
86
+ dy: Optional[int] = None
87
+ button: Optional[int] = None
88
+ wheel: Optional[Tuple[int, int]] = None # (wheel_x, wheel_y)
89
+
90
+ # Window (optional)
91
+ size: Optional[Tuple[int, int]] = None # (width, height)
92
+
93
+ # Text input (optional)
94
+ text: Optional[str] = None
95
+
96
+
97
+ # pylint: enable=too-many-instance-attributes
46
98
 
47
99
 
48
100
  class Backend(Protocol):