libscratchcpp
A library for C++ based Scratch project players
Loading...
Searching...
No Matches
libscratchcpp::Stage Class Reference

The Stage class is the project stage. More...

#include <scratchcpp/stage.h>

Inheritance diagram for libscratchcpp::Stage:
Collaboration diagram for libscratchcpp::Stage:

Public Types

enum class  VideoState { On , Off , OnFlipped }
 

Public Member Functions

 Stage ()
 
 Stage (const Stage &)=delete
 
void setInterface (IStageHandler *newInterface)
 
IStageHandlergetInterface () const
 
bool isStage () const override
 
void setCostumeIndex (int newCostumeIndex) override
 
int currentCostumeWidth () const override
 
int currentCostumeHeight () const override
 
int tempo () const
 
void setTempo (int newTempo)
 
VideoState videoState () const
 
std::string videoStateStr () const
 
void setVideoState (VideoState newVideoState)
 
void setVideoState (const std::string &newVideoState)
 
void setVideoState (const char *newVideoState)
 
int videoTransparency () const
 
void setVideoTransparency (int newVideoTransparency)
 
const std::string & textToSpeechLanguage () const
 
void setTextToSpeechLanguage (const std::string &newTextToSpeechLanguage)
 
Rect boundingRect () const override
 
Rect fastBoundingRect () const override
 
bool touchingPoint (double x, double y) const override
 
bool touchingColor (Rgb color) const override
 
bool touchingColor (Rgb color, Rgb mask) const override
 
void setGraphicsEffectValue (IGraphicsEffect *effect, double value) override
 
void clearGraphicsEffects () override
 
