Skip to content

Eruvanos #2460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions arcade/camera/camera_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ def point_in_view(self, point: Point2) -> bool:
"""
# This is unwrapped from standard Vec2 operations,
# The construction and garbage collection of the vectors would
# increase this method's cost by ~4x
# increase this method's cost by ~4x

pos = self.position
diff = point[0] - pos[0], point[1] - pos[1]

Expand Down Expand Up @@ -569,7 +569,6 @@ def projection(self) -> Rect:

@projection.setter
def projection(self, value: Rect) -> None:

# Unpack and validate
if not value:
raise ZeroProjectionDimension((f"Projection area is 0, {value.lrbt}"))
Expand Down
2 changes: 1 addition & 1 deletion arcade/future/splash.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ArcadeSplash(View):
dark_mode: If True, the splash screen will be shown in dark mode. (Default False)
"""

def __init__(self, view: View, duration: int = 3, dark_mode: bool = False):
def __init__(self, view: View, duration: float = 1.5, dark_mode: bool = False):
super().__init__()
self._next_view = view
self._duration = duration
Expand Down
11 changes: 8 additions & 3 deletions arcade/gui/ui_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def on_draw():

_enabled = False

DEFAULT_LAYER = 0
OVERLAY_LAYER = 10

def __init__(self, window: Optional[arcade.Window] = None):
Expand All @@ -103,7 +104,7 @@ def __init__(self, window: Optional[arcade.Window] = None):

self.register_event_type("on_event")

def add(self, widget: W, *, index=None, layer=0) -> W:
def add(self, widget: W, *, index=None, layer=DEFAULT_LAYER) -> W:
"""Add a widget to the :class:`UIManager`.

Added widgets will receive ui events and be rendered.
Expand Down Expand Up @@ -141,7 +142,9 @@ def remove(self, child: UIWidget):
child.parent = None
self.trigger_render()

def walk_widgets(self, *, root: Optional[UIWidget] = None, layer=0) -> Iterable[UIWidget]:
def walk_widgets(
self, *, root: Optional[UIWidget] = None, layer=DEFAULT_LAYER
) -> Iterable[UIWidget]:
"""Walks through widget tree, in reverse draw order (most top drawn widget first)

Args:
Expand All @@ -165,7 +168,9 @@ def clear(self):
for widget in layer[:]:
self.remove(widget)

def get_widgets_at(self, pos: Point2, cls: type[W] = UIWidget, layer=0) -> Iterable[W]:
def get_widgets_at(
self, pos: Point2, cls: type[W] = UIWidget, layer=DEFAULT_LAYER
) -> Iterable[W]:
"""Yields all widgets containing a position, returns first top laying widgets
which is instance of cls.

Expand Down
Loading