Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2008, 11:12:22 AM (17 years ago)
Author:
chaiy
Message:

BarFactory created, but doesn't work yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud2/src/orxonox/hud/Bar.cc

    r1000 r1002  
    2626*/
    2727
    28 #include "OrxonoxStableHeaders.h"
    29 
    3028#include <OgreOverlayManager.h>
    3129#include <OgreOverlayElement.h>
    32 #include <OgreTextAreaOverlayElement.h>
    3330#include <OgreStringConverter.h>
     31#include <OgreColourValue.h>
    3432#include <string.h>
    3533
    36 #include "Bar.h"
     34#include "BarV1.h"
    3735
    3836namespace orxonox
    3937{
    4038  using namespace Ogre;
    41    
    42   Bar::Bar(Real left, Real top, Real width, Real height,
    43           int dir,  int colour, std::string name){
    44     Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
    45     element = overlayManager.createOverlayElement("Panel",name);
    46     element->setMetricsMode(Ogre::GMM_PIXELS);
    47     dir_ = dir;
    48     left_ = left;
    49     top_ = top;
    50     width_ = width;
    51     height_ = height;
    52     element->setPosition(left_,top_);
    53     element->setDimensions(width_,height_);
    54     setColour(colour);
    55   }
     39
     40    Bar::Bar(const String& name):Ogre::OverlayElement(name){}
     41
     42
     43
     44
     45
     46
     47/*  Bar::Bar(const Ogre::String& s){}
    5648 
    5749  Bar::~Bar(void){}
    5850 
    59  
    60   void Bar::reset(int percentage){
    61     switch(dir_){
    62       case 1:
    63         element->setPosition(left_,top_);
    64         element->setDimensions(width_,height_*percentage/100);
    65         break;
    66       case 2:
    67         element->setPosition(left_+width_-width_*percentage/100,top_);
    68         element->setDimensions(width_*percentage/100,height_);
    69         break;
    70       case 3:
    71         element->setPosition(left_,top_+height_-height_*percentage/100);
    72         element->setDimensions(width_,height_*percentage/100);
    73         break;
    74       default:
    75         element->setPosition(left_,top_);
    76         element->setDimensions(width_*percentage/100,height_); 
     51  */
     52/*  void Bar::setPercentage(float percentage){
     53    percentage_=percentage;
     54    if(dir_){setWidth(int(percentage_* getWidth()));}
     55        else {setHeight(int(percentage_ * getHeight()));}
    7756    }
     57
     58
     59  void Bar::setPercentage(float percentage){
     60    percentage_ = percentage;
     61//    setWidth(getWidth());
    7862  }
    7963
    80   void Bar::setColour(int colour){
    81     switch(colour){
    82      case 0:
    83         element->setMaterialName("Orxonox/Red");
    84         break;
    85      case 1:
    86         element->setMaterialName("Orxonox/Yellow");
    87         break;
    88      case 2:
    89         element->setMaterialName("Orxonox/Green");
    90     }
    91   }
    92 
    93   void Bar::show(){element->show();}
    94 
    95   void Bar::hide(){element->hide();}
    96 
    97   SmartBar::SmartBar(Ogre::Real left, Ogre::Real top, Ogre::Real width, Ogre::Real height,
    98         int dir, std::string name) : Bar(left, top, width, height, dir, Bar::YELLOW, name){
    99   }
    100 
    101   SmartBar::~SmartBar(void){}
    10264
    10365
    104   void SmartBar::reset(int percentage){
    105     if (percentage>50) {setColour(Bar::GREEN);}
    106     else if (percentage>25) {setColour(Bar::YELLOW);}
    107     else setColour(Bar::RED);
    108     Bar::reset(percentage);
     66 
     67  void Bar::setColor(ColourValue color){
     68    color_=color;
     69    setColour(color);
    10970  }
    110 
     71*/       
     72       
    11173}
    11274
Note: See TracChangeset for help on using the changeset viewer.