Changeset 659 for code/branches/FICN/src
- Timestamp:
- Dec 20, 2007, 4:10:08 PM (17 years ago)
- Location:
- code/branches/FICN/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/audio/CMakeLists.txt
r536 r659 12 12 INCLUDE_DIRECTORIES(..) 13 13 14 ADD_LIBRARY(audio ${SRC_FILES})14 ADD_LIBRARY(audio SHARED ${SRC_FILES}) 15 15 16 16 TARGET_LINK_LIBRARIES(audio ${OPENAL_LIBRARY} ${ALUT_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY}) -
code/branches/FICN/src/loader/LevelLoader.cc
r655 r659 26 26 */ 27 27 28 #include <string>29 #include <vector>30 #include <iostream>28 // #include <string> 29 // #include <vector> 30 // #include <iostream> 31 31 #include <algorithm> 32 32 #include <iterator> … … 35 35 36 36 #include "LevelLoader.h" 37 #include "tinyxml/tinyxml.h"37 // #include "tinyxml/tinyxml.h" 38 38 #include "orxonox/core/CoreIncludes.h" 39 39 #include "orxonox/core/Error.h" … … 152 152 { 153 153 tNode = 0; 154 //FIXME something is worng, probably == 154 155 while( tNode = audioElem->IterateChildren( tNode ) ) 155 156 { … … 199 200 mLoadOverlay->hide(); 200 201 } 201 202 202 203 203 204 COUT(0) << "Loading finished!\n\n\n\n\n"; 204 205 } … … 211 212 212 213 213 string LevelLoader::name()214 {215 return this->name_;216 }217 218 string LevelLoader::description()219 {220 return this->description_;221 }222 223 string LevelLoader::image()224 {225 return this->image_;226 }227 228 214 229 215 } -
code/branches/FICN/src/loader/LevelLoader.h
r525 r659 2 2 * Orxonox - www.orxonox.net 3 3 * Level Loader class 4 * 4 * 5 5 * @author Nicolas Perrenoud <nicolape@ee.ethz.ch> 6 6 */ … … 22 22 namespace loader 23 23 { 24 class _LoaderExport LevelLoader 25 { 26 public: 27 // Constructors, loads the level file and some information data 28 LevelLoader(string file, string dir="levels"); 29 // Destructor 30 ~LevelLoader(); 31 // Loads all level data 32 void loadLevel(); 33 34 // Getters 35 string name(); 36 string description(); 37 string image(); 38 private: 39 // Level information 40 std::string name_; 41 std::string description_; 42 std::string image_; 43 std::string loadingBackgroundColor_; 44 std::string loadingBackgroundImage_; 45 std::string loadingBarImage_; 46 std::string loadingBarTop_; 47 std::string loadingBarLeft_; 48 std::string loadingBarWidth_; 49 std::string loadingBarHeight_; 50 51 // Set to true if it was possible to load the level file 52 bool valid_; 53 54 // Xml-Stuff 55 TiXmlDocument doc; 56 TiXmlElement* rootElement; 24 class _LoaderExport LevelLoader 25 { 26 public: 27 // Constructors, loads the level file and some information data 28 LevelLoader(string file, string dir="levels"); 29 // Destructor 30 ~LevelLoader(); 31 // Loads all level data 32 void loadLevel(); 57 33 58 59 }; 34 // Getters 35 inline string name() {return name_; }; 36 inline string description() {return description_; }; 37 inline string image() {return image_; }; 38 private: 39 // Level information 40 std::string name_; 41 std::string description_; 42 std::string image_; 43 std::string loadingBackgroundColor_; 44 std::string loadingBackgroundImage_; 45 std::string loadingBarImage_; 46 std::string loadingBarTop_; 47 std::string loadingBarLeft_; 48 std::string loadingBarWidth_; 49 std::string loadingBarHeight_; 50 51 // Set to true if it was possible to load the level file 52 bool valid_; 53 54 // Xml-Stuff 55 TiXmlDocument doc; 56 TiXmlElement* rootElement; 57 58 59 }; 60 60 } 61 61 #endif -
code/branches/FICN/src/misc/String2Number.h
r592 r659 9 9 10 10 /** 11 * String to number conversion 12 * 13 * This class converts a number inside a std::string 14 * into a numeric type number (int,float,double) 15 * Number in string can be decimal, hexadecimal or octal 16 * 17 * @author Nicolas Perrenoud<nicolape@ee.ethz.ch> 18 * 19 * @example 20 * float f; 21 * String2Number<float>(f, std::string(" 123.45 ")); 22 */ 11 * String to number conversion 12 * 13 * This class converts a number inside a std::string 14 * into a numeric type number (int,float,double) 15 * Number in string can be decimal, hexadecimal or octal 16 * 17 * @author Nicolas Perrenoud<nicolape@ee.ethz.ch> 18 * 19 * @example 20 * float f; 21 * String2Number<float>(f, std::string(" 123.45 ")); 22 */ 23 23 24 template <class T> 24 25 class String2Number 25 26 { 26 private: 27 bool success_; 28 public: 29 /** 30 * Constructor 31 * 32 * First value is the target variable, the second vector is the 33 * string where the number is taken from, the third parameter 34 * should be one of std::hex, std::dec or std::oct (dec is default value) 35 */ 36 inline String2Number(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&) = std::dec, int haltOnError=1) 37 { 38 std::istringstream iss(s); 39 success_ = !(iss >> f >> t).fail(); 27 private: 28 bool success_; 40 29 41 if (!success_ && haltOnError==1) 42 { 43 COUT(1) << "Error: Conversion from string to number in \"" << s << "\" failed." << std::endl; 44 exit(1); 45 } 46 } 30 public: 31 /** 32 * Constructor 33 * 34 * First value is the target variable, the second vector is the 35 * string where the number is taken from, the third parameter 36 * should be one of std::hex, std::dec or std::oct (dec is default value) 37 */ 38 inline String2Number(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&) = std::dec, int haltOnError=1) 39 { 40 std::istringstream iss(s); 41 success_ = !(iss >> f >> t).fail(); 42 43 if (!success_ && haltOnError==1) 44 { 45 COUT(1) << "Error: Conversion from string to number in \"" << s << "\" failed." << std::endl; 46 exit(1); 47 } 48 } 47 49 }; 48 50 -
code/branches/FICN/src/misc/Tokenizer.h
r612 r659 6 6 7 7 /** 8 * String tokenizer9 *10 * Splits a given string into several smaller strings11 * using a delmiter (default is the comma).12 * Returns the result as a vector<string> object13 *14 * @author Nicolas Perrenoud<nicolape@ee.ethz.ch>15 */8 * String tokenizer 9 * 10 * Splits a given string into several smaller strings 11 * using a delmiter (default is the comma). 12 * Returns the result as a vector<string> object 13 * 14 * @author Nicolas Perrenoud<nicolape@ee.ethz.ch> 15 */ 16 16 17 17 inline std::vector<std::string> tokenize(const std::string& str, const std::string& delimiters = ",") -
code/branches/FICN/src/network/CMakeLists.txt
r592 r659 42 42 TARGET_LINK_LIBRARIES(network ${ZLIB_LIBRARY} ${ENet_LIBRARY} ${Boost_thread_LIBRARIES}) 43 43 44 # chatserver for testing purposes 44 45 ADD_EXECUTABLE(chatserver ${CHATSERVER_SRC_FILES}) 45 46 TARGET_LINK_LIBRARIES( chatserver … … 53 54 ) 54 55 56 # chatclient for testing purpose 55 57 ADD_EXECUTABLE(chatclient ${CHATCLIENT_SRC_FILES}) 56 58 TARGET_LINK_LIBRARIES( chatclient … … 64 66 ) 65 67 68 # client for testing purpose 66 69 ADD_EXECUTABLE(client dummyclient2.cc) 67 70 TARGET_LINK_LIBRARIES( client … … 75 78 ) 76 79 80 # server for testing purpose 77 81 ADD_EXECUTABLE(server dummyserver.cc) 78 82 TARGET_LINK_LIBRARIES( server -
code/branches/FICN/src/orxonox/hud/HUD.cc
r618 r659 9 9 10 10 namespace hud { 11 11 HUD::HUD( void ) { 12 12 13 13 init(); 14 14 15 15 setTime(99,55); 16 16 17 18 19 20 17 setTargetWindowName("HURRA"); 18 setTargetWindowDistance(12); 19 setTargetWindowStatus("Dead"); 20 setTargetWindowDistance(30); 21 21 22 22 setEnergyValue(60.0); 23 23 24 25 26 27 24 setShieldLeftTopValue(true); 25 setShieldRightTopValue(false); 26 setShieldLeftBottomValue(false); 27 setShieldRightBottomValue(true); 28 28 29 30 31 32 29 setRocket1(11); 30 setRocket2(22); 31 setRocket3(33); 32 setRocket4(44); 33 33 34 34 setEnergyDistr(33,33,34); 35 35 36 setPrimar(3); 36 setPrimar(3); 37 38 energyDistrPixelX_ = 100; 39 energyDistrPixelY_ = 86; 40 41 } 42 43 44 HUD::~HUD( void ){ 45 46 } 47 48 void HUD::setTime(int i, int j){ 49 timeMin_=i; 50 timeSec_=j; 51 timeText_->setCaption(StringConverter::toString(timeMin_) + ":" + StringConverter::toString(timeSec_)); 52 } 53 54 void HUD::setTargetWindowName(String i){ 55 targetWindowName_=i; 56 targetWindowNameText_->setCaption( targetWindowName_ ); 57 } 58 59 void HUD::setTargetWindowStatus(String i){ 60 targetWindowStatus_=i; 61 targetWindowStatusText_->setCaption( targetWindowStatus_ ); 62 } 63 64 void HUD::setTargetWindowDistance(int i){ 65 targetWindowDistance_=i; 66 targetWindowDistanceText_->setCaption(StringConverter::toString(targetWindowDistance_) + "km" ); 67 } 68 69 void HUD::setTargetWindowHitRating(int i){ 70 targetWindowHitRating_=i; 71 targetWindowHitRatingText_->setCaption(StringConverter::toString(targetWindowHitRating_) + "%" ); 72 } 73 74 void HUD::setEnergyValue(int i){ 75 energyValue_=i; 76 energyLength_->setWidth((int)((float)energyValue_/(float)100*200)); 77 } 78 79 void HUD::setShieldLeftTopValue(bool i){ 80 shieldLeftTopValue_=i; 81 if (shieldLeftTopValue_) shieldLeftTop_->show(); 82 else shieldLeftTop_->hide(); 83 } 84 85 void HUD::setShieldRightTopValue(bool i){ 86 shieldRightTopValue_=i; 87 if (shieldRightTopValue_) shieldRightTop_->show(); 88 else shieldRightTop_->hide(); 89 } 90 91 void HUD::setShieldLeftBottomValue(bool i){ 92 shieldLeftBottomValue_=i; 93 if (shieldLeftBottomValue_) shieldLeftBottom_->show(); 94 else shieldLeftBottom_->hide(); 95 } 96 97 void HUD::setShieldRightBottomValue(bool i){ 98 shieldRightBottomValue_=i; 99 if (shieldRightBottomValue_) shieldRightBottom_->show(); 100 else shieldRightBottom_->hide(); 101 } 102 103 void HUD::setRocket1(int i){ 104 rocket1_=i; 105 rocketNum1_->setCaption(StringConverter::toString(rocket1_)); 106 } 107 108 void HUD::setRocket2(int i){ 109 rocket2_=i; 110 rocketNum2_->setCaption(StringConverter::toString(rocket2_)); 111 } 112 113 void HUD::setRocket3(int i){ 114 rocket3_=i; 115 rocketNum3_->setCaption(StringConverter::toString(rocket3_)); 116 } 117 118 void HUD::setRocket4(int i){ 119 rocket4_=i; 120 rocketNum4_->setCaption(StringConverter::toString(rocket4_)); 121 } 122 123 void HUD::setEnergyDistr(float s, float e, float l){ 124 energyDistrShield_=s; 125 energyDistrEngine_=e; 126 energyDistrLaser_=l; 127 128 float energyDistrShieldInv_ = 100 - energyDistrShield_; 129 float energyDistrEngineInv_ = 100 - energyDistrEngine_; 130 float energyDistrLaserInv_ = 100 - energyDistrLaser_; 131 132 float energyDistrT_ = -energyDistrPixelX_/((energyDistrPixelX_-energyDistrPixelX_/2*energyDistrShieldInv_/(energyDistrShieldInv_+energyDistrEngineInv_))*energyDistrLaserInv_*(energyDistrShieldInv_+energyDistrEngineInv_)/energyDistrShieldInv_/(energyDistrLaserInv_+energyDistrEngineInv_)+energyDistrPixelX_/2+energyDistrPixelX_/2*energyDistrEngineInv_/(energyDistrEngineInv_+energyDistrLaserInv_)); 133 float energyDistrX_ = (-energyDistrPixelX_/2-energyDistrPixelX_/2*energyDistrEngineInv_/(energyDistrEngineInv_+energyDistrLaserInv_))*energyDistrT_; 134 float energyDistrY_ = energyDistrPixelY_+energyDistrPixelY_*energyDistrLaserInv_/(energyDistrLaserInv_+energyDistrEngineInv_)*energyDistrT_; 135 136 energyDistrPoint_->setLeft((int)energyDistrX_-3); 137 energyDistrPoint_->setTop((int)energyDistrY_-3); 138 139 } 140 141 void HUD::setPrimar(int i){ 142 primarValue_=i; 143 if(i==1){ 144 primarChoice_->setLeft(2); 145 primarChoice_->setWidth(48); 146 } 147 if(i==2){ 148 primarChoice_->setLeft(51); 149 primarChoice_->setWidth(49); 150 } 151 else{ 152 primarChoice_->setLeft(101); 153 primarChoice_->setWidth(48); 154 } 155 } 37 156 38 157 39 158 40 energyDistrPixelX_ = 100; 41 energyDistrPixelY_ = 86; 159 void HUD::init(void) 160 { 161 timeText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/Time/Text"); 42 162 43 } 163 targetWindowNameText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/Name"); 164 targetWindowDistanceText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/DistanceText"); 165 targetWindowStatusText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/StatusText"); 166 targetWindowHitRatingText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/HitRatingText"); 167 168 energyLength_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/EnergyBackground"); 169 170 shieldLeftTop_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldLeftTop"); 171 shieldRightTop_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldRightTop"); 172 shieldLeftBottom_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldLeftBottom"); 173 shieldRightBottom_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldRightBottom"); 174 175 rocketNum1_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum1"); 176 rocketNum2_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum2"); 177 rocketNum3_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum3"); 178 rocketNum4_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum4"); 179 180 float energyDistrPixelX_ = 100; 181 float energyDistrPixelY_ = 86; 182 energyDistrPoint_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/EnergyDistrPoint"); 183 184 primarChoice_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/PrimarChoice"); 44 185 45 186 46 HUD::~HUD( void ){ 47 48 } 49 50 void HUD::setTime(int i, int j){ 51 timeMin_=i; 52 timeSec_=j; 53 timeText_->setCaption(StringConverter::toString(timeMin_) + ":" + StringConverter::toString(timeSec_)); 54 55 } 56 void HUD::setTargetWindowName(String i){ 57 targetWindowName_=i; 58 targetWindowNameText_->setCaption( targetWindowName_ ); 59 60 } 61 void HUD::setTargetWindowStatus(String i){ 62 targetWindowStatus_=i; 63 targetWindowStatusText_->setCaption( targetWindowStatus_ ); 64 65 } 66 void HUD::setTargetWindowDistance(int i){ 67 targetWindowDistance_=i; 68 targetWindowDistanceText_->setCaption(StringConverter::toString(targetWindowDistance_) + "km" ); 69 70 } 71 void HUD::setTargetWindowHitRating(int i){ 72 targetWindowHitRating_=i; 73 targetWindowHitRatingText_->setCaption(StringConverter::toString(targetWindowHitRating_) + "%" ); 74 75 } 76 void HUD::setEnergyValue(int i){ 77 energyValue_=i; 78 energyLength_->setWidth((int)((double)energyValue_/(double)100*200)); 79 } 80 void HUD::setShieldLeftTopValue(bool i){ 81 shieldLeftTopValue_=i; 82 if (shieldLeftTopValue_) shieldLeftTop_->show(); 83 else shieldLeftTop_->hide(); 84 } 85 void HUD::setShieldRightTopValue(bool i){ 86 shieldRightTopValue_=i; 87 if (shieldRightTopValue_) shieldRightTop_->show(); 88 else shieldRightTop_->hide(); 89 } 90 void HUD::setShieldLeftBottomValue(bool i){ 91 shieldLeftBottomValue_=i; 92 if (shieldLeftBottomValue_) shieldLeftBottom_->show(); 93 else shieldLeftBottom_->hide(); 94 } 95 void HUD::setShieldRightBottomValue(bool i){ 96 shieldRightBottomValue_=i; 97 if (shieldRightBottomValue_) shieldRightBottom_->show(); 98 else shieldRightBottom_->hide(); 99 } 100 void HUD::setRocket1(int i){ 101 rocket1_=i; 102 rocketNum1_->setCaption(StringConverter::toString(rocket1_)); 103 } 104 void HUD::setRocket2(int i){ 105 rocket2_=i; 106 rocketNum2_->setCaption(StringConverter::toString(rocket2_)); 107 } 108 void HUD::setRocket3(int i){ 109 rocket3_=i; 110 rocketNum3_->setCaption(StringConverter::toString(rocket3_)); 111 } 112 void HUD::setRocket4(int i){ 113 rocket4_=i; 114 rocketNum4_->setCaption(StringConverter::toString(rocket4_)); 115 } 116 void HUD::setEnergyDistr(double s, double e, double l){ 117 energyDistrShield_=s; 118 energyDistrEngine_=e; 119 energyDistrLaser_=l; 120 121 double energyDistrShieldInv_ = 100 - energyDistrShield_; 122 double energyDistrEngineInv_ = 100 - energyDistrEngine_; 123 double energyDistrLaserInv_ = 100 - energyDistrLaser_; 124 125 double energyDistrT_ = -energyDistrPixelX_/((energyDistrPixelX_-energyDistrPixelX_/2*energyDistrShieldInv_/(energyDistrShieldInv_+energyDistrEngineInv_))*energyDistrLaserInv_*(energyDistrShieldInv_+energyDistrEngineInv_)/energyDistrShieldInv_/(energyDistrLaserInv_+energyDistrEngineInv_)+energyDistrPixelX_/2+energyDistrPixelX_/2*energyDistrEngineInv_/(energyDistrEngineInv_+energyDistrLaserInv_)); 126 double energyDistrX_ = (-energyDistrPixelX_/2-energyDistrPixelX_/2*energyDistrEngineInv_/(energyDistrEngineInv_+energyDistrLaserInv_))*energyDistrT_; 127 double energyDistrY_ = energyDistrPixelY_+energyDistrPixelY_*energyDistrLaserInv_/(energyDistrLaserInv_+energyDistrEngineInv_)*energyDistrT_; 128 129 energyDistrPoint_->setLeft((int)energyDistrX_-3); 130 energyDistrPoint_->setTop((int)energyDistrY_-3); 131 132 } 133 134 void HUD::setPrimar(int i){ 135 primarValue_=i; 136 if(i==1){ 137 primarChoice_->setLeft(2); 138 primarChoice_->setWidth(48); 139 } 140 if(i==2){ 141 primarChoice_->setLeft(51); 142 primarChoice_->setWidth(49); 143 } 144 else{ 145 primarChoice_->setLeft(101); 146 primarChoice_->setWidth(48); 147 } 148 } 149 150 151 152 void HUD::init(void) 153 { 154 timeText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/Time/Text"); 155 156 targetWindowNameText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/Name"); 157 targetWindowDistanceText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/DistanceText"); 158 targetWindowStatusText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/StatusText"); 159 targetWindowHitRatingText_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/TargetWindow/HitRatingText"); 160 161 energyLength_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/EnergyBackground"); 162 163 shieldLeftTop_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldLeftTop"); 164 shieldRightTop_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldRightTop"); 165 shieldLeftBottom_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldLeftBottom"); 166 shieldRightBottom_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/shieldRightBottom"); 167 168 rocketNum1_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum1"); 169 rocketNum2_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum2"); 170 rocketNum3_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum3"); 171 rocketNum4_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/RocketNum4"); 172 173 double energyDistrPixelX_ = 100; 174 double energyDistrPixelY_ = 86; 175 energyDistrPoint_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/EnergyDistrPoint"); 176 177 primarChoice_ = OverlayManager::getSingleton().getOverlayElement("Orxonox/HUD1.2/PrimarChoice"); 178 179 180 } 187 } 181 188 182 189 -
code/branches/FICN/src/orxonox/hud/HUD.h
r618 r659 19 19 private: 20 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 21 Ogre::OverlayElement* timeText_; 22 Ogre::OverlayElement* targetWindowNameText_; 23 Ogre::OverlayElement* targetWindowStatusText_; 24 Ogre::OverlayElement* targetWindowDistanceText_; 25 Ogre::OverlayElement* targetWindowHitRatingText_; 26 Ogre::OverlayElement* energyLength_; 27 Ogre::OverlayElement* shieldLeftTop_; 28 Ogre::OverlayElement* shieldRightTop_; 29 Ogre::OverlayElement* shieldLeftBottom_; 30 Ogre::OverlayElement* shieldRightBottom_; 31 Ogre::OverlayElement* rocketNum1_; 32 Ogre::OverlayElement* rocketNum2_; 33 Ogre::OverlayElement* rocketNum3_; 34 Ogre::OverlayElement* rocketNum4_; 35 Ogre::OverlayElement* energyDistrPoint_; 36 Ogre::OverlayElement* primarChoice_; 37 37 38 int timeMin_; 39 int timeSec_; 38 40 41 Ogre::String targetWindowName_; 42 Ogre::String targetWindowStatus_; 43 int targetWindowDistance_; 44 int targetWindowHitRating_; 39 45 46 int energyValue_; 40 47 48 bool shieldLeftTopValue_; 49 bool shieldRightTopValue_; 50 bool shieldLeftBottomValue_; 51 bool shieldRightBottomValue_; 41 52 42 int timeMin_; 43 int timeSec_; 53 int rocket1_; 54 int rocket2_; 55 int rocket3_; 56 int rocket4_; 44 57 45 Ogre::String targetWindowName_; 46 Ogre::String targetWindowStatus_; 47 int targetWindowDistance_; 48 int targetWindowHitRating_; 58 float energyDistrShield_; 59 float energyDistrEngine_; 60 float energyDistrLaser_; 49 61 50 int energyValue_; 62 float energyDistrPixelX_; 63 float energyDistrPixelY_; 51 64 52 bool shieldLeftTopValue_; 53 bool shieldRightTopValue_; 54 bool shieldLeftBottomValue_; 55 bool shieldRightBottomValue_; 65 int primarValue_; 56 66 57 int rocket1_; 58 int rocket2_;59 int rocket3_;60 int rocket4_;67 public: 68 HUD( void ); 69 ~HUD( void ); 70 void init( void ); 61 71 62 double energyDistrShield_; 63 double energyDistrEngine_; 64 double energyDistrLaser_; 65 66 double energyDistrPixelX_; 67 double energyDistrPixelY_; 68 69 int primarValue_; 70 71 72 73 74 75 76 public: 77 HUD( void ); 78 ~HUD( void ); 79 void init( void ); 80 81 void setTime(int i, int j); 82 void setTargetWindowName(Ogre::String i); 83 void setTargetWindowStatus(Ogre::String i); 84 void setTargetWindowDistance(int i); 85 void setTargetWindowHitRating(int i); 86 void setEnergyValue(int i); 87 void setShieldLeftTopValue(bool i); 88 void setShieldRightTopValue(bool i); 89 void setShieldLeftBottomValue(bool i); 90 void setShieldRightBottomValue(bool i); 91 void setRocket1(int i); 92 void setRocket2(int i); 93 void setRocket3(int i); 94 void setRocket4(int i); 95 void setEnergyDistr(double s, double e, double l); 96 void setPrimar(int i); 97 98 99 100 101 72 void setTime(int i, int j); 73 void setTargetWindowName(Ogre::String i); 74 void setTargetWindowStatus(Ogre::String i); 75 void setTargetWindowDistance(int i); 76 void setTargetWindowHitRating(int i); 77 void setEnergyValue(int i); 78 void setShieldLeftTopValue(bool i); 79 void setShieldRightTopValue(bool i); 80 void setShieldLeftBottomValue(bool i); 81 void setShieldRightBottomValue(bool i); 82 void setRocket1(int i); 83 void setRocket2(int i); 84 void setRocket3(int i); 85 void setRocket4(int i); 86 void setEnergyDistr(float s, float e, float l); 87 void setPrimar(int i); 102 88 103 89 }; 104 90 105 106 91 } 107 92 #endif -
code/branches/FICN/src/orxonox/particle/ParticleInterface.cc
r658 r659 43 43 namespace particle { 44 44 45 ParticleInterface::~ParticleInterface(void)46 {47 sceneManager_->destroyParticleSystem(particleSystem_);48 }49 50 45 ParticleInterface::ParticleInterface( SceneManager *sceneManager, String name, String templateName ) 51 46 { … … 62 57 numberOfEmitters_ = particleSystem_->getNumEmitters(); 63 58 standardizeEmitters(); 59 } 60 61 ParticleInterface::~ParticleInterface(void) 62 { 63 sceneManager_->destroyParticleSystem(particleSystem_); 64 64 } 65 65 … … 95 95 distance_ = d; 96 96 //partikel anpassen 97 for (int i=0; i <numberOfEmitters_; i++) {97 for (int i=0; i < numberOfEmitters_; i++) { 98 98 particleSystem_->getEmitter(i)->setTimeToLive(distance_); 99 99 } … … 104 104 colour_ = colour; 105 105 //partikel anpassen 106 for (int i=0; i <numberOfEmitters_; i++) {106 for (int i=0; i < numberOfEmitters_; i++) { 107 107 particleSystem_->getEmitter(i)->setColour(colour_); 108 108 } … … 111 111 ParticleEmitter* ParticleInterface::getEmitter( int emitterNr ) 112 112 { 113 if ( !(emitterNr<numberOfEmitters_)) return NULL;113 if ( (emitterNr >= numberOfEmitters_) || (emitterNr < 0) ) return NULL; 114 114 return particleSystem_->getEmitter(emitterNr); 115 115 } 116 116 117 void ParticleInterface::newEmitter ( void)117 void ParticleInterface::newEmitter () 118 118 { 119 119 particleSystem_->addEmitter(particleSystem_->getEmitter(0)->getType()); 120 numberOfEmitters_=numberOfEmitters_+1;121 particleSystem_->getEmitter(0)->copyParametersTo( particleSystem_->getEmitter(numberOfEmitters_-1) );120 particleSystem_->getEmitter(0)->copyParametersTo( particleSystem_->getEmitter(numberOfEmitters_) ); 121 numberOfEmitters_++; 122 122 } 123 123 -
code/branches/FICN/src/orxonox/particle/ParticleInterface.h
r658 r659 19 19 public: 20 20 21 22 21 ParticleInterface( Ogre::SceneManager *sceneManager, Ogre::String name, Ogre::String templateName ); 22 ~ParticleInterface( void ); 23 23 24 24 void inline addToSceneNode( Ogre::SceneNode* sceneNode ) { sceneNode_ = sceneNode; sceneNode_->attachObject(particleSystem_);}; 25 25 void inline detachFromSceneNode( void ) { sceneNode_->detachObject(particleSystem_); sceneNode_ = NULL;}; 26 26 27 28 27 Ogre::ParticleEmitter* getEmitter ( int emitterNr ); 28 void newEmitter ( void ); 29 29 30 30 Ogre::Vector3 getPositionOfEmitter ( int emitterNr ); … … 32 32 33 33 inline Ogre::Vector3 getDirection ( void ) { return particleSystem_->getEmitter(0)->getDirection(); }; 34 34 void setDirection ( Ogre::Vector3 direction ); 35 35 36 37 36 inline Ogre::Real getVelocity() {return velocity_; }; 37 void setVelocity( Ogre::Real v ); 38 38 39 40 39 inline int getRate() { return rate_; }; 40 void setRate( int r ); 41 41 42 43 42 inline Ogre::Real getDistance() { return distance_; }; 43 void setDistance( Ogre::Real d ); 44 44 45 46 45 inline Ogre::ColourValue getColour( void ) {return colour_;}; 46 void setColour( Ogre::ColourValue colour ); 47 47 48 void switchEnable( void);48 void switchEnable(); 49 49 50 inline Ogre::ParticleSystem* getParticleSystem() { return this->particleSystem_; };50 inline Ogre::ParticleSystem* getParticleSystem() { return this->particleSystem_; }; 51 51 52 52 private: 53 54 53 Ogre::SceneNode *sceneNode_; 54 Ogre::SceneManager *sceneManager_; 55 55 Ogre::ParticleSystem *particleSystem_; 56 57 58 59 60 56 Ogre::Real distance_; 57 Ogre::Real velocity_; 58 int rate_; 59 Ogre::ColourValue colour_; 60 int numberOfEmitters_; 61 61 62 62 void standardizeEmitters(); 63 63 }; 64 65 64 66 65 }
Note: See TracChangeset
for help on using the changeset viewer.