Public Member Functions | Protected Attributes | List of all members
nom::Sprite Class Reference

Base class for bitmap objects. More...

#include <Sprite.hpp>

Inheritance diagram for nom::Sprite:
[legend]
Collaboration diagram for nom::Sprite:
[legend]

Public Member Functions

 Sprite (void)
 
 Sprite (int32 width, int32 height)
 Construct a Sprite object, initializing the width & height coordinates.
 
Sprite & operator= (const Sprite &other)
 Copy assignment operator.
 
virtual ~Sprite (void)
 Destructor.
 
const Point2i size (void) const
 
const Point2i position (void) const
 
uint32 getState (void) const
 Get the object's state.
 
void setState (uint32 state)
 Set a new state.
 
bool load (const std::string &filename, const Color &colorkey, bool use_cache=false)
 Load a new image onto the Sprite.
 
virtual void update (void)
 
void draw (RenderTarget target) const
 Render the object onto the primary video buffer – your visible screen.
 
void draw (RenderTarget target, const double angle) const
 
bool resize (enum ResizeAlgorithm scaling_algorithm)
 Rescale the font with a chosen resizing algorithm.
 
bool resize (const Point2f &scale_factor)
 
- Public Member Functions inherited from nom::Transformable
 Transformable (const Coords &coords)
 
 Transformable (const Coords &coords, const Color &color)
 
const Coords getPosition (void) const
 
const Coords getSize (void) const
 
void setPosition (int32 x, int32 y)
 
void setPosition (int32 x, int32 y, int32 width, int32 height)
 
void setPosition (const Coords &coords)
 
void setSize (int32 width, int32 height)
 
void setSize (const Coords &size)
 
void move (uint32 x=0, uint32 y=0)
 
void move (const Coords &offsets=Coords(0, 0))
 
const Color & getColor (void) const
 
void setColor (uint8 red, uint8 green, uint8 blue, uint8 alpha=255)
 
void setColor (const Color &color)
 
- Public Member Functions inherited from nom::IDrawable
 IDrawable (void)
 Do nothing at all default constructor.
 
virtual ~IDrawable (void)
 Do nothing at all destructor.
 

Protected Attributes

Texture sprite
 Object that holds our sprite image.
 
uint32 state
 Convenience instance variable (user-defined)
 
int32 scale_factor
 Scale factor applied if the resize method is called.
 
- Protected Attributes inherited from nom::Transformable
Coords coords
 
Color color
 

Additional Inherited Members

- Public Types inherited from nom::IDrawable
typedef std::unique_ptr
< IDrawable > 
UniquePtr
 std::unique_ptr definition type for your convenience, sir!
 
typedef std::shared_ptr
< IDrawable > 
SharedPtr
 std::shared_ptr definition type at your leisure, sir!
 
typedef std::vector
< std::shared_ptr< IDrawable > > 
SharedDrawables
 Vector of std::shared_ptr definition type for the brotherhood, sir!
 
typedef std::vector
< std::unique_ptr< IDrawable > > 
UniqueDrawables
 std::unique_ptr vector container type
 
typedef const Window & RenderTarget
 

Detailed Description

Base class for bitmap objects.

Definition at line 46 of file Sprite.hpp.

Constructor & Destructor Documentation

nom::Sprite::Sprite ( void  )

Default construct for initializing instance variables to their respective defaults.

Definition at line 33 of file Sprite.cpp.

Here is the caller graph for this function:

Member Function Documentation

void nom::Sprite::draw ( RenderTarget  target,
const double  angle 
) const

Draw a rotated nom::Sprite on a nom::Window

Parameters
targetReference to an active nom::Window
angleRotation angle in degrees

Definition at line 116 of file Sprite.cpp.

Here is the call graph for this function:

void nom::Sprite::update ( void  )
virtual

Intended to be used internally by the class re-implementing this method; for use in preparing the buffer to be drawn using the draw method call. Whereas both Update & Draw are typically publicly exposed to the end-user, only the Draw method call should be expected of the end-user to be explicitly called.

Todo:
Not all the interfaced (inherited) IDrawable objects in this library conform to the expectations stated above. We need to first figure out if we wish to stay on this course (of expectation), or diverge all together. Undecided. Jeffrey Carpenter jeffr.nosp@m.ey.c.nosp@m.arp@g.nosp@m.mail.nosp@m..com @ 2013-10-03

Implements nom::IDrawable.

Reimplemented in nom::SpriteBatch.

Definition at line 104 of file Sprite.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


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