Class AnimatedMascot

java.lang.Object
wiiuu.ui.AnimatedMascot

public class AnimatedMascot extends Object
An animated branded card with speech bubbles, extracted from WII-UU: a card with googly eyes and little legs. It walks in, blinks, watches a point (the selection), hops when it has something to say, and says it in a speech bubble that types out and fades a few seconds later. The host supplies messages, appearance, a clock, input and repaint scheduling. Use one instance on one UI thread; it does not play audio.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    Branding and live appearance supplied by the host; font sizes are in points.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Supply a live theme and a monotonic millisecond clock for deterministic animation.
    Use a fixed appearance and the system millisecond clock.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    hit(double x, double y)
    Whether a click at x, y hits it.
    void
    hop()
     
    void
    look(float x, float y)
    Where it looks (screen coordinates).
    boolean
    Whether the next frame looks different (the caller repaints only then).
    void
    paint(Graphics2D g, float footX, float footY, float s, boolean bubbleAbove, float bubbleW)
    Paints it standing at footX, footY, with a body s high (2.6 s wide), and its bubble to the right (bubbleAbove false) or above it, at most bubbleW wide.
    void
    paintWalking(Graphics2D g, float footX, float footY, float s, float stride)
     
    long
    How long since it last said something (ms).
    void
    say(String line)
    Says something (and hops).
    void
    sayOne(String... lines)
    Says one of these, at random.
    boolean
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AnimatedMascot

      public AnimatedMascot(AnimatedMascot.Style style)
      Use a fixed appearance and the system millisecond clock. Host owns repaint/input scheduling.
    • AnimatedMascot

      public AnimatedMascot(Supplier<AnimatedMascot.Style> style, LongSupplier clock)
      Supply a live theme and a monotonic millisecond clock for deterministic animation.
  • Method Details

    • say

      public void say(String line)
      Says something (and hops).
    • sayOne

      public void sayOne(String... lines)
      Says one of these, at random.
    • quietFor

      public long quietFor()
      How long since it last said something (ms).
    • talking

      public boolean talking()
    • hop

      public void hop()
    • look

      public void look(float x, float y)
      Where it looks (screen coordinates).
    • hit

      public boolean hit(double x, double y)
      Whether a click at x, y hits it.
    • needsFrame

      public boolean needsFrame()
      Whether the next frame looks different (the caller repaints only then).
    • paint

      public void paint(Graphics2D g, float footX, float footY, float s, boolean bubbleAbove, float bubbleW)
      Paints it standing at footX, footY, with a body s high (2.6 s wide), and its bubble to the right (bubbleAbove false) or above it, at most bubbleW wide.
    • paintWalking

      public void paintWalking(Graphics2D g, float footX, float footY, float s, float stride)