OSDL::Rendering::Sprite Class Reference

A sprite is a specialized view corresponding to a 2D bitmap-based graphical element. More...

#include <OSDLSprite.h>

Collaboration diagram for OSDL::Rendering::Sprite:
Collaboration graph
[legend]

List of all members.

Public Types

typedef Ceylan::Uint8 Shape
 Describes a possible shape for a tiled sprite.

Public Member Functions

 Sprite (const std::string &frameFilename)
 Constructs a new sprite.
virtual ~Sprite () throw ()
 Virtual destructor.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns an user-friendly description of the state of this object.

Static Public Member Functions

static std::string DescribeShape (Shape shape)
 Returns a textual description of specified sprite shape.
static Shape GetSmallestEnclosingShape (OSDL::Video::Length width, OSDL::Video::Length height)
 Returns the smallest registered standard sprite shape enclosing a rectangle of specified dimensions.
static OSDL::Video::Length GetShapeWidthFor (Shape shape)
 Returns the width, in pixels, of the sprite shape associated to specified shape.
static OSDL::Video::Length GetShapeHeightFor (Shape shape)
 Returns the height, in pixels, of the sprite shape associated to specified shape.

Static Public Attributes

static const Shape EightTimesEight = 1
 Describes a sprite whose shape is 8x8 pixels.
static const Shape SixteenTimesEight = 2
 Describes a sprite whose shape is 16x8 pixels.
static const Shape ThirtyTwoTimesEight = 3
 Describes a sprite whose shape is 32x8 pixels.
static const Shape EightTimesSixteen = 4
 Describes a sprite whose shape is 8x16 pixels.
static const Shape SixteenTimesSixteen = 5
 Describes a sprite whose shape is 16x16 pixels.
static const Shape ThirtyTwoTimesSixteen = 6
 Describes a sprite whose shape is 32x16 pixels.
static const Shape EightTimesThirtyTwo = 7
 Describes a sprite whose shape is 8x32 pixels.
static const Shape SixteenTimesThirtyTwo = 8
 Describes a sprite whose shape is 16x32 pixels.
static const Shape ThirtyTwoTimesThirtyTwo = 9
 Describes a sprite whose shape is 32x32 pixels.
static const Shape SixtyFourTimesThirtyTwo = 10
 Describes a sprite whose shape is 32x32 pixels.
static const Shape ThirtyTwoTimesSixtyFour = 11
 Describes a sprite whose shape is 32x64 pixels.
static const Shape SixtyFourTimesSixtyFour = 12
 Describes a sprite whose shape is 64x64 pixels.
static const Shape PowersOfTwo = 13
 Describes a sprite whose width and height are powers of two (not necessarily the same one).

Protected Attributes

bool _ownBoundingBox
 Tells whether this sprite owns the bounding box(es) it refers to.
Engine::BoundingBox2D_box
 Each sprite is linked with a bounding box, which graphically contains it.
Shape _shape
 The shape of this sprite.
Video::OpenGL::GLTexture_texture
 The texture owned by this sprite, if OpenGL is used.

Private Member Functions

 Sprite (const Sprite &source)
 Copy constructor made private to ensure that it will never be called.
Spriteoperator= (const Sprite &source)
 Assignment operator made private to ensure that it will never be called.

Detailed Description

A sprite is a specialized view corresponding to a 2D bitmap-based graphical element.

Definition at line 111 of file OSDLSprite.h.


Member Typedef Documentation

typedef Ceylan::Uint8 OSDL::Rendering::Sprite::Shape

Describes a possible shape for a tiled sprite.

Definition at line 120 of file OSDLSprite.h.


Constructor & Destructor Documentation

Sprite::Sprite ( const std::string &  frameFilename  )  [explicit]

Constructs a new sprite.

Parameters:
frameFilename the filename of the OSDL frame to be used.

Definition at line 107 of file OSDLSprite.cc.

Sprite::~Sprite (  )  throw () [virtual]

Virtual destructor.

Definition at line 133 of file OSDLSprite.cc.

References _box, _ownBoundingBox, and _texture.

OSDL::Rendering::Sprite::Sprite ( const Sprite source  )  [private]

Copy constructor made private to ensure that it will never be called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

string Sprite::DescribeShape ( Shape  shape  )  [static]

Returns a textual description of specified sprite shape.

Exceptions:
SpriteException if the specified shape is not known.

Definition at line 186 of file OSDLSprite.cc.

References EightTimesEight, EightTimesSixteen, EightTimesThirtyTwo, PowersOfTwo, SixteenTimesEight, SixteenTimesSixteen, SixteenTimesThirtyTwo, SixtyFourTimesSixtyFour, SixtyFourTimesThirtyTwo, ThirtyTwoTimesEight, ThirtyTwoTimesSixteen, ThirtyTwoTimesSixtyFour, and ThirtyTwoTimesThirtyTwo.

Referenced by toString().

Length Sprite::GetShapeHeightFor ( Shape  shape  )  [static]

Returns the height, in pixels, of the sprite shape associated to specified shape.

Parameters:
shape the shape whose height is needed.
Returns:
the height of specified shape, in pixels.
Exceptions:
SpriteException if the operation failed, including if the shape is not known.

Definition at line 385 of file OSDLSprite.cc.

References EightTimesEight, EightTimesSixteen, EightTimesThirtyTwo, SixteenTimesEight, SixteenTimesSixteen, SixteenTimesThirtyTwo, SixtyFourTimesSixtyFour, SixtyFourTimesThirtyTwo, ThirtyTwoTimesEight, ThirtyTwoTimesSixteen, ThirtyTwoTimesSixtyFour, and ThirtyTwoTimesThirtyTwo.

Length Sprite::GetShapeWidthFor ( Shape  shape  )  [static]

Returns the width, in pixels, of the sprite shape associated to specified shape.

Parameters:
shape the shape whose width is needed.
Returns:
the width of specified shape, in pixels.
Exceptions:
SpriteException if the operation failed, including if the shape is not known.

Definition at line 345 of file OSDLSprite.cc.

References EightTimesEight, EightTimesSixteen, EightTimesThirtyTwo, SixteenTimesEight, SixteenTimesSixteen, SixteenTimesThirtyTwo, SixtyFourTimesSixtyFour, SixtyFourTimesThirtyTwo, ThirtyTwoTimesEight, ThirtyTwoTimesSixteen, ThirtyTwoTimesSixtyFour, and ThirtyTwoTimesThirtyTwo.

static Shape OSDL::Rendering::Sprite::GetSmallestEnclosingShape ( OSDL::Video::Length  width,
OSDL::Video::Length  height 
) [static]

Returns the smallest registered standard sprite shape enclosing a rectangle of specified dimensions.

Parameters:
width the width of the rectangle to enclose.
height the height of the rectangle to enclose.
Exceptions:
SpriteException if no known shape is large enough to contain the specified size.
Sprite& OSDL::Rendering::Sprite::operator= ( const Sprite source  )  [private]

Assignment operator made private to ensure that it will never be called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

const string Sprite::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns an user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
Ceylan::TextDisplayable

Definition at line 150 of file OSDLSprite.cc.

References _ownBoundingBox, _shape, _texture, DescribeShape(), and OSDL::Video::OpenGL::GLTexture::toString().


Member Data Documentation

Each sprite is linked with a bounding box, which graphically contains it.

Note:
For the moment, each sprite has only one (2D) bounding box.

Definition at line 350 of file OSDLSprite.h.

Referenced by ~Sprite().

Tells whether this sprite owns the bounding box(es) it refers to.

On a local scheme, the bounding box is shared between the view(s) and the model, since it may use both for rendering and collision detection.

On a distributed context (typically, client/server), multiple bounding boxes exist: one on each client, shared between the views, and one on the server, for the model.

Definition at line 338 of file OSDLSprite.h.

Referenced by toString(), and ~Sprite().

The shape of this sprite.

Definition at line 358 of file OSDLSprite.h.

Referenced by toString().

The texture owned by this sprite, if OpenGL is used.

Definition at line 368 of file OSDLSprite.h.

Referenced by toString(), and ~Sprite().

Describes a sprite whose shape is 8x8 pixels.

Definition at line 188 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

Describes a sprite whose shape is 8x16 pixels.

Definition at line 205 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

Describes a sprite whose shape is 8x32 pixels.

Definition at line 222 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

const Sprite::Shape Sprite::PowersOfTwo = 13 [static]

Describes a sprite whose width and height are powers of two (not necessarily the same one).

Definition at line 255 of file OSDLSprite.h.

Referenced by DescribeShape().

Describes a sprite whose shape is 16x8 pixels.

Definition at line 192 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

Describes a sprite whose shape is 16x16 pixels.

Definition at line 209 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

Describes a sprite whose shape is 16x32 pixels.

Definition at line 226 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

Describes a sprite whose shape is 64x64 pixels.

Definition at line 247 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

Describes a sprite whose shape is 32x32 pixels.

Definition at line 234 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

Describes a sprite whose shape is 32x8 pixels.

Definition at line 196 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

Describes a sprite whose shape is 32x16 pixels.

Definition at line 213 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

Describes a sprite whose shape is 32x64 pixels.

Definition at line 243 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().

Describes a sprite whose shape is 32x32 pixels.

Definition at line 230 of file OSDLSprite.h.

Referenced by DescribeShape(), GetShapeHeightFor(), and GetShapeWidthFor().


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 14:05:58 2010 for OSDL by  doxygen 1.6.3