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
50
51
52
53
54
55
|
#ifndef __JE_SPRITE_H__
#define __JE_SPRITE_H__
#include "../common/types.h"
#include "../math/vector2.hpp"
#include "color.h"
#include "graphic.h"
#include "renderable.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 Object, public Renderable
{
public:
Sprite(const Graphic* graphic, const Math::Quad& quad, Origin origin);
Sprite(const Graphic* graphic, const Math::Quad& quad, float ox, float oy);
Sprite(const Graphic* graphic, Origin origin);
Sprite(const Graphic* graphic, float ox, float oy);
virtual ~Sprite();
Math::Vector2<int> getSize();
void render(float x, float y, float sx, float sy, float r) const override;
private:
void setOrigin(Origin origin);
const Math::Vector2<float> mOrigin;
///
/// Quad of graphic.
///
const Math::Quad mQuad;
const Graphic* mGraphic;
};
} // namespace Graphics
} // namespace JinEngine
#endif
|