Changeset 8035 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- May 31, 2006, 4:20:51 PM (18 years ago)
- Location:
- trunk/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/simple_game_menu.cc
r7919 r8035 67 67 ///(this is as modular as it is possible). 68 68 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)); 70 71 pb->show(); 71 72 pb->setAbsCoor2D(50, 50); … … 84 85 void SimpleGameMenu::enterGui() 85 86 { 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); 101 139 102 140 103 141 ///// 142 } 143 144 145 #include "class_list.h" 146 void 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 } 104 165 } 105 166 … … 124 185 system ((std::string("firefox ") + URL).c_str()); 125 186 #elif defined __OSX__ 126 127 128 129 187 CFURLRef url_handle = CFURLCreateWithBytes (NULL, (UInt8 *)URL.c_str(), URL.size(), 188 kCFStringEncodingASCII, NULL); 189 LSOpenCFURLRef (url_handle, NULL); 190 CFRelease (url_handle); 130 191 #elif defined __WIN32__ 131 132 133 192 ShellExecute(GetActiveWindow(), 193 "open", URL.c_str(), NULL, NULL, SW_SHOWNORMAL); 194 } 134 195 #endif 135 196 PRINTF(3)("loaded external webpage %s\n", URL.c_str()); -
trunk/src/story_entities/simple_game_menu.h
r7919 r8035 17 17 #include "elements/text_element.h" 18 18 19 #include "glgui.h" 20 19 21 class SimpleGameMenuData; 20 22 class TiXmlElement; … … 31 33 32 34 public: 33 std::vector<TextElement*> 35 std::vector<TextElement*> menuList; //!< the list of the menu items 34 36 std::vector<StoryEntity*> storyList; //!< the list of the StoryEntities for the menu 35 37 std::vector<ImageEntity*> screenshootList; //!< list of the screen shoots FIXME: make a better structure for this stuff … … 53 55 void execURL() const; 54 56 static int startURL(void* data); 57 58 void setImage(int i); 59 OrxGui::GLGuiImage* image; 60 OrxGui::GLGuiInputLine* imageName; 55 61 /// 56 62 virtual void loadParams(const TiXmlElement* root); … … 69 75 void quitMenu(); 70 76 71 void TEST( ) { printf("TEST\n"); }77 void TEST(int val) { printf("TEST %d\n", val); } 72 78 73 79 protected:
Note: See TracChangeset
for help on using the changeset viewer.