Changeset 10234 in orxonox.OLD for branches/playability/src
- Timestamp:
- Jan 12, 2007, 11:24:37 PM (18 years ago)
- Location:
- branches/playability/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/util/hud.cc
r10233 r10234 57 57 this->resY = 1; 58 58 59 this->overlayPercentage = 5;59 this->overlayPercentage = 40; 60 60 this->overlayActive = false; 61 this->rightRect = NULL;62 this->leftRect = NULL;61 this->rightRect = new OrxGui::GLGuiImage(); 62 this->leftRect = new OrxGui::GLGuiImage(); 63 63 64 64 this->inputLine = new OrxGui::GLGuiInputLine(); … … 126 126 //this->shipValuesBox->pack(this->energyWidget); 127 127 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setStandardSettings(); 128 this->energyWidget->setParent2D(this->leftRect); 128 129 this->energyWidget->show(); 129 130 /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); … … 153 154 //this->shipValuesBox->pack(this->shieldWidget); 154 155 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setStandardSettings(); 156 this->shieldWidget->setParent2D(this->leftRect); 155 157 this->shieldWidget->show(); 156 158 /* this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); … … 182 184 //this->shipValuesBox->pack(this->armorWidget); 183 185 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->armorWidget)->setStandardSettings(); 186 this->armorWidget->setParent2D(this->leftRect); 184 187 this->armorWidget->show(); 185 188 /* this->armorWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); … … 249 252 { 250 253 //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName()); 254 weapon->getEnergyWidget()->setParent2D(this->rightRect); 251 255 weapon->getEnergyWidget()->show(); 252 256 weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1)); 253 257 weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); 258 weapon->getEnergyWidget()->setWidgetSize(120,30); 254 259 //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6); 255 260 this->weaponsWidgetsPrim.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget())); … … 264 269 { 265 270 //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName()); 271 weapon->getEnergyWidget()->setParent2D(this->rightRect); 266 272 weapon->getEnergyWidget()->show(); 267 273 weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1)); … … 291 297 this->notifier->setWidgetSize(0.25 * this->resX, 0.6 * this->resY); 292 298 299 int overlayWidth = this->resX * (overlayPercentage)/(200); 300 this->rightRect->hide(); 301 this->leftRect->hide(); 302 303 this->leftRect->setParent2D(this); 304 this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY)); 305 this->leftRect->setAbsCoor2D(0,0); 306 this->leftRect->setBackgroundTexture(Texture()); 307 this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2)); 308 this->leftRect->setForegroundTexture(Texture()); 309 this->leftRect->setForegroundColor(Color(0,0,0,0)); 310 311 this->rightRect->setParent2D(this); 312 this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY)); 313 this->rightRect->setAbsCoor2D(this->resX - overlayWidth,0); 314 this->rightRect->setBackgroundTexture(Texture()); 315 this->rightRect->setBackgroundColor(Color(0,0,0.7,0.2)); 316 this->rightRect->setForegroundTexture(Texture()); 317 this->rightRect->setForegroundColor(Color(0,0,0,0)); 318 319 293 320 if (this->overlayActive == true) 294 321 { 295 if (this->rightRect == NULL) 296 this->rightRect = new OrxGui::GLGuiWidget(); 297 //if (this->leftRect == NULL) 298 //this->leftRect = new OrxGui::GLGuiWidget(); 299 300 int overlayWidth = this->resX * (100-overlayPercentage)/(200); 301 this->rightRect->hide(); 302 /* 303 this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY)); 304 this->leftRect->setAbsCoor2D(0,0); 305 this->leftRect->setBackgroundTexture(Texture()); 306 this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2)); 322 this->rightRect->show(); 307 323 this->leftRect->show(); 308 */309 310 311 this->rightRect->setParent2D(this);312 this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY));313 this->rightRect->setAbsCoor2D(this->resX - overlayWidth,this->resY);314 this->rightRect->setBackgroundTexture(Texture());315 this->rightRect->setBackgroundColor(Color(0,0,0.7,0.2));316 //this->rightRect->setForegroundTexture(Texture());317 //this->rightRect->setForegroundColor(Color(1,1,1,1));318 this->rightRect->show();319 320 324 } 321 325 … … 324 328 { 325 329 PRINTF(4)("UPDATING RADAR\n"); 330 this->_radar->setParent2D(this->leftRect); 326 331 this->_radar->setCenterNode(State::getPlayer()->getPlayable()); 327 332 //this->_radar->addEntityList(&State::getObjectManager()->getEntityList((OM_LIST)(State::getPlayer()->getPlayable()->getOMListNumber()+1)), Color(.4, .4, 1.0)); … … 354 359 355 360 std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget; 356 Vector2D pos(this->resX, 0.5*this->resY); 361 Vector2D pos(overlayWidth, 0.5*this->resY); 362 363 // out of reasons i can't get behind, this version is segfaulting when calling getSizeX2D or getSizeY2D. the other 364 // element2D- related function works tough.. :s 365 357 366 for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++) 358 367 { 359 if (pos.x < 0.9*resX)360 { 361 pos.x = this->resX;362 pos.y += 150;363 } 364 pos.x -= 40;368 if (pos.x < overlayWidth*0.2) 369 { 370 pos.x = overlayWidth; 371 pos.y += (*weaponWidget)->getSizeX2D(); 372 } 373 pos.x -= (*weaponWidget)->getSizeY2D(); 365 374 (*weaponWidget)->setAbsCoor2D(pos.x, pos.y); 375 //(*weaponWidget)->setAbsCoor2D(0,100); 366 376 (*weaponWidget)->show(); 367 377 //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName()); 368 378 } 369 379 370 pos.y += 1 50;371 pos.x = this->resX;380 pos.y += 160; 381 pos.x = overlayWidth; 372 382 for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++) 373 383 { 374 if (pos.x < 0.9*resX)375 { 376 pos.x = this->resX;377 pos.y += 150;378 } 379 pos.x -= 40;384 if (pos.x < overlayWidth*0.2) 385 { 386 pos.x = overlayWidth; 387 pos.y += (*weaponWidget)->getSizeX2D(); 388 } 389 pos.x -= (*weaponWidget)->getSizeY2D(); 380 390 (*weaponWidget)->setAbsCoor2D(pos.x, pos.y); 381 391 (*weaponWidget)->show(); -
branches/playability/src/world_entities/elements/glgui_energywidgetvertical.cc
r10233 r10234 30 30 GLGuiEnergyWidgetVertical::GLGuiEnergyWidgetVertical () 31 31 { 32 33 this->setAbsDir2D(270); 34 this->setBackgroundTexture(Texture()); 35 this->setBackgroundColor(Color(1,1,1,0)); 36 this->setBorderTop(10); 37 this->setBorderLeft(10); 38 this->setBorderRight(10); 39 this->setBorderBottom(10); 40 this->setWidgetSize(120,50); 41 42 this->_bar.setParent2D(this); 43 this->_bar.setBackgroundTexture(Texture()); 44 this->_bar.setBackgroundColor(Color(0,0,0,0)); 45 this->_bar.setForegroundTexture("maps/gui_element_background_faded.png"); 46 this->_bar.setForegroundColor(Color::green); 47 this->_bar.setChangedValueColor(Color(1,0,0,0.2)); 48 this->_bar.setBorderTop(0); 49 this->_bar.setBorderLeft(0); 50 this->_bar.setBorderRight(0); 51 this->_bar.setBorderBottom(0); 52 this->_bar.setWidgetSize(100,30); 53 //this->_bar.setRelCoor2D(borderLeft(), 0); 54 this->_bar.setRelCoor2D(0,0); 55 56 this->_image.setParent2D(this); 57 this->_image.setBorderTop(0); 58 this->_image.setBorderLeft(0); 59 this->_image.setBorderRight(0); 60 this->_image.setBorderBottom(0); 61 this->_image.setWidgetSize(30,30); 62 this->_image.setForegroundColor(Color(1,1,1,0.6)); 63 this->_image.setBackgroundColor(Color(1,1,1,0)); 64 this->_image.setBackgroundTexture(Texture()); 65 this->_image.loadImageFromFile("maps/evil-flower.png"); 66 //this->_image.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D()); 67 this->_image.setRelCoor2D(0,0); 68 this->_image.setRelDir2D(90); 69 this->_image.setVisibility(true); 70 71 this->_valueText.setParent2D(&this->_bar); 72 this->_valueText.setWidgetSize(100,20); 73 //this->_valueText.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D()); 74 this->_valueText.setAbsCoor2D(-15,-20); 75 this->_valueText.setChangedTextColor(Color::white); 76 this->_valueText.setForegroundColor(Color::white); 77 this->_valueText.setBackgroundTexture(Texture()); 78 this->_valueText.setBackgroundColor(Color(0,0,0,0)); 32 79 } 33 80 … … 66 113 void GLGuiEnergyWidgetVertical::resize() 67 114 { 68 //GLGuiBox::resize(); 115 Vector2D widgetSize = this->getSize2D(); 116 117 this->setBorderTop(widgetSize.y * 0.1); 118 this->setBorderBottom(widgetSize.y * 0.1); 119 this->setBorderLeft(widgetSize.x * 0.2); 120 this->setBorderRight(widgetSize.x * 0.2); 121 122 this->_bar.setWidgetSize(widgetSize.x * 0.8, widgetSize.y * 0.6); 123 this->_image.setWidgetSize(widgetSize.y * 0.6, widgetSize.y * 0.6); 124 this->_valueText.setWidgetSize(widgetSize.x* 0.8, widgetSize.y * 0.4); 69 125 } 70 126 … … 72 128 void GLGuiEnergyWidgetVertical::showing() 73 129 { 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); 130 96 131 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);112 132 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);119 133 this->_valueText.show(); 120 134 }
Note: See TracChangeset
for help on using the changeset viewer.