|
libscratchcpp
A library for C++ based Scratch project players
|
The Target class is the Stage or a Sprite. More...
#include <scratchcpp/target.h>


Public Member Functions | |
| Target () | |
| Target (const Target &)=delete | |
| virtual | ~Target () |
| bool | isTarget () const override final |
| virtual bool | isStage () const |
| const std::string & | name () const |
| void | setName (const std::string &name) |
| const std::vector< std::shared_ptr< Variable > > & | variables () const |
| int | addVariable (std::shared_ptr< Variable > variable) |
| std::shared_ptr< Variable > | variableAt (int index) const |
| int | findVariable (const std::string &variableName) const |
| int | findVariableById (const std::string &id) const |
| ValueData ** | variableData () |
| const std::vector< std::shared_ptr< List > > & | lists () const |
| int | addList (std::shared_ptr< List > list) |
| std::shared_ptr< List > | listAt (int index) const |
| int | findList (const std::string &listName) const |
| int | findListById (const std::string &id) const |
| List ** | listData () |
| const std::vector< std::shared_ptr< Block > > & | blocks () const |
| int | addBlock (std::shared_ptr< Block > block) |
| std::shared_ptr< Block > | blockAt (int index) const |
| int | findBlock (const std::string &id) const |
| std::vector< std::shared_ptr< Block > > | greenFlagBlocks () const |
| const std::vector< std::shared_ptr< Comment > > & | comments () const |
| int | addComment (std::shared_ptr< Comment > comment) |
| std::shared_ptr< Comment > | commentAt (int index) const |
| int | findComment (const std::string &id) const |
| int | costumeIndex () const |
| virtual void | setCostumeIndex (int newCostumeIndex) |
| std::shared_ptr< Costume > | currentCostume () const |
| virtual int | currentCostumeWidth () const |
| virtual int | currentCostumeHeight () const |
| const std::vector< std::shared_ptr< Costume > > & | costumes () const |
| int | addCostume (std::shared_ptr< Costume > costume) |
| std::shared_ptr< Costume > | costumeAt (int index) const |
| int | findCostume (const std::string &costumeName) const |
| const std::vector< std::shared_ptr< Sound > > & | sounds () const |
| int | addSound (std::shared_ptr< Sound > sound) |
| std::shared_ptr< Sound > | soundAt (int index) const |
| int | findSound (const std::string &soundName) const |
| double | volume () const |
| void | setVolume (double newVolume) |
| virtual double | soundEffectValue (Sound::Effect effect) const |
| virtual void | setSoundEffectValue (Sound::Effect effect, double value) |
| virtual void | clearSoundEffects () |
| virtual Rect | boundingRect () const |
| virtual Rect | fastBoundingRect () const |
| bool | touchingSprite (Sprite *sprite) const |
| virtual bool | touchingPoint (double x, double y) const |
| bool | touchingEdge () const |
| virtual bool | touchingColor (Rgb color) const |
| virtual bool | touchingColor (Rgb color, Rgb mask) const |
| double | graphicsEffectValue (IGraphicsEffect *effect) const |
| virtual void | setGraphicsEffectValue (IGraphicsEffect *effect, double value) |
| virtual void | clearGraphicsEffects () |
| TextBubble * | bubble () |
| const TextBubble * | bubble () const |
| void | setEngine (IEngine *engine) override final |
| virtual bool | isTextBubble () const |
| int | layerOrder () const |
| virtual void | setLayerOrder (int newLayerOrder) |
| sigslot::signal< int > & | layerOrderChanged () const |
| IEngine * | engine () const |
Protected Member Functions | |
| virtual Target * | dataSource () const |
| virtual bool | touchingClones (const std::vector< Sprite * > &clones) const |
| Target::Target | ( | ) |
Constructs target.
|
delete |
|
virtual |
Destroys Target.
| int Target::addBlock | ( | std::shared_ptr< Block > | block | ) |
Adds a block and returns its index.
| int Target::addComment | ( | std::shared_ptr< Comment > | comment | ) |
Adds a comment and returns its index.
| int Target::addCostume | ( | std::shared_ptr< Costume > | costume | ) |
Adds a costume and returns its index.
| int Target::addList | ( | std::shared_ptr< List > | list | ) |
Adds a list and returns its index.
| int Target::addSound | ( | std::shared_ptr< Sound > | sound | ) |
Adds a sound and returns its index.
| int Target::addVariable | ( | std::shared_ptr< Variable > | variable | ) |
Adds a variable and returns its index.
| std::shared_ptr< Block > Target::blockAt | ( | int | index | ) | const |
Returns the block at index.
| const std::vector< std::shared_ptr< Block > > & Target::blocks | ( | ) | const |
Returns the list of blocks.
|
virtual |
Returns the bounding rectangle of the sprite.
Reimplemented in libscratchcpp::Sprite, and libscratchcpp::Stage.
| TextBubble * Target::bubble | ( | ) |
Returns the Bubble of this Target.
| const TextBubble * Target::bubble | ( | ) | const |
Returns the Bubble of this Target.
|
virtual |
Sets the value of all graphics effects to 0 (clears them).
Reimplemented in libscratchcpp::Sprite, and libscratchcpp::Stage.
|
virtual |
Sets the value of all sound effects to 0 (clears them).
| std::shared_ptr< Comment > Target::commentAt | ( | int | index | ) | const |
Returns the comment at index.
| const std::vector< std::shared_ptr< Comment > > & Target::comments | ( | ) | const |
Returns the list of comments in the code area.
| std::shared_ptr< Costume > Target::costumeAt | ( | int | index | ) | const |
Returns the costume at index.
| int Target::costumeIndex | ( | ) | const |
Returns the index of the current costume.
| const std::vector< std::shared_ptr< Costume > > & Target::costumes | ( | ) | const |
Returns the list of costumes.
| std::shared_ptr< Costume > Target::currentCostume | ( | ) | const |
Returns the currently set costume.
|
virtual |
Returns the height of the current costume.
Reimplemented in libscratchcpp::Sprite, and libscratchcpp::Stage.
|
virtual |
Returns the width of the current costume.
Reimplemented in libscratchcpp::Sprite, and libscratchcpp::Stage.
|
inlineprotectedvirtual |
Override this method to set a custom data source for blocks, assets, comments, etc.
|
inherited |
Returns the engine.
|
virtual |
Returns the less accurate bounding rectangle of the sprite which is calculated by transforming the costume rectangle.
Reimplemented in libscratchcpp::Sprite, and libscratchcpp::Stage.
| int Target::findBlock | ( | const std::string & | id | ) | const |
Returns the index of the block with the given ID.
| int Target::findComment | ( | const std::string & | id | ) | const |
Returns the index of the comment with the given ID.
| int Target::findCostume | ( | const std::string & | costumeName | ) | const |
Returns the index of the given costume.
| int Target::findList | ( | const std::string & | listName | ) | const |
Returns the index of the list with the given name.
| int Target::findListById | ( | const std::string & | id | ) | const |
Returns the index of the list with the given ID.
| int Target::findSound | ( | const std::string & | soundName | ) | const |
Returns the index of the sound with the given name.
| int Target::findVariable | ( | const std::string & | variableName | ) | const |
Returns the index of the variable with the given name.
| int Target::findVariableById | ( | const std::string & | id | ) | const |
Returns the index of the variable with the given ID.
| double Target::graphicsEffectValue | ( | IGraphicsEffect * | effect | ) | const |
Returns the value of the given graphics effect.
| std::vector< std::shared_ptr< Block > > Target::greenFlagBlocks | ( | ) | const |
Returns list of all "when green flag clicked" blocks.
|
inlinevirtual |
Returns true if this Target is the stage.
Reimplemented in libscratchcpp::Stage.
|
finaloverridevirtual |
Returns true.
Reimplemented from libscratchcpp::Drawable.
|
inlinevirtualinherited |
Returns true if this Drawable is a TextBubble.
Reimplemented in libscratchcpp::TextBubble.
|
inherited |
Returns the layer number.
|
inherited |
Emits when the layer number changes.
| std::shared_ptr< List > Target::listAt | ( | int | index | ) | const |
Returns the list at index.
| List ** Target::listData | ( | ) |
Returns an array of list pointers (for optimized list access).
| const std::vector< std::shared_ptr< List > > & Target::lists | ( | ) | const |
Returns the list of Scratch lists.
| const std::string & Target::name | ( | ) | const |
Returns the name of the target.
|
virtual |
Sets the index of the current costume.
Reimplemented in libscratchcpp::Sprite, and libscratchcpp::Stage.
|
finaloverridevirtual |
Overrides Drawable::setEngine().
Reimplemented from libscratchcpp::Drawable.
|
virtual |
Sets the value of the given graphics effect.
Reimplemented in libscratchcpp::Sprite, and libscratchcpp::Stage.
|
virtualinherited |
Sets the layer number.
Reimplemented in libscratchcpp::Sprite.
| void Target::setName | ( | const std::string & | name | ) |
Sets the name of the target.
|
virtual |
Sets the value of the given sound effect.
| void Target::setVolume | ( | double | newVolume | ) |
Sets the volume of all sounds of this target.
| std::shared_ptr< Sound > Target::soundAt | ( | int | index | ) | const |
Returns the sound at index.
|
virtual |
Returns the value of the given sound effect.
| const std::vector< std::shared_ptr< Sound > > & Target::sounds | ( | ) | const |
Returns the list of sounds.
|
inlineprotectedvirtual |
Override this method to check whether the target touches the given sprite clones.
|
virtual |
Returns true if the Target is touching the given color (RGB triplet).
Reimplemented in libscratchcpp::Sprite, and libscratchcpp::Stage.
Returns true if the mask part of the Target is touching the given color (RGB triplet).
Reimplemented in libscratchcpp::Sprite, and libscratchcpp::Stage.
| bool Target::touchingEdge | ( | ) | const |
Returns true if the target is touching the edge.
|
virtual |
Returns true if the Target is touching the given point (in Scratch coordinates).
Reimplemented in libscratchcpp::Sprite, and libscratchcpp::Stage.
| bool Target::touchingSprite | ( | Sprite * | sprite | ) | const |
| std::shared_ptr< Variable > Target::variableAt | ( | int | index | ) | const |
Returns the variable at index.
| ValueData ** Target::variableData | ( | ) |
Returns an array of raw variable data pointers (for optimized variable access).
| const std::vector< std::shared_ptr< Variable > > & Target::variables | ( | ) | const |
Returns the list of variables.
| double Target::volume | ( | ) | const |
Returns the volume.