dEngine
Simple 2D C++ game engine
Public Member Functions | Private Attributes | List of all members
dengine::Sprite Class Reference

A sprite. More...

#include <Sprite.h>

Inheritance diagram for dengine::Sprite:
dengine::Component

Public Member Functions

 Sprite (std::string filepath, GameObject &parent)
 Constructor. More...
 
 ~Sprite ()
 Desctructor. More...
 
void Render () override
 Render Function. More...
 
SDL_Texture * getTexture ()
 Sprite Texture. More...
 
- Public Member Functions inherited from dengine::Component
 Component (GameObject &parent)
 Create a new component for a gameobject. More...
 
virtual void NotifyCollision (GameObject &other)
 
std::string GetName ()
 Returns the component's name. More...
 
virtual void Start ()
 Start the object To be called by the GameObject's Start method. This should be called at the beginning of instantiation. More...
 
virtual void Update ()
 

Private Attributes

SDL_Texture * texture
 

Additional Inherited Members

- Protected Attributes inherited from dengine::Component
GameObjectparent
 
std::string name
 

Detailed Description

A sprite.

Sprites are used for static images that don't require animation

Constructor & Destructor Documentation

◆ Sprite()

Sprite::Sprite ( std::string  filepath,
GameObject parent 
)

Constructor.

Creates a sprite from the image defined in the filepath

◆ ~Sprite()

Sprite::~Sprite ( )

Desctructor.

Frees up resources allocated by Sprite

Member Function Documentation

◆ getTexture()

SDL_Texture * Sprite::getTexture ( )

Sprite Texture.

Returns a pointer to the texture

◆ Render()

void Sprite::Render ( )
overridevirtual

Render Function.

Renders the sprite

Reimplemented from dengine::Component.

Member Data Documentation

◆ texture

SDL_Texture* dengine::Sprite::texture
private

Referenced by getTexture(), Render(), Sprite(), and ~Sprite().