Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8990 in orxonox.OLD


Ignore:
Timestamp:
Jul 1, 2006, 6:09:30 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: new Functionality to widget, so one can set a foreground texture, for Widgets requesting it.

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gl/glgui_widget.cc

    r8989 r8990  
    651651    else
    652652      this->setForegroundColor(Color(r,g,b,a));
     653  }
     654
     655
     656    /**
     657   * @brief sets the Foreground Texture for all States.
     658   * @param texture the Texture.
     659     */
     660  void GLGuiWidget::setForegroundTexture(const Texture& texture)
     661  {
     662    for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i)
     663      setForegroundTexture(texture, (OrxGui::State)i);
     664  }
     665
     666  /**
     667   * @brief sets the Foreground Texture to all States.
     668   * @param textureName the Texture's fileName.
     669   */
     670  void GLGuiWidget::setForegroundTexture(const std::string& textureName)
     671  {
     672    for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i)
     673      _style[i]._foreground.setDiffuseMap(textureName);
     674    this->_currentStyle._foreground.setDiffuseMap(textureName);
     675  }
     676
     677  /**
     678   * @brief sets the Foreground Texture.
     679   * @param texture the Texture.
     680   * @param state the State to setup.
     681   */
     682  void GLGuiWidget::setForegroundTexture(const Texture& texture, OrxGui::State state)
     683  {
     684    _style[state]._background.setDiffuseMap(texture);
     685    if (state == _state)
     686      _currentStyle._background.setDiffuseMap(texture);
     687  }
     688
     689
     690
     691  /**
     692   * @brief sets the Foreground Texture.
     693   * @param texture the Texture.
     694   * @param stateName the State to setup.
     695   */
     696  void GLGuiWidget::setForegroundTexture(const std::string& textureName, const std::string& stateName)
     697  {
     698    OrxGui::State state;
     699    if (getState(stateName, &state))
     700      ; /// FIXME this->setForegroundTexture(textureName, state);
     701    else
     702      ; ///    this->setForegroundTexture(textureName);
    653703  }
    654704
  • trunk/src/lib/gui/gl/glgui_widget.h

    r8983 r8990  
    192192    void setForegroundColorS(float r, float g, float b, float a, const std::string& stateName);
    193193
     194    void setForegroundTexture(const Texture& texture);
     195    void setForegroundTexture(const std::string& textureName);
     196    void setForegroundTexture(const Texture& texture, OrxGui::State state);
     197    void setForegroundTexture(const std::string& textureName, const std::string& stateName);
     198
    194199    void loadBackgroundMaterial(const Material& material);
    195200    void loadBackgroundMaterial(const Material& material, OrxGui::State state);
  • trunk/src/util/hud.cc

    r8989 r8990  
    4949  notifier->setAbsCoor2D(100,100);
    5050
     51  this->subscribeEvent(ES_ALL, EV_VIDEO_RESIZE);
    5152
    5253
     
    192193}
    193194
    194 
    195 void Hud::tick(float dt)
    196 {
    197   if (this->resY != State::getResY() || this->resX != State::getResX())
    198   {
     195void Hud::draw() const
     196{
     197  //  GLGuiWidget::draw();
     198}
     199
     200
     201void Hud::process(const Event &event)
     202{
     203  if (event.type == EV_VIDEO_RESIZE)
    199204    this->updateResolution();
    200   }
    201 
    202 }
    203 
    204 void Hud::draw() const
    205 {
    206   //  GLGuiWidget::draw();
    207 }
    208 
    209 
     205}
     206
     207
  • trunk/src/util/hud.h

    r8972 r8990  
    88
    99#include "element_2d.h"
     10#include "event_listener.h"
    1011// FORWARD DECLARATION
    1112class TiXmlElement;
     
    2021
    2122//! A class that renders a HUD (Heads Up Display for User Information).
    22 class Hud : public Element2D
     23class Hud : public Element2D, public EventListener
    2324{
    2425
     
    4445  void updateWeaponManager();
    4546
    46   void tick(float dt);
    4747  void draw() const;
     48  virtual void process(const Event &event);
     49
    4850
    4951  private:
  • trunk/src/world_entities/elements/glgui_energywidget.cc

    r8988 r8990  
    3939    this->_bar.setBackgroundTexture(Texture());
    4040    this->_bar.setBackgroundColor(Color(0,0,0,0));
     41    this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");
    4142    this->_bar.setForegroundColor(Color(.5, .5, .5, 1));
    4243  }
Note: See TracChangeset for help on using the changeset viewer.