Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
SpriteComponent.h
Go to the documentation of this file.
1#pragma once
2
3#include "scene/Component.h"
4
5#include <glm/vec4.hpp>
6#include <glm/vec2.hpp>
7#include <memory>
8
9namespace eng
10{
11 class Texture;
12
14 {
16 public:
17 void LoadProperties(const nlohmann::json& json) override;
18 void Update(float deltaTime) override;
19
20 void SetTexture(const std::shared_ptr<Texture>& texture);
21 const std::shared_ptr<Texture>& GetTexture() const;
22 void SetColor(const glm::vec4& color);
23 const glm::vec4& GetColor() const;
24 void SetSize(const glm::vec2& size);
25 const glm::vec2& GetSize() const;
26 void SetLowerLeftUV(const glm::vec2& uv);
27 const glm::vec2& GetLowerLeftUV() const;
28 void SetUpperRightUV(const glm::vec2& uv);
29 const glm::vec2& GetUpperRightUV() const;
30 void SetUV(const glm::vec2& lowerLeftUV, const glm::vec2& upperRightUV);
31 void SetPivot(const glm::vec2& pivot);
32 const glm::vec2& GetPivot() const;
33 void SetVisibile(bool visible);
34 bool IsVisible() const;
35
36 private:
37 std::shared_ptr<Texture> m_texture;
38 glm::vec4 m_color = glm::vec4(1.0f);
39 glm::vec2 m_size = glm::vec2(100.0f);
40 glm::vec2 m_lowerLeftUV = glm::vec2(0.0f);
41 glm::vec2 m_upperRightUV = glm::vec2(1.0f);
42 glm::vec2 m_pivot = glm::vec2(0.5f);
43 bool m_visible = true;
44 };
45}
void SetPivot(const glm::vec2 &pivot)
const std::shared_ptr< Texture > & GetTexture() const
void SetLowerLeftUV(const glm::vec2 &uv)
void SetUV(const glm::vec2 &lowerLeftUV, const glm::vec2 &upperRightUV)
void SetTexture(const std::shared_ptr< Texture > &texture)
void Update(float deltaTime) override
void LoadProperties(const nlohmann::json &json) override
const glm::vec2 & GetPivot() const
void SetUpperRightUV(const glm::vec2 &uv)
const glm::vec4 & GetColor() const
const glm::vec2 & GetLowerLeftUV() const
const glm::vec2 & GetSize() const
void SetVisibile(bool visible)
void SetColor(const glm::vec4 &color)
const glm::vec2 & GetUpperRightUV() const
void SetSize(const glm::vec2 &size)
#define COMPONENT(ComponentClass)
Definition Component.h:105