Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7925 in orxonox.OLD


Ignore:
Timestamp:
May 28, 2006, 5:56:17 PM (18 years ago)
Author:
bensch
Message:

gui: removed the grab-event, and using Rect now

Location:
branches/gui/src
Files:
11 edited

Legend:

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

    r7919 r7925  
    337337  else
    338338  {
    339     SDL_WM_GrabInput(SDL_GRAB_ON);
     339    //SDL_WM_GrabInput(SDL_GRAB_ON);
    340340    SDL_ShowCursor(SDL_DISABLE);
    341341  }
  • branches/gui/src/lib/gui/gl_gui/glgui_button.h

    r7919 r7925  
    3939    void setLabel(const std::string& label);
    4040
    41     virtual void resize() = 0;
    42 
    4341    virtual void draw() const;
    4442
    4543    private:
    4644      void init();
     45
    4746
    4847
  • branches/gui/src/lib/gui/gl_gui/glgui_checkbutton.cc

    r7919 r7925  
    6262    this->label.setRelCoor2D(25, 5);
    6363    this->setSize2D(this->label.getSizeX2D() + 30, this->label.getSizeY2D() + 10);
     64    GLGuiWidget::resize();
     65    this->frontRect().setTopLeft(1, 1);
     66    this->frontRect().setSize(this->getSizeX2D() -2, this->getSizeY2D() -2);
    6467  }
    6568
     
    7275  }
    7376
     77
     78
    7479  /**
    7580   * @brief draws the GLGuiPushButton
     
    8186
    8287    this->frontMaterial().select();
    83     glBegin(GL_QUADS);
    84 
    85     glTexCoord2i(0,0); glVertex2d(1, 1);
    86     glTexCoord2i(0,1); glVertex2d(1, this->getSizeY2D() - 1);
    87     glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 1, this->getSizeY2D() -1);
    88     glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 1, 1);
     88    this->drawRect(this->frontRect());
    8989
    9090    if (this->bActive)
    9191    {
     92      glBegin(GL_QUADS);
    9293      glColor3f( 1, 1 ,1);
    9394      glTexCoord2i(0,0); glVertex2d(8, 8);
     
    117118    else
    118119    {
     120      glBegin(GL_QUADS);
    119121      glColor3f(0, 0, 0);
    120122      glTexCoord2i(0,0); glVertex2d(8, 8);
     
    125127    }
    126128
    127 
    128129    this->endDraw();
    129     //   this->label->draw();
    130     //  printf("test");
    131130  }
    132131}
  • branches/gui/src/lib/gui/gl_gui/glgui_checkbutton.h

    r7919 r7925  
    2626    virtual ~GLGuiCheckButton();
    2727
    28     virtual void resize();
    2928    virtual void released();
    3029
     
    3534    virtual void draw() const;
    3635    virtual void update() {};
     36
     37  protected:
     38    virtual void resize();
    3739
    3840  private:
  • branches/gui/src/lib/gui/gl_gui/glgui_cursor.cc

    r7924 r7925  
    6464    this->color = 0.0f;
    6565
     66    this->resize();
    6667  }
    6768
     
    8889
    8990
    90       this->setAbsCoor2D(newPos);
     91      this->setAbsCoorSoft2D(newPos, 20);
    9192      movement = Vector2D();
    9293    }
  • branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.cc

    r7919 r7925  
    4545  void GLGuiPushButton::resize()
    4646  {
    47     this->label.setRelCoor2D(5, 5);
     47    this->label.setRelCoor2D(25, 5);
    4848    this->setSize2D(this->label.getSizeX2D() + 10, this->label.getSizeY2D() + 10);
     49    GLGuiWidget::resize();
     50    this->frontRect().setTopLeft(1, 1);
     51    this->frontRect().setSize(this->getSizeX2D() -2, this->getSizeY2D() -2);
    4952  }
    5053
  • branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.h

    r7919 r7925  
    2727
    2828
    29     virtual void resize();
    30 
    3129    virtual void receivedFocus();
    3230    virtual void removedFocus();
     
    3735    virtual void draw() const;
    3836    virtual void update();
     37  protected:
     38    virtual void resize();
     39
     40
    3941  private:
    4042    void init();
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.cc

    r7924 r7925  
    104104  }
    105105
     106
     107  void GLGuiWidget::resize()
     108  {
     109    this->backRect().setSize(this->getSize2D());
     110  }
     111
     112
    106113  void GLGuiWidget::click()
    107114  {
     
    189196  }
    190197
     198
    191199  void GLGuiWidget::hide()
    192200  {
     
    195203
    196204
     205  /**
     206   * USE THIS FUNCTION ONLY FROM DERIVED CLASS
     207   */
    197208  void GLGuiWidget::draw() const
    198209  {
    199210    this->backMaterial().select();
    200 
    201     glBegin(GL_QUADS);
    202     glTexCoord2i(0,0); glVertex2d(0, 0);
    203     glTexCoord2i(0,1); glVertex2d(0, this->getSizeY2D());
    204     glTexCoord2i(1,1); glVertex2d(this->getSizeX2D(), this->getSizeY2D());
    205     glTexCoord2i(1,0); glVertex2d(this->getSizeX2D(), 0);
    206     glEnd();
     211    this->drawRect(this->backRect());
    207212  }
    208213
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.h

    r7924 r7925  
    8181
    8282
     83
    8384    /// CLICK
    8485    void click();
     
    8687    bool clickable() const { return this->_clickable; };
    8788    void setClickable(bool clickable = true) { this->_clickable = clickable; };
    88 
    89     virtual void update() {};
    90     virtual void draw() const;
    9189
    9290
     
    102100    const Rect2D& frontRect() const { return this->_frontRect; };
    103101
    104     inline void drawRect(const Rect2D& rect) {
     102    inline void drawRect(const Rect2D& rect) const {
    105103      glBegin(GL_QUADS);
    106104      glTexCoord2i(0,0); glVertex2d(rect.left(), rect.top());
     
    111109    }
    112110
     111
     112    virtual void update() {};
     113    virtual void draw() const;
     114
    113115    /** @param the Event to process. @returns true if the Event has been consumed*/
    114116    virtual bool processEvent(const Event& event) { };
     
    117119    DeclareSignal(testSignal, ());
    118120
     121
     122
    119123  protected:
    120         // if something was clickt on the GUI-widget.
     124
     125    /// LOOKS
     126    virtual void resize();
     127
     128    // if something was clickt on the GUI-widget.
    121129    virtual void clicked();
    122130    virtual void released();
  • branches/gui/src/lib/math/rect2D.h

    r7919 r7925  
    8383  inline void setRight(float right) { _bottomRight.x = right; };
    8484  /** @param topLeft the top left corner of the Rectangle */
    85   void setTopLeft(const Vector2D& topLeft) { _topLeft = topLeft; };
     85  inline void setTopLeft(const Vector2D& topLeft) { _topLeft = topLeft; };
     86  /** @param x the left border of the Rectangle @param y the top border */
     87  inline void setTopLeft(float x, float y) { this->setTopLeft(Vector2D(x,y)); };
    8688  /** @param bottomRight the lower right corner of the Rectangle */
    87   void setBottomRight(const Vector2D& bottomRight) { _bottomRight = bottomRight; };
     89  inline void setBottomRight(const Vector2D& bottomRight) { _bottomRight = bottomRight; };
     90  /** @param x the right border of the Rectangle @param y the bottom border */
     91  inline void setBottomRight(float x, float y) { this->setBottomRight(Vector2D(x,y)); };
    8892
    8993  void setWidth(float width);
  • branches/gui/src/story_entities/simple_game_menu.cc

    r7924 r7925  
    6666  /// GUI
    6767  ///(this is as modular as it is possible).
    68   /*
    6968  OrxGui::GLGuiPushButton* pb = new OrxGui::GLGuiPushButton("PUSH ME");
    7069  pb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::enterGui));
     
    7473  OrxGui::GLGuiHandler::getInstance()->activateCursor();
    7574  OrxGui::GLGuiHandler::getInstance()->activate();
    76   */
    7775  /////
    7876
Note: See TracChangeset for help on using the changeset viewer.