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

The ISpriteHandler class provides a sprite interface for Scratch project players. More...

#include <scratchcpp/ispritehandler.h>

Public Member Functions

virtual ~ISpriteHandler ()
 
virtual void init (Sprite *sprite)=0
 
virtual void deinitClone ()=0
 
virtual void onCloned (Sprite *clone)=0
 
virtual void onCostumeChanged (Costume *costume)=0
 
virtual void onVisibleChanged (bool visible)=0
 
virtual void onXChanged (double x)=0
 
virtual void onYChanged (double y)=0
 
virtual void onMoved (double oldX, double oldY, double newX, double newY)=0
 
virtual void onSizeChanged (double size)=0
 
virtual void onDirectionChanged (double direction)=0
 
virtual void onRotationStyleChanged (Sprite::RotationStyle rotationStyle)=0
 
virtual void onLayerOrderChanged (int layerOrder)=0
 
virtual void onGraphicsEffectChanged (IGraphicsEffect *effect, double value)=0
 
virtual void onGraphicsEffectsCleared ()=0
 
virtual int costumeWidth () const =0
 
virtual int costumeHeight () const =0
 
virtual Rect boundingRect () const =0
 
virtual Rect fastBoundingRect () const =0
 
virtual bool touchingClones (const std::vector< Sprite * > &clones) const =0
 
virtual bool touchingPoint (double x, double y) const =0
 
virtual bool touchingColor (Rgb color) const =0
 
virtual bool touchingColor (Rgb color, Rgb mask) const =0
 

Detailed Description

The ISpriteHandler class provides a sprite interface for Scratch project players.

Constructor & Destructor Documentation

◆ ~ISpriteHandler()

virtual libscratchcpp::ISpriteHandler::~ISpriteHandler ( )
inlinevirtual

Member Function Documentation

◆ boundingRect()

virtual Rect libscratchcpp::ISpriteHandler::boundingRect ( ) const
pure virtual

Used to get the bounding rectangle of the sprite.

Note
The rectangle must be relative to the stage, so make sure to use the sprite's coordinates.

◆ costumeHeight()

virtual int libscratchcpp::ISpriteHandler::costumeHeight ( ) const
pure virtual

Used to get the current costume height.

◆ costumeWidth()

virtual int libscratchcpp::ISpriteHandler::costumeWidth ( ) const
pure virtual

Used to get the current costume width.

◆ deinitClone()

virtual void libscratchcpp::ISpriteHandler::deinitClone ( )
pure virtual

Called when the sprite is deinitialized (if it is a clone).

◆ fastBoundingRect()

virtual Rect libscratchcpp::ISpriteHandler::fastBoundingRect ( ) const
pure virtual

Used to get a less accurate bounding rectangle of the sprite which is calculated by transforming the costume rectangle.

Note
The rectangle must be relative to the stage, so make sure to use the sprite's coordinates.

◆ init()

virtual void libscratchcpp::ISpriteHandler::init ( Sprite * sprite)
pure virtual

Called when the interface is set on a sprite.

◆ onCloned()

virtual void libscratchcpp::ISpriteHandler::onCloned ( Sprite * clone)
pure virtual

Called when the sprite clones.

◆ onCostumeChanged()

virtual void libscratchcpp::ISpriteHandler::onCostumeChanged ( Costume * costume)
pure virtual

Called when the costume changes.

◆ onDirectionChanged()

virtual void libscratchcpp::ISpriteHandler::onDirectionChanged ( double direction)
pure virtual

Called when the direction changes.

◆ onGraphicsEffectChanged()

virtual void libscratchcpp::ISpriteHandler::onGraphicsEffectChanged ( IGraphicsEffect * effect,
double value )
pure virtual

Called when the value of the given graphics effect changes.

Note
This method isn't called when all effects are cleared, use onGraphicsEffectsCleared() for this.

◆ onGraphicsEffectsCleared()

virtual void libscratchcpp::ISpriteHandler::onGraphicsEffectsCleared ( )
pure virtual

Called when all graphics effects are cleared.

◆ onLayerOrderChanged()

virtual void libscratchcpp::ISpriteHandler::onLayerOrderChanged ( int layerOrder)
pure virtual

Called when the layer order changes.

◆ onMoved()

virtual void libscratchcpp::ISpriteHandler::onMoved ( double oldX,
double oldY,
double newX,
double newY )
pure virtual

Called when the sprite position changes.

◆ onRotationStyleChanged()

virtual void libscratchcpp::ISpriteHandler::onRotationStyleChanged ( Sprite::RotationStyle rotationStyle)
pure virtual

Called when the rotation style changes.

◆ onSizeChanged()

virtual void libscratchcpp::ISpriteHandler::onSizeChanged ( double size)
pure virtual

Called when the size changes.

◆ onVisibleChanged()

virtual void libscratchcpp::ISpriteHandler::onVisibleChanged ( bool visible)
pure virtual

Called when the visibility changes.

◆ onXChanged()

virtual void libscratchcpp::ISpriteHandler::onXChanged ( double x)
pure virtual

Called when the X-coordinate changes.

◆ onYChanged()

virtual void libscratchcpp::ISpriteHandler::onYChanged ( double y)
pure virtual

Called when the Y-coordinate changes.

◆ touchingClones()

virtual bool libscratchcpp::ISpriteHandler::touchingClones ( const std::vector< Sprite * > & clones) const
pure virtual

Used to check whether the sprite touches any of the given sprite clones.

◆ touchingColor() [1/2]

virtual bool libscratchcpp::ISpriteHandler::touchingColor ( Rgb color) const
pure virtual

Used to check whether the sprite touches the given color.

◆ touchingColor() [2/2]

virtual bool libscratchcpp::ISpriteHandler::touchingColor ( Rgb color,
Rgb mask ) const
pure virtual

Used to check whether the mask part of the sprite touches the given color.

◆ touchingPoint()

virtual bool libscratchcpp::ISpriteHandler::touchingPoint ( double x,
double y ) const
pure virtual

Used to check whether the sprite touches the given point (in Scratch coordinates).


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