Changeset 10230 in orxonox.OLD for branches/playability/src
- Timestamp:
- Jan 10, 2007, 7:16:00 PM (18 years ago)
- Location:
- branches/playability/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/util/hud.cc
r10194 r10230 24 24 #include "glgui_widget.h" 25 25 #include "glgui_box.h" 26 #include "glgui_bar.h" 26 27 #include "elements/glgui_energywidgetvertical.h" 27 28 … … 51 52 this->shieldWidget = NULL; 52 53 this->armorWidget = NULL; 54 //this->leftRect = NULL; 55 //this->rightRect = NULL; 53 56 this->resX = 1; 54 57 this->resY = 1; 58 59 this->travelZoneWidth = 0.7; 55 60 56 61 this->inputLine = new OrxGui::GLGuiInputLine(); … … 115 120 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedName("Electronics"); 116 121 //this->shipValuesBox->pack(this->energyWidget); 122 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setStandardSettings(); 117 123 this->energyWidget->show(); 118 124 /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); … … 141 147 //this->shieldWidget->shiftDir2D(270); 142 148 //this->shipValuesBox->pack(this->shieldWidget); 149 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setStandardSettings(); 143 150 this->shieldWidget->show(); 144 151 /* this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); … … 169 176 //this->armorWidget->shiftDir2D(270); 170 177 //this->shipValuesBox->pack(this->armorWidget); 178 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->armorWidget)->setStandardSettings(); 171 179 this->armorWidget->show(); 172 180 /* this->armorWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); … … 187 195 { 188 196 weapon->getEnergyWidget()->hide(); 189 this->weaponsWidgets .remove(weapon->getEnergyWidget());197 this->weaponsWidgetsPrim.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); 190 198 } 191 199 } … … 200 208 { 201 209 weapon->getEnergyWidget()->hide(); 202 this->weaponsWidgets .remove(weapon->getEnergyWidget());210 this->weaponsWidgetsSec.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); 203 211 } 204 212 } … … 215 223 { 216 224 // hide all the Widgets 217 std::list<OrxGui::GLGui Widget*>::iterator weaponWidget;218 for (weaponWidget = this->weaponsWidgets .begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++)225 std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget; 226 for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++) 219 227 { 220 228 (*weaponWidget)->hide(); 221 229 } 222 this->weaponsWidgets.clear(); 230 this->weaponsWidgetsPrim.clear(); 231 232 for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++) 233 { 234 (*weaponWidget)->hide(); 235 } 236 this->weaponsWidgetsSec.clear(); 223 237 224 238 // add all that we need again. … … 234 248 weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); 235 249 //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6); 236 this->weaponsWidgets .push_back(weapon->getEnergyWidget());250 this->weaponsWidgetsPrim.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); 237 251 } 238 252 } … … 249 263 weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); 250 264 //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6); 251 this->weaponsWidgets .push_back(weapon->getEnergyWidget());265 this->weaponsWidgetsSec.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); 252 266 } 253 267 } … … 280 294 this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_00), Color(1, 0, 0)); 281 295 this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_01), Color(0, 0, 1)); 282 this->_radar->setAbsCoor2D(0 .8 * this->resX, 0.01 * this->resY);283 this->_radar->setWidgetSize(0. 2* this->resX, 0.2 * this->resY);296 this->_radar->setAbsCoor2D(0, 0.01 * this->resY); 297 this->_radar->setWidgetSize(0.18 * this->resX, 0.2 * this->resY); 284 298 this->_radar->setRange(300); 285 299 this->_radar->show(); 286 300 287 301 if (this->armorWidget != NULL) 288 this->armorWidget->setRelCoor2D( 0.1*this->resX,this->armorWidget->getSizeX2D());302 this->armorWidget->setRelCoor2D(100,0.2*this->resY + this->armorWidget->getSizeX2D()); 289 303 if (this->shieldWidget != NULL) 290 this->shieldWidget->setRelCoor2D( 0.1*this->resX + this->armorWidget->getSizeY2D(),this->armorWidget->getSizeX2D());304 this->shieldWidget->setRelCoor2D(60,0.2*this->resY + this->armorWidget->getSizeX2D()); 291 305 if (this->energyWidget != NULL) 292 this->energyWidget->setRelCoor2D( 0.1*this->resX + this->armorWidget->getSizeY2D() + this->shieldWidget->getSizeY2D(),this->armorWidget->getSizeX2D());306 this->energyWidget->setRelCoor2D(20,0.2*this->resY + this->armorWidget->getSizeX2D()); 293 307 //this->shieldWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D(),0); 294 308 //this->energyWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D() + this->shieldWidget->getSizeX2D(),0); … … 305 319 */ 306 320 307 std::list<OrxGui::GLGuiWidget*>::iterator weaponWidget; 308 Vector2D pos(0.3, .9); 309 for (weaponWidget = this->weaponsWidgets.begin(); weaponWidget != this->weaponsWidgets.end(); weaponWidget++, pos.x+=.1) 310 { 311 if (pos.x > .8) 312 { 313 pos.x = 0.3; 314 pos.y -= .1; 315 316 } 317 (*weaponWidget)->setAbsCoor2D(pos.x*this->resX, pos.y*this->resY); 318 (*weaponWidget)->setWidgetSize(.02*this->resX, .1 *this->resY); 321 std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget; 322 Vector2D pos(this->resX, 0.5*this->resY); 323 for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++) 324 { 325 if (pos.x < 0.9*resX) 326 { 327 pos.x = this->resX; 328 pos.y += 150; 329 } 330 pos.x -= 40; 331 (*weaponWidget)->setAbsCoor2D(pos.x, pos.y); 319 332 (*weaponWidget)->show(); 320 333 //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName()); 321 334 } 335 336 pos.y += 150; 337 pos.x = this->resX; 338 for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++) 339 { 340 if (pos.x < 0.9*resX) 341 { 342 pos.x = this->resX; 343 pos.y += 150; 344 } 345 pos.x -= 40; 346 (*weaponWidget)->setAbsCoor2D(pos.x, pos.y); 347 (*weaponWidget)->show(); 348 //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName()); 349 } 350 351 //if (this->rightRect == NULL) 352 322 353 } 323 354 -
branches/playability/src/util/hud.h
r10194 r10230 10 10 #include "event_listener.h" 11 11 #include "glgui_box.h" 12 #include "elements/glgui_energywidgetvertical.h" 12 13 13 14 … … 53 54 void updateWeaponManager(); 54 55 56 inline void setTravelZoneWidth(float width) 57 { 58 if (width > 1) width = 1; 59 else if (width < 0) width = 0; 60 61 this->travelZoneWidth = width; 62 }; 63 55 64 void draw() const; 56 65 virtual void process(const Event &event); … … 65 74 unsigned int resY; 66 75 76 float travelZoneWidth; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1; 77 67 78 OrxGui::GLGuiWidget* energyWidget; 68 79 OrxGui::GLGuiWidget* shieldWidget; 69 80 OrxGui::GLGuiWidget* armorWidget; 70 //OrxGui::GLGuiBox* shipValuesBox;71 81 72 82 OrxGui::GLGuiNotifier* notifier; … … 74 84 OrxGui::GLGuiRadar* _radar; 75 85 86 OrxGui::GLGuiWidget* rightRect, leftRect; 87 76 88 WeaponManager* weaponManager; 77 89 WeaponManager* weaponManagerSecondary; 78 90 79 std::list<OrxGui::GLGuiWidget*> weaponsWidgets; //!< WeaponWidgets will be displayed one after another 91 std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsPrim; //!< WeaponWidgets will be displayed one after another 92 std::list<OrxGui::GLGuiEnergyWidgetVertical*> weaponsWidgetsSec; 80 93 }; 81 94 -
branches/playability/src/world_entities/elements/glgui_energywidgetvertical.cc
r10200 r10230 30 30 GLGuiEnergyWidgetVertical::GLGuiEnergyWidgetVertical () 31 31 { 32 // this->setClassID(CL_PROTO_ID, "GLGuiEnergyWidget");33 34 //this->_bar.setSize2D(100, 30);35 //this->_bar.setRelCoor2D(-10,0);36 //this->_name.setRelCoor2D(20,0);37 //this->_valueText.setRelCoor2D(,0);38 this->setAbsDir2D(270);39 //std::cout << "absAngle: " << int(this->getAbsDir2D()) << ", relAngle: " << int(this->getRelDir2D()) << '\n';40 //this->setOrientation(OrxGui::Vertical);41 42 //this->pack(&this->_name);43 //this->pack(&this->_valueText);44 45 this->_image.setParent2D(this);46 this->_image.setBorderTop(0);47 this->_image.setBorderLeft(0);48 this->_image.setBorderRight(0);49 this->_image.setBorderBottom(0);50 this->_image.setWidgetSize(30,30);51 this->_image.setForegroundColor(Color(1,1,1,0.6));52 this->_image.setBackgroundColor(Color(1,1,1,0));53 this->_image.setBackgroundTexture(Texture());54 this->_image.loadImageFromFile("maps/evil-flower.png");55 //this->_image.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D());56 this->_image.setRelCoor2D(0,0);57 this->_image.setRelDir2D(90);58 this->_image.setVisibility(true);59 60 this->_valueText.setParent2D(this);61 this->_valueText.setWidgetSize(100,20);62 //this->_valueText.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D());63 this->_valueText.setRelCoor2D(0,0);64 this->_valueText.setChangedTextColor(Color::white);65 66 this->setBackgroundTexture(Texture());67 this->setBackgroundColor(Color(1,1,1,0.5));68 this->setBorderTop(10);69 this->setBorderLeft(10);70 this->setBorderRight(10);71 this->setBorderBottom(10);72 this->setWidgetSize(120,50);73 this->setVisibility(true);74 75 76 //this->_name.setBackgroundTexture(Texture());77 //this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");78 79 this->_bar.setParent2D(&this->_valueText);80 this->_bar.setBackgroundTexture(Texture());81 this->_bar.setBackgroundColor(Color(0,0,0,0));82 this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");83 this->_bar.setForegroundColor(Color(.5, .5, .5, 1));84 this->_bar.setChangedValueColor(Color::black);85 this->_bar.setBorderTop(0);86 this->_bar.setBorderLeft(0);87 this->_bar.setBorderRight(0);88 this->_bar.setBorderBottom(0);89 this->_bar.setWidgetSize(100,30);90 //this->_bar.setRelCoor2D(borderLeft(), 0);91 this->_bar.setRelCoor2D(0,0);92 32 } 93 33 … … 132 72 void GLGuiEnergyWidgetVertical::showing() 133 73 { 74 this->setAbsDir2D(270); 75 this->setBackgroundTexture(Texture()); 76 this->setBackgroundColor(Color(1,1,1,0)); 77 this->setBorderTop(10); 78 this->setBorderLeft(10); 79 this->setBorderRight(10); 80 this->setBorderBottom(10); 81 this->setWidgetSize(120,50); 82 83 this->_bar.setParent2D(&this->_valueText); 84 this->_bar.setBackgroundTexture(Texture()); 85 this->_bar.setBackgroundColor(Color(0,0,0,0)); 86 this->_bar.setForegroundTexture("maps/gui_element_background_faded.png"); 87 this->_bar.setForegroundColor(Color::green); 88 this->_bar.setChangedValueColor(Color(1,0,0,0.2)); 89 this->_bar.setBorderTop(0); 90 this->_bar.setBorderLeft(0); 91 this->_bar.setBorderRight(0); 92 this->_bar.setBorderBottom(0); 93 this->_bar.setWidgetSize(100,30); 94 //this->_bar.setRelCoor2D(borderLeft(), 0); 95 this->_bar.setRelCoor2D(0,0); 96 this->_bar.show(); 97 98 this->_image.setParent2D(this); 99 this->_image.setBorderTop(0); 100 this->_image.setBorderLeft(0); 101 this->_image.setBorderRight(0); 102 this->_image.setBorderBottom(0); 103 this->_image.setWidgetSize(30,30); 104 this->_image.setForegroundColor(Color(1,1,1,0.6)); 105 this->_image.setBackgroundColor(Color(1,1,1,0)); 106 this->_image.setBackgroundTexture(Texture()); 107 this->_image.loadImageFromFile("maps/evil-flower.png"); 108 //this->_image.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D()); 109 this->_image.setRelCoor2D(0,0); 110 this->_image.setRelDir2D(90); 111 this->_image.setVisibility(true); 134 112 this->_image.show(); 113 114 this->_valueText.setParent2D(this); 115 this->_valueText.setWidgetSize(100,20); 116 //this->_valueText.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D()); 117 this->_valueText.setRelCoor2D(0,0); 118 this->_valueText.setChangedTextColor(Color::black); 135 119 this->_valueText.show(); 136 this->_bar.show();137 //this->show();138 120 } 139 121 -
branches/playability/src/world_entities/elements/glgui_energywidgetvertical.h
r10200 r10230 27 27 void setDisplayedImage(const std::string& imageName); 28 28 29 inline GLGui Widget* getImageWidget() {return &this->_image;};30 inline GLGui Widget* getValueWidget() {return &this->_valueText;};31 inline GLGui Widget* getBarWidget() {return &this->_bar;};29 inline GLGuiImage* getImageWidget() {return &this->_image;}; 30 inline GLGuiText* getValueWidget() {return &this->_valueText;}; 31 inline GLGuiBar* getBarWidget() {return &this->_bar;}; 32 32 33 33 protected: -
branches/playability/src/world_entities/elements/glgui_radar.cc
r9019 r10230 122 122 this->_dotLists[i].positions.push_back(Vector2D(((*it)->getAbsCoor().x - _centerNode->getAbsCoor().x) * this->getSizeX2D() , 123 123 ((*it)->getAbsCoor().z - _centerNode->getAbsCoor().z) * this->getSizeY2D() ) 124 / ( 2.0f * _range));124 / (3.0f * _range)); 125 125 } 126 126 -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10224 r10230 34 34 35 35 #include "elements/glgui_energywidgetvertical.h" 36 #include "glgui_bar.h" 36 37 37 38 #include "particles/dot_emitter.h" … … 1054 1055 { //create the widget 1055 1056 this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 1057 this->electronicWidget->getBarWidget()->setChangedValueColor(Color(1,0,0,1)); 1056 1058 //this->electronicWidget->setDisplayedName("Electronics:"); 1057 1059 //this->electronicWidget->setSize2D(100,20); … … 1073 1075 { 1074 1076 this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 1077 this->shieldWidget->getBarWidget()->setChangedValueColor(Color(1,0,0,1)); 1075 1078 //this->shieldWidget->setDisplayedName("Shield:"); 1076 1079 //his->shieldWidget->setSize2D(100,20); -
branches/playability/src/world_entities/weapons/weapon.cc
r10229 r10230 33 33 #include "resource_sound_buffer.h" 34 34 35 #include "elements/glgui_energywidget .h"35 #include "elements/glgui_energywidgetvertical.h" 36 36 37 37 ObjectListDefinition(Weapon); … … 394 394 if (this->energyWidget == NULL) 395 395 { 396 this->energyWidget = new OrxGui::GLGuiEnergyWidget ();397 this->energyWidget->setDisplayedName(this->getClassCName());396 this->energyWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 397 //this->energyWidget->setDisplayedName(this->getClassCName()); 398 398 this->energyWidget->setSize2D( 20, 100); 399 399 this->energyWidget->setMaximum(this->getEnergyMax()); -
branches/playability/src/world_entities/weapons/weapon.h
r10152 r10230 233 233 float maxCharge; //!< The maximal energy to be loaded onto one projectile (this is only availible if chargeable is enabled) 234 234 235 OrxGui::GLGuiEnergyWidget * energyWidget;235 OrxGui::GLGuiEnergyWidgetVertical* energyWidget; 236 236 237 237 PNode* defaultTarget; //!< A target for targeting Weapons.
Note: See TracChangeset
for help on using the changeset viewer.