Hymn to Beauty
C++ 3D Engine
Sprite.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "SuperComponent.hpp"
4
5#include <glm/glm.hpp>
6
7class TextureAsset;
8
9namespace Component {
11class Sprite : public SuperComponent {
12 public:
14 Sprite();
15
17 ~Sprite() override;
18
19 void Serialize(Json::Value& node, bool load) override;
20
23
25 float pixelsPerUnit = 100.0f;
26
28 glm::vec2 pivot = glm::vec2(0.5, 0.5);
29
31 glm::vec3 tint = glm::vec3(1.0f, 1.0f, 1.0f);
32
34 float alpha = 1.0f;
35
37 uint32_t layerMask = 1u;
38};
39} // namespace Component
Component defining a 2D sprite.
Definition: Sprite.hpp:11
Sprite()
Create new sprite.
Definition: Sprite.cpp:10
float pixelsPerUnit
How many pixels go into one world unit.
Definition: Sprite.hpp:25
uint32_t layerMask
Bitmask of which layers to render to.
Definition: Sprite.hpp:37
~Sprite() override
Destructor.
Definition: Sprite.cpp:14
TextureAsset * texture
Texture.
Definition: Sprite.hpp:22
float alpha
The opacity of the sprite (multiplied with the texture's alpha channel).
Definition: Sprite.hpp:34
void Serialize(Json::Value &node, bool load) override
Save or load component values to/from JSON.
Definition: Sprite.cpp:19
glm::vec3 tint
A color to tint the sprite with.
Definition: Sprite.hpp:31
glm::vec2 pivot
The point around which the sprite should be rotated.
Definition: Sprite.hpp:28
Component which all components inherit.
Definition: SuperComponent.hpp:9
A texture used in a hymn.
Definition: TextureAsset.hpp:12
Definition: BoxShapeEditor.hpp:5