Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10301 in orxonox.OLD for branches


Ignore:
Timestamp:
Jan 23, 2007, 3:20:26 PM (18 years ago)
Author:
rennerc
Message:

fixed crash on esc bug

Location:
branches/playability/src/world_entities/elements
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/elements/glgui_energywidgetvertical.cc

    r10234 r10301  
    3030  GLGuiEnergyWidgetVertical::GLGuiEnergyWidgetVertical ()
    3131  {
     32    this->_bar = new GLGuiBar();
     33    this->_valueText = new GLGuiText();
     34    this->_image = new GLGuiImage();
    3235
    3336    this->setAbsDir2D(270);
     
    4043    this->setWidgetSize(120,50);
    4144
    42     this->_bar.setParent2D(this);
    43     this->_bar.setBackgroundTexture(Texture());
    44     this->_bar.setBackgroundColor(Color(0,0,0,0));
    45     this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");
    46     this->_bar.setForegroundColor(Color::green);
    47     this->_bar.setChangedValueColor(Color(1,0,0,0.2));
    48     this->_bar.setBorderTop(0);
    49     this->_bar.setBorderLeft(0);
    50     this->_bar.setBorderRight(0);
    51     this->_bar.setBorderBottom(0);
    52     this->_bar.setWidgetSize(100,30);
     45    this->_bar->setParent2D(this);
     46    this->_bar->setBackgroundTexture(Texture());
     47    this->_bar->setBackgroundColor(Color(0,0,0,0));
     48    this->_bar->setForegroundTexture("maps/gui_element_background_faded.png");
     49    this->_bar->setForegroundColor(Color::green);
     50    this->_bar->setChangedValueColor(Color(1,0,0,0.2));
     51    this->_bar->setBorderTop(0);
     52    this->_bar->setBorderLeft(0);
     53    this->_bar->setBorderRight(0);
     54    this->_bar->setBorderBottom(0);
     55    this->_bar->setWidgetSize(100,30);
    5356    //this->_bar.setRelCoor2D(borderLeft(), 0);
    54     this->_bar.setRelCoor2D(0,0);
     57    this->_bar->setRelCoor2D(0,0);
    5558
    56     this->_image.setParent2D(this);
    57     this->_image.setBorderTop(0);
    58     this->_image.setBorderLeft(0);
    59     this->_image.setBorderRight(0);
    60     this->_image.setBorderBottom(0);
    61     this->_image.setWidgetSize(30,30);
    62     this->_image.setForegroundColor(Color(1,1,1,0.6));
    63     this->_image.setBackgroundColor(Color(1,1,1,0));
    64     this->_image.setBackgroundTexture(Texture());
    65     this->_image.loadImageFromFile("maps/evil-flower.png");
     59    this->_image->setParent2D(this);
     60    this->_image->setBorderTop(0);
     61    this->_image->setBorderLeft(0);
     62    this->_image->setBorderRight(0);
     63    this->_image->setBorderBottom(0);
     64    this->_image->setWidgetSize(30,30);
     65    this->_image->setForegroundColor(Color(1,1,1,0.6));
     66    this->_image->setBackgroundColor(Color(1,1,1,0));
     67    this->_image->setBackgroundTexture(Texture());
     68    this->_image->loadImageFromFile("maps/evil-flower.png");
    6669    //this->_image.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D());
    67     this->_image.setRelCoor2D(0,0);
    68     this->_image.setRelDir2D(90);
    69     this->_image.setVisibility(true);
     70    this->_image->setRelCoor2D(0,0);
     71    this->_image->setRelDir2D(90);
     72    this->_image->setVisibility(true);
    7073
    71     this->_valueText.setParent2D(&this->_bar);
    72     this->_valueText.setWidgetSize(100,20);
     74
     75    this->_valueText->setParent2D(this->_bar);
     76    this->_valueText->setWidgetSize(100,20);
    7377    //this->_valueText.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D());
    74     this->_valueText.setAbsCoor2D(-15,-20);
    75     this->_valueText.setChangedTextColor(Color::white);
    76     this->_valueText.setForegroundColor(Color::white);
    77     this->_valueText.setBackgroundTexture(Texture());
    78     this->_valueText.setBackgroundColor(Color(0,0,0,0));
     78    this->_valueText->setAbsCoor2D(-15,-20);
     79    this->_valueText->setChangedTextColor(Color::white);
     80    this->_valueText->setForegroundColor(Color::white);
     81    this->_valueText->setBackgroundTexture(Texture());
     82    this->_valueText->setBackgroundColor(Color(0,0,0,0));
    7983  }
    8084
     
    8589  GLGuiEnergyWidgetVertical::~GLGuiEnergyWidgetVertical ()
    8690  {
     91    if ( this->_valueText )
     92    {
     93      delete this->_valueText;
     94      this->_valueText = NULL;
     95    }
     96   
     97    if ( this->_image )
     98    {
     99      delete this->_image;
     100      this->_image = NULL;
     101    }
    87102  }
    88103
    89104  void GLGuiEnergyWidgetVertical::setMaximum(float max)
    90105  {
    91     this->_bar.setMaximum(max);
     106    this->_bar->setMaximum(max);
    92107  }
    93108
     
    99114
    100115
    101     this->_bar.setValue(value);
    102     this->_bar.setForegroundColor(Color::slerpHSVColor(Color::red, Color::green, value/this->_bar.maximum()));
     116    this->_bar->setValue(value);
     117    this->_bar->setForegroundColor(Color::slerpHSVColor(Color::red, Color::green, value/this->_bar->maximum()));
    103118    //this->_bar.setFrontColor(Color(1,1,1,1), true);
    104     this->_valueText.setText(val.getString());
     119    this->_valueText->setText(val.getString());
    105120    //this->_valueText.setText("asdfas");
    106121  }
     
    108123  void GLGuiEnergyWidgetVertical::setDisplayedImage(const std::string& imageName)
    109124  {
    110     this->_image.loadImageFromFile(imageName);
     125    this->_image->loadImageFromFile(imageName);
    111126  }
    112127
     
    120135    this->setBorderRight(widgetSize.x * 0.2);
    121136   
    122     this->_bar.setWidgetSize(widgetSize.x * 0.8, widgetSize.y * 0.6);
    123     this->_image.setWidgetSize(widgetSize.y * 0.6, widgetSize.y * 0.6);
    124     this->_valueText.setWidgetSize(widgetSize.x* 0.8, widgetSize.y * 0.4);
     137    this->_bar->setWidgetSize(widgetSize.x * 0.8, widgetSize.y * 0.6);
     138    this->_image->setWidgetSize(widgetSize.y * 0.6, widgetSize.y * 0.6);
     139    this->_valueText->setWidgetSize(widgetSize.x* 0.8, widgetSize.y * 0.4);
    125140  }
    126141
     
    129144  {
    130145   
    131     this->_bar.show();
    132     this->_image.show();
    133     this->_valueText.show();
     146    this->_bar->show();
     147    this->_image->show();
     148    this->_valueText->show();
    134149  }
    135150
    136151  void GLGuiEnergyWidgetVertical::hiding()
    137152  {
    138     this->_image.hide();
    139     this->_valueText.hide();
    140     this->_bar.hide();
     153    this->_image->hide();
     154    this->_valueText->hide();
     155    this->_bar->hide();
    141156  }
    142157}
  • branches/playability/src/world_entities/elements/glgui_energywidgetvertical.h

    r10230 r10301  
    2727    void setDisplayedImage(const std::string& imageName);
    2828
    29     inline GLGuiImage* getImageWidget() {return &this->_image;};
    30     inline GLGuiText* getValueWidget() {return &this->_valueText;};
    31     inline GLGuiBar* getBarWidget() {return &this->_bar;};
     29    inline GLGuiImage* getImageWidget() {return this->_image;};
     30    inline GLGuiText* getValueWidget() {return this->_valueText;};
     31    inline GLGuiBar* getBarWidget() {return this->_bar;};
    3232
    3333  protected:
     
    3737
    3838  private:
    39     GLGuiImage             _image;
    40     GLGuiText               _valueText;
    41     GLGuiBar                _bar;
     39    GLGuiImage*              _image;
     40    GLGuiText*               _valueText;
     41    GLGuiBar*                _bar;
    4242
    4343  };
Note: See TracChangeset for help on using the changeset viewer.