Mercurial > fife-parpg
annotate engine/core/view/renderers/genericrenderer.i @ 487:7f1c42b66aa4
Moved the shooter demo Timer() class to helpers.py.
Changed the formula that calculates the length of the audio clip to be correct.
The shooter demo now demonstrates the use of the audio clip callbacks correctly.
Fixed the fife_timer extension to actually work.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 03 May 2010 19:58:16 +0000 |
parents | 16c2b3ee59ce |
children | 47b49b9b0c0a |
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: | |
445
f855809822cf
* Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
430
diff
changeset
|
32 GenericRendererNode(Instance* attached_instance, Location* relative_location, Layer* relative_layer, const Point &relative_point = Point(0,0)); |
23 | 33 GenericRendererNode(Instance* attached_instance, Location* relative_location, const Point &relative_point = Point(0,0)); |
445
f855809822cf
* Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
430
diff
changeset
|
34 GenericRendererNode(Instance* attached_instance, Layer* relative_layer, const Point &relative_point = Point(0,0)); |
23 | 35 GenericRendererNode(Instance* attached_instance, const Point &relative_point = Point(0,0)); |
445
f855809822cf
* Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
430
diff
changeset
|
36 GenericRendererNode(Location* attached_location, Layer* relative_layer, const Point &relative_point = Point(0,0)); |
23 | 37 GenericRendererNode(Location* attached_location, const Point &relative_point = Point(0,0)); |
445
f855809822cf
* Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
430
diff
changeset
|
38 GenericRendererNode(Layer* attached_layer, const Point &relative_point = Point(0,0)); |
23 | 39 GenericRendererNode(const Point &attached_point); |
40 ~GenericRendererNode(); | |
41 | |
26
70f41ea8e7db
fix compile errors in node setters...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
23
diff
changeset
|
42 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
|
43 void setAttached(Instance* attached_instance, Location* relative_location); |
23 | 44 void setAttached(Instance* attached_instance, const Point &relative_point); |
45 void setAttached(Instance* attached_instance); | |
26
70f41ea8e7db
fix compile errors in node setters...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
23
diff
changeset
|
46 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
|
47 void setAttached(Location* attached_location); |
445
f855809822cf
* Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
430
diff
changeset
|
48 void setAttached(Layer* attached_layer); |
23 | 49 void setAttached(const Point &attached_point); |
50 | |
26
70f41ea8e7db
fix compile errors in node setters...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
23
diff
changeset
|
51 void setRelative(Location* relative_location); |
70f41ea8e7db
fix compile errors in node setters...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
23
diff
changeset
|
52 void setRelative(Location* relative_location, Point relative_point); |
23 | 53 void setRelative(const Point &relative_point); |
54 | |
55 Instance* getAttachedInstance(); | |
56 Location* getAttachedLocation(); | |
445
f855809822cf
* Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
430
diff
changeset
|
57 Layer* getAttachedLayer(); |
23 | 58 Point getAttachedPoint(); |
59 | |
60 Location* getOffsetLocation(); | |
61 Point getOffsetPoint(); | |
62 | |
63 Instance* getInstance(); | |
64 Location* getLocation(); | |
445
f855809822cf
* Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
430
diff
changeset
|
65 Layer* getLayer(); |
23 | 66 Point getPoint(); |
67 | |
482
16c2b3ee59ce
* Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
445
diff
changeset
|
68 Point getCalculatedPoint(Camera* cam, Layer* layer); |
23 | 69 private: |
70 Instance* m_instance; | |
71 Location* m_location; | |
445
f855809822cf
* Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
430
diff
changeset
|
72 Layer* m_layer; |
23 | 73 Point m_point; |
74 }; | |
75 class GenericRendererElementInfo { | |
76 public: | |
77 virtual ~GenericRendererElementInfo() {}; | |
78 }; | |
79 | |
80 class GenericRendererLineInfo : public GenericRendererElementInfo { | |
81 public: | |
82 GenericRendererLineInfo(GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b); | |
83 virtual ~GenericRendererLineInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
84 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
85 GenericRendererNode m_edge1; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
86 GenericRendererNode m_edge2; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
87 uint8_t m_red; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
88 uint8_t m_green; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
89 uint8_t m_blue; |
23 | 90 }; |
91 class GenericRendererPointInfo : public GenericRendererElementInfo { | |
92 public: | |
93 GenericRendererPointInfo(GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b); | |
94 virtual ~GenericRendererPointInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
95 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
96 GenericRendererNode m_anchor; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
97 uint8_t m_red; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
98 uint8_t m_green; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
99 uint8_t m_blue; |
23 | 100 }; |
101 class GenericRendererQuadInfo : public GenericRendererElementInfo { | |
102 public: | |
103 GenericRendererQuadInfo(GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b); | |
104 virtual ~GenericRendererQuadInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
105 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
106 GenericRendererNode m_edge1; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
107 GenericRendererNode m_edge2; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
108 GenericRendererNode m_edge3; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
109 GenericRendererNode m_edge4; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
110 uint8_t m_red; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
111 uint8_t m_green; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
112 uint8_t m_blue; |
23 | 113 }; |
430
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
114 class GenericRendererVertexInfo : public GenericRendererElementInfo { |
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
115 public: |
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
116 GenericRendererVertexInfo(GenericRendererNode center, int size, uint8_t r, uint8_t g, uint8_t b); |
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
117 virtual ~GenericRendererVertexInfo() {}; |
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
118 private: |
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
119 GenericRendererNode m_center; |
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
120 int m_size; |
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
121 uint8_t m_red; |
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
122 uint8_t m_green; |
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
123 uint8_t m_blue; |
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
124 }; |
23 | 125 class GenericRendererImageInfo : public GenericRendererElementInfo { |
126 public: | |
127 GenericRendererImageInfo(GenericRendererNode n, int image); | |
128 virtual ~GenericRendererImageInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
129 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
130 GenericRendererNode m_anchor; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
131 int m_image; |
23 | 132 }; |
133 class GenericRendererAnimationInfo : public GenericRendererElementInfo { | |
134 public: | |
135 GenericRendererAnimationInfo(GenericRendererNode n, int animation); | |
136 virtual ~GenericRendererAnimationInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
137 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
138 GenericRendererNode m_anchor; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
139 int m_animation; |
23 | 140 }; |
141 class GenericRendererTextInfo : public GenericRendererElementInfo { | |
142 public: | |
143 GenericRendererTextInfo(GenericRendererNode n, AbstractFont* font, std::string text); | |
144 virtual ~GenericRendererTextInfo() {}; | |
29
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
145 private: |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
146 GenericRendererNode m_anchor; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
147 AbstractFont* m_font; |
0cb049f291e1
make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
27
diff
changeset
|
148 std::string m_text; |
23 | 149 }; |
150 class GenericRenderer: public RendererBase { | |
151 public: | |
27
788cb9525b2f
add image and text renderer to generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
26
diff
changeset
|
152 GenericRenderer(RenderBackend* renderbackend, int position, ImagePool* imagepool, AnimationPool* animpool); |
422
9d94f4676d17
Moved the management of cameras into the Map class. The View class no longer exists since it now serves no purpose. The engine class itself holds the renderers and these get passed to each map that is loaded and then passed to each camera on each map. This change makes it possible for multiple maps to be loaded at the same time with the same camera id without a name clash. fixes[t:342]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
105
diff
changeset
|
153 ~GenericRenderer(); |
23 | 154 std::string getName(); |
155 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
|
156 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
|
157 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
|
158 void addQuad(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b); |
430
ad1f09d954f9
Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
422
diff
changeset
|
159 void addVertex(const std::string &group, GenericRendererNode n, int size, uint8_t r, uint8_t g, uint8_t b); |
105
2241b0d5379e
use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
160 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
|
161 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
|
162 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
|
163 void removeAll(const std::string &group); |
23 | 164 }; |
165 } |