Skip to content

Commit 7ece25a

Browse files
committed
Cosmetics
1 parent e89deac commit 7ece25a

File tree

2 files changed

+115
-7
lines changed

2 files changed

+115
-7
lines changed

modules/yup_gui/artboard/yup_Artboard.h

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
*/
2630
class YUP_API Artboard : public Component
2731
{
2832
public:
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

77162
private:

modules/yup_gui/artboard/yup_ArtboardFile.h

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,42 @@ namespace yup
2525
class Artboard;
2626

2727
//==============================================================================
28-
class JUCE_API ArtboardFile
28+
/** Represents a Rive file.
29+
30+
This class is used to load Rive binary files (aka .riv files).
31+
*/
32+
class YUP_API ArtboardFile
2933
{
3034
public:
3135
//==============================================================================
32-
const rive::File* getRiveFile() const;
33-
rive::File* getRiveFile();
34-
35-
//==============================================================================
36+
/** The result of loading a Rive file. */
3637
using LoadResult = ResultValue<std::shared_ptr<ArtboardFile>>;
3738

39+
/** Loads a Rive file from a file.
40+
41+
@param file The file to load.
42+
@param factory The factory to use to create the Rive file.
43+
44+
@return The result of loading the Rive file.
45+
*/
3846
static LoadResult load (const File& file, rive::Factory& factory);
47+
48+
/** Loads a Rive file from an input stream.
49+
50+
@param is The input stream to load the Rive file from.
51+
@param factory The factory to use to create the Rive file.
52+
53+
@return The result of loading the Rive file.
54+
*/
3955
static LoadResult load (InputStream& is, rive::Factory& factory);
4056

57+
//==============================================================================
58+
/** Returns the underlying Rive file. */
59+
const rive::File* getRiveFile() const;
60+
61+
/** Returns the underlying Rive file. */
62+
rive::File* getRiveFile();
63+
4164
private:
4265
ArtboardFile() = default;
4366
ArtboardFile (std::unique_ptr<rive::File> rivFile);

0 commit comments

Comments
 (0)