Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8010 in orxonox.OLD for branches/gui/src


Ignore:
Timestamp:
May 31, 2006, 2:03:21 AM (19 years ago)
Author:
bensch
Message:

gui: HOLY COW… The magical texture-viewer is here :)

Location:
branches/gui/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/gui/gl_gui/glgui_image.cc

    r8009 r8010  
    5454  void GLGuiImage::loadImageFromTexture(const Texture& texture)
    5555  {
    56     this->texture = texture;
     56    this->frontMaterial().setDiffuseMap(texture);
     57    this->frontMaterial().setDiffuse(1,1,1);
    5758  }
    5859
     
    7475  void GLGuiImage::resize()
    7576  {
    76     this->frontRect().setTopLeft(1, 1);
    77     this->frontRect().setSize(this->getSizeX2D() -2, this->getSizeY2D() -2);
     77    this->frontRect().setTopLeft(this->borderSize(), this->borderSize());
     78    this->frontRect().setSize(this->getSizeX2D() -2.0*this->borderSize(), this->getSizeY2D() - 2.0* this->borderSize() );
    7879    GLGuiWidget::resize();
    7980  }
     
    9192    this->drawRect(this->frontRect());
    9293    this->endDraw();
    93 
    94 
    9594  }
    9695}
  • branches/gui/src/lib/gui/gl_gui/glgui_text.h

    r7779 r8010  
    2626    virtual ~GLGuiText();
    2727
     28    void setText();
     29
     30    virtual void draw();
     31
     32  private:
    2833    void init();
    2934
    30     virtual void draw();
    3135
    3236  private:
  • branches/gui/src/story_entities/simple_game_menu.cc

    r8009 r8010  
    114114  box->showAll();
    115115
    116   OrxGui::GLGuiImage* image = new OrxGui::GLGuiImage();
    117   image->show();
    118   image->loadImageFromFile( "death_screen.png" );
    119   image->setWidgetSize(200, 200);
    120   image->setAbsCoor2D(300, 300);
    121 
    122   OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
    123   slider->connect(SIGNAL(slider, valueChanged), box, SLOT(Element2D, setRelCoorX2D));
    124   slider->setRange(100, 500);
    125   slider->setStep(50);
    126   slider->setValue(slider->min());
    127   slider->show();
    128   slider->setAbsCoor2D(100, 00);
     116
     117  OrxGui::GLGuiBox* imageSelector = new OrxGui::GLGuiBox();
     118  {
     119
     120    image = new OrxGui::GLGuiImage();
     121    image->show();
     122    image->loadImageFromFile( "death_screen.png" );
     123    image->setWidgetSize(200, 200);
     124    image->setAbsCoor2D(300, 300);
     125    imageSelector->pack(image);
     126
     127    imageName = new OrxGui::GLGuiInputLine();
     128    imageSelector->pack(imageName);
     129
     130    OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
     131    slider->connect(SIGNAL(slider, valueChanged), this, SLOT(SimpleGameMenu, setImage));
     132
     133    slider->setRange(0, 100);
     134    slider->setStep(50);
     135    slider->setValue(slider->min());
     136    imageSelector->pack(slider);
     137  }
     138  imageSelector->showAll();
     139  imageSelector->setAbsCoor2D(400, 30);
     140
    129141
    130142  /////
     143}
     144
     145
     146#include "class_list.h"
     147void SimpleGameMenu::setImage(int i)
     148{
     149  const std::list<BaseObject*>* textures = ClassList::getList(CL_TEXTURE);
     150
     151  if(textures && textures->size() > i)
     152  {
     153    std::list<BaseObject*>::const_iterator test = textures->begin();
     154    while (--i > 0)
     155    {
     156      test++;
     157    }
     158    this->image->loadImageFromTexture(*dynamic_cast<Texture*>(*test));
     159    this->imageName->setText((*test)->getName());
     160  }
    131161}
    132162
  • branches/gui/src/story_entities/simple_game_menu.h

    r7985 r8010  
    1616
    1717#include "elements/text_element.h"
     18
     19#include "glgui.h"
    1820
    1921class SimpleGameMenuData;
     
    5355    void execURL() const;
    5456    static int startURL(void* data);
     57
     58    void setImage(int i);
     59    OrxGui::GLGuiImage* image;
     60    OrxGui::GLGuiInputLine* imageName;
    5561    ///
    5662    virtual void loadParams(const TiXmlElement* root);
Note: See TracChangeset for help on using the changeset viewer.