Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/hud/src/util/hud.cc @ 10685

Last change on this file since 10685 was 10685, checked in by bknecht, 17 years ago

My computer is not working anymore, so I upload my unfinished work to continue my work

File size: 19.7 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: Benjamin Knecht
14*/
15
16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
17
18#include "hud.h"
19
20#include "state.h"
21#include "debug.h"
22
23#include "world_entities/weapons/weapon_manager.h"
24#include "glgui_widget.h"
25#include "glgui_box.h"
26#include "glgui_bar.h"
27#include "elements/glgui_energywidgetvertical.h"
28
29#include "glgui_inputline.h"
30#include "specials/glgui_notifier.h"
31#include "elements/glgui_radar.h"
32#include "world_entities/space_ships/space_ship.h"
33
34
35
36/// HACK
37#include "player.h"
38#include "playable.h"
39
40ObjectListDefinition(Hud);
41/**
42 * standard constructor
43 * @todo this constructor is not jet implemented - do it
44*/
45Hud::Hud ()
46{
47  this->registerObject(this, Hud::_objectList);
48
49  //this->setSize2D(
50  this->weaponManager = NULL;
51  this->weaponManagerSecondary = NULL;
52  this->energyWidget = NULL;
53  this->shieldWidget = NULL;
54  this->healthWidget = NULL;
55  //this->leftRect = NULL;
56  //this->rightRect = NULL;
57  this->resX = 1;
58  this->resY = 1;
59
60  this->overlayPercentage = 40;
61  this->overlayActive = false;
62  //this->rightRect = new OrxGui::GLGuiImage();
63  //this->leftRect = new OrxGui::GLGuiImage();
64  this->topRect = new OrxGui::GLGuiImage();
65  this->bottomRect = new OrxGui::GLGuiImage();
66  this->middleRect = new OrxGui::GLGuiImage();
67
68  //this->inputLine = new OrxGui::GLGuiInputLine();
69  //this->inputLine->setParent2D(this);
70  this->notifier = new OrxGui::GLGuiNotifier();
71  this->notifier->setParent2D(this->bottomRect);
72  notifier->setRelCoor2D(5,5);
73 
74  this->barSocket = new OrxGui::GLGuiImage();
75  this->barSocket->setParent2D(this->bottomRect);
76
77  this->_radar = new OrxGui::GLGuiRadar();
78  this->radarCenterNode = NULL;
79
80  this->subscribeEvent(ES_ALL, EV_VIDEO_RESIZE);
81  this->subscribeEvent(ES_ALL, SDLK_TAB);
82
83  //this->shipValuesBox = NULL;
84}
85
86
87/**
88 * standard deconstructor
89*/
90Hud::~Hud ()
91{
92  delete this->inputLine;
93  delete this->notifier;
94
95  delete this->_radar;
96  delete this->rightRect;
97  delete this->leftRect;
98  delete this->topRect;
99  delete this->bottomRect;
100  delete this->middleRect;
101  //if (this->shipValuesBox != NULL)
102    //delete this->shipValuesBox;
103
104  // delete what has to be deleted here
105}
106
107
108void Hud::loadParams(const TiXmlElement* root)
109{
110  Element2D::loadParams(root);
111}
112
113void Hud::notifyUser(const std::string& message)
114{
115  this->notifier->pushNotifyMessage(message);
116}
117
118void Hud::setBackGround()
119{}
120
121void Hud::setEnergyWidget(OrxGui::GLGuiWidget* widget)
122{
123  //if (this->shipValuesBox == NULL)
124    //this->createShipValuesBox();
125
126  // decopple old widget
127  if (this->energyWidget != NULL)
128  {
129    this->energyWidget->hide();
130  }
131
132  this->energyWidget = widget;
133  if (this->energyWidget != NULL)
134  {
135    //this->energyWidget->shiftDir2D(270);
136    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedName("Electronics");
137    //this->shipValuesBox->pack(this->energyWidget);
138    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setStandardSettings();
139    this->energyWidget->setParent2D(this->leftRect);
140    dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedImage("textures/gui/gui_electronics_icon.png");
141    this->energyWidget->show();
142    /*    this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
143        this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
144  }
145
146  this->updateResolution(); 
147}
148
149void Hud::setShieldWidget(OrxGui::GLGuiWidget* widget)
150{
151  /*
152  if (this->shipValuesBox == NULL)
153    this->createShipValuesBox();
154  */
155
156  // decopple old widget
157  if (this->shieldWidget != NULL)
158  {
159    this->shieldWidget->hide();
160  }
161
162  this->shieldWidget = widget;
163  if (this->shieldWidget != NULL)
164  {
165    //this->shieldWidget->shiftDir2D(270);
166    //this->shipValuesBox->pack(this->shieldWidget);
167    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setStandardSettings();
168    this->shieldWidget->setParent2D(this->leftRect);
169    dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setDisplayedImage("textures/gui/gui_shield_icon.png");
170    this->shieldWidget->show();
171    /*    this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
172        this->shieldWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
173  }
174  else
175    printf("schild im hud nicht uebergeben!!!!!!!!!!!!!!!!!!!!!!!!!");
176
177  this->updateResolution();
178}
179
180void Hud::setHealthWidget(OrxGui::GLGuiWidget* widget)
181{
182        if( this->playmode == FirstPerson )
183        {
184                this->healthWidget = new OrxGui::GLGuiBar();
185                this->healthWidget->setMaximum(widget->getBarWidget()->maximum());
186        this->healthWidget->setValue(widget->getBarWidget()->value());
187        this->healthWidget->setParent2D(this->barSocket);
188        }
189        else
190        {
191          /*
192          if (this->shipValuesBox == NULL)
193            this->createShipValuesBox();
194          */
195       
196        // decopple old widget
197          if (this->healthWidget != NULL)
198          {
199            this->healthWidget->hide();
200          }
201       
202          this->healthWidget = widget;
203          if (this->healthWidget != NULL)
204          {
205            //this->healthWidget->shiftDir2D(270);
206            //this->shipValuesBox->pack(this->healthWidget);
207            //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->healthWidget)->setStandardSettings();
208            this->healthWidget->setParent2D(this->leftRect);
209            //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->healthWidget)->setDisplayedImage("textures/gui/gui_health_icon.png");
210            this->healthWidget->show();
211            /*    this->healthWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
212                this->healthWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
213          }
214        }
215
216  this->updateResolution();
217}
218
219
220void Hud::setImplantWidget(OrxGui::GLGuiWidget* widget)
221{
222  //if (this->shipValuesBox == NULL)
223    //this->createShipValuesBox();
224
225  // decopple old widget
226  if (this->implantWidget != NULL)
227  {
228    this->implantWidget->hide();
229  }
230
231  this->implantWidget = widget;
232  if (this->implantWidget != NULL)
233  {
234    //this->energyWidget->shiftDir2D(270);
235    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedName("Electronics");
236    //this->shipValuesBox->pack(this->energyWidget);
237    //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setStandardSettings();
238    this->implantWidget->setParent2D(this->leftRect);
239    dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->implantWidget)->setDisplayedImage("textures/gui/gui_electronics_icon.png");
240    this->implantWidget->show();
241    /*    this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
242        this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
243  }
244
245  this->updateResolution();
246}
247
248void Hud::setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec)
249{
250  //clearWeaponManager();
251
252  //Hide all widgets
253  if (this->weaponManager != NULL)
254  {
255    for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++)
256    {
257      Weapon* weapon = this->weaponManager->getWeapon(i);
258      if (weapon != NULL)
259      {
260        weapon->getEnergyWidget()->hide();
261        //this->weaponsWidgetsPrim.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
262      }
263    }
264  }
265
266  if (this->weaponManagerSecondary != NULL)
267  {
268    for (unsigned int i = 0; i < this->weaponManagerSecondary->getSlotCount(); i++)
269    {
270      Weapon* weapon = this->weaponManagerSecondary->getWeapon(i);
271      if (weapon != NULL)
272      {
273        weapon->getEnergyWidget()->hide();
274        //this->weaponsWidgetsSec.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
275      }
276    }
277  }
278
279  this->weaponManager = weaponMan;
280  this->weaponManagerSecondary = weaponManSec; 
281
282  this->updateWeaponManager();
283  //  this->updateResolution();
284}
285
286/*
287void Hud::clearWeaponManager()
288{
289  //Hide all widgets
290  if (this->weaponManager != NULL)
291  {
292    for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++)
293    {
294      Weapon* weapon = this->weaponManager->getWeapon(i);
295      if (weapon != NULL)
296      {
297        weapon->getEnergyWidget()->hide();
298        //this->weaponsWidgetsPrim.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
299      }
300    }
301  }
302
303  if (this->weaponManagerSecondary != NULL)
304  {
305    for (unsigned int i = 0; i < this->weaponManagerSecondary->getSlotCount(); i++)
306    {
307      Weapon* weapon = this->weaponManagerSecondary->getWeapon(i);
308      if (weapon != NULL)
309      {
310        weapon->getEnergyWidget()->hide();
311        //this->weaponsWidgetsSec.remove(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
312      }
313    }
314  }
315
316  //this->weaponsWidgetsPrim.clear();
317  //this->weaponsWidgetsSec.clear();
318}
319*/
320
321void Hud::updateWeaponManager()
322{
323  // hide all the Widgets
324 
325  std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget;
326  for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++)
327  {
328    (*weaponWidget)->hide();
329  }
330  this->weaponsWidgetsPrim.clear();
331
332  for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++)
333  {
334    (*weaponWidget)->hide();
335  }
336  this->weaponsWidgetsSec.clear();
337 
338
339  // add all that we need again.
340
341  if (this->weaponManager != NULL)
342    for (unsigned int i = 0; i < this->weaponManager->getSlotCount(); i++)
343    {
344      Weapon* weapon = this->weaponManager->getWeapon(i);
345      if (weapon != NULL)
346      {
347        //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName());
348        weapon->getEnergyWidget()->setParent2D(this->rightRect);
349        weapon->getEnergyWidget()->show();
350        weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1));
351        weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6));
352        weapon->getEnergyWidget()->setWidgetSize(120,30);
353        //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6);
354        this->weaponsWidgetsPrim.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
355      }
356    }
357
358  if (this->weaponManagerSecondary != NULL)
359    for (unsigned int i = 0; i < this->weaponManagerSecondary->getSlotCount(); i++)
360    {
361      Weapon* weapon = this->weaponManagerSecondary->getWeapon(i);
362      if (weapon != NULL)
363      {
364        //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName());
365        weapon->getEnergyWidget()->setParent2D(this->rightRect);
366        weapon->getEnergyWidget()->show();
367        weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1));
368        weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6));
369        weapon->getEnergyWidget()->setWidgetSize(150,50);
370        //weapon->getEnergyWidget()->frontMaterial().setTransparency(.6);
371        this->weaponsWidgetsSec.push_back(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (weapon->getEnergyWidget()));
372      }
373    }
374
375  this->updateResolution();
376
377}
378
379void Hud::addWeaponWidget(OrxGui::GLGuiWidget* widget)
380{}
381
382void Hud::removeWeaponWidget(OrxGui::GLGuiWidget* widget)
383{}
384
385void Hud::updateResolution()
386{
387  this->resX = State::getResX();
388  this->resY = State::getResY();
389
390  this->setSize2D(.2 * this->resX, this->resY);
391  if( this->playmode != FirstPerson )
392  {
393          this->notifier->setAbsCoor2D(0.7 * this->resX, 0.3 * this->resY);
394          this->notifier->setWidgetSize(0.25 * this->resX, 0.6 * this->resY);
395  }
396
397  int overlayWidth = 0;
398  if (overlayPercentage >= 20)
399    overlayWidth = this->resX * (overlayPercentage)/(200);
400  else
401    overlayWidth = this->resX * 0.1;
402  //if (overlayWidth < 100)
403    //overlayWidth = 100;
404
405  this->rightRect->hide();
406  this->leftRect->hide();
407 
408  if( this->playmode != FirstPerson )
409  {
410          this->leftRect->setParent2D(this);
411          this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY));
412          this->leftRect->setAbsCoor2D(0,0);
413          this->leftRect->setBackgroundTexture(Texture());
414          this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2));
415          this->leftRect->setForegroundTexture(Texture());
416          this->leftRect->setForegroundColor(Color(0,0,0,0));
417       
418          this->rightRect->setParent2D(this);
419          this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY));
420          this->rightRect->setAbsCoor2D(this->resX - overlayWidth,0);
421          this->rightRect->setBackgroundTexture(Texture());
422          this->rightRect->setBackgroundColor(Color(0,0,0.7,0.2));
423          this->rightRect->setForegroundTexture(Texture());
424          this->rightRect->setForegroundColor(Color(0,0,0,0));
425  }
426  else
427  {
428          this->bottomRect->setParent2D(this);
429          this->bottomRect->setWidgetSize(float(this->resX), float(overlayWidth));
430          this->bottomRect->setAbsCoor2D(0, this->resY - overlayWidth);
431          this->topRect->setParent2D(this);
432          this->topRect->setWidgetSize(float(this->resX), float(overlayWidth));
433          this->topRect->setAbsCoor2D(0, 0);
434          this->middleRect->setParent2D(this);
435          this->middleRect->setWidgetSize(float(this->resY)/2, float(this->resY)/2);
436          this->middleRect->setAbsCoor2D(float(this->resX - this->resY/2)/2, float(this->resY)/4);
437  }
438
439  if (this->overlayActive == true)
440  {
441    this->rightRect->show();
442    this->leftRect->show();
443  }
444
445
446  if (State::getPlayer() && State::getPlayer()->getPlayable() && State::getObjectManager())
447  {
448    PRINTF(4)("UPDATING RADAR\n");
449    if( this->playmode != FirstPerson )
450        this->_radar->setParent2D(this->leftRect);
451    else
452        this->_radar->setParent2D(this->topRect);
453    if (radarCenterNode == NULL)
454      this->_radar->setCenterNode(State::getPlayer()->getPlayable());
455    else
456      this->_radar->setCenterNode(this->radarCenterNode);
457
458    //this->_radar->addEntityList(&State::getObjectManager()->getEntityList((OM_LIST)(State::getPlayer()->getPlayable()->getOMListNumber()+1)), Color(.4, .4, 1.0));
459    this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_00), Color(1, 0, 0));
460    this->_radar->addEntityList(&State::getObjectManager()->getEntityList(OM_GROUP_01), Color(0, 0, 1));
461    this->_radar->setAbsCoor2D(0, 0.01 * this->resY);
462    this->_radar->setWidgetSize(overlayWidth, overlayWidth);
463    this->_radar->setRange(300);
464    this->_radar->show();
465   
466    int statWidgetsNumber = 0;
467    float expectedHealthSizeX = 0;
468    float expectedHealthSizeY = 0;
469    float newSizeY = 0; float newSizeX = 0;
470    float moduloWidth = 0;
471
472        if( this->playmode != FirstPerson )
473        {
474            if (this->healthWidget != NULL)
475            {
476              expectedHealthSizeX = 150;
477              expectedHealthSizeY = 50;
478              statWidgetsNumber++;
479            }
480
481            if (this->shieldWidget != NULL)
482              statWidgetsNumber++;
483           
484            if (this->energyWidget != NULL)
485              statWidgetsNumber++;
486       
487            if (expectedHealthSizeY * statWidgetsNumber > overlayWidth)
488            {
489              newSizeY = overlayWidth / float(statWidgetsNumber);
490              newSizeX = expectedHealthSizeX;
491              PRINTF(0)("Statwidgets resized\n");
492            }
493            else
494            {
495              newSizeY = expectedHealthSizeY;
496              newSizeX = expectedHealthSizeX;
497              moduloWidth = int(overlayWidth) % int(expectedHealthSizeY * statWidgetsNumber);
498            }
499       
500            float posY = overlayWidth + newSizeX;
501       
502            if (this->healthWidget != NULL)
503            {
504              this->healthWidget->setSize2D(newSizeX, newSizeY);
505              this->healthWidget->setRelCoor2D((statWidgetsNumber - 1) * newSizeY + 3 * moduloWidth / (statWidgetsNumber + 1),posY);
506            }
507            if (this->shieldWidget != NULL)
508            {
509              this->shieldWidget->setSize2D(newSizeX, newSizeY);
510              this->shieldWidget->setRelCoor2D((statWidgetsNumber - 2) * newSizeY + 2 *moduloWidth / (statWidgetsNumber + 1),posY);
511            }
512            if (this->energyWidget != NULL)
513            {
514              this->energyWidget->setSize2D(newSizeX, newSizeY);
515              this->energyWidget->setRelCoor2D(moduloWidth / (statWidgetsNumber + 1),posY);
516            }
517        }
518        else
519        {
520                this->barSocket->setParent2D(this->bottomRect);
521                this->barSocket->setWidgetSize( float(overlayWidth), float(overlayWidth));
522                this->barSocket->setRelCoor2D(0,this->resX - float(overlayWidth));
523               
524                this->healthWidget->setRelCoor2D(10,-20);
525        }
526       
527
528    /*
529    if (this->healthWidget != NULL)
530      this->healthWidget->setRelCoor2D(100,0.2*this->resY + this->healthWidget->getSizeX2D());
531    if (this->shieldWidget != NULL)
532      this->shieldWidget->setRelCoor2D(60,0.2*this->resY + this->healthWidget->getSizeX2D());
533    if (this->energyWidget != NULL)
534      this->energyWidget->setRelCoor2D(20,0.2*this->resY + this->healthWidget->getSizeX2D());
535    */
536    //this->shieldWidget->setRelCoor2D(0.1*this->resX + this->healthWidget->getSizeX2D(),0);
537    //this->energyWidget->setRelCoor2D(0.1*this->resX + this->healthWidget->getSizeX2D() + this->shieldWidget->getSizeX2D(),0);
538  }
539
540  /*
541  if (this->shipValuesBox != NULL)
542  {
543    this->shipValuesBox->setAbsCoor2D(0.2 * this->resX, 0.4 * this->resY);
544    this->shipValuesBox->setWidgetSize(.4 * this->resX, 0.1 * this->resY);
545  }
546  else
547    createShipValuesBox();
548  */
549
550  std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget;
551  Vector2D pos = Vector2D(overlayWidth, 0.4*this->resY);
552  float largestWidgetSizeX = 0;
553  //PRINTF(0)("Cur Pos: %f,%f\n",pos.x,pos.y);
554  // out of reasons i can't get behind, this version is segfaulting when calling getSizeX2D or getSizeY2D. the other
555  // element2D- related function works tough.. :s
556
557  for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++)
558  {
559    float ySize = (*weaponWidget)->getSizeY2D();
560    float xSize = (*weaponWidget)->getSizeX2D();
561    if (xSize > largestWidgetSizeX)
562      largestWidgetSizeX = xSize;
563    if (pos.x < ySize)
564    {
565      pos.x = overlayWidth;
566      pos.y += largestWidgetSizeX;
567    }
568    pos.x -= ySize;
569    (*weaponWidget)->setAbsCoor2D(pos.x + this->rightRect->getAbsCoor2D().x, pos.y);
570    //(*weaponWidget)->setAbsCoor2D(0,100);
571    (*weaponWidget)->show();
572    //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
573  }
574 
575  weaponWidget = this->weaponsWidgetsSec.begin();
576  float expectedWidgetSizeY = 0;
577  if (weaponWidget != this->weaponsWidgetsSec.end())
578  {
579    expectedWidgetSizeY = (*weaponWidget)->getSizeY2D();
580  }
581  pos.y = resY - expectedWidgetSizeY * 0.6;
582  pos.x = overlayWidth + this->rightRect->getAbsCoor2D().x;
583
584  for (weaponWidget = this->weaponsWidgetsSec.begin(); weaponWidget != this->weaponsWidgetsSec.end(); weaponWidget++)
585  {
586    float ySize = (*weaponWidget)->getSizeY2D();
587    float xSize = (*weaponWidget)->getSizeX2D();
588    if (xSize > largestWidgetSizeX)
589      largestWidgetSizeX = xSize;
590    if (pos.x < ySize)
591    {
592      pos.x = overlayWidth;
593      pos.y -= largestWidgetSizeX + expectedWidgetSizeY * 0.6;
594    }
595    pos.x -= ySize;
596    //PRINTF(0)("secweaponwidget y-size: %f/n", (*weaponWidget)->getSizeY2D());
597    (*weaponWidget)->setAbsCoor2D(pos.x, pos.y);//+this->rightRect->getAbsCoor2D().x, pos.y);
598    (*weaponWidget)->show();
599    //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
600  }
601
602}
603
604void Hud::draw() const
605{
606  //  GLGuiWidget::draw();
607}
608
609
610void Hud::process(const Event &event)
611{
612  if (event.type == EV_VIDEO_RESIZE)
613    this->updateResolution();
614  else if (event.type == SDLK_TAB)
615  {
616    /// TODO SHOW THE INPUT-LINE
617  //  this->inputLine->select();
618  }
619}
620
621/*
622void Hud::createShipValuesBox()
623{
624  this->shipValuesBox = new OrxGui::GLGuiBox(OrxGui::Vertical);
625  //this->shipValuesBox->setWidgetSize(1000,500);
626  //this->shipValuesBox->setBackgroundTexture("textures/gui_container_background.png");
627  this->shipValuesBox->setBackgroundTexture(Texture());
628  this->shipValuesBox->setBackgroundColor(Color(0,0,1,0.5));
629  this->shipValuesBox->setVisibility(true);
630}
631*/
632
633
Note: See TracBrowser for help on using the repository browser.