Skip to content

Commit

Permalink
Suppress internal mouse.tile_motion deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
HexDecimal committed Aug 14, 2024
1 parent b692d78 commit a8f66fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ This project adheres to [Semantic Versioning](https://semver.org/) since version

- Keyboard bitmask modifiers `tcod.event.KMOD_*` have been replaced by `tcod.event.Modifier`.

### Fixed

- Suppressed internal `mouse.tile_motion` deprecation warning.

## [16.2.3] - 2024-07-16

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion tcod/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def convert_event(self, event: _Event) -> _Event:
event.position[0] - event.motion[0],
event.position[1] - event.motion[1],
)
event_copy.motion = event.tile_motion = tcod.event.Point(
event_copy.motion = event._tile_motion = tcod.event.Point(
event._tile[0] - prev_tile[0], event._tile[1] - prev_tile[1]
)
return event_copy
Expand Down
6 changes: 3 additions & 3 deletions tcod/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def __init__(
) -> None:
super().__init__(position, tile, state)
self.motion = Point(*motion)
self.__tile_motion = Point(*tile_motion) if tile_motion is not None else None
self._tile_motion = Point(*tile_motion) if tile_motion is not None else None

@property
def pixel_motion(self) -> Point:
Expand Down Expand Up @@ -514,7 +514,7 @@ def tile_motion(self) -> Point:
DeprecationWarning,
stacklevel=2,
)
return _verify_tile_coordinates(self.__tile_motion)
return _verify_tile_coordinates(self._tile_motion)

@tile_motion.setter
def tile_motion(self, xy: tuple[int, int]) -> None:
Expand All @@ -524,7 +524,7 @@ def tile_motion(self, xy: tuple[int, int]) -> None:
DeprecationWarning,
stacklevel=2,
)
self.__tile_motion = Point(*xy)
self._tile_motion = Point(*xy)

@classmethod
def from_sdl_event(cls, sdl_event: Any) -> MouseMotion:
Expand Down

0 comments on commit a8f66fc

Please sign in to comment.