Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 8, 2007, 9:19:39 PM (18 years ago)
Author:
muellmic
Message:

implementing interface 'by hand' without still buggy packing-function. can't test with spaceship because of segfault

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

Legend:

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

    r10139 r10194  
    1919
    2020#include "multi_type.h"
     21#include <iostream>
     22#include "math.h"
    2123
    2224namespace OrxGui
     
    3335    //this->_name.setRelCoor2D(20,0);
    3436    //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);
    4040
    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());
    4253    this->_valueText.setChangedTextColor(Color::white);
    43     this->_bar.setBackgroundTexture(Texture());
    4454
    4555    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);
    4758
    4859    //this->_name.setBackgroundTexture(Texture());
    4960    //this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");
     61
     62    this->_bar.setParent2D(&this->_valueText);
    5063    this->_bar.setBackgroundTexture(Texture());
    5164    this->_bar.setBackgroundColor(Color(0,0,0,0));
     
    5366    this->_bar.setForegroundColor(Color(.5, .5, .5, 1));
    5467    this->_bar.setChangedValueColor(Color::black);
     68    this->_bar.setSize2D(100,20);
     69    this->_bar.setRelCoor2D(borderLeft(), 0);
    5570  }
    5671
     
    6176  GLGuiEnergyWidgetVertical::~GLGuiEnergyWidgetVertical ()
    6277  {
    63   }
    64 
    65 
    66   void GLGuiEnergyWidgetVertical::setDisplayedName(const std::string& name)
    67   {
    68     this->_name.setText(name);
    69     this->_bar.setWidgetSize(this->_name.getSize2D());
    7078  }
    7179
     
    8593    this->_bar.setFrontColor(Color(1,1,1,1), true);
    8694    this->_valueText.setText(val.getString());
     95    //this->_valueText.setText("asdfas");
    8796  }
    8897
    8998  void GLGuiEnergyWidgetVertical::resize()
    9099  {
    91     GLGuiBox::resize();
     100    //GLGuiBox::resize();
    92101  }
    93102
     
    95104  void GLGuiEnergyWidgetVertical::showing()
    96105  {
    97     this->_name.show();
     106    this->_image.show();
    98107    this->_valueText.show();
    99108    this->_bar.show();
     
    102111  void GLGuiEnergyWidgetVertical::hiding()
    103112  {
    104     this->_name.hide();
     113    this->_image.hide();
    105114    this->_valueText.hide();
    106115    this->_bar.hide();
  • branches/playability/src/world_entities/elements/glgui_energywidgetvertical.h

    r10107 r10194  
    1010#include "glgui_bar.h"
    1111#include "glgui_text.h"
     12#include "glgui_widget.h"
    1213
    1314namespace OrxGui
     
    1516
    1617  //! A class for ...
    17   class GLGuiEnergyWidgetVertical : public GLGuiBox
     18  class GLGuiEnergyWidgetVertical : public GLGuiWidget
    1819  {
    1920
     
    2223    virtual ~GLGuiEnergyWidgetVertical();
    2324
    24     void setDisplayedName(const std::string& name);
    2525    void setMaximum(float max);
    2626    void setValue(float value);
    2727
    28     inline GLGuiWidget* getNameWidget() {return &this->_name;};
     28    inline GLGuiWidget* getImageWidget() {return &this->_image;};
    2929    inline GLGuiWidget* getValueWidget() {return &this->_valueText;};
    3030    inline GLGuiWidget* getBarWidget() {return &this->_bar;};
     
    3636
    3737  private:
    38     GLGuiText               _name;
     38    GLGuiWidget             _image;
    3939    GLGuiText               _valueText;
    4040    GLGuiBar                _bar;
Note: See TracChangeset for help on using the changeset viewer.