Skip to content

Commit

Permalink
Add window center properties (#2056)
Browse files Browse the repository at this point in the history
* add window center properties

* oh right, docstrings
  • Loading branch information
DigiDuncan committed Apr 9, 2024
1 parent 92b9224 commit 71de1f8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions arcade/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,21 @@ def on_mouse_leave(self, x: int, y: int):
"""
pass

@property
def center(self) -> tuple[float, float]:
"""Returns the coordinates of the center of the window."""
return (self.width / 2, self.height / 2)

@property
def center_x(self) -> float:
"""Returns the X-coordinate of the center of the window."""
return self.width / 2

@property
def center_y(self) -> float:
"""Returns the Y-coordinate of the center of the window."""
return self.height / 2


def open_window(
width: int,
Expand Down

0 comments on commit 71de1f8

Please sign in to comment.