![]() |
nomlib
|
Extended sprite rendering using sprite sheets. More...
#include <SpriteBatch.hpp>
Public Types | |
| typedef SpriteBatch | self_type |
| typedef Sprite | derived_class |
| Public Types inherited from nom::Sprite | |
| typedef Sprite | self_type |
| typedef Transformable | derived_class |
| Public Types inherited from nom::Transformable | |
| typedef Transformable | self_type |
| Public Types inherited from nom::IDrawable | |
| typedef IDrawable | self_type |
| typedef self_type * | raw_ptr |
| A type definition for a C pointer – raw pointer – to an IDrawable object. | |
| typedef std::unique_ptr< self_type > | unique_ptr |
| A type definition for a C++11 std::unique_ptr to an IDrawable object. | |
| typedef std::shared_ptr< self_type > | shared_ptr |
| A type definition for a C++11 std::shared_ptr to an IDrawable object. | |
| typedef const RenderWindow | RenderTarget |
| Public Types inherited from nom::IObject | |
| typedef IObject | self_type |
| typedef IObject * | raw_ptr |
Public Member Functions | |
| SpriteBatch () | |
| virtual | ~SpriteBatch () |
| Destructor. | |
| virtual void | set_sprite_sheet (const SpriteSheet &sheet) |
| Use the sprite frames from an existing SpriteSheet object. | |
| ObjectTypeInfo | type () const override |
| Re-implements the IObject::type method. | |
| SpriteBatch * | clone () const |
| Implements the required IDrawable::clone method. | |
| virtual int32 | frame () const |
| Get the object's current sheet_id. | |
| int32 | frames () const |
| Obtain the number of frames available. | |
| void | set_frame (int32 id) |
| Set a new frame ID to render. | |
| virtual void | draw (IDrawable::RenderTarget &target) const override |
| Render the sprite frame. | |
| virtual void | draw (RenderTarget &target, real64 angle) const override |
| Render the sprite frame at an angle. | |
| Public Member Functions inherited from nom::Sprite | |
| bool | init_with_color (const Color4i &color, const Size2i &dims) |
| Construct a sprite from a dimension and color. | |
| virtual void | set_position (const Point2i &pos) override |
| Re-implements Transformable::set_position. | |
| virtual void | set_size (const Size2i &dims) override |
| Re-implements Transformable::set_size. | |
| std::unique_ptr< Sprite > | clone () const |
| Implements the required IDrawable::clone method. | |
| std::shared_ptr< Texture > | texture () const |
| bool | valid () const |
| Color4i | color () const |
| Get the texture color of the sprite. | |
| BlendMode | color_blend_mode () const |
| Get the color blend mode of the sprite. | |
| uint8 | alpha () const |
| Get the alpha value of the sprite. | |
| bool | set_texture (Texture &tex) |
| Construct a sprite from an existing texture source. | |
| bool | set_texture (Texture *tex) |
| Construct a sprite from an existing texture source. | |
| bool | set_texture (std::shared_ptr< Texture > &tex) |
| Construct a sprite from an existing texture source. | |
| bool | set_alpha (uint8 opacity) |
| bool | set_color (const Color4i &color) |
| bool | set_color_blend_mode (BlendMode blend) |
| void | release_texture () |
| Free the stored texture. | |
| Public Member Functions inherited from nom::Transformable | |
| Transformable (const Point2i &pos, const Size2i &size) | |
| Transformable (const IntRect &bounds) | |
| Construct an object using a complete set of coordinates (bounds). | |
| ObjectTypeInfo | type () const override |
| Re-implements the IObject::type method. | |
| const Point2i & | position (void) const |
| Getter for stored positioning coordinates. | |
| const Size2i & | size (void) const |
| Getter for stored size dimensions. | |
| virtual void | set_bounds (const IntRect &bounds) |
| Set the complete bounds of the object – position (X, Y) and size (width and height) dimensions. | |
| void | set_position (int x, int y) |
| void | set_size (int w, int h) |
| virtual void | translate (const Point2i &pos) |
| Public Member Functions inherited from nom::IDrawable | |
| IDrawable (void) | |
| Do nothing at all default constructor. | |
| virtual | ~IDrawable (void) |
| Do nothing at all destructor. | |
| Public Member Functions inherited from nom::IObject | |
| IObject (void) | |
| Default constructor. | |
| virtual | ~IObject (void) |
| Virtual destructor. | |
| virtual bool | is_type (const ObjectTypeInfo &rhs) const |
| Compare this object type with another object's type. | |
Protected Attributes | |
| IntRect | offsets |
| Source (input) coordinates – used for sprite sheet positioning. | |
| SpriteSheet | sprite_sheet |
| Our attached sprite sheet object. | |
| int32 | sheet_id_ |
| The sheet's frame ID presently in use. | |
| Protected Attributes inherited from nom::Sprite | |
| std::shared_ptr< Texture > | texture_ |
| The underlying texture for the sprite. | |
Private Member Functions | |
| virtual void | update () override |
| Update the sprite for rendering with regard to positioning coordinates and target frame ID. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from nom::IObject | |
| template<typename Base, typename Derived> | |
| static bool | is_a (const Derived object) |
| Compare two objects to determine if a derived class inherits from a base class object. | |
| static void * | operator new (nom::size_type mem) |
| static void | operator delete (void *ptr) |
| Static Public Attributes inherited from nom::IObject | |
| static uint64 | total_alloc_bytes |
| static uint64 | total_dealloc_bytes |
Extended sprite rendering using sprite sheets.
Definition at line 42 of file SpriteBatch.hpp.
| typedef Sprite nom::SpriteBatch::derived_class |
Definition at line 46 of file SpriteBatch.hpp.
| typedef SpriteBatch nom::SpriteBatch::self_type |
Definition at line 45 of file SpriteBatch.hpp.
| nom::SpriteBatch::SpriteBatch | ( | ) |
Default construct for initializing instance variables to their respective defaults.
|
overridevirtual |
Render the sprite frame.
Reimplemented from nom::Sprite.
|
overridevirtual |
Render the sprite frame at an angle.
Reimplemented from nom::Sprite.
| void nom::SpriteBatch::set_frame | ( | int32 | id | ) |
Set a new frame ID to render.
| id | The frame identifier (from the sprite sheet) to use in rendering. |
|
virtual |
Use the sprite frames from an existing SpriteSheet object.
| sheet | The pre-loaded sprite sheet instance to use the frames from. |
|
overridevirtual |
Re-implements the IObject::type method.
Reimplemented from nom::Sprite.
|
overrideprivatevirtual |
Update the sprite for rendering with regard to positioning coordinates and target frame ID.
Reimplemented from nom::Sprite.
|
protected |
Source (input) coordinates – used for sprite sheet positioning.
Definition at line 113 of file SpriteBatch.hpp.
|
protected |
The sheet's frame ID presently in use.
Definition at line 119 of file SpriteBatch.hpp.
|
protected |
Our attached sprite sheet object.
Definition at line 116 of file SpriteBatch.hpp.