Mercurial > fife-parpg
comparison engine/core/view/renderers/genericrenderer.i @ 23:e5e2fec68834
add generic renderer
author | spq@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 11 Jul 2008 10:42:31 +0000 |
parents | |
children | 70f41ea8e7db |
comparison
equal
deleted
inserted
replaced
22:aa0aea2572c9 | 23:e5e2fec68834 |
---|---|
1 %module fife | |
2 %{ | |
3 #include "view/renderers/genericrenderer.h" | |
4 %} | |
5 | |
6 namespace FIFE { | |
7 class RenderBackend; | |
8 | |
9 class GenericRendererNode { | |
10 public: | |
11 GenericRendererNode(Instance* attached_instance, Location* relative_location, const Point &relative_point = Point(0,0)); | |
12 GenericRendererNode(Instance* attached_instance, const Point &relative_point = Point(0,0)); | |
13 GenericRendererNode(Location* attached_location, const Point &relative_point = Point(0,0)); | |
14 GenericRendererNode(const Point &attached_point); | |
15 ~GenericRendererNode(); | |
16 | |
17 void setAttached(Instance* attached_instance, const Location &relative_location, const Point &relative_point); | |
18 void setAttached(Instance* attached_instance, const Location &relative_location); | |
19 void setAttached(Instance* attached_instance, const Point &relative_point); | |
20 void setAttached(Instance* attached_instance); | |
21 void setAttached(const Location &attached_location, const Point &relative_point); | |
22 void setAttached(const Location &attached_location); | |
23 void setAttached(const Point &attached_point); | |
24 | |
25 void setRelative(const Location &relative_location); | |
26 void setRelative(const Location &relative_location, Point relative_point); | |
27 void setRelative(const Point &relative_point); | |
28 | |
29 Instance* getAttachedInstance(); | |
30 Location* getAttachedLocation(); | |
31 Point getAttachedPoint(); | |
32 | |
33 Location* getOffsetLocation(); | |
34 Point getOffsetPoint(); | |
35 | |
36 Instance* getInstance(); | |
37 Location* getLocation(); | |
38 Point getPoint(); | |
39 | |
40 Point getCalculatedPoint(Camera* cam, Layer* layer, std::vector<Instance*>& instances); | |
41 private: | |
42 Instance* m_instance; | |
43 Location* m_location; | |
44 Point m_point; | |
45 }; | |
46 class GenericRendererElementInfo { | |
47 public: | |
48 virtual void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend) = 0; | |
49 virtual ~GenericRendererElementInfo() {}; | |
50 }; | |
51 | |
52 class GenericRendererLineInfo : public GenericRendererElementInfo { | |
53 public: | |
54 GenericRendererNode n1; | |
55 GenericRendererNode n2; | |
56 uint8_t r; | |
57 uint8_t g; | |
58 uint8_t b; | |
59 virtual void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend); | |
60 GenericRendererLineInfo(GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b); | |
61 virtual ~GenericRendererLineInfo() {}; | |
62 }; | |
63 class GenericRendererPointInfo : public GenericRendererElementInfo { | |
64 public: | |
65 GenericRendererNode n; | |
66 uint8_t r; | |
67 uint8_t g; | |
68 uint8_t b; | |
69 virtual void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend); | |
70 GenericRendererPointInfo(GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b); | |
71 virtual ~GenericRendererPointInfo() {}; | |
72 }; | |
73 class GenericRendererQuadInfo : public GenericRendererElementInfo { | |
74 public: | |
75 GenericRendererNode n1; | |
76 GenericRendererNode n2; | |
77 GenericRendererNode n3; | |
78 GenericRendererNode n4; | |
79 uint8_t r; | |
80 uint8_t g; | |
81 uint8_t b; | |
82 virtual void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend); | |
83 GenericRendererQuadInfo(GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b); | |
84 virtual ~GenericRendererQuadInfo() {}; | |
85 }; | |
86 class GenericRendererImageInfo : public GenericRendererElementInfo { | |
87 public: | |
88 GenericRendererNode n; | |
89 int image; | |
90 virtual void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend); | |
91 GenericRendererImageInfo(GenericRendererNode n, int image); | |
92 virtual ~GenericRendererImageInfo() {}; | |
93 }; | |
94 class GenericRendererAnimationInfo : public GenericRendererElementInfo { | |
95 public: | |
96 GenericRendererNode n; | |
97 int animation; | |
98 virtual void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend); | |
99 GenericRendererAnimationInfo(GenericRendererNode n, int animation); | |
100 virtual ~GenericRendererAnimationInfo() {}; | |
101 }; | |
102 class GenericRendererTextInfo : public GenericRendererElementInfo { | |
103 public: | |
104 GenericRendererNode n; | |
105 AbstractFont* font; | |
106 std::string text; | |
107 virtual void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend); | |
108 GenericRendererTextInfo(GenericRendererNode n, AbstractFont* font, std::string text); | |
109 virtual ~GenericRendererTextInfo() {}; | |
110 }; | |
111 class GenericRenderer: public RendererBase { | |
112 public: | |
113 GenericRenderer(RenderBackend* renderbackend, int position); | |
114 ~GeometricRenderer(); | |
115 std::string getName(); | |
116 static GenericRenderer* getInstance(IRendererContainer* cnt); | |
117 void addLine(GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b); | |
118 void addPoint(GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b); | |
119 void addQuad(GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b); | |
120 void addText(GenericRendererNode n, AbstractFont* font, std::string text); | |
121 void addImage(GenericRendererNode n, int image); | |
122 void addAnimation(GenericRendererNode n, int animation); | |
123 void removeAll(); | |
124 }; | |
125 } |