Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8035 in orxonox.OLD for trunk/src/story_entities


Ignore:
Timestamp:
May 31, 2006, 4:20:51 PM (18 years ago)
Author:
bensch
Message:

gui: merged the gui back to the trunk

Location:
trunk/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/simple_game_menu.cc

    r7919 r8035  
    6767  ///(this is as modular as it is possible).
    6868  OrxGui::GLGuiPushButton* pb = new OrxGui::GLGuiPushButton("PUSH ME");
    69   pb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::enterGui));
     69  //pb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::enterGui));
     70  pb->connect(SIGNAL(pb, released), this, SLOT(SimpleGameMenu, enterGui));
    7071  pb->show();
    7172  pb->setAbsCoor2D(50, 50);
     
    8485void SimpleGameMenu::enterGui()
    8586{
    86   ///
    87   OrxGui::GLGuiButton* dnpb = new OrxGui::GLGuiCheckButton("Push the button");
    88   dnpb->show();
    89   dnpb->setAbsCoor2D(350, 50);
    90   dnpb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::execURL));
    91 
    92   OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("Quit ORXONOX!!");
    93   rdnpb->show();
    94   rdnpb->setAbsCoor2D(200, 180);
    95   rdnpb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::quitMenu));
    96 
    97   OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine();
    98   input->setText("input some text here");
    99   input->show();
    100   input->setAbsCoor2D(200, 230);
     87
     88  OrxGui::GLGuiBox* box = new OrxGui::GLGuiBox();
     89  {
     90    ///
     91    OrxGui::GLGuiButton* dnpb = new OrxGui::GLGuiCheckButton("Push the button");
     92
     93    box->pack(dnpb);
     94
     95    OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("Quit ORXONOX!!");
     96    rdnpb->connect(SIGNAL(rdnpb, released), this, SLOT(SimpleGameMenu, quitMenu));
     97
     98    box->pack(rdnpb);
     99
     100    OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine();
     101    input->setText("input some text here");
     102    input->connect(SIGNAL(input, textChanged), this, SLOT(SimpleGameMenu, TEST));
     103    box->pack(input);
     104
     105    OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
     106    slider->connect(SIGNAL(slider, valueChanged), this, SLOT(SimpleGameMenu, TEST));
     107    slider->connect(SIGNAL(slider, valueChanged), box, SLOT(OrxGui::GLGuiWidget, setBackgroundColor));
     108    slider->setRange(0, 1);
     109    slider->setValue(slider->min());
     110    box->pack(slider);
     111  }
     112  box->setAbsCoor2D(50, 200);
     113
     114  box->showAll();
     115
     116
     117  OrxGui::GLGuiBox* imageSelector = new OrxGui::GLGuiBox();
     118  {
     119    image = new OrxGui::GLGuiImage();
     120    image->setWidgetSize(300, 300);
     121    image->setAbsCoor2D(300, 300);
     122    imageSelector->pack(image);
     123
     124    imageName = new OrxGui::GLGuiInputLine();
     125    imageSelector->pack(imageName);
     126
     127    OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider();
     128    slider->setWidgetSize(200, 30);
     129    slider->setRange(0, 100);
     130    slider->setStep(1);
     131    slider->setValue(slider->min());
     132    slider->connect(SIGNAL(slider, valueChanged), this, SLOT(SimpleGameMenu, setImage));
     133
     134    imageSelector->pack(slider);
     135    slider->setValue(0);
     136  }
     137  imageSelector->showAll();
     138  imageSelector->setAbsCoor2D(400, 30);
    101139
    102140
    103141  /////
     142}
     143
     144
     145#include "class_list.h"
     146void SimpleGameMenu::setImage(int i)
     147{
     148  const std::list<BaseObject*>* textures = ClassList::getList(CL_TEXTURE);
     149
     150  if(textures)
     151  {
     152    std::list<BaseObject*>::const_iterator test = textures->begin();
     153    std::list<BaseObject*>::const_iterator lastOK = textures->begin();
     154    while (true)
     155    {
     156      if (--i == 0 || test == textures->end())
     157        break;
     158      if (dynamic_cast<Texture*>(*test)->getTexture() != 0)
     159        lastOK = test;
     160      test++;
     161    }
     162    this->image->loadImageFromTexture(*dynamic_cast<Texture*>(*lastOK));
     163    this->imageName->setText((*lastOK)->getName());
     164  }
    104165}
    105166
     
    124185  system ((std::string("firefox ") + URL).c_str());
    125186#elif defined __OSX__
    126     CFURLRef url_handle = CFURLCreateWithBytes (NULL, (UInt8 *)URL.c_str(), URL.size(),
    127                                          kCFStringEncodingASCII, NULL);
    128     LSOpenCFURLRef (url_handle, NULL);
    129     CFRelease (url_handle);
     187  CFURLRef url_handle = CFURLCreateWithBytes (NULL, (UInt8 *)URL.c_str(), URL.size(),
     188                        kCFStringEncodingASCII, NULL);
     189  LSOpenCFURLRef (url_handle, NULL);
     190  CFRelease (url_handle);
    130191#elif defined __WIN32__
    131     ShellExecute(GetActiveWindow(),
    132                  "open", URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
    133   }
     192  ShellExecute(GetActiveWindow(),
     193               "open", URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
     194}
    134195#endif
    135196  PRINTF(3)("loaded external webpage %s\n", URL.c_str());
  • trunk/src/story_entities/simple_game_menu.h

    r7919 r8035  
    1717#include "elements/text_element.h"
    1818
     19#include "glgui.h"
     20
    1921class SimpleGameMenuData;
    2022class TiXmlElement;
     
    3133
    3234  public:
    33     std::vector<TextElement*>          menuList;                        //!< the list of the menu items
     35    std::vector<TextElement*>         menuList;                        //!< the list of the menu items
    3436    std::vector<StoryEntity*>         storyList;                       //!< the list of the StoryEntities for the menu
    3537    std::vector<ImageEntity*>         screenshootList;                 //!< list of the screen shoots FIXME: make a better structure for this stuff
     
    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);
     
    6975    void quitMenu();
    7076
    71     void TEST() { printf("TEST\n"); }
     77    void TEST(int val) { printf("TEST %d\n", val); }
    7278
    7379  protected:
Note: See TracChangeset for help on using the changeset viewer.