blob: a361be7ed601e7d3f8d0d8aa3be7f0527a7b06cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#ifndef __JE_SPRITE_H__
#define __JE_SPRITE_H__
#include "../common/je_types.h"
#include "../math/je_vector2.hpp"
#include "shaders/je_shader.h"
#include "je_color.h"
namespace JinEngine
{
namespace Graphics
{
///
/// A sprite is unit of rendering. Animation is based on sprite, but not texture or other graphic stuff.
///
class Sprite
{
public:
void setOrigin(int x, int y);
void setPosition(int x, int y);
void setScale(float x, float y);
void setColor(Color color);
void setShader(const Shaders::Shader* shader);
void setGraphic(const Graphic* graphic);
///
/// Render callback.
///
virtual void onRender();
private:
///
/// Origin must be 0~1 float value.
///
Math::Vector2<float> mPosition;
Math::Vector2<int> mOrigin;
Math::Vector2<float> mScale;
Color mColor;
Shaders::Shader* mShader;
Graphic* mGraphic;
};
} // namespace Graphics
} // namespace JinEngine
#endif
|