Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10716 in orxonox.OLD for branches/presentation/src


Ignore:
Timestamp:
Jun 18, 2007, 4:06:03 PM (17 years ago)
Author:
bknecht
Message:

hud update

Location:
branches/presentation/src/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/util/hud.cc

    r10698 r10716  
    5858  this->resY = 1;
    5959
    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);
     60        this->init();
    7361 
    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;
    8462}
    8563
     
    10078  delete this->bottomRect;
    10179  delete this->middleRect;
     80 
    10281
    10382  //if (this->shipValuesBox != NULL)
     
    10584
    10685  // delete what has to be deleted here
     86}
     87
     88void Hud::init()
     89{
     90        this->overlayPercentage = 40;
     91        this->overlayActive = false;
     92        this->rightRect = new OrxGui::GLGuiImage();
     93        this->leftRect = new OrxGui::GLGuiImage();
     94        this->topRect = new OrxGui::GLGuiImage();
     95        this->bottomRect = new OrxGui::GLGuiImage();
     96        this->middleRect = new OrxGui::GLGuiImage();
     97
     98        this->inputLine = new OrxGui::GLGuiInputLine();
     99        this->inputLine->setParent2D(this);
     100        this->notifier = new OrxGui::GLGuiNotifier();
     101        this->notifier->setParent2D(this);
     102        notifier->setAbsCoor2D(100,100);
     103       
     104        this->barSocket = new OrxGui::GLGuiImage();
     105        this->barSocket->setParent2D(this->bottomRect);
     106       
     107        this->_radar = new OrxGui::GLGuiRadar();
     108        this->radarCenterNode = NULL;
     109       
     110        this->subscribeEvent(ES_ALL, EV_VIDEO_RESIZE);
     111        this->subscribeEvent(ES_ALL, SDLK_TAB);
     112 
     113        if (this->playmode == FirstPerson)
     114        {
     115                this->topHit = new OrxGui::GLGuiImage();
     116                this->topHit->loadImageFromFile("textures/gui/gui_hitbar.png");
     117                this->topHit->setParent2D(this->middleRect);
     118                this->topHit->setRelDir2D(-1.5708);
     119               
     120                this->bottomHit = new OrxGui::GLGuiImage();
     121                this->bottomHit->loadImageFromFile("textures/gui/gui_hitbar.png");
     122                this->bottomHit->setParent2D(this->middleRect);
     123                this->bottomHit->setRelDir2D(1.5708);
     124               
     125                this->leftHit = new OrxGui::GLGuiImage();
     126                this->leftHit->loadImageFromFile("textures/gui/gui_hitbar.png");
     127                this->leftHit->setParent2D(this->middleRect);
     128               
     129                this->rightHit = new OrxGui::GLGuiImage();
     130                this->rightHit->loadImageFromFile("textures/gui/gui_hitbar.png");
     131                this->rightHit->setParent2D(this->middleRect);
     132                this->rightHit->setRelDir2D(3.1416);
     133               
     134                this->leftRect->setParent2D(this);
     135                this->rightRect->setParent2D(this);
     136        }
     137
     138  //this->shipValuesBox = NULL;
    107139}
    108140
     
    321353*/
    322354
     355void Hud::setMode(Hud::Playmode playmode)
     356{
     357        this->playmode = playmode;
     358        this->init();
     359}
     360
    323361void Hud::updateWeaponManager()
    324362{
     
    390428  this->resY = State::getResY();
    391429
    392   this->setSize2D(.2 * this->resX, this->resY);
     430  this->setSize2D(this->resX, this->resY);
    393431  if( this->playmode != FirstPerson )
    394432  {
     
    410448  if( this->playmode != FirstPerson )
    411449  {
    412           this->leftRect->setParent2D(this);
     450         
    413451          this->leftRect->setWidgetSize(float(overlayWidth), float(this->resY));
    414452          this->leftRect->setAbsCoor2D(0,0);
    415           this->leftRect->setBackgroundTexture(Texture());
     453          /*this->leftRect->setBackgroundTexture(Texture());
    416454          this->leftRect->setBackgroundColor(Color(0,0,0.7,0.2));
    417455          this->leftRect->setForegroundTexture(Texture());
    418           this->leftRect->setForegroundColor(Color(0,0,0,0));
    419        
    420           this->rightRect->setParent2D(this);
     456          this->leftRect->setForegroundColor(Color(0,0,0,0));*/
     457         
    421458          this->rightRect->setWidgetSize(float(overlayWidth), float(this->resY));
    422459          this->rightRect->setAbsCoor2D(this->resX - overlayWidth,0);
    423           this->rightRect->setBackgroundTexture(Texture());
     460          /*this->rightRect->setBackgroundTexture(Texture());
    424461          this->rightRect->setBackgroundColor(Color(0,0,0.7,0.2));
    425462          this->rightRect->setForegroundTexture(Texture());
    426           this->rightRect->setForegroundColor(Color(0,0,0,0));
     463          this->rightRect->setForegroundColor(Color(0,0,0,0));*/
    427464  }
    428465  else
     
    431468          this->bottomRect->setWidgetSize(float(this->resX), float(overlayWidth));
    432469          this->bottomRect->setAbsCoor2D(0, this->resY - overlayWidth);
     470         
    433471          this->topRect->setParent2D(this);
    434472          this->topRect->setWidgetSize(float(this->resX), float(overlayWidth));
    435473          this->topRect->setAbsCoor2D(0, 0);
     474         
    436475          this->middleRect->setParent2D(this);
    437           this->middleRect->setWidgetSize(float(this->resY)/2, float(this->resY)/2);
    438           this->middleRect->setAbsCoor2D(float(this->resX - this->resY/2)/2, float(this->resY)/4);
     476          //this->middleRect->setWidgetSize(float(this->resY)/2, float(this->resY)/2);
     477          this->middleRect->setAbsCoor2D(/*float(this->resX - this->resY/2)/2, float(this->resY)/4*/float(this->resX/2), float(this->resY/2));
     478         
     479          this->bottomHit->setRelCoor2D(0, this->resY/4);
     480          this->topHit->setRelCoor2D(0, -this->resY/4);
     481          this->leftHit->setRelCoor2D(-this->resX/4, 0);
     482          this->rightHit->setRelCoor2D(this->resX/4, 0);
    439483  }
    440484
  • branches/presentation/src/util/hud.h

    r10698 r10716  
    4747  void notifyUser(const std::string& message);
    4848
    49   inline void setMode(Hud::Playmode playmode) {this->playmode = playmode;};
     49  void setMode(Hud::Playmode playmode);
    5050  inline Hud::Playmode getMode() {return this->playmode;};
    5151
     
    9393  private:
    9494    void updateResolution();
     95    void init();
    9596    //void createShipValuesBox();
    9697
     
    119120  OrxGui::GLGuiWidget*          middleRect;
    120121  OrxGui::GLGuiWidget*          barSocket;
     122  OrxGui::GLGuiImage*           topHit;
     123  OrxGui::GLGuiImage*           bottomHit;
     124  OrxGui::GLGuiImage*           leftHit;
     125  OrxGui::GLGuiImage*           rightHit;
    121126  bool                     overlayActive;
    122127  int                      overlayPercentage; //the percentage of the screen, the player has got for his movements. should always be a value between 0 and 1;
Note: See TracChangeset for help on using the changeset viewer.