@@ -23,55 +23,140 @@ namespace yup
2323{
2424
2525// ==============================================================================
26+ /* * Represents a Rive artboard.
27+
28+ This class is used to display a Rive artboard.
29+ */
2630class YUP_API Artboard : public Component
2731{
2832public:
2933 // ==============================================================================
30- Artboard (StringRef componentID);
34+ /* * Creates a new Rive artboard.
35+
36+ @param componentID The ID of the component.
37+ */
38+ Artboard (StringRef componentID = {});
39+
40+ /* * Creates a new Rive artboard.
41+
42+ @param componentID The ID of the component.
43+ @param artboardFile The Rive artboard file to display.
44+ */
3145 Artboard (StringRef componentID, std::shared_ptr<ArtboardFile> artboardFile);
3246
47+ // ==============================================================================
48+ /* * Sets the Rive artboard file to display.
49+
50+ @param artboardFile The Rive artboard file to display.
51+ */
3352 void setFile (std::shared_ptr<ArtboardFile> artboardFile);
3453
3554 // ==============================================================================
55+ /* * Clears the Rive artboard. */
3656 void clear ();
3757
3858 // ==============================================================================
59+ /* * Returns true if the Rive artboard is paused. */
3960 bool isPaused () const ;
61+
62+ /* * Sets the Rive artboard to paused or running.
63+
64+ @param shouldPause True to pause the Rive artboard, false to run it.
65+ */
4066 void setPaused (bool shouldPause);
4167
68+ /* * Advances the Rive artboard by a given number of seconds.
69+
70+ @param elapsedSeconds The number of seconds to advance the Rive artboard by.
71+ */
4272 void advanceAndApply (float elapsedSeconds);
73+
74+ /* * Returns the duration of the Rive artboard in seconds. */
4375 float durationSeconds () const ;
4476
4577 // ==============================================================================
78+ /* * Returns true if the Rive artboard has a boolean input with the given name. */
4679 bool hasBoolInput (const String& name) const ;
80+
81+ /* * Sets the value of a boolean input with the given name.
82+
83+ @param name The name of the input.
84+ @param value The value to set the input to.
85+ */
4786 void setBoolInput (const String& name, bool value);
4887
88+ /* * Returns true if the Rive artboard has a number input with the given name. */
4989 bool hasNumberInput (const String& name) const ;
90+
91+ /* * Sets the value of a number input with the given name.
92+
93+ @param name The name of the input.
94+ @param value The value to set the input to.
95+ */
5096 void setNumberInput (const String& name, double value);
5197
98+ /* * Returns true if the Rive artboard has a trigger input with the given name. */
5299 bool hasTriggerInput (const String& name) const ;
100+
101+ /* * Triggers a trigger input with the given name.
102+
103+ @param name The name of the input.
104+ */
53105 void triggerInput (const String& name);
54106
55107 // ==============================================================================
108+ /* * Returns all the inputs of the Rive artboard. */
56109 var getAllInputs () const ;
110+
111+ /* * Sets all the inputs of the Rive artboard.
112+
113+ @param value The value to set the inputs to.
114+ */
57115 void setAllInputs (const var& value);
116+
117+ /* * Sets the value of an input with the given name.
118+
119+ @param name The name of the input.
120+ @param value The value to set the input to.
121+ */
58122 void setInput (const String& state, const var& value);
59123
60124 // ==============================================================================
125+ /* * A callback that is called when a property of the Rive artboard changes. */
61126 std::function<void (Artboard&, const String&, const String&, const var&, const var&)> onPropertyChanged;
62127
63- virtual void propertyChanged (const String& eventName, const String& propertyName, const var& oldValue, const var& newValue);
128+ /* * A callback that is called when a property of the Rive artboard changes.
129+
130+ @param eventName The name of the event.
131+ @param propertyName The name of the property.
132+ @param oldValue The old value of the property.
133+ @param newValue The new value of the property.
134+ */
135+ virtual void propertyChanged (const String& eventName,
136+ const String& propertyName,
137+ const var& oldValue,
138+ const var& newValue);
64139
65140 // ==============================================================================
141+ /* * @internal */
66142 void refreshDisplay (double lastFrameTimeSeconds) override ;
143+ /* * @internal */
67144 void paint (Graphics& g) override ;
145+ /* * @internal */
68146 void resized () override ;
147+ /* * @internal */
69148 void contentScaleChanged (float dpiScale) override ;
149+ /* * @internal */
70150 void mouseEnter (const MouseEvent& event) override ;
151+ /* * @internal */
71152 void mouseExit (const MouseEvent& event) override ;
153+ /* * @internal */
72154 void mouseDown (const MouseEvent& event) override ;
155+ /* * @internal */
73156 void mouseUp (const MouseEvent& event) override ;
157+ /* * @internal */
74158 void mouseMove (const MouseEvent& event) override ;
159+ /* * @internal */
75160 void mouseDrag (const MouseEvent& event) override ;
76161
77162private:
0 commit comments