bool isTarget () const override final
 
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< VariablevariableAt (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< ListlistAt (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< BlockblockAt (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< CommentcommentAt (int index) const
 
int findComment (const std::string &id) const
 
int costumeIndex () const
 
std::shared_ptr< CostumecurrentCostume () const
 
const std::vector< std::shared_ptr< Costume > > & costumes () const
 
int addCostume (std::shared_ptr< Costume > costume)
 
std::shared_ptr< CostumecostumeAt (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< SoundsoundAt (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 ()
 
bool touchingSprite (Sprite *sprite) const
 
bool touchingEdge () const
 
double graphicsEffectValue (IGraphicsEffect *effect) const
 
TextBubblebubble ()
 
const TextBubblebubble () const
 
void setEngine (IEngine *engine) override final
 
virtual bool isTextBubble () const
 
int layerOrder () const
 
virtual void setLayerOrder (int newLayerOrder)
 
sigslot::signal< int > & layerOrderChanged () const
 
IEngineengine () const
 

Protected Member Functions

virtual TargetdataSource () const
 

Detailed Description

The Stage class is the project stage.

Member Enumeration Documentation

◆ VideoState

Enumerator
On 
Off 
OnFlipped 

Constructor & Destructor Documentation

◆ Stage() [1/2]

Stage::Stage ( )

Constructs Stage.

◆ Stage() [2/2]

libscratchcpp::Stage::Stage ( const Stage & )
delete

Member Function Documentation

◆ addBlock()

int Target::addBlock ( std::shared_ptr< Block > block)
inherited

Adds a block and returns its index.

◆ addComment()

int Target::addComment ( std::shared_ptr< Comment > comment)
inherited

Adds a comment and returns its index.

◆ addCostume()

int Target::addCostume ( std::shared_ptr< Costume > costume)
inherited

Adds a costume and returns its index.

◆ addList()

int Target::addList ( std::shared_ptr< List > list)
inherited

Adds a list and returns its index.

◆ addSound()

int Target::addSound ( std::shared_ptr< Sound > sound)
inherited

Adds a sound and returns its index.

◆ addVariable()

int Target::addVariable ( std::shared_ptr< Variable > variable)
inherited

Adds a variable and returns its index.

◆ blockAt()

std::shared_ptr< Block > Target::blockAt ( int index) const
inherited

Returns the block at index.

◆ blocks()

const std::vector< std::shared_ptr< Block > > & Target::blocks ( ) const
inherited

Returns the list of blocks.

◆ boundingRect()

Rect Stage::boundingRect ( ) const
overridevirtual

Overrides Target::boundingRect().

Reimplemented from libscratchcpp::Target.

◆ bubble() [1/2]

TextBubble * Target::bubble ( )
inherited

Returns the Bubble of this Target.

◆ bubble() [2/2]

const TextBubble * Target::bubble ( ) const
inherited

Returns the Bubble of this Target.

◆ clearGraphicsEffects()

void Stage::clearGraphicsEffects ( )
overridevirtual

Overrides Target::clearGraphicsEffects().

Reimplemented from libscratchcpp::Target.

◆ clearSoundEffects()

void Target::clearSoundEffects ( )
virtualinherited

Sets the value of all sound effects to 0 (clears them).

◆ commentAt()

std::shared_ptr< Comment > Target::commentAt ( int index) const
inherited

Returns the comment at index.

◆ comments()

const std::vector< std::shared_ptr< Comment > > & Target::comments ( ) const
inherited

Returns the list of comments in the code area.

◆ costumeAt()

std::shared_ptr< Costume > Target::costumeAt ( int index) const
inherited

Returns the costume at index.

◆ costumeIndex()

int Target::costumeIndex ( ) const
inherited

Returns the index of the current costume.

◆ costumes()

const std::vector< std::shared_ptr< Costume > > & Target::costumes ( ) const
inherited

Returns the list of costumes.

◆ currentCostume()

std::shared_ptr< Costume > Target::currentCostume ( ) const
inherited

Returns the currently set costume.

◆ currentCostumeHeight()

int Stage::currentCostumeHeight ( ) const
overridevirtual

Overrides Target::currentCostumeHeight().

Reimplemented from libscratchcpp::Target.

◆ currentCostumeWidth()

int Stage::currentCostumeWidth ( ) const
overridevirtual

Overrides Target::currentCostumeWidth().

Reimplemented from libscratchcpp::Target.

◆ dataSource()

virtual Target * libscratchcpp::Target::dataSource ( ) const
inlineprotectedvirtualinherited

Override this method to set a custom data source for blocks, assets, comments, etc.

◆ engine()

IEngine * Drawable::engine ( ) const
inherited

Returns the engine.

◆ fastBoundingRect()

Rect Stage::fastBoundingRect ( ) const
overridevirtual

Overrides Target::boundingRect().

Reimplemented from libscratchcpp::Target.

◆ findBlock()

int Target::findBlock ( const std::string & id) const
inherited

Returns the index of the block with the given ID.

◆ findComment()

int Target::findComment ( const std::string & id) const
inherited

Returns the index of the comment with the given ID.

◆ findCostume()

int Target::findCostume ( const std::string & costumeName) const
inherited

Returns the index of the given costume.

◆ findList()

int Target::findList ( const std::string & listName) const
inherited

Returns the index of the list with the given name.

◆ findListById()

int Target::findListById ( const std::string & id) const
inherited

Returns the index of the list with the given ID.

◆ findSound()

int Target::findSound ( const std::string & soundName) const
inherited

Returns the index of the sound with the given name.

◆ findVariable()

int Target::findVariable ( const std::string & variableName) const
inherited

Returns the index of the variable with the given name.

◆ findVariableById()

int Target::findVariableById ( const std::string & id) const
inherited

Returns the index of the variable with the given ID.

◆ getInterface()

IStageHandler * Stage::getInterface ( ) const

Returns the stage interface.

◆ graphicsEffectValue()

double Target::graphicsEffectValue ( IGraphicsEffect * effect) const
inherited

Returns the value of the given graphics effect.

◆ greenFlagBlocks()

std::vector< std::shared_ptr< Block > > Target::greenFlagBlocks ( ) const
inherited

Returns list of all "when green flag clicked" blocks.

◆ isStage()

bool Stage::isStage ( ) const
overridevirtual

Returns true.

Reimplemented from libscratchcpp::Target.

◆ isTarget()

bool Target::isTarget ( ) const
finaloverridevirtualinherited

Returns true.

Reimplemented from libscratchcpp::Drawable.

◆ isTextBubble()

virtual bool libscratchcpp::Drawable::isTextBubble ( ) const
inlinevirtualinherited

Returns true if this Drawable is a TextBubble.

Reimplemented in libscratchcpp::TextBubble.

◆ layerOrder()

int Drawable::layerOrder ( ) const
inherited

Returns the layer number.

◆ layerOrderChanged()

sigslot::signal< int > & Drawable::layerOrderChanged ( ) const
inherited

Emits when the layer number changes.

◆ listAt()

std::shared_ptr< List > Target::listAt ( int index) const
inherited

Returns the list at index.

◆ listData()

List ** Target::listData ( )
inherited

Returns an array of list pointers (for optimized list access).

◆ lists()

const std::vector< std::shared_ptr< List > > & Target::lists ( ) const
inherited

Returns the list of Scratch lists.

◆ name()

const std::string & Target::name ( ) const
inherited

Returns the name of the target.

◆ setCostumeIndex()

void Stage::setCostumeIndex ( int newCostumeIndex)
overridevirtual

Overrides Target::setCostumeIndex().

Reimplemented from libscratchcpp::Target.

◆ setEngine()

void Target::setEngine ( IEngine * engine)
finaloverridevirtualinherited

Overrides Drawable::setEngine().

Reimplemented from libscratchcpp::Drawable.

◆ setGraphicsEffectValue()

void Stage::setGraphicsEffectValue ( IGraphicsEffect * effect,
double value )
overridevirtual

◆ setInterface()

void Stage::setInterface ( IStageHandler * newInterface)

Sets the stage interface.

◆ setLayerOrder()

void Drawable::setLayerOrder ( int newLayerOrder)
virtualinherited

Sets the layer number.

Reimplemented in libscratchcpp::Sprite.

◆ setName()

void Target::setName ( const std::string & name)
inherited

Sets the name of the target.

Note
Setting the name to one of the reserved names (mouse, stage, edge, myself, random) won't do anything.

◆ setSoundEffectValue()

void Target::setSoundEffectValue ( Sound::Effect effect,
double value )
virtualinherited

Sets the value of the given sound effect.

◆ setTempo()

void Stage::setTempo ( int newTempo)

Sets the tempo.

◆ setTextToSpeechLanguage()

void Stage::setTextToSpeechLanguage ( const std::string & newTextToSpeechLanguage)

Sets the text to speech language.

◆ setVideoState() [1/3]

void Stage::setVideoState ( const char * newVideoState)

Sets the video state.

◆ setVideoState() [2/3]

void Stage::setVideoState ( const std::string & newVideoState)

Sets the video state.

◆ setVideoState() [3/3]

void Stage::setVideoState ( VideoState newVideoState)

Sets the video state.

◆ setVideoTransparency()

void Stage::setVideoTransparency ( int newVideoTransparency)

Sets the video transparency.

◆ setVolume()

void Target::setVolume ( double newVolume)
inherited

Sets the volume of all sounds of this target.

◆ soundAt()

std::shared_ptr< Sound > Target::soundAt ( int index) const
inherited

Returns the sound at index.

◆ soundEffectValue()

double Target::soundEffectValue ( Sound::Effect effect) const
virtualinherited

Returns the value of the given sound effect.

◆ sounds()

const std::vector< std::shared_ptr< Sound > > & Target::sounds ( ) const
inherited

Returns the list of sounds.

◆ tempo()

int Stage::tempo ( ) const

Returns the tempo.

◆ textToSpeechLanguage()

const std::string & Stage::textToSpeechLanguage ( ) const

Returns the text to speech language.

◆ touchingColor() [1/2]

bool Stage::touchingColor ( Rgb color) const
overridevirtual

Overrides Target::touchingColor().

Reimplemented from libscratchcpp::Target.

◆ touchingColor() [2/2]

bool Stage::touchingColor ( Rgb color,
Rgb mask ) const
overridevirtual

Overrides Target::touchingColor().

Reimplemented from libscratchcpp::Target.

◆ touchingEdge()

bool Target::touchingEdge ( ) const
inherited

Returns true if the target is touching the edge.

◆ touchingPoint()

bool Stage::touchingPoint ( double x,
double y ) const
overridevirtual

Overrides Target::touchingPoint().

Reimplemented from libscratchcpp::Target.

◆ touchingSprite()

bool Target::touchingSprite ( Sprite * sprite) const
inherited

Returns true if the Target is touching the given Sprite (or its clones).

◆ variableAt()

std::shared_ptr< Variable > Target::variableAt ( int index) const
inherited

Returns the variable at index.

◆ variableData()

ValueData ** Target::variableData ( )
inherited

Returns an array of raw variable data pointers (for optimized variable access).

◆ variables()

const std::vector< std::shared_ptr< Variable > > & Target::variables ( ) const
inherited

Returns the list of variables.

◆ videoState()

Stage::VideoState Stage::videoState ( ) const

Returns the video state.

◆ videoStateStr()

std::string Stage::videoStateStr ( ) const

Returns the video state as a string.

◆ videoTransparency()

int Stage::videoTransparency ( ) const

Returns the video transparency.

◆ volume()

double Target::volume ( ) const
inherited

Returns the volume.


The documentation for this class was generated from the following files: