ge211  2021.5.1
A student game engine
Sprite Class Referenceabstract

Detailed Description

A sprite is an image that knows how to render itself to the screen at a given location, under a particular transformation.

You cannot create a Sprite object directly, but must create one of its derived classes, such as Image_sprite or Rectangle_sprite. You can find out any sprite's dimensions with the Sprite::dimensions() const member function. Specific derived classes of Sprite, such as Rectangle_sprite, may have more specific operations.

See also
Circle_sprite
Image_sprite
Rectangle_sprite
Text_sprite

Definition at line 38 of file ge211_sprites.hxx.

+ Inheritance diagram for Sprite:

Public Member Functions

virtual Dims< int > dimensions () const =0
 Returns the current dimensions of this Sprite. More...
 

Member Function Documentation

◆ dimensions()

virtual Dims<int> dimensions ( ) const
pure virtual

Returns the current dimensions of this Sprite.

When deriving from Sprite to implement your own kind of sprite (or when deriving from Multiplexed_sprite), you need to make sure that this returns the maximum dimensions that the sprite could render at. For animated sprites, it's usually best if all the frames have the same dimensions anyway.


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