Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8429 in orxonox.OLD for branches/gui/src/lib


Ignore:
Timestamp:
Jun 15, 2006, 12:29:58 AM (18 years ago)
Author:
bensch
Message:

orxonox/gui: better draw to CheckButton

Location:
branches/gui/src/lib/gui/gl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/gui/gl/glgui_checkbutton.cc

    r8378 r8429  
    6565  void GLGuiCheckButton::resize()
    6666  {
    67     this->labelText().setRelCoor2D(borderLeft() + 25, borderTop() + 5);
    68     this->setSize2D(this->labelText().getSizeX2D() + 30 + borderLeft() + borderRight(), this->labelText().getSizeY2D() + 10 + borderTop()+borderBottom());
     67
     68    this->labelText().setRelCoor2D( borderLeft() + 15.0, borderTop() + 5);
     69    this->setSize2D(this->labelText().getSizeX2D() + 15.0 + borderLeft() + borderRight(), this->labelText().getSizeY2D() + 10 + borderTop()+borderBottom());
    6970    GLGuiWidget::resize();
     71
     72    this->_checkBox.setSize(10.0, 10.0);
     73    this->_checkBox.setCenter( borderLeft() + _checkBox.height()/2.0, borderTop() + (this->getSizeY2D() - borderTop() - borderBottom()) / 2.0);
     74
    7075/*    this->frontRect().setTopLeft(borderLeft(), borderTop());
    7176    this->frontRect().setSize(this->getSizeX2D() - (borderLeft() + borderRight()) , this->getSizeY2D() - (borderTop() + borderBottom()));*/
     
    9499    if (this->bActive)
    95100    {
    96       glBegin(GL_QUADS);
    97       glColor3f( 1, 1 ,1);
    98       glTexCoord2i(0,0); glVertex2d(borderLeft()+8, borderTop()+8);
    99       glTexCoord2i(0,1); glVertex2d(borderLeft() + 8, this->getSizeY2D()-8 - (borderTop() + borderBottom()));
    100       glTexCoord2i(1,1); glVertex2d(this->getSizeY2D()-8 +borderLeft(), this->getSizeY2D()-8- (borderTop() + borderBottom()));
    101       glTexCoord2i(1,0); glVertex2d(this->getSizeY2D()-8 +borderLeft(), borderTop()+8);
    102       glEnd();
     101      glColor3fv( &this->frontColor()[0]);
     102      this->drawRect(this->_checkBox);
    103103
    104104
    105105      // DRAW a cross :)
    106       glColor3f(0,0,0);
     106      Vector2D center = this->_checkBox.center();
     107      glColor4f(1,1,1, 1.0);
    107108      glLineWidth(3.0);
     109
    108110      glBegin(GL_LINE_LOOP);
    109       glVertex2d(borderLeft()+8,borderTop() +8);
    110       glVertex2d(this->getSizeY2D()/2 + borderLeft(), this->getSizeY2D()/2 - 1);
     111      glVertex2d(_checkBox.left(), _checkBox.top());
     112      glVertex2d(center.x, center.y);
    111113
    112       glVertex2d(this->getSizeY2D()-8 + borderLeft(), borderTop()+8);
    113       glVertex2d(this->getSizeY2D()/2 +1 + borderLeft(), this->getSizeY2D()/2);
     114      glVertex2d(_checkBox.right(), _checkBox.top());
     115      glVertex2d(center.x, center.y);
    114116
    115       glVertex2d(this->getSizeY2D()-8 + borderLeft(), this->getSizeY2D()-8- (borderTop() + borderBottom()));
    116       glVertex2d(this->getSizeY2D()/2 + borderLeft(), this->getSizeY2D()/2+1);
     117      glVertex2d(_checkBox.right(), _checkBox.bottom());
     118      glVertex2d(center.x, center.y);
    117119
    118       glVertex2d(borderLeft() + 8, this->getSizeY2D()-8 - (borderTop() + borderBottom()));
    119       glVertex2d(this->getSizeY2D()/2 -1 + borderLeft(), this->getSizeY2D()/2);
     120      glVertex2d(_checkBox.left(), _checkBox.bottom());
     121      glVertex2d(center.x, center.y);
    120122      glEnd();
    121123    }
    122124    else
    123125    {
    124       glBegin(GL_QUADS);
    125       glColor3f(0, 0, 0);
    126       glTexCoord2i(0,0); glVertex2d(borderLeft()+8, borderTop()+8);
    127       glTexCoord2i(0,1); glVertex2d(borderLeft()+ 8, this->getSizeY2D()-8 - (borderTop() + borderBottom()));
    128       glTexCoord2i(1,1); glVertex2d(this->getSizeY2D()-8 +borderLeft(), this->getSizeY2D()-8- (borderTop() + borderBottom()));
    129       glTexCoord2i(1,0); glVertex2d(this->getSizeY2D()-8 +borderLeft(), borderTop()+8);
    130       glEnd();
     126      glColor3fv( &this->frontColor()[0]);
     127      this->drawRect(this->_checkBox);
    131128    }
    132129
  • branches/gui/src/lib/gui/gl/glgui_checkbutton.h

    r8145 r8429  
    4646  private:
    4747    bool             bActive;
    48 
     48    Rect2D           _checkBox;
    4949  };
    5050}
Note: See TracChangeset for help on using the changeset viewer.