Skip to content

Rotate UIWidget #2380

Open
Open

Description

@eruvanos

Enhancement request:

Allow rotation of widgets.

What would it help with?

Having animation for GUIs is the logical next step. Such animations often contain some rotation of widgets.
Also playful menus sometimes rotate the buttons to present them in a game specific style.

Known issues:

  • Rect does not support rotation
  • Rect: In bounce checks do not support rotation
  • Rotating the content of a widget messes up the required space, so layouts are not able to deal with them

First Brainstorming

UIWidgets keep non rotated rect, but the inside content_rect can be rotated.
In this case it will shrink to stay within bounce of the rect (inc border and padding)
Such implementation will also not interfere with the layouts.

Activity

  1. added
    guiRelated to arcade GUI (sub module arcade.gui)
    on Sep 29, 2024
  2. eruvanos commented on Sep 29, 2024

    @eruvanos
    MemberAuthor

    @DragonMoffon @pushfoo any thoughts?

  3. pushfoo commented on Oct 1, 2024

    @pushfoo
    Member

    TL;DR: Rect is a doc issue + we're touching on larger hitbox / layout design which may need post-3.0 thought

    Rect does not support rotation

    Rect is an AABB. I merged @DigiDuncan's Rect PR without a thorough doc proof-reading pass because we needed the features ASAP.

    I agree the current Rect could be clearer about the AABB. We could probably fit it in the first line of the docstring and after as something like this:

    An Axis-Aligned Bounding Box (AABB).

    Since it is axis-aligned, you will need to $WORLD_SPACE_TRANSFORM

    I can work on this change in a bit. As to the larger set of concerns, I brought some of this up with the pyglet team in the past:

    The summary is:

    • It's hard to performantly calculate width and height for layout purposes when rotations are applied
    • We didn't ever come to a conclusion about how to resolve it
    • I've wondered whether radius-based heuristics would be better for layout:
      1. Updating state radius = max(dist(pt, points.centroid) for pt in points)
      2. Use the GPU / C to make it faster?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementguiRelated to arcade GUI (sub module arcade.gui)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions