Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.