Changeset 10347 in orxonox.OLD for branches/playability
- Timestamp:
- Jan 24, 2007, 6:50:33 PM (18 years ago)
- Location:
- branches/playability/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/util/hud.cc
r10332 r10347 341 341 this->notifier->setWidgetSize(0.25 * this->resX, 0.6 * this->resY); 342 342 343 int overlayWidth = this->resX * (overlayPercentage)/(200); 344 if (overlayWidth < 100) 345 overlayWidth = 100; 343 int overlayWidth = 0; 344 if (overlayPercentage >= 20) 345 overlayWidth = this->resX * (overlayPercentage)/(200); 346 else 347 overlayWidth = this->resX * 0.1; 348 //if (overlayWidth < 100) 349 //overlayWidth = 100; 346 350 347 351 this->rightRect->hide(); … … 385 389 this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_01), Color(0, 0, 1)); 386 390 this->_radar->setAbsCoor2D(0, 0.01 * this->resY); 387 this->_radar->setWidgetSize( 0.18 * this->resX, 0.2 * this->resY);391 this->_radar->setWidgetSize(overlayWidth, overlayWidth); 388 392 this->_radar->setRange(300); 389 393 this->_radar->show(); 390 394 395 int statWidgetsNumber = 0; 396 float expectedArmorSizeX = 0; 397 float expectedArmorSizeY = 0; 398 float newSizeY = 0; float newSizeX = 0; 399 float moduloWidth = 0; 400 401 if (this->armorWidget != NULL) 402 { 403 expectedArmorSizeX = 150; 404 expectedArmorSizeY = 50; 405 statWidgetsNumber++; 406 } 407 408 if (this->shieldWidget != NULL) 409 statWidgetsNumber++; 410 411 if (this->energyWidget != NULL) 412 statWidgetsNumber++; 413 414 if (expectedArmorSizeY * statWidgetsNumber > overlayWidth) 415 { 416 newSizeY = overlayWidth / float(statWidgetsNumber); 417 newSizeX = expectedArmorSizeX; 418 PRINTF(0)("Statwidgets resized\n"); 419 } 420 else 421 { 422 newSizeY = expectedArmorSizeY; 423 newSizeX = expectedArmorSizeX; 424 moduloWidth = int(overlayWidth) % int(expectedArmorSizeY * statWidgetsNumber); 425 } 426 427 float posY = overlayWidth + newSizeX; 428 429 if (this->armorWidget != NULL) 430 { 431 this->armorWidget->setSize2D(newSizeX, newSizeY); 432 this->armorWidget->setRelCoor2D((statWidgetsNumber - 1) * newSizeY + 3 * moduloWidth / (statWidgetsNumber + 1),posY); 433 } 434 if (this->shieldWidget != NULL) 435 { 436 this->shieldWidget->setSize2D(newSizeX, newSizeY); 437 this->shieldWidget->setRelCoor2D((statWidgetsNumber - 2) * newSizeY + 2 *moduloWidth / (statWidgetsNumber + 1),posY); 438 } 439 if (this->energyWidget != NULL) 440 { 441 this->energyWidget->setSize2D(newSizeX, newSizeY); 442 this->energyWidget->setRelCoor2D(moduloWidth / (statWidgetsNumber + 1),posY); 443 } 444 445 /* 391 446 if (this->armorWidget != NULL) 392 447 this->armorWidget->setRelCoor2D(100,0.2*this->resY + this->armorWidget->getSizeX2D()); … … 395 450 if (this->energyWidget != NULL) 396 451 this->energyWidget->setRelCoor2D(20,0.2*this->resY + this->armorWidget->getSizeX2D()); 452 */ 397 453 //this->shieldWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D(),0); 398 454 //this->energyWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D() + this->shieldWidget->getSizeX2D(),0); … … 411 467 std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget; 412 468 Vector2D pos = Vector2D(overlayWidth, 0.4*this->resY); 469 float largestWidgetSizeX = 0; 413 470 //PRINTF(0)("Cur Pos: %f,%f\n",pos.x,pos.y); 414 471 // out of reasons i can't get behind, this version is segfaulting when calling getSizeX2D or getSizeY2D. the other … … 418 475 { 419 476 float ySize = (*weaponWidget)->getSizeY2D(); 477 float xSize = (*weaponWidget)->getSizeX2D(); 478 if (xSize > largestWidgetSizeX) 479 largestWidgetSizeX = xSize; 420 480 if (pos.x < ySize) 421 481 { 422 482 pos.x = overlayWidth; 423 pos.y += (*weaponWidget)->getSizeX2D();483 pos.y += largestWidgetSizeX; 424 484 } 425 485 pos.x -= ySize; … … 429 489 //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName()); 430 490 } 431 432 pos.y += 160; 433 pos.x = 0; //overlayWidth + this->rightRect->getAbsCoor2D().x; 491 492 weaponWidget = this->weaponsWidgetsSec.begin(); 493 float expectedWidgetSizeY = 0; 494 if (weaponWidget != this->weaponsWidgetsSec.end()) 495 { 496 expectedWidgetSizeY = (*weaponWidget)->getSizeY2D(); 497 } 498 pos.y = resY - expectedWidgetSizeY * 0.6; 499 pos.x = overlayWidth + this->rightRect->getAbsCoor2D().x; 500 434 501 for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++) 435 502 { 436 503 float ySize = (*weaponWidget)->getSizeY2D(); 504 float xSize = (*weaponWidget)->getSizeX2D(); 505 if (xSize > largestWidgetSizeX) 506 largestWidgetSizeX = xSize; 437 507 if (pos.x < ySize) 438 508 { 439 509 pos.x = overlayWidth; 440 pos.y += (*weaponWidget)->getSizeX2D();510 pos.y -= largestWidgetSizeX + expectedWidgetSizeY * 0.6; 441 511 } 442 512 pos.x -= ySize; 443 PRINTF(0)("secweaponwidget y-size: %f/n", (*weaponWidget)->getSizeY2D());513 //PRINTF(0)("secweaponwidget y-size: %f/n", (*weaponWidget)->getSizeY2D()); 444 514 (*weaponWidget)->setAbsCoor2D(pos.x + this->rightRect->getAbsCoor2D().x, pos.y); 445 515 (*weaponWidget)->show(); -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10335 r10347 371 371 this->travelDistancePlus = Vector2D(50,50); 372 372 this->travelDistanceMinus = Vector2D(-50,-50); 373 this->isTravelDistanceInit = false;373 this->isTravelDistanceInit = true; 374 374 this->actionWidthPercentage = 1; 375 375 … … 420 420 LoadParam(root, "cameraDistance", this, SpaceShip, setCameraDistance); 421 421 LoadParam(root, "cameraFovy", this, SpaceShip, setCameraFovy); 422 //LoadParam(root, "actionWidthPercentage", this, SpaceShip, setActionWidthPercentage);422 LoadParam(root, "actionWidthPercentage", this, SpaceShip, setActionWidthPercentage); 423 423 424 424 State::getCamera()->setViewMode(Camera::ViewTop); … … 860 860 this->travelNode->updateNode(0.01f); 861 861 862 if (this->hasPlayer()) 863 this->isTravelDistanceInit = false; 862 this->isTravelDistanceInit = false; 864 863 865 864 if(this->entityTrack) … … 1167 1166 if (i<0) i=0; 1168 1167 this->actionWidthPercentage = i/100.0; 1169 //State::getPlayer()->hud().setOverlayPercentage(100-i); 1170 //updateTravelDistance(); 1168 1171 1169 if (this->hasPlayer()) 1172 1170 this->isTravelDistanceInit = false;
Note: See TracChangeset
for help on using the changeset viewer.