Mercurial > fife-parpg
annotate engine/core/view/renderers/genericrenderer.i @ 105:2241b0d5379e
use strings as grouping in generic renderer, easier for the clients...
author | spq@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 24 Jul 2008 13:20:39 +0000 |
parents | 90005975cdbb |
children | 9d94f4676d17 |
rev | line source |
---|---|
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
1 /*************************************************************************** |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
2 * Copyright (C) 2005-2008 by the FIFE team * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
3 * http://www.fifengine.de * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
4 * This file is part of FIFE. * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
5 * * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
6 * FIFE is free software; you can redistribute it and/or * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
8 * License as published by the Free Software Foundation; either * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
10 * * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
11 * This library is distributed in the hope that it will be useful, * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
14 * Lesser General Public License for more details. * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
15 * * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
17 * License along with this library; if not, write to the * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
18 * Free Software Foundation, Inc., * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
20 ***************************************************************************/ |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
32
diff
changeset
|
21 |
23 | 22 %module fife |
23 %{ | |
24 #include "view/renderers/genericrenderer.h" | |
25 %} | |
26 | |
27 namespace FIFE { | |
28 class RenderBackend; | |
29 | |
30 class GenericRendererNode { | |
31 public: | |
32 GenericRendererNode(Instance* attached_instance, Location* relative_location, const Point &relative_point = Point(0,0)); | |
33 GenericRendererNode(Instance* attached_instance, const Point &relative_point = Point(0,0)); | |
34 GenericRendererNode(Location* attached_location, const Point &relative_point = Point(0,0)); | |
35 GenericRendererNode(const Point &attached_point); | |
36 ~GenericRendererNode(); | |
37 | |
26
70f41ea8e7db
fix compile errors in node setters...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
23
diff
changeset
|
38 void setAttached(Instance* attached_instance, Location* relative_location, const Point &relative_point); |
70f41ea8e7db
fix compile errors in node setters...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
23
diff
changeset
|
39 void setAttached(Instance* attached_instance, Location* relative_location); |
23 | 40 void setAttached(Instance* attached_instance, const Point &relative_point); |
41 void setAttached(Instance* attached_instance); | |
26
70f41ea8e7db
fix compile errors in node setters...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
23
diff
changeset
|
42 void setAttached(Location* attached_location, const Point &relative_point); |
70f41ea8e7db
fix compile errors in node setters...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
23
diff
changeset
|
43 void setAttached(Location* attached_location); |
23 | 44 void setAttached(const Point &attached_point); |
45 | |
26
70f41ea8e7db
fix compile errors in node setters...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
23
diff
changeset
|
46 void setRelative(Location* relative_location); |
70f41ea8e7db
fix compile errors in node setters...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
23
diff
changeset
|
47 void setRelative(Location* relative_location, Point relative_point); |
23 | 48 void setRelative(const Point &relative_point); |
49 | |
50 Instance* getAttachedInstance(); | |
51 Location* getAttachedLocation(); | |
52 Point getAttachedPoint(); | |
53 | |
54 Location* getOffsetLocation(); | |
55 Point getOffsetPoint(); | |
56 | |
57 Instance* getInstance(); | |
58 Location* getLocation(); | |
59 Point getPoint(); | |
60 | |
61 Point getCalculatedPoint(Camera* cam, Layer* layer, std::vector<Instance*>& instances); | |
62 private: | |
63 Instance* m_instance; | |
64 Location* m_location; | |
65 Point m_point; | |
66 }; | |
67 class GenericRendererElementInfo { | |
68 public: | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
69 virtual void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {}; |
23 | 70 virtual ~GenericRendererElementInfo() {}; |
71 }; | |
72 | |
73 class GenericRendererLineInfo : public GenericRendererElementInfo { | |
74 public: | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
75 void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool); |
23 | 76 GenericRendererLineInfo(GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b); |
77 virtual ~GenericRendererLineInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
78 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
79 GenericRendererNode m_edge1; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
80 GenericRendererNode m_edge2; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
81 uint8_t m_red; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
82 uint8_t m_green; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
83 uint8_t m_blue; |
23 | 84 }; |
85 class GenericRendererPointInfo : public GenericRendererElementInfo { | |
86 public: | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
87 void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool); |
23 | 88 GenericRendererPointInfo(GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b); |
89 virtual ~GenericRendererPointInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
90 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
91 GenericRendererNode m_anchor; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
92 uint8_t m_red; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
93 uint8_t m_green; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
94 uint8_t m_blue; |
23 | 95 }; |
96 class GenericRendererQuadInfo : public GenericRendererElementInfo { | |
97 public: | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
98 void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool); |
23 | 99 GenericRendererQuadInfo(GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b); |
100 virtual ~GenericRendererQuadInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
101 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
102 GenericRendererNode m_edge1; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
103 GenericRendererNode m_edge2; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
104 GenericRendererNode m_edge3; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
105 GenericRendererNode m_edge4; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
106 uint8_t m_red; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
107 uint8_t m_green; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
108 uint8_t m_blue; |
23 | 109 }; |
110 class GenericRendererImageInfo : public GenericRendererElementInfo { | |
111 public: | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
112 void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool); |
23 | 113 GenericRendererImageInfo(GenericRendererNode n, int image); |
114 virtual ~GenericRendererImageInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
115 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
116 GenericRendererNode m_anchor; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
117 int m_image; |
23 | 118 }; |
119 class GenericRendererAnimationInfo : public GenericRendererElementInfo { | |
120 public: | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
121 void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool); |
23 | 122 GenericRendererAnimationInfo(GenericRendererNode n, int animation); |
123 virtual ~GenericRendererAnimationInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
124 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
125 GenericRendererNode m_anchor; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
126 int m_animation; |
23 | 127 }; |
128 class GenericRendererTextInfo : public GenericRendererElementInfo { | |
129 public: | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
130 void render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool); |
23 | 131 GenericRendererTextInfo(GenericRendererNode n, AbstractFont* font, std::string text); |
132 virtual ~GenericRendererTextInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
133 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
134 GenericRendererNode m_anchor; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
135 AbstractFont* m_font; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
136 std::string m_text; |
23 | 137 }; |
138 class GenericRenderer: public RendererBase { | |
139 public: | |
27
788cb9525b2f
add image and text renderer to generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
26
diff
changeset
|
140 GenericRenderer(RenderBackend* renderbackend, int position, ImagePool* imagepool, AnimationPool* animpool); |
23 | 141 ~GeometricRenderer(); |
142 std::string getName(); | |
143 static GenericRenderer* getInstance(IRendererContainer* cnt); | |
105
2241b0d5379e
use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
144 void addLine(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b); |
2241b0d5379e
use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
145 void addPoint(const std::string &group, GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b); |
2241b0d5379e
use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
146 void addQuad(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b); |
2241b0d5379e
use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
147 void addText(const std::string &group, GenericRendererNode n, AbstractFont* font, const std::string &text); |
2241b0d5379e
use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
148 void addImage(const std::string &group, GenericRendererNode n, int image); |
2241b0d5379e
use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
149 void addAnimation(const std::string &group, GenericRendererNode n, int animation); |
2241b0d5379e
use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
150 void removeAll(const std::string &group); |
23 | 151 }; |
152 } |