Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7928 in orxonox.OLD


Ignore:
Timestamp:
May 28, 2006, 6:50:55 PM (18 years ago)
Author:
bensch
Message:

gui: slider work

Location:
branches/gui/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/event/event_handler.cc

    r7925 r7928  
    474474    {
    475475      EventHandler::getInstance()->grabEvents( true);
    476       return 0;
     476      return 1;
    477477    }
    478478  }
  • branches/gui/src/lib/gui/gl_gui/glgui.h

    r7924 r7928  
    1818//#include "glgui_colorselector.h"
    1919#include "glgui_pushbutton.h"
     20#include "glgui_slider.h"
    2021#include "glgui_cursor.h"
    2122#include "glgui_inputline.h"
  • branches/gui/src/lib/gui/gl_gui/glgui_bar.cc

    r7919 r7928  
    6060  void GLGuiBar::draw() const
    6161  {
    62     this->startDraw();
     62    this->beginDraw();
    6363
    6464    GLGuiWidget::draw();
  • branches/gui/src/lib/gui/gl_gui/glgui_checkbutton.cc

    r7925 r7928  
    8282  void GLGuiCheckButton::draw() const
    8383  {
    84     this->startDraw();
     84    this->beginDraw();
    8585    GLGuiButton::draw();
    8686
  • branches/gui/src/lib/gui/gl_gui/glgui_cursor.cc

    r7925 r7928  
    8989
    9090
    91       this->setAbsCoorSoft2D(newPos, 20);
     91      this->setAbsCoor2D(newPos);
    9292      movement = Vector2D();
    9393    }
     
    9999  void GLGuiCursor::draw() const
    100100  {
    101     this->startDraw();
     101    this->beginDraw();
    102102    GLGuiWidget::draw();
    103103    this->endDraw();
  • branches/gui/src/lib/gui/gl_gui/glgui_inputline.cc

    r7926 r7928  
    163163  void GLGuiInputLine::draw() const
    164164  {
    165     this->startDraw();
     165    this->beginDraw();
    166166    GLGuiWidget::draw();
    167167
  • branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.cc

    r7926 r7928  
    9494  void GLGuiPushButton::draw() const
    9595  {
    96     this->startDraw();
     96    this->beginDraw();
    9797    GLGuiButton::draw();
    9898
  • branches/gui/src/lib/gui/gl_gui/glgui_slider.cc

    r7919 r7928  
    4444  {
    4545    this->setClassID(CL_GLGUI_SLIDER, "GLGuiSlider");
     46    this->_value = 0.0;
     47    this->_minValue = 0.0;
     48    this->_maxValue = 1.0;
     49    this->_step = 0.1;
    4650
     51    this->setSize2D(100, 30);
     52    this->resize();
     53  }
     54
     55
     56  void GLGuiSlider::setValue(float value)
     57  {
     58    this->_value = value;
     59  }
     60
     61  void GLGuiSlider::setMin(float minimum)
     62  {
     63    this->_minValue = minimum;
     64  }
     65
     66  void GLGuiSlider::setMax(float maximum)
     67  {
     68    this->_maxValue = maximum;
     69  }
     70
     71  void GLGuiSlider::setRange(float minimum, float maximum)
     72  {
     73    this->_minValue = minimum;
     74    this->_maxValue = maximum;
     75  }
     76
     77  void GLGuiSlider::setStep(float step)
     78  {
     79    this->_step = step;
     80  }
     81
     82
     83  void GLGuiSlider::resize()
     84  {
     85    GLGuiWidget::resize();
     86    this->frontRect().setTopLeft(5, this->getSizeY2D()/2.0 - 1.0);
     87    this->frontRect().setSize(this->getSizeX2D() - 10.0, 5);
    4788  }
    4889
    4990  /**
    50    * draws the GLGuiSlider
     91   * @brief draws the GLGuiSlider
    5192   */
    5293  void GLGuiSlider::draw() const
    5394  {
     95    this->beginDraw();
     96    GLGuiWidget::draw();
     97
     98    this->frontMaterial().select();
     99    this->drawRect(this->frontRect());
     100
     101    float percentagePosition = (this->_value - this->_minValue)/( this->_maxValue - this->_minValue);
     102
     103    this->drawRect(Rect2D(percentagePosition* this->getSizeX2D(), 2, 5, this->getSizeY2D() - 4));
     104
     105    this->endDraw();
    54106  }
    55107}
  • branches/gui/src/lib/gui/gl_gui/glgui_slider.h

    r7924 r7928  
    4545
    4646    virtual void draw() const;
     47  protected:
     48    void resize();
    4749
    4850  private:
    4951    void init();
    50     private:
     52  private:
    5153
    5254    Orientation      orientation;
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.h

    r7925 r7928  
    135135
    136136
    137     inline void startDraw() const { glPushMatrix(); glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); };
     137    inline void beginDraw() const { glPushMatrix(); glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); };
    138138    inline void endDraw() const { glPopMatrix(); };
    139139
  • branches/gui/src/story_entities/simple_game_menu.cc

    r7925 r7928  
    100100  input->setAbsCoor2D(200, 230);
    101101
     102  OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
     103  slider->setRange(1, 10);
     104  slider->setValue(5.0);
     105  slider->show();
     106  slider->setAbsCoor2D(200, 270);
    102107
    103108  /////
Note: See TracChangeset for help on using the changeset viewer.