|
Fireworks Engine
v2.0
Lightweight Sandbox Game Engine using OpenGL for additional Customisation and Quick Prototyping
|
The class responsible for drawing the Sprites in the scene. More...
#include <sprite.h>
Public Member Functions | |
| Sprite () | |
| Create and empty sprite with this constructor. More... | |
| Sprite (glm::vec3 position, glm::vec2 size, glm::vec4 color, Primitive2D primitive2d=Primitive2D::Quad) | |
| Create Sprite renderable. More... | |
| Sprite (glm::vec3 position, glm::vec2 size, Texture *texture, Primitive2D primitive2d=Primitive2D::Quad) | |
| Create Sprite renderable. More... | |
| Sprite (glm::vec3 position, glm::vec2 size, Texture *texture, glm::vec2 sheetDimension, Primitive2D primitive2d=Primitive2D::Quad) | |
| Create Sprite renderable. More... | |
| Sprite (glm::vec3 position, glm::vec2 size, glm::vec4 color, Shader *shader, Primitive2D primitive2d=Primitive2D::Quad) | |
| Create Sprite renderable. More... | |
| Sprite (glm::vec3 position, glm::vec2 size, Shader *shader, Texture *texture, Primitive2D primitive2d=Primitive2D::Quad) | |
| Create Sprite renderable. More... | |
| Sprite (glm::vec3 position, glm::vec2 size, Shader *shader, Texture *texture, glm::vec2 sheetDimension, Primitive2D primitive2d=Primitive2D::Quad) | |
| Create Sprite renderable. More... | |
| void | addedRigidBody2D () override |
| The overridden callback function that confirms the addition of physics::RigidBody2D component to the Sprite. More... | |
| void | animateSprite (uint32_t frameRate, SpriteAnimationType animType) |
| Animate the sprite by setting the framerate and the type of animation style. More... | |
| const float | getTotalFrames () const |
| Gets the total frames in the sprite sheet. More... | |
Public Member Functions inherited from fireworks::graphics::Renderable2D | |
| Renderable2D (glm::vec3 position, glm::vec2 size, glm::vec4 color, Primitive2D primitive2d) | |
| Creates the renderable. More... | |
| Renderable2D (glm::vec3 position, glm::vec2 size, glm::vec4 color, Primitive2D primitive2d, Shader *shader) | |
| Creates the renderable. More... | |
| virtual | ~Renderable2D () |
| template<typename T > | |
| void | AddComponent (components::Component *component) |
| Template methods of various ways of adding components to the renderable. More... | |
| template<> | |
| void | AddComponent (components::Component *component) |
| The Rigidbody2D overload template. More... | |
| const glm::vec3 & | getPosition () const |
| Gets the position of the Renderable. More... | |
| const float & | getRotation () const |
| Gets the rotation of the Renderable. More... | |
| const glm::vec2 & | getSize () const |
| Gets the size of the renderable. More... | |
| const glm::vec4 & | getColor () const |
| Gets the color of the renderable. More... | |
| const Primitive2D | getPrimitive () const |
| Gets the primitive shape that is used to draw the renderable. More... | |
| const std::vector< glm::vec2 > & | getUV () const |
| Gets the UV coordinates of the 2D Renderable. More... | |
| const Texture * | getTexture () const |
| Gets the texture that is used to draw the renderable. More... | |
| const GLuint | getTID () const |
| Gets the ID of the renderables texture. More... | |
| void | flipX () |
| Flip the Renderable along the X-axis. More... | |
| void | unflipX () |
| Unflip the Renderable along the X-axis. More... | |
| void | flipY () |
| Flip the Renderable along the Y-axis. More... | |
| void | unflipY () |
| Unflip the Renderable along the X-axis. More... | |
Public Attributes | |
| std::uint32_t | frame |
| The frame number in the sprite sheet. More... | |
| std::uint32_t | frameRate |
| The rate at which the frames are displayed. More... | |
| glm::vec3 & | position |
| The position of the Sprite. More... | |
| glm::vec4 & | color |
| The color of the Sprite. More... | |
| glm::vec2 & | size |
| The size of the Sprite. More... | |
| float & | rotation |
| The rotation of the Sprite. More... | |
Public Attributes inherited from fireworks::graphics::Renderable2D | |
| std::uint32_t | objectID |
| The unique ID of the renderable object. More... | |
| Shader * | shader |
| The Shader used to draw the particular renderable. More... | |
| bool | flippedX |
| tells whether or not the renderable is flipped on the X-axis or not More... | |
| bool | flippedY |
| tells whether or not the renderable is flipped on the Y-axis or not More... | |
| std::vector< components::Component * > | components |
| The collection of Components that is attached to the renderable. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from fireworks::graphics::Renderable2D | |
| Renderable2D () | |
| Create an empty renderable. More... | |
Protected Attributes inherited from fireworks::graphics::Renderable2D | |
| glm::vec2 | m_Size |
| The size of the renderable. More... | |
| glm::vec3 | m_Position |
| The position of the renderable. More... | |
| glm::vec4 | m_Color |
| The color of the renderable. More... | |
| float | m_Rotation |
| The rotation of the renderable along the Z-Axis. More... | |
| Primitive2D | m_Primitive2D |
| The primitive that is used to draw the renderable. More... | |
| std::vector< glm::vec2 > | m_UV |
| The UV coordinates of the renderable. More... | |
| Texture * | m_Texture |
| The texture (if any) used by the renderable. More... | |
The class responsible for drawing the Sprites in the scene.
| fireworks::graphics::Sprite::Sprite | ( | ) |
Create and empty sprite with this constructor.
| fireworks::graphics::Sprite::Sprite | ( | glm::vec3 | position, |
| glm::vec2 | size, | ||
| glm::vec4 | color, | ||
| Primitive2D | primitive2d = Primitive2D::Quad |
||
| ) |
Create Sprite renderable.
| position | The position at which the sprite should be rendered at |
| size | The dimensions of the sprite color The color of the sprite |
| primitive2d | The primitive shape with which the Sprite should be rendered with |
| fireworks::graphics::Sprite::Sprite | ( | glm::vec3 | position, |
| glm::vec2 | size, | ||
| Texture * | texture, | ||
| Primitive2D | primitive2d = Primitive2D::Quad |
||
| ) |
Create Sprite renderable.
| position | The position at which the sprite should be rendered at |
| size | The dimensions of the sprite texture The Texture with which the sprite should be rendered with |
| primitive2d | The primitive shape with which the Sprite should be rendered with |
| fireworks::graphics::Sprite::Sprite | ( | glm::vec3 | position, |
| glm::vec2 | size, | ||
| Texture * | texture, | ||
| glm::vec2 | sheetDimension, | ||
| Primitive2D | primitive2d = Primitive2D::Quad |
||
| ) |
Create Sprite renderable.
| position | The position at which the sprite should be rendered at |
| size | The dimensions of the sprite texture The Texture with which the sprite should be rendered with |
| sheetDimension | The dimensions of the sprite sheet i.e. no of sprites in the sheet not the actual dimensions of the sheet |
| primitive2d | The primitive shape with which the Sprite should be rendered with |
| fireworks::graphics::Sprite::Sprite | ( | glm::vec3 | position, |
| glm::vec2 | size, | ||
| glm::vec4 | color, | ||
| Shader * | shader, | ||
| Primitive2D | primitive2d = Primitive2D::Quad |
||
| ) |
Create Sprite renderable.
| position | The position at which the sprite should be rendered at |
| size | The dimensions of the sprite color The color of the sprite |
| shader | The shader with which you want the sprite to be rendered with |
| primitive2d | The primitive shape with which the Sprite should be rendered with |
| fireworks::graphics::Sprite::Sprite | ( | glm::vec3 | position, |
| glm::vec2 | size, | ||
| Shader * | shader, | ||
| Texture * | texture, | ||
| Primitive2D | primitive2d = Primitive2D::Quad |
||
| ) |
Create Sprite renderable.
| position | The position at which the sprite should be rendered at |
| size | The dimensions of the sprite color The color of the sprite |
| shader | The shader with which you want the sprite to be rendered with texture The Texture with which the sprite should be rendered with |
| primitive2d | The primitive shape with which the Sprite should be rendered with |
| fireworks::graphics::Sprite::Sprite | ( | glm::vec3 | position, |
| glm::vec2 | size, | ||
| Shader * | shader, | ||
| Texture * | texture, | ||
| glm::vec2 | sheetDimension, | ||
| Primitive2D | primitive2d = Primitive2D::Quad |
||
| ) |
Create Sprite renderable.
| position | The position at which the sprite should be rendered at |
| size | The dimensions of the sprite color The color of the sprite |
| shader | The shader with which you want the sprite to be rendered with texture The Texture with which the sprite should be rendered with |
| sheetDimension | The dimensions of the sprite sheet i.e. no of sprites in the sheet not the actual dimensions of the sheet |
| primitive2d | The primitive shape with which the Sprite should be rendered with |
|
overridevirtual |
The overridden callback function that confirms the addition of physics::RigidBody2D component to the Sprite.
Reimplemented from fireworks::graphics::Renderable2D.
| void fireworks::graphics::Sprite::animateSprite | ( | uint32_t | frameRate, |
| SpriteAnimationType | animType | ||
| ) |
Animate the sprite by setting the framerate and the type of animation style.
| frameRate | The frame rate at which you want the animation to play |
| animType | The type of animation |
|
inline |
Gets the total frames in the sprite sheet.
| glm::vec4& fireworks::graphics::Sprite::color |
The color of the Sprite.
|
mutable |
The frame number in the sprite sheet.
| std::uint32_t fireworks::graphics::Sprite::frameRate |
The rate at which the frames are displayed.
| glm::vec3& fireworks::graphics::Sprite::position |
The position of the Sprite.
| float& fireworks::graphics::Sprite::rotation |
The rotation of the Sprite.
| glm::vec2& fireworks::graphics::Sprite::size |
The size of the Sprite.