Hymn to Beauty
C++ 3D Engine
Component::Sprite Class Reference

Component defining a 2D sprite. More...

#include <Sprite.hpp>

Inheritance diagram for Component::Sprite:
Component::SuperComponent

Public Member Functions

 Sprite ()
 Create new sprite. More...
 
 ~Sprite () override
 Destructor. More...
 
void Serialize (Json::Value &node, bool load) override
 Save or load component values to/from JSON. More...
 
- Public Member Functions inherited from Component::SuperComponent
 SuperComponent ()
 Create new SuperComponent. More...
 
virtual ~SuperComponent ()
 Destructor. More...
 
void Kill ()
 Kill the component, will be removed at the end of the frame. More...
 
bool IsKilled () const
 Get whether component has been killed. More...
 

Public Attributes

TextureAssettexture
 Texture. More...
 
float pixelsPerUnit = 100.0f
 How many pixels go into one world unit. More...
 
glm::vec2 pivot = glm::vec2(0.5, 0.5)
 The point around which the sprite should be rotated. More...
 
glm::vec3 tint = glm::vec3(1.0f, 1.0f, 1.0f)
 A color to tint the sprite with. More...
 
float alpha = 1.0f
 The opacity of the sprite (multiplied with the texture's alpha channel). More...
 
uint32_t layerMask = 1u
 Bitmask of which layers to render to. More...
 
- Public Attributes inherited from Component::SuperComponent
Entityentity = nullptr
 Pointer to which entity this component corresponds. More...
 

Detailed Description

Component defining a 2D sprite.

Constructor & Destructor Documentation

◆ Sprite()

Sprite::Sprite ( )

Create new sprite.

◆ ~Sprite()

Sprite::~Sprite ( )
override

Destructor.

Member Function Documentation

◆ Serialize()

void Sprite::Serialize ( Json::Value &  node,
bool  load 
)
overridevirtual

Save or load component values to/from JSON.

Parameters
nodeThe JSON node to save to or load from.
loadWhether to load (otherwise saves).

Implements Component::SuperComponent.

Member Data Documentation

◆ alpha

float Component::Sprite::alpha = 1.0f

The opacity of the sprite (multiplied with the texture's alpha channel).

◆ layerMask

uint32_t Component::Sprite::layerMask = 1u

Bitmask of which layers to render to.

◆ pivot

glm::vec2 Component::Sprite::pivot = glm::vec2(0.5, 0.5)

The point around which the sprite should be rotated.

◆ pixelsPerUnit

float Component::Sprite::pixelsPerUnit = 100.0f

How many pixels go into one world unit.

◆ texture

TextureAsset* Component::Sprite::texture

Texture.

◆ tint

glm::vec3 Component::Sprite::tint = glm::vec3(1.0f, 1.0f, 1.0f)

A color to tint the sprite with.


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