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

The Asset class represents a Scratch asset, for example a Costume or a Sound. More...

#include <scratchcpp/asset.h>

Inheritance diagram for libscratchcpp::Asset:
Collaboration diagram for libscratchcpp::Asset:

Public Member Functions

 Asset (const std::string &name, const std::string &id, const std::string &format)
 
 Asset (const Asset &)=delete
 
virtual ~Asset ()
 
void setId (const std::string &id)
 
const std::string & name () const
 
const std::string & fileName () const
 
const std::string & dataFormat () const
 
const void * data () const
 
unsigned int dataSize () const
 
void setData (unsigned int size, void *data)
 
Targettarget () const
 
void setTarget (Target *target)
 
const std::string & id () const
 

Protected Member Functions

virtual void processData (unsigned int size, void *data)
 
virtual bool isClone () const
 

Detailed Description

The Asset class represents a Scratch asset, for example a Costume or a Sound.

Constructor & Destructor Documentation

◆ Asset() [1/2]

Asset::Asset ( const std::string & name,
const std::string & id,
const std::string & format )

Constructs Asset.

◆ Asset() [2/2]

libscratchcpp::Asset::Asset ( const Asset & )
delete

◆ ~Asset()

Asset::~Asset ( )
virtual

Destroys Asset.

Member Function Documentation

◆ data()

const void * Asset::data ( ) const

Returns the asset data.

◆ dataFormat()

const std::string & Asset::dataFormat ( ) const

Returns the name of the format of the asset file.

◆ dataSize()

unsigned int Asset::dataSize ( ) const

Returns the size of the asset data.

◆ fileName()

const std::string & Asset::fileName ( ) const

Returns the name of the asset file.

◆ id()

const std::string & Entity::id ( ) const
inherited

Returns the ID.

◆ isClone()

virtual bool libscratchcpp::Asset::isClone ( ) const
inlineprotectedvirtual

Reimplemented in libscratchcpp::Sound.

◆ name()

const std::string & Asset::name ( ) const

Returns the name of the asset.

◆ processData()

virtual void libscratchcpp::Asset::processData ( unsigned int size,
void * data )
inlineprotectedvirtual

Reimplemented in libscratchcpp::Sound.

◆ setData()

void Asset::setData ( unsigned int size,
void * data )

Sets the asset data (will be deallocated when the object is destroyed).

◆ setId()

void Asset::setId ( const std::string & id)

Sets the ID (MD5 hash) of the asset file.

◆ setTarget()

void Asset::setTarget ( Target * target)

Sets the sprite or stage this asset belongs to.

◆ target()

Target * Asset::target ( ) const

Returns the sprite or stage this asset belongs to.


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