comparison engine/core/view/renderers/genericrenderer.cpp @ 24:cb87d40e9342

fix exceptions and cleanup code
author spq@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 11 Jul 2008 11:00:10 +0000
parents e5e2fec68834
children fc6713d72b80
comparison
equal deleted inserted replaced
23:e5e2fec68834 24:cb87d40e9342
87 void GenericRendererNode::setRelative(const Point &relative_point) { 87 void GenericRendererNode::setRelative(const Point &relative_point) {
88 } 88 }
89 89
90 Instance* GenericRendererNode::getAttachedInstance() { 90 Instance* GenericRendererNode::getAttachedInstance() {
91 if(m_instance == NULL) { 91 if(m_instance == NULL) {
92 throw "asd"; 92 throw NotSupported("No instance attached.");
93 } 93 }
94 return m_instance; 94 return m_instance;
95 } 95 }
96 Location* GenericRendererNode::getAttachedLocation() { 96 Location* GenericRendererNode::getAttachedLocation() {
97 if(m_instance != NULL or m_location == NULL) { 97 if(m_instance != NULL or m_location == NULL) {
98 throw "asd"; 98 throw NotSupported("No location attached.");
99 } 99 }
100 return m_location; 100 return m_location;
101 } 101 }
102 Point GenericRendererNode::getAttachedPoint() { 102 Point GenericRendererNode::getAttachedPoint() {
103 if(m_instance != NULL or m_location != NULL) { 103 if(m_instance != NULL or m_location != NULL) {
104 throw "asd"; 104 throw NotSupported("No point attached.");
105 } 105 }
106 return m_point; 106 return m_point;
107 } 107 }
108 108
109 Location* GenericRendererNode::getOffsetLocation() { 109 Location* GenericRendererNode::getOffsetLocation() {
110 if(m_instance == NULL) { 110 if(m_instance == NULL or m_location == NULL) {
111 throw "asd"; 111 throw NotSupported("No location as offset used.");
112 } 112 }
113 return m_location; 113 return m_location;
114 } 114 }
115 Point GenericRendererNode::getOffsetPoint() { 115 Point GenericRendererNode::getOffsetPoint() {
116 if(m_instance == NULL and m_location == NULL) { 116 if(m_instance == NULL and m_location == NULL) {
117 throw "asd"; 117 throw NotSupported("No point as offset used.");
118 } 118 }
119 return m_point; 119 return m_point;
120 } 120 }
121 121
122 Instance* GenericRendererNode::getInstance() { 122 Instance* GenericRendererNode::getInstance() {
263 void GenericRenderer::addAnimation(GenericRendererNode n, int animation) { 263 void GenericRenderer::addAnimation(GenericRendererNode n, int animation) {
264 GenericRendererElementInfo* info = new GenericRendererAnimationInfo(n, animation); 264 GenericRendererElementInfo* info = new GenericRendererAnimationInfo(n, animation);
265 m_infos.push_back(info); 265 m_infos.push_back(info);
266 } 266 }
267 void GenericRenderer::removeAll() { 267 void GenericRenderer::removeAll() {
268 std::vector<GenericRendererElementInfo*>::const_iterator info_it = m_infos.begin();
269 for (;info_it != m_infos.end(); ++info_it) {
270 delete *info_it;
271 }
268 m_infos.clear(); 272 m_infos.clear();
269 } 273 }
270 274
271 void GenericRenderer::render(Camera* cam, Layer* layer, std::vector<Instance*>& instances) { 275 void GenericRenderer::render(Camera* cam, Layer* layer, std::vector<Instance*>& instances) {
272 std::vector<GenericRendererElementInfo*>::const_iterator info_it = m_infos.begin(); 276 std::vector<GenericRendererElementInfo*>::const_iterator info_it = m_infos.begin();