Changeset 10194 in orxonox.OLD for branches/playability
- Timestamp:
- Jan 8, 2007, 9:19:39 PM (18 years ago)
- Location:
- branches/playability/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/lib/gui/gl/glgui_box.cc
r10139 r10194 22 22 #include "network_log.h" 23 23 24 24 25 namespace OrxGui 25 26 { … … 188 189 for (widget = this->_children.begin(); widget != this->_children.end(); ++widget) 189 190 { 190 float radDir = (*widget)->getAbsDir2D() * 2 * M_PI / 360; 191 float realSizeX = fabsf((*widget)->getSizeX2D() * cosf(radDir)) + fabsf((*widget)->getSizeY2D() * sinf(radDir)); 192 float realSizeY = fabsf((*widget)->getSizeX2D() * sinf(radDir)) + fabsf((*widget)->getSizeY2D() * cosf(radDir)); 191 //float radDir = (*widget)->getAbsDir2D() * 2 * M_PI / 360; 192 //float realSizeX = fabsf((*widget)->getSizeX2D() * cosf(radDir)) + fabsf((*widget)->getSizeY2D() * sinf(radDir)); 193 //float realSizeY = fabsf((*widget)->getSizeX2D() * sinf(radDir)) + fabsf((*widget)->getSizeY2D() * cosf(radDir)); 194 float realSizeX, realSizeY; 195 int angleAbs = (int)(*widget)->getAbsDir2D(); 196 int angleRel = (int)(*widget)->getRelDir2D(); 197 //std::cout << "absangle: " << angleAbs << ", relangle: " << angleRel << '\n'; 198 if ((*widget)->getAbsDir2D() == 0 || (*widget)->getAbsDir2D() == 180) 199 { 200 realSizeX = (*widget)->getSizeX2D(); 201 realSizeY = (*widget)->getSizeY2D(); 202 //std::cout<<"box vertical, widget 0or180"; 203 } 204 else if ((*widget)->getAbsDir2D() == 90 || (*widget)->getAbsDir2D() == 270) 205 { 206 realSizeX = (*widget)->getSizeY2D(); 207 realSizeY = (*widget)->getSizeX2D(); 208 //std::cout<<"box vertical, widget 90or270"; 209 } 193 210 194 211 (*widget)->setRelCoor2D(borderLeft(), height + borderTop()); … … 211 228 for (widget = this->_children.begin(); widget != this->_children.end(); ++widget) 212 229 { 213 float radDir = (*widget)->getAbsDir2D() * 2 * M_PI / 360;230 //float radDir = (*widget)->getAbsDir2D() * 2 * M_PI / 360; 214 231 //std::cout << "size X: " << (*widget)->getSizeX2D() << "size Y: " << (*widget)->getSizeY2D() << '\n'; 215 float realSizeX = fabsf((*widget)->getSizeX2D() * cosf(radDir)) + fabsf((*widget)->getSizeY2D() * sinf(radDir)); 216 float realSizeY = fabsf((*widget)->getSizeX2D() * sinf(radDir)) + fabsf((*widget)->getSizeY2D() * cosf(radDir)); 232 //float realSizeX = fabsf((*widget)->getSizeX2D() * cosf(radDir)) + fabsf((*widget)->getSizeY2D() * sinf(radDir)); 233 //float realSizeY = fabsf((*widget)->getSizeX2D() * sinf(radDir)) + fabsf((*widget)->getSizeY2D() * cosf(radDir)); 234 float realSizeX, realSizeY; 235 int angleAbs = (int)(*widget)->getAbsDir2D(); 236 int angleRel = (int)(*widget)->getRelDir2D(); 237 //std::cout << "absangle: " << angleAbs << ", relangle: " << angleRel << '\n'; 238 if ((*widget)->getAbsDir2D() == 0 || (*widget)->getAbsDir2D() == 180) 239 { 240 realSizeX = (*widget)->getSizeX2D(); 241 realSizeY = (*widget)->getSizeY2D(); 242 //std::cout<<"box horicontal, widget 0or180"; 243 } 244 else if ((*widget)->getAbsDir2D() == 90 || (*widget)->getAbsDir2D() == 270) 245 { 246 realSizeX = (*widget)->getSizeY2D(); 247 realSizeY = (*widget)->getSizeX2D(); 248 //std::cout<<"box horicontal, widget 90or270"; 249 } 217 250 218 251 (*widget)->setRelCoor2D(width, borderTop()); -
branches/playability/src/util/hud.cc
r10139 r10194 65 65 this->subscribeEvent(ES_ALL, SDLK_TAB); 66 66 67 this->shipValuesBox = NULL;67 //this->shipValuesBox = NULL; 68 68 } 69 69 … … 78 78 79 79 delete this->_radar; 80 delete this->shipValuesBox; 80 //if (this->shipValuesBox != NULL) 81 //delete this->shipValuesBox; 81 82 82 83 // delete what has to be deleted here … … 99 100 void Hud::setEnergyWidget(OrxGui::GLGuiWidget* widget) 100 101 { 101 if (this->shipValuesBox == NULL) 102 this->createShipValuesBox(); 102 //if (this->shipValuesBox == NULL) 103 //this->createShipValuesBox(); 104 103 105 // decopple old widget 104 106 if (this->energyWidget != NULL) … … 111 113 { 112 114 //this->energyWidget->shiftDir2D(270); 113 dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedName("Electronics");114 this->shipValuesBox->pack(this->energyWidget);115 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedName("Electronics"); 116 //this->shipValuesBox->pack(this->energyWidget); 115 117 this->energyWidget->show(); 116 118 /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); … … 123 125 void Hud::setShiledWidget(OrxGui::GLGuiWidget* widget) 124 126 { 127 /* 125 128 if (this->shipValuesBox == NULL) 126 129 this->createShipValuesBox(); 130 */ 131 127 132 // decopple old widget 128 133 if (this->shieldWidget != NULL) … … 135 140 { 136 141 //this->shieldWidget->shiftDir2D(270); 137 this->shipValuesBox->pack(this->shieldWidget);142 //this->shipValuesBox->pack(this->shieldWidget); 138 143 this->shieldWidget->show(); 139 144 /* this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); … … 148 153 void Hud::setArmorWidget(OrxGui::GLGuiWidget* widget) 149 154 { 155 /* 150 156 if (this->shipValuesBox == NULL) 151 157 this->createShipValuesBox(); 158 */ 152 159 153 160 // decopple old widget … … 161 168 { 162 169 //this->armorWidget->shiftDir2D(270); 163 this->shipValuesBox->pack(this->armorWidget);170 //this->shipValuesBox->pack(this->armorWidget); 164 171 this->armorWidget->show(); 165 172 /* this->armorWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); … … 277 284 this->_radar->setRange(300); 278 285 this->_radar->show(); 279 } 280 281 286 287 if (this->armorWidget != NULL) 288 this->armorWidget->setRelCoor2D(0.1*this->resX, this->armorWidget->getSizeX2D()); 289 if (this->shieldWidget != NULL) 290 this->shieldWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeY2D(), this->armorWidget->getSizeX2D()); 291 if (this->energyWidget != NULL) 292 this->energyWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeY2D() + this->shieldWidget->getSizeY2D(), this->armorWidget->getSizeX2D()); 293 //this->shieldWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D(),0); 294 //this->energyWidget->setRelCoor2D(0.1*this->resX + this->armorWidget->getSizeX2D() + this->shieldWidget->getSizeX2D(),0); 295 } 296 297 /* 282 298 if (this->shipValuesBox != NULL) 283 299 { … … 287 303 else 288 304 createShipValuesBox(); 289 305 */ 290 306 291 307 std::list<OrxGui::GLGuiWidget*>::iterator weaponWidget; … … 323 339 } 324 340 341 /* 325 342 void Hud::createShipValuesBox() 326 343 { 327 this->shipValuesBox = new OrxGui::GLGuiBox(OrxGui:: Horizontal);344 this->shipValuesBox = new OrxGui::GLGuiBox(OrxGui::Vertical); 328 345 //this->shipValuesBox->setWidgetSize(1000,500); 329 346 //this->shipValuesBox->setBackgroundTexture("maps/gui_container_background.png"); … … 332 349 this->shipValuesBox->setVisibility(true); 333 350 } 334 335 351 */ 352 353 -
branches/playability/src/util/hud.h
r10139 r10194 59 59 private: 60 60 void updateResolution(); 61 void createShipValuesBox();61 //void createShipValuesBox(); 62 62 63 63 private: … … 68 68 OrxGui::GLGuiWidget* shieldWidget; 69 69 OrxGui::GLGuiWidget* armorWidget; 70 OrxGui::GLGuiBox* shipValuesBox;70 //OrxGui::GLGuiBox* shipValuesBox; 71 71 72 72 OrxGui::GLGuiNotifier* notifier; -
branches/playability/src/world_entities/elements/glgui_energywidgetvertical.cc
r10139 r10194 19 19 20 20 #include "multi_type.h" 21 #include <iostream> 22 #include "math.h" 21 23 22 24 namespace OrxGui … … 33 35 //this->_name.setRelCoor2D(20,0); 34 36 //this->_valueText.setRelCoor2D(,0); 35 this->shiftDir2D(270); 36 this->setOrientation(OrxGui::Horizontal); 37 this->pack(&this->_name); 38 this->pack(&this->_valueText); 39 this->_bar.setParent2D(&this->_valueText); 37 this->setAbsDir2D(270); 38 //std::cout << "absAngle: " << int(this->getAbsDir2D()) << ", relAngle: " << int(this->getRelDir2D()) << '\n'; 39 //this->setOrientation(OrxGui::Vertical); 40 40 41 this->_name.setForegroundColor(Color(1,1,1,.8)); 41 //this->pack(&this->_name); 42 //this->pack(&this->_valueText); 43 44 this->_image.setParent2D(this); 45 this->_image.setSize2D(20,20); 46 this->_image.setBackgroundColor(Color(1,1,1,.8)); 47 this->_image.setBackgroundTexture("maps/TE2.png"); 48 this->_image.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D()); 49 50 this->_valueText.setParent2D(this); 51 this->_valueText.setSize2D(100,20); 52 this->_valueText.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D()); 42 53 this->_valueText.setChangedTextColor(Color::white); 43 this->_bar.setBackgroundTexture(Texture());44 54 45 55 this->setBackgroundTexture(Texture()); 46 this->setBackgroundColor(Color(.5,.5,.5,0.5)); 56 this->setBackgroundColor(Color(.5,.5,.5,0)); 57 this->setSize2D(120,20); 47 58 48 59 //this->_name.setBackgroundTexture(Texture()); 49 60 //this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png"); 61 62 this->_bar.setParent2D(&this->_valueText); 50 63 this->_bar.setBackgroundTexture(Texture()); 51 64 this->_bar.setBackgroundColor(Color(0,0,0,0)); … … 53 66 this->_bar.setForegroundColor(Color(.5, .5, .5, 1)); 54 67 this->_bar.setChangedValueColor(Color::black); 68 this->_bar.setSize2D(100,20); 69 this->_bar.setRelCoor2D(borderLeft(), 0); 55 70 } 56 71 … … 61 76 GLGuiEnergyWidgetVertical::~GLGuiEnergyWidgetVertical () 62 77 { 63 }64 65 66 void GLGuiEnergyWidgetVertical::setDisplayedName(const std::string& name)67 {68 this->_name.setText(name);69 this->_bar.setWidgetSize(this->_name.getSize2D());70 78 } 71 79 … … 85 93 this->_bar.setFrontColor(Color(1,1,1,1), true); 86 94 this->_valueText.setText(val.getString()); 95 //this->_valueText.setText("asdfas"); 87 96 } 88 97 89 98 void GLGuiEnergyWidgetVertical::resize() 90 99 { 91 GLGuiBox::resize();100 //GLGuiBox::resize(); 92 101 } 93 102 … … 95 104 void GLGuiEnergyWidgetVertical::showing() 96 105 { 97 this->_ name.show();106 this->_image.show(); 98 107 this->_valueText.show(); 99 108 this->_bar.show(); … … 102 111 void GLGuiEnergyWidgetVertical::hiding() 103 112 { 104 this->_ name.hide();113 this->_image.hide(); 105 114 this->_valueText.hide(); 106 115 this->_bar.hide(); -
branches/playability/src/world_entities/elements/glgui_energywidgetvertical.h
r10107 r10194 10 10 #include "glgui_bar.h" 11 11 #include "glgui_text.h" 12 #include "glgui_widget.h" 12 13 13 14 namespace OrxGui … … 15 16 16 17 //! A class for ... 17 class GLGuiEnergyWidgetVertical : public GLGui Box18 class GLGuiEnergyWidgetVertical : public GLGuiWidget 18 19 { 19 20 … … 22 23 virtual ~GLGuiEnergyWidgetVertical(); 23 24 24 void setDisplayedName(const std::string& name);25 25 void setMaximum(float max); 26 26 void setValue(float value); 27 27 28 inline GLGuiWidget* get NameWidget() {return &this->_name;};28 inline GLGuiWidget* getImageWidget() {return &this->_image;}; 29 29 inline GLGuiWidget* getValueWidget() {return &this->_valueText;}; 30 30 inline GLGuiWidget* getBarWidget() {return &this->_bar;}; … … 36 36 37 37 private: 38 GLGui Text _name;38 GLGuiWidget _image; 39 39 GLGuiText _valueText; 40 40 GLGuiBar _bar; -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10188 r10194 416 416 this->secWeaponMan.showCrosshair(); 417 417 this->toList( OM_GROUP_01 ); 418 dynamic_cast <OrxGui::GLGuiEnergyWidgetVertical*> (State::getPlayer()->hud().getArmorWidget())->setDisplayedName("Armor");418 //dynamic_cast <OrxGui::GLGuiEnergyWidgetVertical*> (State::getPlayer()->hud().getArmorWidget())->setDisplayedName("Armor"); 419 419 //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true); 420 420 //this->attachCamera(); … … 1047 1047 { //create the widget 1048 1048 this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 1049 this->electronicWidget->setDisplayedName("Electronics:");1049 //this->electronicWidget->setDisplayedName("Electronics:"); 1050 1050 //this->electronicWidget->setSize2D(100,20); 1051 1051 //this->electronicWidget->setAbsCoor2D(150,200); … … 1066 1066 { 1067 1067 this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 1068 this->shieldWidget->setDisplayedName("Shield:");1068 //this->shieldWidget->setDisplayedName("Shield:"); 1069 1069 //his->shieldWidget->setSize2D(100,20); 1070 1070 //this->shieldWidget->setAbsCoor2D(200,200); -
branches/playability/src/world_entities/world_entity.cc
r10139 r10194 752 752 { 753 753 this->healthWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 754 this->healthWidget->setDisplayedName("Health");754 //this->healthWidget->setDisplayedName("Health"); 755 755 //this->healthWidget->setSize2D(100,20); 756 756 //this->healthWidget->setAbsCoor2D(100,200);
Note: See TracChangeset
for help on using the changeset viewer.