tbx  0.7.5
Public Member Functions | List of all members
tbx::WimpSprite Class Reference

Class for handling sprites from the Wimp sprite pool. More...

#include <sprite.h>

Inheritance diagram for tbx::WimpSprite:
tbx::Sprite tbx::Image

Public Member Functions

 WimpSprite (const std::string &sname)
 Construct a WIMP sprite. More...
 
 WimpSprite (const char *sname)
 Construct a WIMP sprite. More...
 
 WimpSprite (int file_type)
 Construct a wimp sprite to represent the given file_type. More...
 
 WimpSprite (int file_type, std::string leafname)
 Construct a wimp sprite to represent the given file_type. More...
 
bool exist () const
 Check if this sprite exists in the Wimp sprite area.
 
virtual void plot_raw (const Point &pos, int code=SPA_USE_MASK) const
 Plot this sprite at the given position with no scaling or colour conversions.
 
virtual void plot_scaled (const Point &pos, const ScaleFactors *sf, const TranslationTable *tt=NULL, int code=SPA_USE_MASK) const
 Plot this sprite scaled using the given colour translation. More...
 
virtual void plot_screen (const Point &pos, int code=SPA_USE_MASK) const
 Plot sprite to screen. More...
 
virtual void plot_raw (int x, int y, int code=SPA_USE_MASK) const
 Plot this sprite at the given position with no scaling or colour conversions.
 
virtual void plot_scaled (int x, int y, const ScaleFactors *sf, const TranslationTable *tt=NULL, int code=SPA_USE_MASK) const
 Plot this sprite scaled using the given colour translation. More...
 
virtual void plot_screen (int x, int y, int code=SPA_USE_MASK) const
 Plot sprite to screen. More...
 
virtual std::string name () const
 Get the name of the sprite. More...
 
virtual bool info (Size *pixel_size, int *mode=NULL, bool *mask=NULL) const
 Get information about the sprite. More...
 
virtual void get_wimp_scale (ScaleFactors &factor) const
 Get the scale factors required to plot this sprite in the WIMP as its logical size. More...
 
virtual int area_id () const
 Return sprite area id used for calls that take an area pointer or a special value for WIMP/System areas. More...
 
bool has_palette () const
 Check if WimpSprite is using a palette.
 
- Public Member Functions inherited from tbx::Sprite
virtual void plot (int x, int y) const
 Plot sprite to screen. More...
 
virtual void plot (const Point &pos) const
 Plot sprite to screen. More...
 
Size size () const
 Return the size of the sprite. More...
 
int width () const
 Return the width of the sprite. More...
 
int height () const
 Return the height of the sprite. More...
 
Size pixel_size () const
 Get size of the sprite in pixels. More...
 
int mode () const
 Get the mode of the sprite. More...
 
bool has_mask () const
 Check if the sprite has a mask. More...
 

Detailed Description

Class for handling sprites from the Wimp sprite pool.

These sprites are read only so just have functions for getting information and plotting a sprite.

Constructor & Destructor Documentation

◆ WimpSprite() [1/4]

tbx::WimpSprite::WimpSprite ( const std::string &  sname)
inline

Construct a WIMP sprite.

There is no check on the name given here. If it is incorrect the other sprite operations will fail silently.

Call the exist function to check if a sprite is currently in the WIMP sprite pool.

Parameters
snameof sprite in to reference

◆ WimpSprite() [2/4]

tbx::WimpSprite::WimpSprite ( const char *  sname)
inline

Construct a WIMP sprite.

There is no check on the name given here. If it is incorrect the other sprite operations will fail silently.

Call the exist function to check if a sprite is currently in the WIMP sprite pool.

Parameters
snameof sprite in to reference

◆ WimpSprite() [3/4]

WimpSprite::WimpSprite ( int  file_type)

Construct a wimp sprite to represent the given file_type.

Applications will be given the generic file type.

If the sprite is not in the current wimp sprite pool unknown will be used.

Parameters
file_typefile type to construct sprite for

◆ WimpSprite() [4/4]

WimpSprite::WimpSprite ( int  file_type,
std::string  leafname 
)

Construct a wimp sprite to represent the given file_type.

Applications will be check for the name sprite first.

If the sprite is not in the current wimp sprite pool unknown will be used.

Parameters
file_typefile type to construct sprite for
leafnameleaf name of file (used for applications)

Member Function Documentation

◆ area_id()

virtual int tbx::WimpSprite::area_id ( ) const
inlinevirtual

Return sprite area id used for calls that take an area pointer or a special value for WIMP/System areas.

This is always 1 for the wimp sprite area.

Implements tbx::Sprite.

◆ get_wimp_scale()

void WimpSprite::get_wimp_scale ( ScaleFactors factor) const
virtual

Get the scale factors required to plot this sprite in the WIMP as its logical size.

Parameters
factorscale factors updated with the correct value

Implements tbx::Sprite.

◆ info()

bool WimpSprite::info ( Size pixel_size,
int *  mode = NULL,
bool *  mask = NULL 
) const
virtual

Get information about the sprite.

Parameters
pixel_sizepointer to Size to be updated with size of sprite in pixels
modepointer to integer to receive the sprite mode number or 0 (the default) not to return the mode
maskpointer to a boolean which will be set to true if the sprite has a mask or 0 (the default) not to return the mask
Returns
true if successfule

Implements tbx::Sprite.

◆ name()

virtual std::string tbx::WimpSprite::name ( ) const
inlinevirtual

Get the name of the sprite.

Returns
the name of the sprite as a string

Implements tbx::Sprite.

◆ plot_scaled() [1/2]

void WimpSprite::plot_scaled ( const Point pos,
const ScaleFactors sf,
const TranslationTable tbl = NULL,
int  code = SPA_USE_MASK 
) const
virtual

Plot this sprite scaled using the given colour translation.

  • x os x position for plot
  • y os y position for plot
  • sf scale factors (0 = don't scale)
  • table colour translation table (0 = don't translate colours)

Implements tbx::Sprite.

◆ plot_scaled() [2/2]

void WimpSprite::plot_scaled ( int  x,
int  y,
const ScaleFactors sf,
const TranslationTable tbl = NULL,
int  code = SPA_USE_MASK 
) const
virtual

Plot this sprite scaled using the given colour translation.

  • x os x position for plot
  • y os y position for plot
  • sf scale factors (0 = don't scale)
  • table colour translation table (0 = don't translate colours)

Implements tbx::Sprite.

◆ plot_screen() [1/2]

void WimpSprite::plot_screen ( const Point pos,
int  code = SPA_USE_MASK 
) const
virtual

Plot sprite to screen.

Calculates the translation table and scale factors for the current screen and plots the sprite

Implements tbx::Sprite.

◆ plot_screen() [2/2]

void WimpSprite::plot_screen ( int  x,
int  y,
int  code = SPA_USE_MASK 
) const
virtual

Plot sprite to screen.

Calculates the translation table and scale factors for the current screen and plots the sprite

Implements tbx::Sprite.


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