Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7883 in orxonox.OLD


Ignore:
Timestamp:
May 27, 2006, 1:57:33 AM (18 years ago)
Author:
bensch
Message:

gui: click and release work (internally)

Location:
branches/gui/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/graphics/importer/material.cc

    r7848 r7883  
    108108      return true;
    109109
    110 
    111   // setting diffuse color
     110  if (likely(Material::selectedMaterial != NULL))
     111  {
     112    for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i)
     113    {
     114        glActiveTexture(Material::glTextureArbs[i]);
     115        //glBindTexture(GL_TEXTURE_2D, 0);
     116        glDisable(GL_TEXTURE_2D);
     117    }
     118  }
     119
     120    // setting diffuse color
    112121  glColor4f (diffuse[0], diffuse[1], diffuse[2], this->transparency);
    113122  // setting ambient color
     
    118127  glMaterialf(GL_FRONT, GL_SHININESS, this->shininess);
    119128
    120 
    121129  // setting the transparency
    122130  if (this->transparency < 1.0 ||       /* This allows alpha blending of 2D textures with the scene */
     
    138146    glShadeModel(GL_SMOOTH);
    139147
    140   if (likely(Material::selectedMaterial != NULL))
    141   {
    142     for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i)
    143     {
    144         glActiveTexture(Material::glTextureArbs[i]);
    145         glBindTexture(GL_TEXTURE_2D, 0);
    146         glDisable(GL_TEXTURE_2D);
    147     }
    148   }
    149148
    150149  for(unsigned int i = 0; i < this->textures.size(); ++i)
     
    159158  }
    160159  Material::selectedMaterial = this;
    161 
    162   /*  if (this->diffuseTexture != NULL)
    163       {
    164         glEnable(GL_TEXTURE_2D);
    165         glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
    166       }
    167     else
    168       {
    169         glDisable(GL_TEXTURE_2D);
    170         glBindTexture(GL_TEXTURE_2D, 0);
    171       }*/
    172160}
    173161
  • branches/gui/src/lib/gui/gl_gui/glgui_button.cc

    r7882 r7883  
    5454    this->setClickable(true);
    5555
     56    this->label.setFont("fonts/final_frontier.ttf", 20);
     57    this->frontMaterial().setDiffuse(1, 0, 0);
     58
    5659    this->label.setParent2D(this);
    5760  }
     61
    5862
    5963  void GLGuiButton::setLabel(const std::string& label)
  • branches/gui/src/lib/gui/gl_gui/glgui_button.h

    r7881 r7883  
    2727  //! This is part of the openglGUI class
    2828  /**
    29    *
     29   * The Button is an Abstract class, that can be pushed to Toggle its state.
    3030   */
    3131  class GLGuiButton : public GLGuiWidget
  • branches/gui/src/lib/gui/gl_gui/glgui_handler.cc

    r7882 r7883  
    3838
    3939    this->cursor = NULL;
    40     //this->subscribeEvent()
     40    for (unsigned int i = 0; i < EV_NUMBER; i++)
     41    {
     42      this->subscribeEvent(ES_MENU, i);
     43    }
    4144
    4245  }
     
    8689  void GLGuiHandler::process(const Event &event)
    8790  {
     91    if (event.type == EV_MOUSE_BUTTON_LEFT)
     92    {
    8893
     94      if (GLGuiWidget::focused() != NULL)
     95      {
     96        if (event.bPressed)
     97          GLGuiWidget::focused()->click();
     98        else
     99          GLGuiWidget::focused()->release();
     100      }
     101    }
    89102
    90103  }
  • branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.cc

    r7881 r7883  
    5454    printf("%s received focus\n", this->getLabel().c_str());
    5555
     56    Vector test;
     57    this->frontMaterial().getDiffuseColor(test.x, test.y, test.z);
     58    test.debug();
    5659  }
    5760  void GLGuiPushButton::removedFocus()
     
    6164  }
    6265
     66  void GLGuiPushButton::clicked()
     67  {
     68    printf("%s clicked\n", this->getLabel().c_str());
     69  }
     70
     71
     72  void GLGuiPushButton::released()
     73  {
     74    printf("%s released\n", this->getLabel().c_str());
     75  }
    6376
    6477
     
    7285    GLGuiButton::draw();
    7386
    74     this->frontMat.select();
     87    this->frontMaterial().select();
    7588    glBegin(GL_QUADS);
    7689
     
    8194
    8295    glEnd();
    83 
    8496    this->endDraw();
    8597    //   this->label->draw();
  • branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.h

    r7881 r7883  
    2929    virtual void receivedFocus();
    3030    virtual void removedFocus();
     31    virtual void clicked();
     32    virtual void released();
     33
     34
    3135    virtual void draw() const;
    3236    virtual void update();
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.cc

    r7882 r7883  
    6060
    6161    this->backMat.setDiffuse(1.0, 1.0, 1.0);
     62    this->frontMat.setDiffuse(1.0, 0.0, 0.0);
    6263
    6364    this->frontModel = 0;
     65    this->backModel = 0;
    6466
    6567    this->widgetSignals.resize(SignalCount, SignalConnector());
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.h

    r7882 r7883  
    7979    bool clickable() const { return this->_clickable; };
    8080    void setClickable(bool clickable = true) { this->_clickable = clickable; };
    81 
     81    void click() { this->clicked(); };
     82    void release() { this->released(); };
    8283
    8384    virtual void update() {};
     
    9899  protected:
    99100        // if something was clickt on the GUI-widget.
    100     virtual void clicked(const Event& event) {};
    101     virtual void released(const Event& event) {};
     101    virtual void clicked() {};
     102    virtual void released() {};
    102103
    103104    virtual void receivedFocus() {};
  • branches/gui/src/story_entities/simple_game_menu.cc

    r7880 r7883  
    6666  pb->show();
    6767  pb->setAbsCoor2D(50, 50);
     68
     69  OrxGui::GLGuiPushButton* dnpb = new OrxGui::GLGuiPushButton("DO NOT PUSH ME");
     70  dnpb->show();
     71  dnpb->setAbsCoor2D(350, 50);
     72
     73  OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("REALLY DO NOT PUSH ME!!");
     74  rdnpb->show();
     75  rdnpb->setAbsCoor2D(200, 180);
     76
    6877
    6978  OrxGui::GLGuiHandler::getInstance()->activateCursor();
Note: See TracChangeset for help on using the changeset viewer.