Changeset 3746 in orxonox.OLD for orxonox/branches/levelloader/src/lib
- Timestamp:
- Apr 7, 2005, 3:54:49 PM (20 years ago)
- Location:
- orxonox/branches/levelloader/src/lib
- Files:
-
- 34 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/lib/Makefile.in
r3605 r3746 1 # Makefile.in generated by automake 1.8. 5from Makefile.am.1 # Makefile.in generated by automake 1.8.2 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 183 183 esac; \ 184 184 done; \ 185 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/Makefile'; \185 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/Makefile'; \ 186 186 cd $(top_srcdir) && \ 187 $(AUTOMAKE) -- foreignsrc/lib/Makefile187 $(AUTOMAKE) --gnu src/lib/Makefile 188 188 .PRECIOUS: Makefile 189 189 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 278 278 tags=; \ 279 279 here=`pwd`; \ 280 if ( $(ETAGS)--etags-include --version) >/dev/null 2>&1; then \280 if (etags --etags-include --version) >/dev/null 2>&1; then \ 281 281 include_option=--etags-include; \ 282 empty_fix=.; \283 282 else \ 284 283 include_option=--include; \ 285 empty_fix=; \286 284 fi; \ 287 285 list='$(SUBDIRS)'; for subdir in $$list; do \ 288 286 if test "$$subdir" = .; then :; else \ 289 test ! -f $$subdir/TAGS ||\287 test -f $$subdir/TAGS && \ 290 288 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ 291 289 fi; \ … … 297 295 $(AWK) ' { files[$$0] = 1; } \ 298 296 END { for (i in files) print i; }'`; \ 299 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 300 test -n "$$unique" || unique=$$empty_fix; \ 301 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 302 $$tags $$unique; \ 303 fi 297 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 298 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 299 $$tags $$unique 304 300 ctags: CTAGS 305 301 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ -
orxonox/branches/levelloader/src/lib/coord/helper_parent.h
r3605 r3746 8 8 #define _HELPER_PARENT_H 9 9 10 #include "stdincl.h" 10 11 11 #include "p_node.h" 12 12 -
orxonox/branches/levelloader/src/lib/coord/null_parent.cc
r3605 r3746 19 19 20 20 #include "null_parent.h" 21 #include "stdincl.h" 22 #include "vector.h" 23 #include "list.h" 21 24 22 25 … … 51 54 this->parent = this; 52 55 this->mode = PNODE_ALL; 53 this->absCoordinate = *absCoordinate;56 *this->absCoordinate = *absCoordinate; 54 57 this->setName("NullParent"); 55 58 } … … 74 77 worry, normaly... 75 78 */ 76 void NullParent::update ( )79 void NullParent::update (float dt) 77 80 { 78 81 79 PRINTF(4)("NullParent::update - (%f, %f, %f)\n", this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z); 80 this->absCoordinate = this->relCoordinate; 81 this->absDirection = parent->getAbsDir () * this->relDirection; 82 83 PNode* pn = this->children->enumerate (); 82 PRINTF(4)("NullParent::update - (%f, %f, %f)\n", this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z); 83 *this->absCoordinate = *this->relCoordinate; 84 *this->absDirection = parent->getAbsDir () * *this->relDirection; 85 86 tIterator<PNode>* iterator = this->children->getIterator(); 87 //PNode* pn = this->children->enumerate (); 88 PNode* pn = iterator->nextElement(); 84 89 while( pn != NULL) 85 90 { … … 89 94 if( this->bRelDirChanged || this->bAbsDirChanged) 90 95 pn->parentDirChanged (); 91 pn->update (); 92 pn = this->children->nextElement (); 96 pn->update (dt); 97 //pn = this->children->nextElement (); 98 pn = iterator->nextElement(); 93 99 } 94 100 -
orxonox/branches/levelloader/src/lib/coord/null_parent.h
r3605 r3746 8 8 #define _NULL_PARENT_H 9 9 10 #include "stdincl.h" 10 11 11 #include "p_node.h" 12 12 … … 19 19 20 20 21 virtual void update ( );22 21 virtual void update (float dt); 22 23 23 private: 24 24 NullParent (); -
orxonox/branches/levelloader/src/lib/coord/p_node.cc
r3605 r3746 21 21 22 22 #include "p_node.h" 23 23 #include "stdincl.h" 24 25 #include "error.h" 26 #include "debug.h" 27 #include "list.h" 28 #include "vector.h" 24 29 #include "null_parent.h" 25 #include "vector.h" 30 31 32 //#include "vector.h" 33 //#include "quaternion.h" 26 34 27 35 using namespace std; … … 52 60 this->init(parent); 53 61 54 this->absCoordinate = *absCoordinate;62 *this->absCoordinate = *absCoordinate; 55 63 if (parent != NULL) 56 64 { 57 this->relCoordinate =this->absCoordinate - parent->getAbsCoor ();65 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); 58 66 parent->addChild (this); 59 67 } 60 68 else 61 this->relCoordinate = Vector(0,0,0);69 this->relCoordinate = new Vector(0,0,0); 62 70 } 63 71 … … 94 102 } 95 103 104 96 105 void PNode::init(PNode* parent) 97 106 { … … 103 112 this->parent = parent; 104 113 this->objectName = NULL; 114 115 this->absCoordinate = new Vector(); 116 this->relCoordinate = new Vector(); 117 this->absDirection = new Quaternion(); 118 this->relDirection = new Quaternion(); 119 this->lastAbsCoordinate = new Vector(); 105 120 } 106 121 … … 129 144 \brief get relative coordinates 130 145 \returns relative coordinates to its parent 131 */ 132 Vector PNode::getRelCoor () 133 { 134 Vector r = this->relCoordinate; /* return a copy, so it can't be modified */ 135 return r; 146 147 the reference that is returned is a pointer to the real relCoor, so don't 148 change it unless you realy know what you are doing. 149 */ 150 Vector* PNode::getRelCoor () 151 { 152 //Vector r = *this->relCoordinate; /* return a copy, so it can't be modified */ 153 return this->relCoordinate; 136 154 } 137 155 … … 148 166 { 149 167 this->bRelCoorChanged = true; 150 this->relCoordinate = *relCoord; 168 *this->relCoordinate = *relCoord; 169 } 170 171 172 /** 173 \brief set relative coordinates 174 \param relCoord relative coordinates to its parent 175 176 it is very importand, that you use this function, if you want to update the 177 relCoordinates. If you don't use this, the PNode won't recognize, that something 178 has changed and won't update the children Nodes. 179 */ 180 void PNode::setRelCoor (Vector relCoord) 181 { 182 this->bRelCoorChanged = true; 183 *this->relCoordinate = relCoord; 151 184 } 152 185 … … 158 191 Vector PNode::getAbsCoor () 159 192 { 160 return this->absCoordinate;193 return *this->absCoordinate; 161 194 } 162 195 … … 172 205 { 173 206 this->bAbsCoorChanged = true; 174 this->absCoordinate = *absCoord; 207 *this->absCoordinate = *absCoord; 208 } 209 210 211 212 /** 213 \param absCoord set absolute coordinate 214 215 it is very importand, that you use this function, if you want to update the 216 absCoordinates. If you don't use this, the PNode won't recognize, that something 217 has changed and won't update the children Nodes. 218 */ 219 void PNode::setAbsCoor (Vector absCoord) 220 { 221 this->bAbsCoorChanged = true; 222 *this->absCoordinate = absCoord; 175 223 } 176 224 … … 200 248 if( this->bAbsCoorChanged) 201 249 { 202 this->absCoordinate =this->absCoordinate + *shift;250 *this->absCoordinate = *this->absCoordinate + *shift; 203 251 } 204 252 else 205 253 { 206 this->relCoordinate = this->relCoordinate + *shift; 254 *this->relCoordinate = *this->relCoordinate + *shift; 255 this->bRelCoorChanged = true; 256 } 257 } 258 259 260 261 /** 262 \brief shift coordinate (abs and rel) 263 \param shift vector 264 265 this function shifts the current coordinates about the vector shift. this is 266 usefull because from some place else you can: 267 PNode* someNode = ...; 268 Vector objectMovement = calculateShift(); 269 someNode->shiftCoor(objectMovement); 270 271 elsewhere you would have to: 272 PNode* someNode = ...; 273 Vector objectMovement = calculateShift(); 274 Vector currentCoor = someNode->getRelCoor(); 275 Vector newCoor = currentCoor + objectMovement; 276 someNode->setRelCoor(newCoor); 277 278 yea right... shorter... 279 280 */ 281 void PNode::shiftCoor (Vector shift) 282 { 283 if( this->bAbsCoorChanged) 284 { 285 *this->absCoordinate = *this->absCoordinate + shift; 286 } 287 else 288 { 289 *this->relCoordinate = *this->relCoordinate + shift; 207 290 this->bRelCoorChanged = true; 208 291 } … … 217 300 Quaternion PNode::getRelDir () 218 301 { 219 return this->relDirection;302 return *this->relDirection; 220 303 } 221 304 … … 232 315 { 233 316 this->bRelCoorChanged = true; 234 this->relDirection = *relDir; 317 *this->relDirection = *relDir; 318 } 319 320 321 void PNode::setRelDir (Quaternion relDir) 322 { 323 this->bRelCoorChanged = true; 324 *this->relDirection = relDir; 235 325 } 236 326 … … 242 332 Quaternion PNode::getAbsDir () 243 333 { 244 return this->absDirection;334 return *this->absDirection; 245 335 } 246 336 … … 257 347 { 258 348 this->bAbsDirChanged = true; 259 this->absDirection = *absDir; 260 } 349 *this->absDirection = *absDir; 350 } 351 352 353 354 /** 355 \brief sets the absolute direction (0,0,1) 356 \param absDir absolute coordinates 357 358 it is very importand, that you use this function, if you want to update the 359 absDirection. If you don't use this, the PNode won't recognize, that something 360 has changed and won't update the children Nodes. 361 */ 362 void PNode::setAbsDir (Quaternion absDir) 363 { 364 this->bAbsDirChanged = true; 365 *this->absDirection = absDir; 366 } 367 261 368 262 369 … … 285 392 {} 286 393 394 395 /** 396 \brief shift coordinate (abs and rel) 397 \param shift vector 398 399 this function shifts the current coordinates about the vector shift. this is 400 usefull because from some place else you can: 401 PNode* someNode = ...; 402 Quaternion objectMovement = calculateShift(); 403 someNode->shiftCoor(objectMovement); 404 405 elsewhere you would have to: 406 PNode* someNode = ...; 407 Quaternion objectMovement = calculateShift(); 408 Quaternion currentCoor = someNode->getRelCoor(); 409 Quaternion newCoor = currentCoor + objectMovement; 410 someNode->setRelCoor(newCoor); 411 412 yea right... shorter... 413 414 \todo implement this 415 */ 416 void PNode::shiftDir (Quaternion shift) 417 {} 418 419 420 /** 421 \brief this calculates the current movement speed of the node 422 */ 423 float PNode::getSpeed() 424 { 425 if(this->time == 0) 426 return 1000; 427 Vector diff; 428 diff = *this->absCoordinate - *this->lastAbsCoordinate; 429 float x = diff.len(); 430 return x / this->time; 431 } 432 433 287 434 /** 288 435 \brief adds a child and makes this node to a parent … … 308 455 if( pNode->parent != NULL ) 309 456 { 310 PRINTF( 2)("PNode::addChild() - reparenting node: removing it and adding it again\n");457 PRINTF(3)("PNode::addChild() - reparenting node: removing it and adding it again\n"); 311 458 pNode->parent->children->remove(pNode); 312 459 } … … 338 485 void PNode::remove() 339 486 { 340 NullParent* np = NullParent::getInstance(); 341 PNode* pn = this->children->enumerate(); 487 NullParent* nullParent = NullParent::getInstance(); 488 489 tIterator<PNode>* iterator = this->children->getIterator(); 490 PNode* pn = iterator->nextElement(); 491 342 492 while( pn != NULL) 343 493 { 344 this->children->remove(pn); 345 np->addChild(pn, pn->getMode()); 346 pn = this->children->nextElement(); 347 } 494 //this->children->remove(pn); 495 nullParent->addChild(pn, pn->getMode()); 496 pn = iterator->nextElement(); 497 } 498 delete iterator; 499 this->parent->children->remove(this); 348 500 } 349 501 … … 410 562 worry, normaly... 411 563 */ 412 void PNode::update () 413 { 414 PRINTF(2)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z); 415 // printf("%s", this->objectName); 564 void PNode::update (float dt) 565 { 566 *this->lastAbsCoordinate = *this->absCoordinate; 567 this->time = dt; 568 PRINTF(4)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z); 416 569 if(this->mode & PNODE_MOVEMENT ) 417 570 { … … 419 572 { 420 573 /* if you have set the absolute coordinates this overrides all other changes */ 421 this->relCoordinate =this->absCoordinate - parent->getAbsCoor ();574 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); 422 575 } 423 576 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) … … 426 579 if( this->parent == NULL) 427 580 { 428 this->absCoordinate =this->relCoordinate;581 *this->absCoordinate = *this->relCoordinate; 429 582 } 430 583 else 431 this->absCoordinate = parent->getAbsCoor() +this->relCoordinate; /* update the current absCoordinate */584 *this->absCoordinate = parent->getAbsCoor() + *this->relCoordinate; /* update the current absCoordinate */ 432 585 } 433 586 } … … 438 591 { 439 592 /* if you have set the absolute coordinates this overrides all other changes */ 440 this->relDirection =this->absDirection - parent->getAbsDir();593 *this->relDirection = *this->absDirection - parent->getAbsDir(); 441 594 } 442 595 else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 443 596 { 444 597 /* update the current absDirection - remember * means rotation around sth.*/ 445 this->absDirection = parent->getAbsDir() *this->relDirection;598 *this->absDirection = parent->getAbsDir() * *this->relDirection; 446 599 } 447 600 } … … 452 605 { 453 606 /* if you have set the absolute coordinates this overrides all other changes */ 454 this->relCoordinate =this->absCoordinate - parent->getAbsCoor ();607 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); 455 608 } 456 609 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) … … 458 611 /*this is bad style... must be deleted later - just for testing*/ 459 612 if( this->parent == NULL) 460 this->absCoordinate =this->relCoordinate;613 *this->absCoordinate = *this->relCoordinate; 461 614 else 462 this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(this->relCoordinate); /* update the current absCoordinate */615 *this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(*this->relCoordinate); /* update the current absCoordinate */ 463 616 } 464 617 } 465 618 466 619 467 PNode* pn = this->children->enumerate(); 620 tIterator<PNode>* iterator = this->children->getIterator(); 621 //PNode* pn = this->children->enumerate(); 622 PNode* pn = iterator->nextElement(); 468 623 while( pn != NULL) 469 624 { … … 473 628 if( this->bRelDirChanged || this->bAbsDirChanged) 474 629 pn->parentDirChanged (); 475 pn->update(); 476 pn = this->children->nextElement(); 477 } 630 631 pn->update(dt); 632 //pn = this->children->nextElement(); 633 pn = iterator->nextElement(); 634 } 635 delete iterator; 478 636 479 637 this->timeStamp = timeStamp; … … 507 665 { 508 666 PRINTF(2)("PNode::debug() - absCoord: (%f, %f, %f)\n", 509 this->absCoordinate .x,510 this->absCoordinate .y,511 this->absCoordinate .z);667 this->absCoordinate->x, 668 this->absCoordinate->y, 669 this->absCoordinate->z); 512 670 } 513 671 -
orxonox/branches/levelloader/src/lib/coord/p_node.h
r3605 r3746 23 23 24 24 #include "base_object.h" 25 //#include "vector.h" 25 26 26 27 // FORWARD DEFINITION \\ … … 28 29 class Quaternion; 29 30 class Vector; 31 template<class T> class tList; 30 32 31 33 //! enumeration for the different translation-binding-types … … 55 57 56 58 57 Vector getRelCoor ();59 Vector* getRelCoor (); 58 60 void setRelCoor (Vector* relCoord); 59 //void setRelCoor (Vector relCoord);61 void setRelCoor (Vector relCoord); 60 62 Vector getAbsCoor (); 61 63 void setAbsCoor (Vector* absCoord); 62 //void setAbsCoor (Vector absCoord);64 void setAbsCoor (Vector absCoord); 63 65 void shiftCoor (Vector* shift); 66 void shiftCoor (Vector shift); 64 67 //void shiftCoor (Vector shift); 65 68 66 69 Quaternion getRelDir (); 67 70 void setRelDir (Quaternion* relDir); 71 void setRelDir (Quaternion relDir); 68 72 Quaternion getAbsDir (); 69 73 void setAbsDir (Quaternion* absDir); 74 void setAbsDir (Quaternion absDir); 70 75 void shiftDir (Quaternion* shift); 76 void shiftDir (Quaternion shift); 77 78 float getSpeed(); 71 79 72 80 void addChild (PNode* pNode); … … 82 90 int getMode(); 83 91 84 virtual void update ( );92 virtual void update (float dt); 85 93 void processTick (float dt); 86 94 … … 90 98 91 99 void debug (); 92 93 private:94 void init(PNode* parent);95 100 96 101 protected: … … 102 107 bool bRelDirChanged; //!< If Relative Direction has changed since last time we checked 103 108 104 Vector relCoordinate; //!< coordinates relative to the parent105 Vector absCoordinate; //!< absolute coordinates in the world ( from (0,0,0) )106 Quaternion relDirection; //!< direction relative to the parent107 Quaternion absDirection; //!< absolute direvtion in the world ( from (0,0,1) )109 Vector* relCoordinate; //!< coordinates relative to the parent 110 Vector* absCoordinate; //!< absolute coordinates in the world ( from (0,0,0) ) 111 Quaternion* relDirection; //!< direction relative to the parent 112 Quaternion* absDirection; //!< absolute direvtion in the world ( from (0,0,1) ) 108 113 109 114 int mode; //!< the mode of the binding 110 115 116 private: 117 void init(PNode* parent); 118 119 Vector* lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 120 float time; //!< time since last update 111 121 }; 112 122 -
orxonox/branches/levelloader/src/lib/graphics/Makefile.in
r3605 r3746 1 # Makefile.in generated by automake 1.8. 5from Makefile.am.1 # Makefile.in generated by automake 1.8.2 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 177 177 esac; \ 178 178 done; \ 179 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/graphics/Makefile'; \179 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/graphics/Makefile'; \ 180 180 cd $(top_srcdir) && \ 181 $(AUTOMAKE) -- foreignsrc/lib/graphics/Makefile181 $(AUTOMAKE) --gnu src/lib/graphics/Makefile 182 182 .PRECIOUS: Makefile 183 183 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 272 272 tags=; \ 273 273 here=`pwd`; \ 274 if ( $(ETAGS)--etags-include --version) >/dev/null 2>&1; then \274 if (etags --etags-include --version) >/dev/null 2>&1; then \ 275 275 include_option=--etags-include; \ 276 empty_fix=.; \277 276 else \ 278 277 include_option=--include; \ 279 empty_fix=; \280 278 fi; \ 281 279 list='$(SUBDIRS)'; for subdir in $$list; do \ 282 280 if test "$$subdir" = .; then :; else \ 283 test ! -f $$subdir/TAGS ||\281 test -f $$subdir/TAGS && \ 284 282 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ 285 283 fi; \ … … 291 289 $(AWK) ' { files[$$0] = 1; } \ 292 290 END { for (i in files) print i; }'`; \ 293 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 294 test -n "$$unique" || unique=$$empty_fix; \ 295 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 296 $$tags $$unique; \ 297 fi 291 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 292 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 293 $$tags $$unique 298 294 ctags: CTAGS 299 295 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ -
orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.am
r3499 r3746 5 5 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib 6 6 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/data 7 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/g aphics7 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics 8 8 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer 9 9 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/lang … … 27 27 model.cc \ 28 28 objModel.cc \ 29 primitive_model.cc \ 29 30 array.cc \ 30 31 material.cc \ 31 32 texture.cc \ 32 $(MAINSRCDIR)/lib/math/vector.cc 33 $(MAINSRCDIR)/lib/graphics/graphics_engine.cc \ 34 $(MAINSRCDIR)/lib/lang/base_object.cc \ 35 $(MAINSRCDIR)/lib/math/vector.cc \ 36 $(MAINSRCDIR)/lib/util/resource_manager.cc 33 37 34 38 noinst_HEADERS= framework.h \ … … 36 40 model.h \ 37 41 objModel.h \ 42 primitive_model.h \ 38 43 array.h \ 39 44 material.h \ -
orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.in
r3605 r3746 1 # Makefile.in generated by automake 1.8. 5from Makefile.am.1 # Makefile.in generated by automake 1.8.2 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 42 42 subdir = src/lib/graphics/importer 43 43 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ 44 $(srcdir)/Makefile.in 44 $(srcdir)/Makefile.in TODO 45 45 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 46 46 am__aclocal_m4_deps = $(top_srcdir)/configure.ac … … 50 50 CONFIG_HEADER = $(top_builddir)/config.h 51 51 CONFIG_CLEAN_FILES = 52 am__installdirs = "$(DESTDIR)$(bindir)"52 am__installdirs = $(DESTDIR)$(bindir) 53 53 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 54 54 PROGRAMS = $(bin_PROGRAMS) 55 55 am_importer_OBJECTS = framework.$(OBJEXT) windowHandler.$(OBJEXT) \ 56 model.$(OBJEXT) objModel.$(OBJEXT) array.$(OBJEXT) \ 57 material.$(OBJEXT) texture.$(OBJEXT) vector.$(OBJEXT) 56 model.$(OBJEXT) objModel.$(OBJEXT) primitive_model.$(OBJEXT) \ 57 array.$(OBJEXT) material.$(OBJEXT) texture.$(OBJEXT) \ 58 graphics_engine.$(OBJEXT) base_object.$(OBJEXT) \ 59 vector.$(OBJEXT) resource_manager.$(OBJEXT) 58 60 importer_OBJECTS = $(am_importer_OBJECTS) 59 61 importer_LDADD = $(LDADD) … … 61 63 depcomp = $(SHELL) $(top_srcdir)/depcomp 62 64 am__depfiles_maybe = depfiles 63 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po ./$(DEPDIR)/framework.Po \ 65 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po \ 66 @AMDEP_TRUE@ ./$(DEPDIR)/base_object.Po \ 67 @AMDEP_TRUE@ ./$(DEPDIR)/framework.Po \ 68 @AMDEP_TRUE@ ./$(DEPDIR)/graphics_engine.Po \ 64 69 @AMDEP_TRUE@ ./$(DEPDIR)/material.Po ./$(DEPDIR)/model.Po \ 65 @AMDEP_TRUE@ ./$(DEPDIR)/objModel.Po ./$(DEPDIR)/texture.Po \ 66 @AMDEP_TRUE@ ./$(DEPDIR)/vector.Po ./$(DEPDIR)/windowHandler.Po 70 @AMDEP_TRUE@ ./$(DEPDIR)/objModel.Po \ 71 @AMDEP_TRUE@ ./$(DEPDIR)/primitive_model.Po \ 72 @AMDEP_TRUE@ ./$(DEPDIR)/resource_manager.Po \ 73 @AMDEP_TRUE@ ./$(DEPDIR)/texture.Po ./$(DEPDIR)/vector.Po \ 74 @AMDEP_TRUE@ ./$(DEPDIR)/windowHandler.Po 67 75 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 68 76 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) … … 185 193 target_vendor = @target_vendor@ 186 194 MAINSRCDIR = ../../.. 187 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/g aphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai195 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai 188 196 AM_LDFLAGS = $(MWINDOWS) 189 197 importer_SOURCES = framework.cc \ … … 191 199 model.cc \ 192 200 objModel.cc \ 201 primitive_model.cc \ 193 202 array.cc \ 194 203 material.cc \ 195 204 texture.cc \ 196 $(MAINSRCDIR)/lib/math/vector.cc 205 $(MAINSRCDIR)/lib/graphics/graphics_engine.cc \ 206 $(MAINSRCDIR)/lib/lang/base_object.cc \ 207 $(MAINSRCDIR)/lib/math/vector.cc \ 208 $(MAINSRCDIR)/lib/util/resource_manager.cc 197 209 198 210 noinst_HEADERS = framework.h \ … … 200 212 model.h \ 201 213 objModel.h \ 214 primitive_model.h \ 202 215 array.h \ 203 216 material.h \ … … 217 230 esac; \ 218 231 done; \ 219 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/graphics/importer/Makefile'; \232 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/graphics/importer/Makefile'; \ 220 233 cd $(top_srcdir) && \ 221 $(AUTOMAKE) -- foreignsrc/lib/graphics/importer/Makefile234 $(AUTOMAKE) --gnu src/lib/graphics/importer/Makefile 222 235 .PRECIOUS: Makefile 223 236 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 239 252 install-binPROGRAMS: $(bin_PROGRAMS) 240 253 @$(NORMAL_INSTALL) 241 test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"254 $(mkdir_p) $(DESTDIR)$(bindir) 242 255 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 243 256 p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ … … 245 258 ; then \ 246 259 f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ 247 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \248 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f"|| exit 1; \260 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ 261 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ 249 262 else :; fi; \ 250 263 done … … 254 267 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 255 268 f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 256 echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \257 rm -f "$(DESTDIR)$(bindir)/$$f"; \269 echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ 270 rm -f $(DESTDIR)$(bindir)/$$f; \ 258 271 done 259 272 … … 271 284 272 285 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ 286 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_object.Po@am__quote@ 273 287 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framework.Po@am__quote@ 288 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics_engine.Po@am__quote@ 274 289 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@ 275 290 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Po@am__quote@ 276 291 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objModel.Po@am__quote@ 292 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive_model.Po@am__quote@ 293 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_manager.Po@am__quote@ 277 294 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@ 278 295 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@ … … 295 312 @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 296 313 314 graphics_engine.o: $(MAINSRCDIR)/lib/graphics/graphics_engine.cc 315 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.o -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.o `test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/graphics/graphics_engine.cc; \ 316 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi 317 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' object='graphics_engine.o' libtool=no @AMDEPBACKSLASH@ 318 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@ 319 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 320 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.o `test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/graphics/graphics_engine.cc 321 322 graphics_engine.obj: $(MAINSRCDIR)/lib/graphics/graphics_engine.cc 323 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT graphics_engine.obj -MD -MP -MF "$(DEPDIR)/graphics_engine.Tpo" -c -o graphics_engine.obj `if test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; fi`; \ 324 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/graphics_engine.Tpo" "$(DEPDIR)/graphics_engine.Po"; else rm -f "$(DEPDIR)/graphics_engine.Tpo"; exit 1; fi 325 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/graphics/graphics_engine.cc' object='graphics_engine.obj' libtool=no @AMDEPBACKSLASH@ 326 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/graphics_engine.Po' tmpdepfile='$(DEPDIR)/graphics_engine.TPo' @AMDEPBACKSLASH@ 327 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 328 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o graphics_engine.obj `if test -f '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/graphics/graphics_engine.cc'; fi` 329 330 base_object.o: $(MAINSRCDIR)/lib/lang/base_object.cc 331 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT base_object.o -MD -MP -MF "$(DEPDIR)/base_object.Tpo" -c -o base_object.o `test -f '$(MAINSRCDIR)/lib/lang/base_object.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/lang/base_object.cc; \ 332 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/base_object.Tpo" "$(DEPDIR)/base_object.Po"; else rm -f "$(DEPDIR)/base_object.Tpo"; exit 1; fi 333 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/lang/base_object.cc' object='base_object.o' libtool=no @AMDEPBACKSLASH@ 334 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/base_object.Po' tmpdepfile='$(DEPDIR)/base_object.TPo' @AMDEPBACKSLASH@ 335 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 336 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o base_object.o `test -f '$(MAINSRCDIR)/lib/lang/base_object.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/lang/base_object.cc 337 338 base_object.obj: $(MAINSRCDIR)/lib/lang/base_object.cc 339 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT base_object.obj -MD -MP -MF "$(DEPDIR)/base_object.Tpo" -c -o base_object.obj `if test -f '$(MAINSRCDIR)/lib/lang/base_object.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/lang/base_object.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/lang/base_object.cc'; fi`; \ 340 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/base_object.Tpo" "$(DEPDIR)/base_object.Po"; else rm -f "$(DEPDIR)/base_object.Tpo"; exit 1; fi 341 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/lang/base_object.cc' object='base_object.obj' libtool=no @AMDEPBACKSLASH@ 342 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/base_object.Po' tmpdepfile='$(DEPDIR)/base_object.TPo' @AMDEPBACKSLASH@ 343 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 344 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o base_object.obj `if test -f '$(MAINSRCDIR)/lib/lang/base_object.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/lang/base_object.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/lang/base_object.cc'; fi` 345 297 346 vector.o: $(MAINSRCDIR)/lib/math/vector.cc 298 347 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vector.o -MD -MP -MF "$(DEPDIR)/vector.Tpo" -c -o vector.o `test -f '$(MAINSRCDIR)/lib/math/vector.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/math/vector.cc; \ … … 310 359 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 311 360 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vector.obj `if test -f '$(MAINSRCDIR)/lib/math/vector.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/math/vector.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/math/vector.cc'; fi` 361 362 resource_manager.o: $(MAINSRCDIR)/lib/util/resource_manager.cc 363 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.o -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.o `test -f '$(MAINSRCDIR)/lib/util/resource_manager.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/resource_manager.cc; \ 364 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi 365 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/util/resource_manager.cc' object='resource_manager.o' libtool=no @AMDEPBACKSLASH@ 366 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@ 367 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 368 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.o `test -f '$(MAINSRCDIR)/lib/util/resource_manager.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/resource_manager.cc 369 370 resource_manager.obj: $(MAINSRCDIR)/lib/util/resource_manager.cc 371 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.obj -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.obj `if test -f '$(MAINSRCDIR)/lib/util/resource_manager.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/resource_manager.cc'; fi`; \ 372 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi 373 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$(MAINSRCDIR)/lib/util/resource_manager.cc' object='resource_manager.obj' libtool=no @AMDEPBACKSLASH@ 374 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@ 375 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 376 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f '$(MAINSRCDIR)/lib/util/resource_manager.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/resource_manager.cc'; fi` 312 377 uninstall-info-am: 313 378 … … 332 397 $(AWK) ' { files[$$0] = 1; } \ 333 398 END { for (i in files) print i; }'`; \ 334 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 335 test -n "$$unique" || unique=$$empty_fix; \ 336 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 337 $$tags $$unique; \ 338 fi 399 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 400 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 401 $$tags $$unique 339 402 ctags: CTAGS 340 403 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ … … 391 454 all-am: Makefile $(PROGRAMS) $(HEADERS) 392 455 installdirs: 393 for dir in "$(DESTDIR)$(bindir)"; do \ 394 test -z "$$dir" || $(mkdir_p) "$$dir"; \ 395 done 456 $(mkdir_p) $(DESTDIR)$(bindir) 396 457 install: install-am 397 458 install-exec: install-exec-am -
orxonox/branches/levelloader/src/lib/graphics/importer/framework.cc
r3499 r3746 17 17 18 18 #include "vector.h" 19 20 #include "primitive_model.h" 21 19 22 20 23 int verbose; … … 76 79 obj = new OBJModel(argv[1]); 77 80 else 78 { 79 // This is an example, of how it is possible, to create a new Model, and adding some vertex-information. 80 // This also packs everything into a DisplayList, and can be handled exactly as any other model. 81 // This is an example of a cube with Texture-Coordinates, but without explicite Vertex-Normals. (they are soft-created). 82 /* 83 obj = (OBJModel*) new Model(); 84 obj->setName("CUBE"); 85 obj->addVertex (-0.5, -0.5, 0.5); 86 obj->addVertex (0.5, -0.5, 0.5); 87 obj->addVertex (-0.5, 0.5, 0.5); 88 obj->addVertex (0.5, 0.5, 0.5); 89 obj->addVertex (-0.5, 0.5, -0.5); 90 obj->addVertex (0.5, 0.5, -0.5); 91 obj->addVertex (-0.5, -0.5, -0.5); 92 obj->addVertex (0.5, -0.5, -0.5); 93 94 obj->addVertexTexture (0.0, 0.0); 95 obj->addVertexTexture (1.0, 0.0); 96 obj->addVertexTexture (0.0, 1.0); 97 obj->addVertexTexture (1.0, 1.0); 98 obj->addVertexTexture (0.0, 2.0); 99 obj->addVertexTexture (1.0, 2.0); 100 obj->addVertexTexture (0.0, 3.0); 101 obj->addVertexTexture (1.0, 3.0); 102 obj->addVertexTexture (0.0, 4.0); 103 obj->addVertexTexture (1.0, 4.0); 104 obj->addVertexTexture (2.0, 0.0); 105 obj->addVertexTexture (2.0, 1.0); 106 obj->addVertexTexture (-1.0, 0.0); 107 obj->addVertexTexture (-1.0, 1.0); 108 109 obj->addFace ("1 2 4 3"); 110 obj->addFace ("3 4 6 5"); 111 obj->addFace ("5 6 8 7"); 112 obj->addFace ("7 8 2 1"); 113 obj->addFace ("2 8 6 4"); 114 obj->addFace ("7 1 3 5"); 115 obj->finalize(); 116 */ 117 obj = (OBJModel*) new Model(CYLINDER); 118 } 81 obj = new PrimitiveModel(SPHERE); 82 119 83 M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0); 120 84 rotAxis = Vector (0.0,1.0,0.0); … … 166 130 switch (event.type) { 167 131 case SDL_MOUSEMOTION: 168 PRINTF( 3)("Mouse motion about %d,%d Pixels to (%d,%d).\n",132 PRINTF(4)("Mouse motion about %d,%d Pixels to (%d,%d).\n", 169 133 event.motion.xrel, event.motion.yrel, 170 134 event.motion.x, event.motion.y); … … 205 169 if (event.button.button == 4) 206 170 { 207 PRINTF( 0)("MouseWheel up\n");171 PRINTF(4)("MouseWheel up\n"); 208 172 zoomTo *= .5; 209 173 } 210 174 else if (event.button.button == 5) 211 175 { 212 PRINTF( 2)("MouseWheel down\n");176 PRINTF(4)("MouseWheel down\n"); 213 177 zoomTo *= 2.0; 214 178 } … … 240 204 else 241 205 { 242 PRINTF( 2)("MouseButton %d released at (%d,%d).\n",206 PRINTF(4)("MouseButton %d released at (%d,%d).\n", 243 207 event.button.button, event.button.x, event.button.y); 244 208 } -
orxonox/branches/levelloader/src/lib/graphics/importer/framework.h
r3499 r3746 4 4 #include "windowHandler.h" // Include the Whandler Basecode 5 5 #include "objModel.h" 6 #include "vector.h" 6 7 7 8 class Vector; … … 34 35 35 36 WindowHandler wHandler; // Create an instance of the whandler basecode class 36 OBJModel* obj;37 Model* obj; 37 38 38 39 -
orxonox/branches/levelloader/src/lib/graphics/importer/material.cc
r3605 r3746 21 21 #include "texture.h" 22 22 #include "debug.h" 23 #include "resource_manager.h" 23 24 #include <stdlib.h> 24 25 #include <string.h> 26 27 //! \todo check if we are in RESOURCE MANAGER-mode 28 #include "resource_manager.h" 25 29 26 30 using namespace std; … … 58 62 delete []this->name; 59 63 if (this->diffuseTexture) 60 this->diffuseTexture;64 ResourceManager::getInstance()->unload(this->diffuseTexture); 61 65 if (this->nextMat) 62 66 delete this->nextMat; … … 89 93 this->nextMat = NULL; 90 94 this->name =""; 91 this->setIllum( 1);95 this->setIllum(3); 92 96 this->setDiffuse(0,0,0); 93 97 this->setAmbient(0,0,0); … … 104 108 this->ambientTextureSet = false; 105 109 this->specularTextureSet = false; 106 107 108 110 } 109 111 … … 167 169 } 168 170 169 170 171 /** 171 172 \brief Set the Name of the Material. (Important for searching) … … 321 322 void Material::addTexturePath(char* pathName) 322 323 { 323 PathList::getInstance()->addPath(pathName);324 ResourceManager::getInstance()->addImageDir(pathName); 324 325 } 325 326 … … 333 334 { 334 335 PRINTF(4)("setting Diffuse Map %s\n", dMap); 335 diffuseTexture = new Texture(); 336 this->diffuseTextureSet = diffuseTexture->loadImage(dMap); 337 336 // diffuseTexture = new Texture(); 337 // this->diffuseTextureSet = diffuseTexture->loadImage(dMap); 338 339 //! \todo check if RESOURCE MANAGER is availiable 340 //! \todo Textures from .mtl-file need special care. 341 this->diffuseTextureSet = this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE); 338 342 } 339 343 -
orxonox/branches/levelloader/src/lib/graphics/importer/model.cc
r3605 r3746 34 34 { 35 35 this->initialize(); 36 }37 38 /**39 \brief Creates a 3D-Model of Primitive-Type type40 41 if you want to just display a Cube/Sphere/Cylinder/... without any material.42 43 \todo implement Cube/Sphere/Cylinder/...44 */45 Model::Model(PRIMITIVE type)46 {47 this->initialize();48 49 switch (type)50 {51 default:52 case CUBE:53 this->cubeModel();54 break;55 case SPHERE:56 this->sphereModel();57 break;58 case CYLINDER:59 this->cylinderModel();60 break;61 62 }63 this->importToGL ();64 65 this->cleanup();66 36 } 67 37 … … 492 462 493 463 tmpElem->vertexNumber = va_arg (itemlist, int) -1; 494 if (type >= 2)464 if (type & TEXCOORD) 495 465 tmpElem->texCoordNumber = va_arg (itemlist, int) -1; 496 if (type == 1 || type ==3)466 if (type & NORMAL) 497 467 tmpElem->normalNumber = va_arg(itemlist, int) -1; 498 468 this->currentGroup->currentFace->vertexCount++; … … 797 767 void Model::cubeModel(void) 798 768 { 799 this->addVertex ( "-0.5 -0.5 0.5");800 this->addVertex ( "0.5 -0.5 0.5");801 this->addVertex ( "-0.5 0.5 0.5");802 this->addVertex ( "0.5 0.5 0.5");803 this->addVertex ( "-0.5 0.5 -0.5");804 this->addVertex ( "0.5 0.5 -0.5");805 this->addVertex ( "-0.5 -0.5 -0.5");806 this->addVertex ( "0.5 -0.5 -0.5");807 808 this->addVertexTexture ( "0.0 0.0");809 this->addVertexTexture ( "1.0 0.0");810 this->addVertexTexture ( "0.0 1.0");811 this->addVertexTexture ( "1.0 1.0");812 this->addVertexTexture ( "0.0 2.0");813 this->addVertexTexture ( "1.0 2.0");814 this->addVertexTexture ( "0.0 3.0");815 this->addVertexTexture ( "1.0 3.0");816 this->addVertexTexture ( "0.0 4.0");817 this->addVertexTexture ( "1.0 4.0");818 this->addVertexTexture ( "2.0 0.0");819 this->addVertexTexture ( "2.0 1.0");820 this->addVertexTexture ( "-1.0 0.0");821 this->addVertexTexture ( "-1.0 1.0");822 823 this->addVertexNormal ( "0.0 0.0 1.0");824 this->addVertexNormal ( "0.0 0.0 1.0");825 this->addVertexNormal ( "0.0 0.0 1.0");826 this->addVertexNormal ( "0.0 0.0 1.0");827 this->addVertexNormal ( "0.0 1.0 0.0");828 this->addVertexNormal ( "0.0 1.0 0.0");829 this->addVertexNormal ( "0.0 1.0 0.0");830 this->addVertexNormal ( "0.0 1.0 0.0");831 this->addVertexNormal ( "0.0 0.0 -1.0");832 this->addVertexNormal ( "0.0 0.0 -1.0");833 this->addVertexNormal ( "0.0 0.0 -1.0");834 this->addVertexNormal ( "0.0 0.0 -1.0");835 this->addVertexNormal ( "0.0 -1.0 0.0");836 this->addVertexNormal ( "0.0 -1.0 0.0");837 this->addVertexNormal ( "0.0 -1.0 0.0");838 this->addVertexNormal ( "0.0 -1.0 0.0");839 this->addVertexNormal ( "1.0 0.0 0.0");840 this->addVertexNormal ( "1.0 0.0 0.0");841 this->addVertexNormal ( "1.0 0.0 0.0");842 this->addVertexNormal ( "1.0 0.0 0.0");843 this->addVertexNormal ( "-1.0 0.0 0.0");844 this->addVertexNormal ( "-1.0 0.0 0.0");845 this->addVertexNormal ( "-1.0 0.0 0.0");846 this->addVertexNormal ( "-1.0 0.0 0.0");769 this->addVertex (-0.5, -0.5, 0.5); 770 this->addVertex (0.5, -0.5, 0.5); 771 this->addVertex (-0.5, 0.5, 0.5); 772 this->addVertex (0.5, 0.5, 0.5); 773 this->addVertex (-0.5, 0.5, -0.5); 774 this->addVertex (0.5, 0.5, -0.5); 775 this->addVertex (-0.5, -0.5, -0.5); 776 this->addVertex (0.5, -0.5, -0.5); 777 778 this->addVertexTexture (0.0, 0.0); 779 this->addVertexTexture (1.0, 0.0); 780 this->addVertexTexture (0.0, 1.0); 781 this->addVertexTexture (1.0, 1.0); 782 this->addVertexTexture (0.0, 2.0); 783 this->addVertexTexture (1.0, 2.0); 784 this->addVertexTexture (0.0, 3.0); 785 this->addVertexTexture (1.0, 3.0); 786 this->addVertexTexture (0.0, 4.0); 787 this->addVertexTexture (1.0, 4.0); 788 this->addVertexTexture (2.0, 0.0); 789 this->addVertexTexture (2.0, 1.0); 790 this->addVertexTexture (-1.0, 0.0); 791 this->addVertexTexture (-1.0, 1.0); 792 793 this->addVertexNormal (0.0, 0.0, 1.0); 794 this->addVertexNormal (0.0, 0.0, 1.0); 795 this->addVertexNormal (0.0, 0.0, 1.0); 796 this->addVertexNormal (0.0, 0.0, 1.0); 797 this->addVertexNormal (0.0, 1.0, 0.0); 798 this->addVertexNormal (0.0, 1.0, 0.0); 799 this->addVertexNormal (0.0, 1.0, 0.0); 800 this->addVertexNormal (0.0, 1.0, 0.0); 801 this->addVertexNormal (0.0, 0.0, -1.0); 802 this->addVertexNormal (0.0, 0.0, -1.0); 803 this->addVertexNormal (0.0, 0.0, -1.0); 804 this->addVertexNormal (0.0, 0.0, -1.0); 805 this->addVertexNormal (0.0, -1.0, 0.0); 806 this->addVertexNormal (0.0, -1.0, 0.0); 807 this->addVertexNormal (0.0, -1.0, 0.0); 808 this->addVertexNormal (0.0, -1.0, 0.0); 809 this->addVertexNormal (1.0, 0.0, 0.0); 810 this->addVertexNormal (1.0, 0.0, 0.0); 811 this->addVertexNormal (1.0, 0.0, 0.0); 812 this->addVertexNormal (1.0, 0.0, 0.0); 813 this->addVertexNormal (-1.0, 0.0, 0.0); 814 this->addVertexNormal (-1.0, 0.0, 0.0); 815 this->addVertexNormal (-1.0, 0.0, 0.0); 816 this->addVertexNormal (-1.0, 0.0, 0.0); 847 817 848 818 /* normaleLess-testingMode … … 855 825 */ 856 826 857 this->addFace ("1/1/1 2/2/2 4/4/3 3/3/4"); 858 this->addFace ("3/3/5 4/4/6 6/6/7 5/5/8"); 859 this->addFace ("5/5/9 6/6/10 8/8/11 7/7/12"); 860 this->addFace ("7/7/13 8/8/14 2/10/15 1/9/16"); 861 this->addFace ("2/2/17 8/11/18 6/12/19 4/4/20"); 862 this->addFace ("7/13/21 1/1/22 3/3/23 5/14/24"); 863 864 } 865 866 /** 867 \brief Builds a Sphere into the Model 868 */ 869 void Model::sphereModel() 870 { 871 int detail = 30; 872 if (detail <= 0) detail = 1; 873 float df = (float)detail; 874 for (float i = 0.0; i < df/2; i+=1.0) 875 { 876 for (float j = 0.0; j < df; j+=1.0) 877 { 878 float vz = i/df *2.0*PI - PI/2.0; 879 this->addVertex(cos(j/df*2.0*PI) * cos(vz) , 880 sin(j/df*2.0*PI) * cos(vz), 881 sin(vz)); 882 //if (j==0.0) 883 //printf ("%f %f\n", vz, sin (vz)); 884 if (i==0.0) 885 PRINTF(0)("%f, %f\n", j/df*2.0*PI, cos(j/df*PI)); 886 } 887 } 888 vertices->debug(); 889 for (int i = 0; i < detail/2; i++) 890 for (int j = 1; j < detail; j++) 891 { 892 unsigned int v1,v2,v3,v4; 893 v1 = i*detail +j; 894 895 /* if (j+1 == detail) 896 { 897 v2 = i*detail +1; 898 v3 = i*detail+detail + 1; 899 } 900 else*/ 901 { 902 v2 = i*detail +j+1; 903 v3 = i*detail+detail + j+1; 904 } 905 v4 = i*detail+detail + j; 906 //printf("%i %i %i %i\n", v1, v2, v3, v4); 907 this->addFace(4, 0, v1, v2, v3, v4); 908 } 909 } 910 911 /** 912 \brief Creates a Cylinder. 913 */ 914 void Model::cylinderModel(void) 915 { 916 unsigned int detail = 20; 917 float size = 1.0; 918 919 // check if devision by zero 920 if (detail <= 3) 921 detail = 3; 922 int count = 0; 923 // defining Points of the Cylinder. 924 for (float phi = 0.0; phi < 2.0*PI; phi += 2.0*PI/(float)detail) 925 { 926 this->addVertex(size*cos(phi), size*sin(phi), -size); 927 this->addVertex(size*cos(phi), size*sin(phi), size); 928 count ++; 929 } 930 this->addVertex(0, 0, -size); 931 this->addVertex(0, 0, size); 932 933 934 if (count != detail) 935 PRINTF(1)("calculation error, count should be %d but is %d.\n", detail, count); 936 vertices->debug(); 937 938 // adding Faces 939 for (int i = 0; i < detail-1; i++) 940 { 941 int p1, p2, p3, p4; 942 p1 = 2*i+1; 943 p2 = 2*i+2; 944 if (i <= detail); 945 p3 = 2*i+4; 946 p4 = 2*i+3; 947 // something is wrong here 948 this->addFace(4, 0, p1, p2, p3, p4); 949 this->addFace(3, 0, p4, p1, 2*detail+1); 950 this->addFace(3, 0, p2, p3, 2*detail+2); 951 } 952 addFace(4,0, 2*detail-1, 2*detail, 2, 1); 953 this->addFace(3, 0, 1, 2*detail-1, 2*detail+1); 954 this->addFace(3, 0, 2*detail, 2, 2*detail+2); 955 956 } 827 this->addFace (4, 3, 1,1,1, 2,2,2, 4,4,3, 3,3,4); 828 this->addFace (4, 3, 3,3,5, 4,4,6, 6,6,7, 5,5,8); 829 this->addFace (4, 3, 5,5,9, 6,6,10, 8,8,11, 7,7,12); 830 this->addFace (4, 3, 7,7,13, 8,8,14, 2,10,15, 1,9,16); 831 this->addFace (4, 3, 2,2,17, 8,11,18, 6,12,19, 4,4,20); 832 this->addFace (4, 3, 7,13,21, 1,1,22, 3,3,23, 5,14,24); 833 834 } -
orxonox/branches/levelloader/src/lib/graphics/importer/model.h
r3499 r3746 15 15 using namespace std; 16 16 17 //! Specification of different primitives the Model knows 18 enum PRIMITIVE {PLANE, CUBE, SPHERE, CYLINDER}; 17 // definition of different modes for setting up Faces 18 #define VERTEX 0 //!< If Faces are created WITH Vertex-Coordinate 19 #define NORMAL 1 //!< If Faces are created WITH Normals (otherwise autocalculate) 20 #define TEXCOORD 2 //!< If Faces are created WITH TextureCoordinate 19 21 20 22 //! Class that handles 3D-Models. it can also read them in and display them. … … 23 25 public: 24 26 Model(void); 25 Model(PRIMITIVE type);26 27 Model(char* modelName); 27 28 virtual ~Model(void); … … 114 115 115 116 void cubeModel(void); 116 void sphereModel(void);117 void cylinderModel(void);118 117 }; 119 118 -
orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc
r3605 r3746 21 21 22 22 #include "debug.h" 23 24 /**25 \brief Crates a 3D-Model and loads in a File.26 \param fileName file to parse and load (must be a .obj file)27 */28 OBJModel::OBJModel(const char* fileName)29 {30 this->initializeOBJ();31 32 this->importFile (fileName);33 34 this->importToGL ();35 36 this->cleanup();37 }38 23 39 24 /** … … 193 178 else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented 194 179 { 195 PRINTF( 3)("smoothing groups not supportet yet. line: %s\n", Buffer);180 PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer); 196 181 } 197 182 } … … 200 185 delete []fileName; 201 186 return true; 202 203 187 } 204 188 -
orxonox/branches/levelloader/src/lib/graphics/importer/objModel.h
r3542 r3746 13 13 { 14 14 public: 15 OBJModel(const char* fileName); 16 OBJModel(const char* fileName, float scaling); 15 OBJModel(const char* fileName, float scaling = 1.0); 17 16 virtual ~OBJModel(); 18 17 void initializeOBJ(void); … … 28 27 bool readFromObjFile (void); 29 28 bool readMtlLib (const char* matFile); 30 31 29 }; 32 30 -
orxonox/branches/levelloader/src/lib/graphics/importer/texture.cc
r3605 r3746 22 22 #include "texture.h" 23 23 24 // headers only for PathList 25 #include <unistd.h> 26 #include <sys/types.h> 27 #include <sys/stat.h> 28 #include <stdlib.h> 29 #include <fstream> 30 31 /** 32 \brief creates a ned PathList. 33 34 It is a good idea to use this as an initial List, 35 because if you give on a name the Path will not be checked for its existence. 36 */ 37 PathList::PathList() 38 { 39 this->pathName = NULL; 40 this->next = NULL; 41 } 42 43 /** 44 \brief Creates a new PathList with a Name. 45 \param pName the Name of The Path. 46 47 This function just adds the Path without checking if it exists. 48 */ 49 PathList::PathList(char* pName) 50 { 51 this->pathName = new char [strlen(pName)+1]; 52 strcpy (this->pathName, pName); 53 this->next = NULL; 54 } 55 56 /** 57 \brief destroys a PathList 58 59 It does this by deleting the Name and then delete its preceding PathList. 60 */ 61 PathList::~PathList() 62 { 63 if (this->pathName) 64 delete []this->pathName; 65 if (this->next) 66 delete this->next; 67 } 68 69 PathList* PathList::firstPath = NULL; 70 71 /** 72 \returns A Pointer to the first Path of the Pathlist 73 */ 74 PathList* PathList::getInstance(void) 75 { 76 if (firstPath) 77 return firstPath; 78 firstPath = new PathList(); 79 } 80 /** 81 \brief Adds a new Pathlist Element. 82 \param pName 83 84 Adding a Path automatically checks if the Path exists, 85 and if it does not it will not add it to the List. 86 */ 87 void PathList::addPath (char* pName) 88 { 89 if (pName[0] == '\0') 90 { 91 PRINTF(2)("not Adding empty Path to the List.\n"); 92 return; 93 } 94 char* tmpPName = new char[strlen(pName)]; 95 strncpy(tmpPName, pName, strlen(pName)-1); 96 tmpPName[strlen(pName)-1] = '\0'; 97 if (access (tmpPName, F_OK) == 0) 98 { 99 struct stat status; 100 stat(tmpPName, &status); 101 if (status.st_mode & S_IFDIR) 102 { 103 PRINTF(4)("Adding Path %s to the PathList.\n", pName); 104 PathList* tmpPathList = this; 105 while (tmpPathList->next) 106 tmpPathList = tmpPathList->next; 107 tmpPathList->next = new PathList(pName); 108 } 109 else 110 PRINTF(2)("You tried to add non-folder %s to a PathList.\n", tmpPName); 111 } 112 else 113 PRINTF(2)("You tried to add non-existing folder %s to a PathList.\n", tmpPName); 114 delete []tmpPName; 115 } 116 117 24 #include "graphics_engine.h" 118 25 119 26 /** … … 127 34 this->texture = 0; 128 35 } 36 37 /** 38 \brief Constructor for a Texture 39 */ 40 Texture::Texture(const char* imageName) 41 { 42 this->pImage = new Image; 43 this->pImage->data = NULL; 44 this->map = NULL; 45 this->texture = 0; 46 this->loadImage(imageName); 47 } 129 48 130 49 /** … … 143 62 144 63 /** 145 \brief Searches for a Texture inside one of the defined Paths146 \param texName The name of the texture o search for.147 \returns pathName+texName if texName was found in the pathList. NULL if the Texture is not found.148 */149 char* Texture::searchTextureInPaths(char* texName) const150 {151 char* tmpName = NULL;152 PathList* pList = PathList::getInstance();153 while (pList)154 {155 if (pList->pathName)156 {157 tmpName = new char [strlen(pList->pathName)+strlen(texName)+1];158 strcpy(tmpName, pList->pathName);159 }160 else161 {162 tmpName = new char [strlen(texName)+1];163 tmpName[0]='\0';164 }165 strcat(tmpName, texName);166 if (access (tmpName, F_OK) == 0)167 return tmpName;168 169 if (tmpName)170 delete []tmpName;171 tmpName = NULL;172 pList = pList->next;173 }174 return NULL;175 }176 177 /**178 64 \brief a Simple function that switches two char values 179 65 \param a The first value … … 195 81 bool Texture::loadTexToGL (Image* pImage) 196 82 { 197 PRINTF(4)("Loading texture to OpenGL-Environment.\n"); 198 glGenTextures(1, &this->texture); 199 glBindTexture(GL_TEXTURE_2D, this->texture); 200 /* not Working, and not needed. 201 glTexImage2D( GL_TEXTURE_2D, 0, 3, width, 202 height, 0, GL_BGR, 203 GL_UNSIGNED_BYTE, map->pixels ); 204 */ 205 gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, pImage->format, GL_UNSIGNED_BYTE, pImage->data); 206 207 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); 208 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR); 209 } 210 83 if (GraphicsEngine::texturesEnabled) 84 { 85 PRINTF(4)("Loading texture to OpenGL-Environment.\n"); 86 glGenTextures(1, &this->texture); 87 glBindTexture(GL_TEXTURE_2D, this->texture); 88 /* not Working, and not needed. 89 glTexImage2D( GL_TEXTURE_2D, 0, 3, width, 90 height, 0, GL_BGR, 91 GL_UNSIGNED_BYTE, map->pixels ); 92 */ 93 gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImage->width, pImage->height, pImage->format, GL_UNSIGNED_BYTE, pImage->data); 94 95 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); 96 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR); 97 } 98 } 211 99 212 100 #ifdef HAVE_SDL_SDL_IMAGE_H 213 bool Texture::loadImage(char* imageName) 214 { 215 char* imgNameWithPath = searchTextureInPaths(imageName); 216 if (imgNameWithPath) 217 { 218 this->map=IMG_Load(imgNameWithPath); 219 if(!map) 220 { 221 PRINTF(1)("IMG_Load: %s\n", IMG_GetError()); 101 bool Texture::loadImage(const char* imageName) 102 { 103 if (GraphicsEngine::texturesEnabled) 104 { 105 if (imageName) 106 { 107 this->map=IMG_Load(imageName); 108 if(!map) 109 { 110 PRINTF(1)("IMG_Load: %s\n", IMG_GetError()); 111 return false; 112 } 113 pImage->height = map->h; 114 pImage->width = map->w; 115 pImage->data = (GLubyte*)map->pixels; 116 pImage->bpp = map->format->BytesPerPixel; 117 if (pImage->bpp == 3) 118 pImage->format = GL_RGB; 119 else if (pImage->bpp == 4) 120 pImage->format = GL_RGBA; 121 122 if( !IMG_isPNG(SDL_RWFromFile(imageName, "rb")) && !IMG_isJPG(SDL_RWFromFile(imageName, "rb"))) 123 for (int i=0;i<map->h * map->w *3;i+=3) 124 { 125 GLuint temp = pImage->data[i]; 126 pImage->data[i] = pImage->data[i+2]; 127 pImage->data[i+2] = temp; 128 } 129 /* this is the real swapping algorithm */ 130 for( int i = 0 ; i < (pImage->height / 2) ; ++i ) 131 for( int j = 0 ; j < pImage->width * pImage->bpp; j += pImage->bpp ) 132 for(int k = 0; k < pImage->bpp; ++k) 133 swap( pImage->data[ (i * pImage->width * pImage->bpp) + j + k], pImage->data[ ( (pImage->height - i - 1) * pImage->width * pImage->bpp ) + j + k]); 134 135 this->loadTexToGL (this->pImage); 136 SDL_FreeSurface(map); 137 this->pImage->data = NULL; 138 } 139 else 140 { 141 PRINTF(2)("Image not Found: %s\n", imageName); 222 142 return false; 223 143 } 224 pImage->height = map->h;225 pImage->width = map->w;226 pImage->data = (GLubyte*)map->pixels;227 pImage->bpp = map->format->BytesPerPixel;228 if (pImage->bpp == 3)229 pImage->format = GL_RGB;230 else if (pImage->bpp == 4)231 pImage->format = GL_RGBA;232 233 if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb")))234 for (int i=0;i<map->h * map->w *3;i+=3)235 {236 GLuint temp = pImage->data[i];237 pImage->data[i] = pImage->data[i+2];238 pImage->data[i+2] = temp;239 }240 /* this is the real swapping algorithm */241 for( int i = 0 ; i < (pImage->height / 2) ; ++i )242 for( int j = 0 ; j < pImage->width * pImage->bpp; j += pImage->bpp )243 for(int k = 0; k < pImage->bpp; ++k)244 swap( pImage->data[ (i * pImage->width * pImage->bpp) + j + k], pImage->data[ ( (pImage->height - i - 1) * pImage->width * pImage->bpp ) + j + k]);245 246 this->loadTexToGL (this->pImage);247 SDL_FreeSurface(map);248 this->pImage->data = NULL;249 }250 else251 {252 PRINTF(2)("Image not Found: %s\n", imgNameWithPath);253 return false;254 144 } 255 145 } … … 262 152 \todo Checks where to find the Image 263 153 */ 264 bool Texture::loadImage(char* imageName) 265 { 266 char* imgNameWithPath = searchTextureInPaths(imageName); 267 if (imgNameWithPath) 268 { 269 if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4)) 270 { 271 PRINTF(4)("Requested bmp-image. Trying to Import.\n"); 272 return this->loadBMP(imgNameWithPath); 273 } 274 275 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5)) 276 { 277 PRINTF(4)("Requested jpeg-image. Trying to Import\n"); 278 return this->loadJPG(imgNameWithPath); 279 } 280 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4)) 281 { 282 PRINTF(4)("Requested tga-image. Trying to Import\n"); 283 return this->loadTGA(imgNameWithPath); 284 } 285 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4)) 286 { 287 PRINTF(4)("Requested png-image. Trying to Import\n"); 288 return this->loadPNG(imgNameWithPath); 154 bool Texture::loadImage(const char* imageName) 155 { 156 if (GraphicsEngine::texturesEnabled) 157 { 158 if (imageName) 159 { 160 if (!strncmp(imageName+strlen(imageName)-4, ".bmp", 4)) 161 { 162 PRINTF(4)("Requested bmp-image. Trying to Import.\n"); 163 return this->loadBMP(imageName); 164 } 165 166 else if (!strncmp(imageName+strlen(imageName)-4, ".jpg", 4) || !strncmp(imageName+strlen(imageName)-5, ".jpg", 5)) 167 { 168 PRINTF(4)("Requested jpeg-image. Trying to Import\n"); 169 return this->loadJPG(imageName); 170 } 171 else if (!strncmp(imageName+strlen(imageName)-4, ".tga", 4)) 172 { 173 PRINTF(4)("Requested tga-image. Trying to Import\n"); 174 return this->loadTGA(imageName); 175 } 176 else if (!strncmp(imageName+strlen(imageName)-4, ".png", 4)) 177 { 178 PRINTF(4)("Requested png-image. Trying to Import\n"); 179 return this->loadPNG(imageName); 180 } 181 else 182 { 183 PRINTF(2)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imageName); 184 return false; 185 } 289 186 } 290 187 else 291 188 { 292 PRINTF(2)(" Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);189 PRINTF(2)("Image not Found: %s\n", imageName); 293 190 return false; 294 191 } 295 192 } 296 else 297 { 298 PRINTF(2)("Image not Found: %s\n", imgNameWithPath); 299 return false; 300 } 301 } 302 193 } 303 194 /** 304 195 \brief reads in a Windows BMP-file, and imports it to openGL. -
orxonox/branches/levelloader/src/lib/graphics/importer/texture.h
r3605 r3746 28 28 #endif /* HAVE_SDL_SDL_IMAGE_H */ 29 29 30 31 32 //! Class to handle lists of paths.33 /**34 \todo Ability to return Paths by itself.35 36 It is simple to use, and good, for all PathList you want.37 just create a new Pathlist, and add Paths.38 */39 class PathList40 {41 private:42 PathList();43 static PathList* firstPath; //!< A static Pointer to the first PathList in the List.44 public:45 PathList(char* pName);46 ~PathList();47 static PathList* getInstance(void);48 49 void addPath (char* pName);50 char* pathName; //!< The Name of the current Path.51 PathList* next; //!< Pointer to the next Pathlist.52 };53 54 30 //! A Class, that reads in Textures from different fileformats. 55 31 class Texture … … 70 46 GLuint texture; //!< The Texture-ID of opengl from this Texture. 71 47 SDL_Surface* map; //!< The map SDL initializes for this element. 72 char* searchTextureInPaths(c har* texName) const;48 char* searchTextureInPaths(const char* texName) const; 73 49 inline void swap(unsigned char &a, unsigned char &b); 74 50 public: 75 51 Texture(void); 52 Texture(const char* imageName); 76 53 ~Texture(void); 77 54 /** \returns The textureID of this texture. */ … … 79 56 bool loadTexToGL (Image* pImage); 80 57 81 bool loadImage(c har* imageName);58 bool loadImage(const char* imageName); 82 59 #ifndef HAVE_SDL_SDL_IMAGE_H 83 60 -
orxonox/branches/levelloader/src/lib/graphics/light.cc
r3605 r3746 21 21 22 22 #include "glincl.h" 23 #include "vector.h" 23 24 24 25 using namespace std; -
orxonox/branches/levelloader/src/lib/gui/Makefile.in
r3605 r3746 1 # Makefile.in generated by automake 1.8. 5from Makefile.am.1 # Makefile.in generated by automake 1.8.2 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 179 179 esac; \ 180 180 done; \ 181 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/gui/Makefile'; \181 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/gui/Makefile'; \ 182 182 cd $(top_srcdir) && \ 183 $(AUTOMAKE) -- foreignsrc/lib/gui/Makefile183 $(AUTOMAKE) --gnu src/lib/gui/Makefile 184 184 .PRECIOUS: Makefile 185 185 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 274 274 tags=; \ 275 275 here=`pwd`; \ 276 if ( $(ETAGS)--etags-include --version) >/dev/null 2>&1; then \276 if (etags --etags-include --version) >/dev/null 2>&1; then \ 277 277 include_option=--etags-include; \ 278 empty_fix=.; \279 278 else \ 280 279 include_option=--include; \ 281 empty_fix=; \282 280 fi; \ 283 281 list='$(SUBDIRS)'; for subdir in $$list; do \ 284 282 if test "$$subdir" = .; then :; else \ 285 test ! -f $$subdir/TAGS ||\283 test -f $$subdir/TAGS && \ 286 284 tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ 287 285 fi; \ … … 293 291 $(AWK) ' { files[$$0] = 1; } \ 294 292 END { for (i in files) print i; }'`; \ 295 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 296 test -n "$$unique" || unique=$$empty_fix; \ 297 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 298 $$tags $$unique; \ 299 fi 293 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 294 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 295 $$tags $$unique 300 296 ctags: CTAGS 301 297 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ -
orxonox/branches/levelloader/src/lib/gui/console/Makefile.in
r3605 r3746 1 # Makefile.in generated by automake 1.8. 5from Makefile.am.1 # Makefile.in generated by automake 1.8.2 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 50 50 CONFIG_HEADER = $(top_builddir)/config.h 51 51 CONFIG_CLEAN_FILES = 52 am__installdirs = "$(DESTDIR)$(bindir)"52 am__installdirs = $(DESTDIR)$(bindir) 53 53 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 54 54 PROGRAMS = $(bin_PROGRAMS) … … 205 205 esac; \ 206 206 done; \ 207 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/gui/console/Makefile'; \207 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/gui/console/Makefile'; \ 208 208 cd $(top_srcdir) && \ 209 $(AUTOMAKE) -- foreignsrc/lib/gui/console/Makefile209 $(AUTOMAKE) --gnu src/lib/gui/console/Makefile 210 210 .PRECIOUS: Makefile 211 211 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 227 227 install-binPROGRAMS: $(bin_PROGRAMS) 228 228 @$(NORMAL_INSTALL) 229 test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"229 $(mkdir_p) $(DESTDIR)$(bindir) 230 230 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 231 231 p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ … … 233 233 ; then \ 234 234 f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ 235 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \236 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f"|| exit 1; \235 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ 236 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ 237 237 else :; fi; \ 238 238 done … … 242 242 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 243 243 f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 244 echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \245 rm -f "$(DESTDIR)$(bindir)/$$f"; \244 echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ 245 rm -f $(DESTDIR)$(bindir)/$$f; \ 246 246 done 247 247 … … 299 299 $(AWK) ' { files[$$0] = 1; } \ 300 300 END { for (i in files) print i; }'`; \ 301 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 302 test -n "$$unique" || unique=$$empty_fix; \ 303 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 304 $$tags $$unique; \ 305 fi 301 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 302 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 303 $$tags $$unique 306 304 ctags: CTAGS 307 305 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ … … 358 356 all-am: Makefile $(PROGRAMS) $(HEADERS) 359 357 installdirs: 360 for dir in "$(DESTDIR)$(bindir)"; do \ 361 test -z "$$dir" || $(mkdir_p) "$$dir"; \ 362 done 358 $(mkdir_p) $(DESTDIR)$(bindir) 363 359 install: install-am 364 360 install-exec: install-exec-am -
orxonox/branches/levelloader/src/lib/gui/gui/Makefile.am
r3499 r3746 21 21 22 22 #AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) 23 LIBS=$(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)23 AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) 24 24 25 25 bin_PROGRAMS=gui -
orxonox/branches/levelloader/src/lib/gui/gui/Makefile.in
r3605 r3746 1 # Makefile.in generated by automake 1.8. 5from Makefile.am.1 # Makefile.in generated by automake 1.8.2 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 50 50 CONFIG_HEADER = $(top_builddir)/config.h 51 51 CONFIG_CLEAN_FILES = 52 am__installdirs = "$(DESTDIR)$(bindir)"52 am__installdirs = $(DESTDIR)$(bindir) 53 53 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 54 54 PROGRAMS = $(bin_PROGRAMS) … … 131 131 LDFLAGS = @LDFLAGS@ 132 132 LIBOBJS = @LIBOBJS@ 133 134 #AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) 135 LIBS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) 133 LIBS = @LIBS@ 136 134 LTLIBOBJS = @LTLIBOBJS@ 137 135 MAKEINFO = @MAKEINFO@ … … 195 193 MAINSRCDIR = ../../.. 196 194 AM_CXXFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/gaphics -I$(MAINSRCDIR)/lib/graphics/font -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai 195 196 #AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) 197 AM_LDFLAGS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) 197 198 gui_SOURCES = orxonox_gui.cc \ 198 199 orxonox_gui_gtk.cc \ … … 238 239 esac; \ 239 240 done; \ 240 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/gui/gui/Makefile'; \241 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/gui/gui/Makefile'; \ 241 242 cd $(top_srcdir) && \ 242 $(AUTOMAKE) -- foreignsrc/lib/gui/gui/Makefile243 $(AUTOMAKE) --gnu src/lib/gui/gui/Makefile 243 244 .PRECIOUS: Makefile 244 245 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 260 261 install-binPROGRAMS: $(bin_PROGRAMS) 261 262 @$(NORMAL_INSTALL) 262 test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"263 $(mkdir_p) $(DESTDIR)$(bindir) 263 264 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 264 265 p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ … … 266 267 ; then \ 267 268 f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ 268 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \269 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f"|| exit 1; \269 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ 270 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ 270 271 else :; fi; \ 271 272 done … … 275 276 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 276 277 f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 277 echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \278 rm -f "$(DESTDIR)$(bindir)/$$f"; \278 echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ 279 rm -f $(DESTDIR)$(bindir)/$$f; \ 279 280 done 280 281 … … 338 339 $(AWK) ' { files[$$0] = 1; } \ 339 340 END { for (i in files) print i; }'`; \ 340 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 341 test -n "$$unique" || unique=$$empty_fix; \ 342 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 343 $$tags $$unique; \ 344 fi 341 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 342 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 343 $$tags $$unique 345 344 ctags: CTAGS 346 345 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ … … 397 396 all-am: Makefile $(PROGRAMS) $(HEADERS) 398 397 installdirs: 399 for dir in "$(DESTDIR)$(bindir)"; do \ 400 test -z "$$dir" || $(mkdir_p) "$$dir"; \ 401 done 398 $(mkdir_p) $(DESTDIR)$(bindir) 402 399 install: install-am 403 400 install-exec: install-exec-am -
orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui.cc
r3499 r3746 95 95 96 96 // Reading Values from File 97 exec->set Filename("~/.orxonox.conf");97 exec->setConfFile("~/.orxonox/orxonox.conf"); 98 98 exec->readFromFile(orxonoxGUI); 99 99 // Merging changes to the Options from appended flags. -
orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.cc
r3499 r3746 25 25 26 26 #include "orxonox_gui_exec.h" 27 27 28 #include <iostream> 28 29 #include <string> 30 31 #include <sys/stat.h> 32 #include <sys/types.h> 33 29 34 30 35 HashTable* orxonoxFlagHash; … … 50 55 this->saveSettings->saveability(); 51 56 this->execBox->fill(this->saveSettings); 52 this->verboseMode = new Menu("verbose mode", "no output", "error", "warning", "info", "lastItem");57 this->verboseMode = new Menu("verbose mode", "nothing", "error", "warning", "info", "lastItem"); 53 58 this->verboseMode->setFlagName("verbose", "v", 0); 54 59 this->verboseMode->saveability(); … … 90 95 91 96 /** 97 \brief sets the confDir and File-name out of an input-string 98 */ 99 void OrxonoxGuiExec::setConfFile(char* confFile) 100 { 101 char splitter = 102 #ifdef __WIN32__ 103 '\\'; 104 #else 105 '/'; 106 #endif 107 char* tmpConfFile = new char[strlen(confFile)+1]; 108 strcpy(tmpConfFile, confFile); 109 char* tmp = strrchr(tmpConfFile, splitter); 110 if (tmp) 111 { 112 tmp[0] = '\0'; 113 this->setConfDir(tmpConfFile); 114 this->setFileName(tmp+1); 115 } 116 else 117 { 118 this->setConfDir("~/"); 119 this->setFileName(tmpConfFile); 120 } 121 delete []tmp; 122 delete []tmpConfFile; 123 } 124 125 /** 126 \brief sets the Directory of the configuration files 127 \param confDir the Directory for the configuration files 128 */ 129 void OrxonoxGuiExec::setConfDir(char* confDir) 130 { 131 if (!strncmp(confDir, "~/", 2)) 132 { 133 char tmp[500]; 134 #ifdef __WIN32__ 135 strcpy(tmp, getenv("USERPROFILE")); 136 #else 137 strcpy(tmp, getenv("HOME")); 138 #endif 139 this->confDir = new char[strlen(tmp)+strlen(confDir)]; 140 sprintf(this->confDir, "%s%s", tmp, confDir+1); 141 } 142 else 143 { 144 this->confDir = new char[strlen(confDir)+1]; 145 strcpy(this->confDir, confDir); 146 } 147 PRINTF(3)("Config Directory is: %s.\n", this->confDir); 148 mkdir(this->confDir, 0755); 149 } 150 151 /** 92 152 \brief Sets the location of the configuration File. 93 \param file name the location of the configFile153 \param fileName the location of the configFile 94 154 95 155 \todo: memory allocation could be better. … … 97 157 The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows 98 158 */ 99 void OrxonoxGuiExec::setFilename(char* filename) 100 { 101 char* buffer = (char*)malloc(2048*sizeof(char)); 102 sprintf(buffer, "%s", filename); 103 if(!strncmp(buffer, "~/", 2)) 104 { 105 #ifdef __WIN32__ 106 sprintf(configFile, "%s/%s", getenv("USERPROFILE"), buffer+2); 107 #else 108 sprintf(configFile, "%s/%s", getenv("HOME"), buffer+2); 109 #endif 110 } 111 else if(buffer) 112 strcpy(this->configFile, buffer); 113 free (buffer); 159 void OrxonoxGuiExec::setFileName(char* fileName) 160 { 161 if (!this->confDir) 162 this->setConfDir("~/"); 163 this->configFile = new char[strlen(this->confDir)+strlen(fileName)+2]; 164 sprintf(this->configFile, "%s/%s", this->confDir, fileName); 165 PRINTF(3)("ConfigurationFile is %s.\n", this->configFile); 114 166 } 115 167 … … 117 169 \returns The name of the Configuration-File 118 170 */ 119 char* OrxonoxGuiExec::getConfigFile(void) 171 char* OrxonoxGuiExec::getConfigFile(void) const 120 172 { 121 173 return this->configFile; … … 190 242 space2under[0] = '_'; 191 243 } 192 if(widget->isOption <=3) 193 fprintf(CONFIG_FILE, "%s = %d\n", Buffer, static_cast<Option*>(widget)->value); 194 else if(widget->isOption == 5) 195 fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<OptionLabel*>(widget)->cValue); 244 fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<Option*>(widget)->save()); 196 245 } 197 246 … … 259 308 { 260 309 PRINT(3)("Located Option %s.\n", widget->title); 261 if(widget->isOption >= 1 && widget->isOption <= 3) 262 { 263 static_cast<Option*>(widget)->value = atoi(info->variableValue); 264 static_cast<Option*>(widget)->redraw(); //!< \todo change this to setValue. 265 } 266 else if(widget->isOption == 5) 267 static_cast<OptionLabel*>(widget)->setValue(info->variableValue); 310 if(widget->isOption >= 1) 311 static_cast<Option*>(widget)->load(info->variableValue); 268 312 } 269 313 } -
orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.h
r3499 r3746 22 22 CheckButton* alwaysShow; //!< A CheckButton, for if orxonox should start with or without gui. 23 23 Button* quit; //!< A Button to quit the Gui without starting orxonox. 24 char* confDir; //!< The directory of the orxonox-configuration-files. 24 25 char* configFile; //!< The name of the .orxonox.conf(ig)-file. 25 26 FILE* CONFIG_FILE; //!< Filehandler for reading and writing. … … 37 38 38 39 Widget* getWidget(void); 39 40 void setFilename(char* filename); 41 char* getConfigFile(void); 40 41 void setConfFile(char* confFile); 42 void setConfDir(char* confDir); 43 void setFileName(char* fileName); 44 char* getConfigFile(void) const; 42 45 int shouldsave(void); 43 46 void writeToFile(Widget* widget); -
orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.cc
r3499 r3746 25 25 26 26 27 #include "orxonox_gui_gtk.h" 28 29 #include <stdarg.h> 27 30 #include <iostream> 28 29 #include "orxonox_gui_gtk.h"30 31 31 32 … … 68 69 #else /* HAVE_GTK2 */ 69 70 char boolAns = 'y'; 70 char ans[10]; 71 char ans[10]; 72 PRINT(0)("================================\n"); 73 PRINT(0)("= ORXONOX CONFIGURATION WIZARD =\n"); 74 PRINT(0)("================================ - version:" PACKAGE_VERSION "\n"); 75 71 76 while(true) 72 77 { 73 PRINT(0)(" Listing all the Orxonox Options: \n");78 PRINT(0)("\n Listing all the Orxonox Options: \n"); 74 79 PRINT(0)(" #############################\n"); 75 80 Window::mainWindow->walkThrough(Widget::listOptionsAndGroups, 1); … … 122 127 //! \todo move this into the gui-gtk-file 123 128 //! \todo finish it. 129 //! \todo memory leek at save(); and save is a BAD word, use saveString instead, or something like it. 124 130 } 125 131 #endif /* HAVE_GTK2 */ … … 133 139 134 140 /* WIDGET */ 135 136 /** 137 \brief deletes any given Widget 138 This is still pretty crappy. 139 */ 140 Widget::~Widget(void) 141 { 142 this->destroy(); 143 } 144 145 /** 146 \brief Initializes a widget. 147 Initializes the next Pointer and the other Widget-specific Defaults. 148 */ 149 void Widget::init(void) 141 /** 142 \brief constructs a Widget 143 */ 144 Widget::Widget(void) 150 145 { 151 146 next = NULL; … … 155 150 156 151 /** 157 \brief Destroys a Widget 158 */ 159 void Widget::destroy(void) 160 { 161 if (this->title) 152 \brief deletes any given Widget 153 This is still pretty crappy. 154 */ 155 Widget::~Widget(void) 156 { 157 if (this->title) 162 158 { 163 159 delete []this->title; … … 172 168 delete this->next; 173 169 this->next = NULL; 174 175 170 //! \todo not hiding widget, deleting. 176 171 // this->hide(); 177 172 // delete this->widget; 173 } 174 175 /** 176 \brief sets a new Title to a Widget 177 \param title The new Title to set to the Widget 178 */ 179 void Widget::setTitle(const char* title) 180 { 181 if (this->title) 182 delete []this->title; 183 this->title = new char[strlen(title)+1]; 184 strcpy(this->title, title); 178 185 } 179 186 … … 273 280 { 274 281 if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName) 275 cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n";276 if (widget->isOption >= 1 && widget->isOption <= 3)277 cout << " " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;278 else if (widget->isOption == 5)279 cout << " " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;282 PRINT(0)("[%s]\n", static_cast<Packer*>(widget)->groupName); 283 if (widget->isOption >= 1) 284 { 285 Widget::listOptions(widget); 286 } 280 287 } 281 288 … … 286 293 void Widget::listOptions(Widget* widget) 287 294 { 288 if (widget->isOption >= 1 && widget->isOption <= 3) 289 cout << " " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl; 290 else if (widget->isOption == 5) 291 cout << " " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl; 295 if(widget->isOption >= 1) 296 PRINT(0)(" %s is %s\n", static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save()); 292 297 } 293 298 … … 300 305 { 301 306 302 if (widget->isOption >= 1 && widget->isOption <= 3)307 if (widget->isOption >= 1) 303 308 { 304 309 int* count =(int*)data; 305 310 *count = *count +1; 306 cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl; 307 } 308 else if (widget->isOption == 5) 309 { 310 int* count =(int*)data; 311 *count = *count +1; 312 cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl; 311 PRINT(0)(" %d:%s is %s\n", *count, static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save()); 313 312 } 314 313 } … … 513 512 514 513 /* PACKERS */ 515 516 /** 517 \brief Initializes a Packer. 518 519 Sets the down-pinter to NULL and other PackerSpecific-values to their defaults. 520 */ 521 void Packer::init(void) 514 /** 515 \brief Constructs a Packer 516 */ 517 Packer::Packer(void) 522 518 { 523 519 this->down = NULL; 524 520 this->groupName = NULL; 525 526 527 static_cast<Widget*>(this)->init();528 return;529 521 } 530 522 … … 532 524 \brief Destroys a Packer. 533 525 */ 534 void Packer::destroy(void)526 Packer::~Packer(void) 535 527 { 536 528 PRINTF(4)("deleting the Packer part.\n"); … … 543 535 delete this->down; 544 536 this->down = NULL; 545 546 static_cast<Widget*>(this)->destroy();547 537 } 548 538 … … 575 565 sets the Container-Specific defaults. 576 566 */ 577 void Container::init(void)567 Container::Container(void) 578 568 { 579 569 this->isOption = -1; 580 581 static_cast<Packer*>(this)->init();582 583 return;584 570 } 585 571 … … 587 573 \brief Destroys a Container. 588 574 */ 589 void Container::destroy(void)575 Container::~Container(void) 590 576 { 591 577 PRINTF(4)("deleting the Container part.\n"); 592 593 static_cast<Packer*>(this)->destroy();594 578 } 595 579 … … 665 649 Window::~Window(void) 666 650 { 667 this->destroy(); 651 if (this->title) 652 PRINTF(3)("deleting the Window: %s\n", this->title); 653 else 654 PRINTF(3)("deleting the Window.\n"); 655 // this->hide(); 668 656 } 669 657 … … 677 665 678 666 isOpen = false; 679 680 static_cast<Container*>(this)->init();681 667 682 668 #ifdef HAVE_GTK2 … … 691 677 692 678 /** 693 \brief Destroys a Window.694 */695 void Window::destroy(void)696 {697 if (this->title)698 PRINTF(3)("deleting the Window: %s\n", this->title);699 else700 PRINTF(3)("deleting the Window.\n");701 // this->hide();702 static_cast<Container*>(this)->destroy();703 704 }705 706 /**707 679 \brief Shows all Widgets that are included within this->widget. 708 680 */ … … 730 702 \param title title the Window should get. 731 703 */ 732 void Window::setTitle(c har* title)704 void Window::setTitle(const char* title) 733 705 { 734 706 if (this->title) … … 823 795 Frame::~Frame(void) 824 796 { 825 this->destroy();826 }827 828 /**829 \brief Initializes a new Frame with default settings830 */831 void Frame::init(void)832 {833 static_cast<Container*>(this)->init();834 835 #ifdef HAVE_GTK2836 this->widget = gtk_frame_new("");837 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);838 #endif /* HAVE_GTK2 */839 }840 841 /**842 \brief Destroys a Frame.843 */844 void Frame::destroy(void)845 {846 797 if (this->title) 847 798 PRINTF(3)("deleting the Frame: %s\n", this->title); 848 799 else 849 800 PRINTF(3)("deleting the Frame.\n"); 850 851 static_cast<Container*>(this)->destroy(); 801 } 802 803 /** 804 \brief Initializes a new Frame with default settings 805 */ 806 void Frame::init(void) 807 { 808 #ifdef HAVE_GTK2 809 this->widget = gtk_frame_new(""); 810 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 811 #endif /* HAVE_GTK2 */ 852 812 } 853 813 … … 856 816 \param title The title the Frame should get. 857 817 */ 858 void Frame::setTitle(c har* title)818 void Frame::setTitle(const char* title) 859 819 { 860 820 if (this->title) … … 892 852 EventBox::~EventBox(void) 893 853 { 894 this->destroy();895 896 }897 898 /**899 \brief Initializes a new EventBox900 */901 void EventBox::init(void)902 {903 this->isOption = -1;904 905 static_cast<Container*>(this)->init();906 907 #ifdef HAVE_GTK2908 this->widget = gtk_event_box_new();909 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);910 #endif /* HAVE_GTK2 */911 }912 913 /**914 \brief Destroys an EventBox.915 */916 void EventBox::destroy(void)917 {918 854 if (this->title) 919 855 PRINTF(3)("deleting the EventBox: %s\n", this->title); 920 856 else 921 857 PRINTF(3)("deleting the EventBox.\n"); 922 923 static_cast<Container*>(this)->destroy(); 924 } 925 926 /** 927 \brief Sets the Title of the EventBox(not implemented) 928 \param title Name the EventBox should get(only datastructure-internal). 929 */ 930 void EventBox::setTitle(char* title) 931 { 932 if (this->title) 933 delete []this->title; 934 this->title = new char[strlen(title)+1]; 935 strcpy(this->title, title); 858 } 859 860 /** 861 \brief Initializes a new EventBox 862 */ 863 void EventBox::init(void) 864 { 865 this->isOption = -1; 866 867 #ifdef HAVE_GTK2 868 this->widget = gtk_event_box_new(); 869 gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3); 870 #endif /* HAVE_GTK2 */ 936 871 } 937 872 … … 960 895 Box::~Box(void) 961 896 { 962 this->destroy();963 }964 965 /**966 \brief Initializes a new Box with type boxtype967 \param boxtype see Box(char boxtype)968 */969 void Box::init(char boxtype)970 {971 this->isOption = -2;972 973 static_cast<Packer*>(this)->init();974 #ifdef HAVE_GTK2975 if (boxtype == 'v')976 {977 this->widget = gtk_vbox_new(FALSE, 0);978 }979 else980 {981 this->widget = gtk_hbox_new(FALSE, 0);982 }983 #endif /* HAVE_GTK2 */984 }985 986 /**987 \brief Destroys a Box.988 */989 void Box::destroy(void)990 {991 897 if (this->title) 992 898 PRINTF(3)("deleting the Box: %s\n", this->title); … … 994 900 PRINTF(3)("deleting the Box.\n"); 995 901 996 static_cast<Packer*>(this)->destroy(); 902 } 903 904 /** 905 \brief Initializes a new Box with type boxtype 906 \param boxtype see Box(char boxtype) 907 */ 908 void Box::init(char boxtype) 909 { 910 this->isOption = -2; 911 912 #ifdef HAVE_GTK2 913 if (boxtype == 'v') 914 { 915 this->widget = gtk_vbox_new(FALSE, 0); 916 } 917 else 918 { 919 this->widget = gtk_hbox_new(FALSE, 0); 920 } 921 #endif /* HAVE_GTK2 */ 997 922 } 998 923 … … 1022 947 } 1023 948 1024 /**1025 \brief Sets the Title of a Box.1026 \param title the new Title to set.1027 */1028 void Box::setTitle(char* title)1029 {1030 if (this->title)1031 delete []this->title;1032 this->title = new char[strlen(title)+1];1033 strcpy(this->title, title);1034 }1035 1036 949 /* OPTION */ 1037 950 … … 1040 953 sets all Option-Specific-Values to their defaults. 1041 954 */ 1042 void Option::init(void)955 Option::Option(void) 1043 956 { 1044 957 this->value = 0; … … 1047 960 this->saveable = false; 1048 961 this->defaultValue = 0; 1049 1050 static_cast<Widget*>(this)->init();1051 1052 return;1053 962 } 1054 963 … … 1056 965 \brief Destroys an Option. 1057 966 */ 1058 void Option::destroy(void)967 Option::~Option(void) 1059 968 { 1060 969 PRINTF(4)("deleting the Option Part.\n"); … … 1063 972 if (this->flagNameShort) 1064 973 delete []this->flagNameShort; 1065 1066 static_cast<Widget*>(this)->destroy();1067 974 } 1068 975 … … 1123 1030 1124 1031 /** 1032 \brief saves an Option 1033 \returns the String that should be saved. 1034 1035 this is a default Option save 1036 */ 1037 char* Option::save(void) 1038 { 1039 char* value = new char [10]; 1040 sprintf (value, "%d", this->value); 1041 return value; 1042 } 1043 1044 /** 1045 \brief loads an Option from of its loadString 1046 \param loadString the string from which to load the data from 1047 */ 1048 void Option::load(char* loadString) 1049 { 1050 this->value = atoi(loadString); 1051 PRINT(3)("Loading %s: %s %d\n", this->title, loadString, value); 1052 this->redraw(); 1053 } 1054 1055 /** 1125 1056 \returns The saveable-state. 1126 1057 */ … … 1161 1092 Button::~Button(void) 1162 1093 { 1163 this->destroy();1164 }1165 1166 /**1167 \brief Initializes a new Button1168 */1169 void Button::init(void)1170 {1171 isOption = 0;1172 1173 static_cast<Option*>(this)->init();1174 1175 #ifdef HAVE_GTK21176 widget = gtk_button_new_with_label("");1177 #endif /* HAVE_GTK2 */1178 }1179 1180 /**1181 \brief Destroys a Button.1182 */1183 void Button::destroy(void)1184 {1185 1094 if (this->title) 1186 1095 PRINTF(3)("deleting the Label: %s\n", this->title); … … 1188 1097 PRINTF(3)("deleting the Label.\n"); 1189 1098 1190 static_cast<Option*>(this)->destroy(); 1099 } 1100 1101 /** 1102 \brief Initializes a new Button 1103 */ 1104 void Button::init(void) 1105 { 1106 isOption = 0; 1107 1108 #ifdef HAVE_GTK2 1109 widget = gtk_button_new_with_label(""); 1110 #endif /* HAVE_GTK2 */ 1191 1111 } 1192 1112 … … 1195 1115 \param title The name the Button should get 1196 1116 */ 1197 void Button::setTitle(c har *title)1117 void Button::setTitle(const char *title) 1198 1118 { 1199 1119 if (this->title) … … 1245 1165 CheckButton::~CheckButton(void) 1246 1166 { 1247 this->destroy();1248 }1249 1250 /**1251 \brief Initialize a new CheckButton with default settings1252 */1253 void CheckButton::init(void)1254 {1255 this->isOption = 1;1256 1257 static_cast<Option*>(this)->init();1258 1259 #ifdef HAVE_GTK21260 this->widget = gtk_check_button_new_with_label("");1261 #endif /* HAVE_GTK2 */1262 }1263 1264 /**1265 \brief Destroys a CheckButton.1266 */1267 void CheckButton::destroy(void)1268 {1269 1167 if (this->title) 1270 1168 PRINTF(3)("deleting the CheckButton: %s\n", this->title); 1271 1169 else 1272 1170 PRINTF(3)("deleting the CheckButton.\n"); 1273 1274 static_cast<Option*>(this)->destroy(); 1171 } 1172 1173 /** 1174 \brief Initialize a new CheckButton with default settings 1175 */ 1176 void CheckButton::init(void) 1177 { 1178 this->isOption = 1; 1179 1180 #ifdef HAVE_GTK2 1181 this->widget = gtk_check_button_new_with_label(""); 1182 #endif /* HAVE_GTK2 */ 1275 1183 } 1276 1184 … … 1279 1187 \param title The new Name the CheckButton should display. 1280 1188 */ 1281 void CheckButton::setTitle(c har* title)1189 void CheckButton::setTitle(const char* title) 1282 1190 { 1283 1191 if (this->title) … … 1306 1214 #else /* HAVE_GTK2 */ 1307 1215 char tmpChar[20]; 1308 cout << "\nPlease give me a new value for " << this->title << " [0,1](def ualt:" << this->defaultValue << "): ";1216 cout << "\nPlease give me a new value for " << this->title << " [0,1](default:" << this->defaultValue << "): "; 1309 1217 cin >> tmpChar; 1310 1218 … … 1350 1258 Slider::~Slider(void) 1351 1259 { 1352 this->destroy();1353 }1354 1355 /**1356 \brief Initializes a Slider with start and end Values1357 params: see Slider::Slider(char* slidername, int start, int end)1358 */1359 void Slider::init(int start, int end)1360 {1361 this->isOption = 2;1362 1363 static_cast<Option*>(this)->init();1364 1365 this->start = start;1366 this->end = end;1367 #ifdef HAVE_GTK21368 widget = gtk_hscale_new_with_range(this->start, this->end, 5);1369 #endif /* HAVE_GTK2 */1370 }1371 1372 /**1373 \brief Destroys a Slider.1374 */1375 void Slider::destroy(void)1376 {1377 1260 if (this->title) 1378 1261 PRINTF(3)("deleting the Slider: %s\n", this->title); 1379 1262 else 1380 1263 PRINTF(3)("deleting the Slider.\n"); 1381 1382 static_cast<Option*>(this)->destroy(); 1383 1384 } 1385 1386 /** 1387 \brief Sets a new Title to the Slider 1388 \param title The new Name of the slider 1389 */ 1390 void Slider::setTitle(char* title) 1391 { 1392 if (this->title)1393 delete []this->title; 1394 this->title = new char[strlen(title)+1];1395 strcpy(this->title, title); 1264 } 1265 1266 /** 1267 \brief Initializes a Slider with start and end Values 1268 params: see Slider::Slider(char* slidername, int start, int end) 1269 */ 1270 void Slider::init(int start, int end) 1271 { 1272 this->isOption = 2; 1273 1274 this->start = start; 1275 this->end = end; 1276 #ifdef HAVE_GTK2 1277 widget = gtk_hscale_new_with_range(this->start, this->end, 5); 1278 #endif /* HAVE_GTK2 */ 1396 1279 } 1397 1280 … … 1425 1308 #else /* HAVE_GTK2 */ 1426 1309 char tmpChar[20]; 1427 cout << "\nPlease give me a new value for " << this->title << " [" <<this->start << "-" << this->end << "](def ualt:" << this->defaultValue << "): ";1310 cout << "\nPlease give me a new value for " << this->title << " [" <<this->start << "-" << this->end << "](default:" << this->defaultValue << "): "; 1428 1311 cin >> tmpChar; 1429 1312 … … 1437 1320 1438 1321 /* MENU */ 1322 1323 /** 1324 \brief constructs a new Menu, without adding any items to it. 1325 \param menuName the Name the Menu gets. 1326 */ 1327 Menu::Menu(const char* menuName) 1328 { 1329 this->init(); 1330 this->setTitle(menuName); 1331 } 1439 1332 1440 1333 /** … … 1448 1341 this->init(); 1449 1342 this->setTitle(menuname); 1450 1343 va_list itemlist; //!< The list to readin multiple Options. 1344 1451 1345 char *itemName; 1452 1346 1453 #ifdef HAVE_GTK2 /////////////////////// REINPLEMENT1454 1347 va_start(itemlist, menuname); 1455 1348 while(strcmp(itemName = va_arg(itemlist, char*), "lastItem")) … … 1458 1351 } 1459 1352 va_end(itemlist); 1460 #endif /* HAVE_GTK2 */1461 1462 #ifdef HAVE_GTK21463 gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu);1464 this->connectSignal("changed", this->OptionChange);1465 #endif /* HAVE_GTK2 */1466 1353 } 1467 1354 … … 1471 1358 Menu::~Menu(void) 1472 1359 { 1473 this->destroy();1474 }1475 1476 /**1477 \brief Initializes a new Menu with no items1478 */1479 void Menu::init(void)1480 {1481 this->isOption = 2;1482 1483 static_cast<Option*>(this)->init();1484 1485 #ifdef HAVE_GTK21486 this->widget = gtk_option_menu_new();1487 this->menu = gtk_menu_new();1488 #endif /* HAVE_GTK2 */1489 1490 }1491 1492 /**1493 \brief Destroys a Menu.1494 */1495 void Menu::destroy(void)1496 {1497 1360 if (this->title) 1498 1361 PRINTF(3)("deleting the Menu: %s\n", this->title); … … 1500 1363 PRINTF(3)("deleting the Menu.\n"); 1501 1364 //! \todo destroy menu 1502 1503 static_cast<Option*>(this)->destroy(); 1504 } 1505 1506 1507 /** 1508 * Sets the Database-Name of this Menu 1509 \param title Database-Name to be set. 1510 */ 1511 void Menu::setTitle(char* title) 1512 { 1513 if (this->title) 1514 delete []this->title; 1515 this->title = new char[strlen(title)+1]; 1516 strcpy(this->title, title); 1365 this->currItem = this->firstItem; 1366 while(this->currItem) 1367 { 1368 delete []this->currItem->name; 1369 /* 1370 #ifdef HAVE_GTK2 1371 free(this->currItem->item); 1372 #endif /* HAVE_GTK2 */ 1373 MenuItem* tmpItem = this->currItem; 1374 this->currItem = this->currItem->next; 1375 delete tmpItem; 1376 } 1377 } 1378 1379 /** 1380 \brief Initializes a new Menu with no items 1381 */ 1382 void Menu::init(void) 1383 { 1384 this->isOption = 2; 1385 this->firstItem = NULL; 1386 1387 #ifdef HAVE_GTK2 1388 this->widget = gtk_option_menu_new(); 1389 this->menu = gtk_menu_new(); 1390 gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu); 1391 this->connectSignal("changed", this->OptionChange); 1392 #endif /* HAVE_GTK2 */ 1393 } 1394 1395 /** 1396 \brief saves the Label of the Menu 1397 \returns the name of the selected Menu-Item 1398 */ 1399 char* Menu::save(void) 1400 { 1401 MenuItem* tmpItem = this->firstItem; 1402 for (int i = 0; i<this->value; i++) 1403 tmpItem = tmpItem->next; 1404 1405 return tmpItem->name; 1406 } 1407 1408 /** 1409 \brief loads a Menu from of its loadString 1410 \param loadString the string from which to load the data from 1411 */ 1412 void Menu::load(char* loadString) 1413 { 1414 MenuItem* tmpItem = firstItem; 1415 bool foundItem = false; 1416 while (tmpItem) 1417 { 1418 if (!strcmp(loadString, tmpItem->name)) 1419 {foundItem = true; break;} 1420 tmpItem = tmpItem->next; 1421 } 1422 if (foundItem) 1423 this->value = tmpItem->itemNumber; 1424 else 1425 { 1426 this->value = 0; 1427 PRINTF(2)("Sorry, but %s has not been found in the Itemlist of %s\n", loadString, this->title); 1428 } 1429 PRINTF(3)( "Loading %s: setting to %d\n", this->title, this->value); 1430 this->redraw(); 1517 1431 } 1518 1432 … … 1520 1434 \brief appends a new Item to the Menu-List. 1521 1435 \param itemName the itemName to be appendet. 1522 1523 \todo make the item-list readable without GTK1524 1436 */ 1525 1437 void Menu::addItem(char* itemName) 1526 1438 { 1527 #ifdef HAVE_GTK2 1528 this->item = gtk_menu_item_new_with_label(itemName); 1529 gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->item); 1530 #endif /* HAVE_GTK2 */ 1439 if (!this->firstItem) 1440 { 1441 this->firstItem = this->currItem = new MenuItem; 1442 this->currItem->itemNumber = 0; 1443 } 1444 else 1445 { 1446 int tmpI = this->currItem->itemNumber; 1447 this->currItem = this->currItem->next = new MenuItem; 1448 this->currItem->itemNumber = tmpI+1; 1449 } 1450 1451 this->currItem->name = new char[strlen(itemName)+1]; 1452 strcpy(this->currItem->name, itemName); 1453 1454 #ifdef HAVE_GTK2 1455 this->currItem->item = gtk_menu_item_new_with_label(itemName); 1456 gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->currItem->item); 1457 #endif /* HAVE_GTK2 */ 1458 this->currItem->next = NULL; 1531 1459 } 1532 1460 … … 1551 1479 #else /* HAVE_GTK2 */ 1552 1480 char tmpChar[20]; 1553 cout << "\nPlease give me a new value for " << this->title << "(def ualt:" << this->defaultValue << "): ";1481 cout << "\nPlease give me a new value for " << this->title << "(default:" << this->defaultValue << "): "; 1554 1482 cin >> tmpChar; 1555 1483 this->value = atoi(tmpChar); … … 1578 1506 OptionLabel::~OptionLabel(void) 1579 1507 { 1580 this->destroy();1581 }1582 1583 /**1584 \brief Initializes an OptionLabel1585 */1586 void OptionLabel::init(void)1587 {1588 this->isOption = 5;1589 static_cast<Option*>(this)->init();1590 1591 cValue = NULL;1592 1593 #ifdef HAVE_GTK21594 this->widget = gtk_label_new("");1595 #endif /* HAVE_GTK2 */1596 }1597 1598 /**1599 \brief Destroys a OptionLabel.1600 */1601 void OptionLabel::destroy(void)1602 {1603 1508 if (this->title) 1604 1509 PRINTF(3)("deleting the OptionLabel: %s\n", this->title); … … 1607 1512 if (this->cValue) 1608 1513 delete []this->cValue; 1609 1610 static_cast<Option*>(this)->destroy(); 1611 } 1612 1514 } 1515 1516 /** 1517 \brief Initializes an OptionLabel 1518 */ 1519 void OptionLabel::init(void) 1520 { 1521 this->isOption = 5; 1522 cValue = NULL; 1523 1524 #ifdef HAVE_GTK2 1525 this->widget = gtk_label_new(""); 1526 #endif /* HAVE_GTK2 */ 1527 } 1613 1528 1614 1529 /** … … 1628 1543 1629 1544 /** 1630 \brief Sets a ned Title to the OptionLabel.1631 \param title The now title of the OptionLabel.1632 */1633 void OptionLabel::setTitle(char* title)1634 {1635 if (this->title)1636 delete []this->title;1637 this->title = new char [strlen(title)+1];1638 strcpy(this->title, title);1639 this->redraw();1640 }1641 1642 /**1643 1545 \brief Redraws an OptionLabel(not implemented yet, but it works). 1644 1546 */ … … 1666 1568 1667 1569 /** 1570 \brief creates the Optionlabel save-string 1571 \returns the String to save. 1572 */ 1573 char* OptionLabel::save(void) 1574 { 1575 return cValue; 1576 } 1577 1578 /** 1579 \brief loads an Option from of its loadString 1580 \param loadString the string from which to load the data from 1581 */ 1582 void OptionLabel::load(char* loadString) 1583 { 1584 PRINTF(3)( "Loading %s: setting to %s\n", this->title, loadString); 1585 this->setValue(loadString); 1586 } 1587 1588 /** 1668 1589 \brief Creates a new default Label with no Text. 1669 1590 You migth consider adding Label::setTitle with this. … … 1689 1610 Label::~Label(void) 1690 1611 { 1691 this->destroy();1692 }1693 1694 /**1695 \brief initializes a new Label1696 */1697 void Label::init(void)1698 {1699 this->isOption = 0;1700 1701 static_cast<Widget*>(this)->init();1702 1703 #ifdef HAVE_GTK21704 this->widget = gtk_label_new("");1705 gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);1706 #endif /* HAVE_GTK2 */1707 }1708 1709 /**1710 \brief Destroys a Label.1711 */1712 void Label::destroy(void)1713 {1714 1612 if (this->title) 1715 1613 PRINTF(3)("deleting the Label: %s\n", this->title); 1716 1614 else 1717 1615 PRINTF(3)("deleting the Label.\n"); 1718 1719 static_cast<Widget*>(this)->destroy(); 1616 } 1617 1618 /** 1619 \brief initializes a new Label 1620 */ 1621 void Label::init(void) 1622 { 1623 this->isOption = 0; 1624 1625 #ifdef HAVE_GTK2 1626 this->widget = gtk_label_new(""); 1627 gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE); 1628 #endif /* HAVE_GTK2 */ 1720 1629 } 1721 1630 … … 1813 1722 ProgressBar::~ProgressBar(void) 1814 1723 { 1815 this->destroy(); 1724 if (this->title) 1725 PRINTF(3)("deleting the ProgressBar: %s\n", this->title); 1726 else 1727 PRINTF(3)("deleting the ProgressBar.\n"); 1816 1728 } 1817 1729 … … 1825 1737 this->totalSize = 0.0; 1826 1738 1827 static_cast<Widget*>(this)->init();1828 1739 #ifdef HAVE_GTK2 1829 1740 this->adjustment =(GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0); 1830 1741 this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment); 1831 1742 #endif /* HAVE_GTK2 */ 1832 }1833 1834 /**1835 \brief Destroys a ProgressBar.1836 */1837 void ProgressBar::destroy(void)1838 {1839 if (this->title)1840 PRINTF(3)("deleting the ProgressBar: %s\n", this->title);1841 else1842 PRINTF(3)("deleting the ProgressBar.\n");1843 1844 static_cast<Widget*>(this)->destroy();1845 }1846 1847 /**1848 \brief Sets a ned Title to the ProgressBar.1849 \param title The now title of the ProgressBar.1850 */1851 void ProgressBar::setTitle(char* title)1852 {1853 if (this->title)1854 delete []this->title;1855 this->title = new char [strlen(title)+1];1856 strcpy(this->title, title);1857 1743 } 1858 1744 … … 1913 1799 Image::~Image(void) 1914 1800 { 1915 this->destroy();1916 }1917 1918 /**1919 \brief Initializes a new Image1920 */1921 void Image::init(void)1922 {1923 isOption = 0;1924 1925 static_cast<Widget*>(this)->init();1926 }1927 1928 /**1929 \brief Destroys a Image.1930 */1931 void Image::destroy(void)1932 {1933 1801 if (this->title) 1934 1802 PRINTF(3)("deleting the Image: %s\n", this->title); 1935 1803 else 1936 1804 PRINTF(3)("deleting the Image.\n"); 1937 1938 static_cast<Widget*>(this)->destroy(); 1939 } 1940 1941 /** 1942 \brief Sets a ned Title to the Image. 1943 \param title The now title of the OptionLabel. 1944 */ 1945 void Image::setTitle(char* title) 1946 { 1947 if (this->title) 1948 delete []this->title; 1949 this->title = new char [strlen(title)+1]; 1950 strcpy(this->title, title); 1951 } 1805 } 1806 1807 /** 1808 \brief Initializes a new Image 1809 */ 1810 void Image::init(void) 1811 { 1812 isOption = 0; 1813 } -
orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.h
r3605 r3746 39 39 40 40 public: 41 Widget(void); 41 42 virtual ~Widget(void); 42 void init(void);43 void destroy(void);44 43 45 44 void show(void); 46 45 void hide(void); 47 46 void setSize(int width, int height); 48 virtual void setTitle(c har* title) = 0; //!< An abstract Function, that sets the title of Widgets.47 virtual void setTitle(const char* title); //!< An abstract Function, that sets the title of Widgets. 49 48 50 49 Widget* findWidgetByName(char* name, unsigned int depth); … … 90 89 { 91 90 public: 91 Packer(void); 92 virtual ~Packer(void); 93 92 94 Widget* down; //!< this points to the Widget below this. 93 95 char* groupName; //!< For each Packer you can specify a Groupname under which the lowerWidgets will be saved. 94 95 void init(void);96 void destroy(void);97 96 98 97 void setGroupName(char* name); … … 115 114 116 115 public: 117 void init(void); 118 void destroy(void); 119 116 Container(void); 117 virtual ~Container(void); 120 118 // void setBorderWidth(int borderwidth); 121 // virtual void setTitle(char* title) = 0;122 119 void fill(Widget* lowerWidget); 123 120 }; … … 138 135 Window(void); 139 136 Window(char* windowName); 140 ~Window(void); 141 void init(void); 142 void destroy(void); 143 144 void setTitle(char* title); 137 virtual ~Window(void); 138 void init(void); 139 140 void setTitle(const char* title); 145 141 void showall(void); 146 142 void open(void); … … 164 160 Frame(void); 165 161 Frame(char* frameName); 166 ~Frame(void); 167 void init(void); 168 void destroy(void); 169 170 void setTitle(char* title); 162 virtual ~Frame(void); 163 void init(void); 164 165 void setTitle(const char* title); 171 166 }; 172 167 … … 180 175 EventBox(void); 181 176 EventBox(char* eventBoxName); 182 ~EventBox(void); 183 void init(void); 184 void destroy(void); 185 186 void setTitle(char* title); 177 virtual ~EventBox(void); 178 void init(void); 187 179 }; 188 180 … … 198 190 Box(void); 199 191 Box(char boxtype); 200 ~Box(void);192 virtual ~Box(void); 201 193 void init(char boxtype); 202 void destroy(void);203 194 204 195 void fill(Widget* lowerWidget); 205 206 void setTitle(char* title);207 196 }; 208 197 … … 217 206 218 207 public: 219 void init(void); 220 void destroy(void); 208 Option(void); 209 virtual ~Option(void); 210 void init(void); 221 211 222 212 int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume … … 227 217 void saveability(void); 228 218 void saveability(bool isSaveable); 219 virtual char* save(void); 220 virtual void load(char* loadString); 221 229 222 bool isSaveable(void); 230 223 void setFlagName(char* flagname, int defaultvalue); … … 246 239 public: 247 240 Button(char* buttonname); 248 ~Button(void); 249 void init(void); 250 void destroy(void); 251 252 void setTitle(char* title); 241 virtual ~Button(void); 242 void init(void); 243 244 void setTitle(const char* title); 253 245 void redraw(void); 254 246 void changeOption(void); … … 262 254 public: 263 255 CheckButton(char* buttonname); 264 ~CheckButton(void); 265 void init(void); 266 void destroy(void); 267 268 void setTitle(char* title); 256 virtual ~CheckButton(void); 257 void init(void); 258 259 void setTitle(const char* title); 269 260 bool isActive(void); //!< a Bool value to see, if this CheckButton is active. 270 261 void redraw(void); … … 283 274 public: 284 275 Slider(char* slidername, int start, int end); 285 ~Slider(void);276 virtual ~Slider(void); 286 277 void init(int start, int end); 287 void destroy(void); 288 289 void setTitle(char* title); 278 290 279 void setValue(int value); 291 280 void redraw(void); … … 299 288 #ifdef HAVE_GTK2 300 289 GtkWidget* menu; //!< The menu That will hold the Options. 301 GtkWidget* item; //!< One Item From a Menu. 302 #endif /* HAVE_GTK2 */ 303 va_list itemlist; //!< The list to readin multiple Options. 304 305 public: 290 #endif /* HAVE_GTK2 */ 291 292 //! A struct to handle the MenuItems 293 struct MenuItem 294 { 295 char* name; //!< The name of this entry. 296 int itemNumber; //!< The n'th entry of this menu; 297 #ifdef HAVE_GTK2 298 GtkWidget* item; //!< One Item From a Menu. 299 #endif /* HAVE_GTK2 */ 300 MenuItem* next; //!< Pointer to the next MenuItem. 301 }; 302 MenuItem* firstItem; //!< Pointer to the first Item. 303 MenuItem* currItem; //!< Pointer to the current Item. 304 305 public: 306 Menu(const char* menuName); 306 307 Menu(char* menuname, ...); 307 ~Menu(void); 308 void init(void); 309 void destroy(void); 310 311 void setTitle(char* title); 308 virtual ~Menu(void); 309 void init(void); 310 311 virtual char* save(void); 312 virtual void load(char* loadString); 313 312 314 void addItem(char* itemName); 313 315 void redraw(void); … … 322 324 public: 323 325 OptionLabel(char* label, char* value); 324 ~OptionLabel(void); 325 void init(void); 326 void destroy(void); 327 326 virtual ~OptionLabel(void); 327 void init(void); 328 328 329 329 void setValue(char* newValue); 330 void setTitle(char* title); 330 331 virtual char* save(void); 332 virtual void load(char* loadString); 333 331 334 void redraw(void); 332 335 void changeOption(void); … … 342 345 Label(void); 343 346 Label(char* text); 344 ~Label(void); 345 void init(void); 346 void destroy(void); 347 virtual ~Label(void); 348 void init(void); 347 349 348 350 void setTitle(char* text); … … 359 361 ProgressBar(void); 360 362 ProgressBar(char* label); 361 ~ProgressBar(void); 362 void init(void); 363 void destroy(void); 364 365 void setTitle(char* title); 363 virtual ~ProgressBar(void); 364 void init(void); 365 366 366 void setProgress(double progress); 367 367 void setTotalSize(double totalSize); … … 385 385 public: 386 386 Image(char* imgaename); 387 ~Image(void); 388 void init(void); 389 void destroy(void); 390 391 void setTitle(char* title); 387 virtual ~Image(void); 388 void init(void); 392 389 }; 393 390 -
orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.cc
r3499 r3746 27 27 #include "orxonox_gui_video.h" 28 28 29 #include "glincl.h" 30 29 31 /** 30 32 \brief Creates the Video-Option-Frame … … 40 42 this->fullscreen->saveability(); 41 43 this->videoBox->fill(this->fullscreen); 42 this->resolution = new Menu("Resolution", "640x480", "800x600", "1024x768", "1280x1024", "1400x1050", "1600x1200", "1920x1200", "lastItem"); 44 this->resolution = new Menu("Resolution"); 45 this->getResolutions(this->resolution); 43 46 this->resolution->saveability(); 44 47 this->videoBox->fill(this->resolution); … … 146 149 } 147 150 151 void OrxonoxGuiVideo::getResolutions(Menu* menu) 152 { 153 SDL_Init(SDL_INIT_VIDEO); 154 SDL_Rect **modes; 155 int i; 156 int x = 0,y =0; // check for difference 157 char tmpChar[100]; 158 159 /* Get available fullscreen/hardware modes */ 160 modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); 161 162 /* Check is there are any modes available */ 163 if(modes == (SDL_Rect **)0){ 164 PRINTF(2)("No video-modes available!\n"); 165 exit(-1); 166 } 167 168 /* Check if our resolution is restricted */ 169 if(modes == (SDL_Rect **)-1){ 170 PRINTF(2)("All resolutions available.\n"); 171 } 172 else{ 173 /* Print valid modes */ 174 PRINT(4)("Available Modes\n"); 175 for(i = 0; modes[i] ;++i) 176 { 177 if (x != modes[i]->w || y != modes[i]->h) 178 { 179 PRINT(4)(" %d x %d\n", modes[i]->w, modes[i]->h); 180 sprintf(tmpChar, "%dx%d", modes[i]->w, modes[i]->h); 181 menu->addItem(tmpChar); 182 x = modes[i]->w; y = modes[i]->h; 183 } 184 } 185 } 186 SDL_Quit(); 187 } -
orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.h
r3499 r3746 45 45 OrxonoxGuiVideo(void); 46 46 ~OrxonoxGuiVideo(void); 47 48 Widget* getWidget(void); 49 50 void getResolutions(Menu* menu); 47 51 48 Widget* getWidget(void); 52 49 53 }; 50 54 #endif /* _ORXONOX_GUI_VIDEO_H */ -
orxonox/branches/levelloader/src/lib/lang/base_object.cc
r3605 r3746 18 18 19 19 #include "base_object.h" 20 #include "stdincl.h" 20 21 21 22 … … 29 30 { 30 31 this->className = NULL; 32 this->finalized = false; 31 33 } 32 34 … … 57 59 return true; 58 60 } 61 62 /* 63 bool BaseObject::isFinalized() 64 { 65 66 } 67 */ 68 69 void BaseObject::finalize() 70 { 71 this->finalized = true; 72 } -
orxonox/branches/levelloader/src/lib/lang/base_object.h
r3605 r3746 21 21 bool isA (char* className); 22 22 23 inline bool isFinalized() { return this->finalized; } 24 void finalize(); 25 23 26 private: 24 27 char* className; 25 28 bool finalized; 26 29 }; 27 30 -
orxonox/branches/levelloader/src/lib/math/vector.cc
r3605 r3746 65 65 float Vector::operator* (const Vector& v) const 66 66 { 67 return x *v.x+y*v.y+z*v.z;67 return x * v.x + y * v.y+ z * v.z; 68 68 } 69 69 -
orxonox/branches/levelloader/src/lib/util/list.h
r3605 r3746 46 46 }; 47 47 48 class Iterator 49 { 50 48 49 50 template<class T> struct listElement 51 { 52 listElement* prev; 53 T* curr; 54 listElement* next; 55 }; 56 57 template<class T> class tIterator 58 { 51 59 public: 52 bool hasNext(); 53 WorldEntity* next(); 60 tIterator(listElement<T>* startElement); 61 ~tIterator(); 62 63 T* nextElement(); 54 64 55 65 private: 56 57 }; 66 listElement<T>* currentEl; 67 listElement<T>* tmpEl; 68 }; 69 70 71 template<class T> 72 inline tIterator<T>::tIterator (listElement<T>* startElement) 73 { 74 this->currentEl = startElement; 75 this->tmpEl = NULL; 76 } 77 78 79 template<class T> 80 tIterator<T>::~tIterator () 81 { 82 this->currentEl = NULL; 83 } 84 85 86 template<class T> 87 inline T* tIterator<T>::nextElement () 88 { 89 if( this->currentEl == NULL) 90 return NULL; 91 92 this->tmpEl = this->currentEl; 93 this->currentEl = this->currentEl->next; 94 return this->tmpEl->curr; 95 } 96 58 97 59 98 60 99 template<class T> class tList 61 100 { 62 private:63 struct listElement64 {65 listElement* prev;66 T* curr;67 listElement* next;68 };69 70 Uint32 size;71 listElement* first;72 listElement* last;73 listElement* currentEl;74 75 101 public: 76 102 tList (); 77 103 ~tList (); 78 79 104 80 105 void add(T* entity); … … 85 110 int getSize(); 86 111 T* enumerate(); 112 tIterator<T>* getIterator(); 87 113 T* nextElement(); 88 114 T* nextElement(T* toEntity); 89 115 T* toArray(); 90 116 void debug(); 117 118 private: 119 Uint32 size; 120 listElement<T>* first; 121 listElement<T>* last; 122 listElement<T>* currentEl; 91 123 }; 92 124 … … 106 138 while(this->currentEl != NULL) 107 139 { 108 listElement * le = this->currentEl->next;140 listElement<T>* le = this->currentEl->next; 109 141 //delete this->currentEl->curr; 110 142 delete this->currentEl; … … 118 150 119 151 template<class T> 120 void tList<T>::add(T* entity)152 inline void tList<T>::add(T* entity) 121 153 { 122 154 if( entity == NULL) return; 123 listElement * el = new listElement;155 listElement<T>* el = new listElement<T>; 124 156 el->prev = this->last; 125 157 el->curr = entity; … … 135 167 136 168 template<class T> 137 void tList<T>::remove(T* entity)169 inline void tList<T>::remove(T* entity) 138 170 { 139 171 if( entity == NULL) return; 140 172 this->currentEl = this->first; 141 listElement * te;173 listElement<T>* te; 142 174 while( this->currentEl != NULL) 143 175 { … … 150 182 else this->currentEl->next->prev = this->currentEl->prev; 151 183 152 te = this->currentEl->next; // for what am i doing this?184 //te = this->currentEl->next; // for what am i doing this? 153 185 delete this->currentEl; 154 this->currentEl = te; 186 //this->currentEl = te; 187 this->currentEl = NULL; 155 188 this->size--; 156 189 return; … … 167 200 while(this->currentEl != NULL) 168 201 { 169 listElement * le = this->currentEl->next;202 listElement<T>* le = this->currentEl->next; 170 203 //delete this->currentEl->curr; 171 204 delete this->currentEl; … … 203 236 { 204 237 //if( this->last == this->first == NULL) return NULL; 205 if( this->size == 0) return NULL;238 if( this->size == 0) return NULL; 206 239 this->currentEl = this->first; 207 240 return this->currentEl->curr; … … 210 243 211 244 template<class T> 245 inline tIterator<T>* tList<T>::getIterator() 246 { 247 tIterator<T>* iterator = new tIterator<T>(this->first); 248 return iterator; 249 } 250 251 252 template<class T> 212 253 T* tList<T>::nextElement() 213 254 { 214 255 // if( this->last == this->first == NULL) return NULL; 215 if( this->size == 0) return NULL;256 if( this->size == 0) return NULL; 216 257 this->currentEl = this->currentEl->next; 217 if( this->currentEl == NULL) return NULL;258 if( this->currentEl == NULL) return NULL; 218 259 return this->currentEl->curr; 219 260 } -
orxonox/branches/levelloader/src/lib/util/resource_manager.cc
r3742 r3746 391 391 \param directoryName the Directory to check for 392 392 \returns true if it is a directory/symlink false otherwise 393 \todo implement for win32 usage too 394 \bug does return false by default on win32 393 395 */ 394 396 bool ResourceManager::isDir(const char* directoryName) 395 397 { 398 #ifdef __WIN32__ 399 return false; 400 #elif 396 401 struct stat status; 397 402 stat(directoryName, &status); … … 400 405 else 401 406 return false; 407 #endif 402 408 } 403 409 … … 406 412 \param fileName the File to check for 407 413 \returns true if it is a regular file/symlink, false otherwise 414 \todo implement fo win32 usage too 415 \bug does return false by default on win32 408 416 */ 409 417 bool ResourceManager::isFile(const char* fileName) 410 418 { 419 #ifdef __WIN32__ 420 return false; 421 #elif 411 422 struct stat status; 412 423 stat(fileName, &status); … … 415 426 else 416 427 return false; 428 #endif 417 429 } 418 430
Note: See TracChangeset
for help on using the changeset viewer.