Changeset 10066 in orxonox.OLD for branches/gui/src
- Timestamp:
- Dec 13, 2006, 3:35:48 PM (18 years ago)
- Location:
- branches/gui/src/world_entities/questGUI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/world_entities/questGUI/quest_gui.cc
r10031 r10066 38 38 #include "menu/glgui_imagebutton.h" 39 39 #include "glgui_text.h" 40 #include <glgui_image.h> 40 41 41 42 … … 49 50 CREATE_FACTORY(QuestGUI); 50 51 SHELL_COMMAND(gui, QuestGUI, guiInit); 52 //SHELL_COMMAND(cancel, QuestGUI, guiDestruct); 51 53 52 54 … … 56 58 57 59 this->toList(OM_GROUP_00); 58 59 this->mainMenuBox = NULL;60 60 61 61 this->questBox = NULL; … … 81 81 82 82 /** 83 * loads the xml tags 83 * loads the xml tagsthis->questDescription 84 84 * @param root: root xml tag for this element 85 85 */ … … 92 92 LoadParam(root, "quest-description", this, QuestGUI, setQuestDescription) 93 93 .describe("sets the description of a quest"); 94 LoadParam(root, "quest-picture", this, QuestGUI, setQuestPicture) 95 .describe("sets the picture of a quest"); 96 LoadParam(root, "quest-outline", this, QuestGUI, setQuestOutline) 97 .describe("sets the outline of a quiest"); 98 94 99 } 95 100 … … 100 105 void QuestGUI::guiInit() 101 106 { 102 if ( mainMenuBox == NULL)107 if (questBox == NULL) 103 108 { 104 this->mainMenuBox = new OrxGui::GLGuiBox(); 105 { 106 OrxGui::GLGuiButton* startButton = new OrxGui::GLGuiPushButton("Quests"); 107 startButton->released.connect(this, &QuestGUI::showQuest); 108 this->mainMenuBox->pack(startButton); 109 startButton->select(); 110 111 OrxGui::GLGuiButton* networkButton = new OrxGui::GLGuiPushButton("Bla Bla"); 112 //networkButton->released.connect(this, &QuestGUI::showMultiPlayer); 113 this->mainMenuBox->pack(networkButton); 114 115 OrxGui::GLGuiButton* optionsButton = new OrxGui::GLGuiPushButton("Blobb"); 116 //optionsButton->released.connect(this, &QuestGUI::showOptionsMenu); 117 this->mainMenuBox->pack(optionsButton); 118 119 120 OrxGui::GLGuiButton* quitButton = new OrxGui::GLGuiPushButton("Quit Menu"); 121 this->mainMenuBox->pack(quitButton); 122 quitButton->released.connect(this, &QuestGUI::quitMenu); 123 } 124 125 this->mainMenuBox->showAll(); 126 127 this->mainMenuBox->setRelCoor2D(200, 100); 128 109 this->questBox= new OrxGui::GLGuiBox(); 110 111 OrxGui::GLGuiBox* labelBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); 112 //labelBox->setWidgetSize(100, 200); 113 114 OrxGui::GLGuiText* questTxt = new OrxGui::GLGuiText(); 115 questTxt->setText(this->questDescription); 116 labelBox->pack(questTxt); 117 118 OrxGui::GLGuiImage* image = new OrxGui::GLGuiImage(); 119 image->setWidgetSize(100, 100); 120 image->loadImageFromFile(questPicture); 121 image->show(); 122 123 this->questBox->setAbsCoor2D(300, 40); 124 labelBox->setRelCoor2D(300, 300); 125 image->setRelCoor2D(0, 0); 126 127 this->questBox->pack(image); 128 this->questBox->pack(labelBox); 129 this->questBox->showAll(); 130 129 131 OrxGui::GLGuiHandler::getInstance()->activate(); 130 132 OrxGui::GLGuiHandler::getInstance()->activateCursor(); … … 134 136 OrxGui::GLGuiHandler::getInstance()->deactivate(); 135 137 OrxGui::GLGuiHandler::getInstance()->deactivateCursor(); 136 delete this-> mainMenuBox;137 this-> mainMenuBox = NULL;138 delete this->questBox; 139 this->questBox = NULL; 138 140 } 139 141 140 }141 142 void QuestGUI::showQuest()143 {144 if (this->questBox== NULL)145 {146 this->questBox= new OrxGui::GLGuiBox(OrxGui::Horizontal);147 148 OrxGui::GLGuiBox* labelBox = new OrxGui::GLGuiBox();149 150 OrxGui::GLGuiText* questTxt = new OrxGui::GLGuiText();151 questTxt->setText(this->questDescription);152 labelBox->pack(questTxt);153 154 OrxGui::GLGuiImage* image = new OrxGui::GLGuiImage();155 image->show();156 image->setWidgetSize( 250, 200);157 image->setAbsCoor2D(400, 150);158 image->setForegroundColor(Color( 1,1,1,.6));159 160 this->questBox->pack(labelBox);161 this->questBox->pack(image);162 }163 164 this->showSecondLevelElement(this->questBox);165 166 }167 168 void QuestGUI::quitMenu()169 {170 delete this->mainMenuBox;171 this->mainMenuBox = NULL;172 }173 174 void QuestGUI::showSecondLevelElement(OrxGui::GLGuiBox* element)175 {176 if (this->currentlyOpened != NULL && this->currentlyOpened != element)177 this->currentlyOpened->hideAll();178 179 element->showAll();180 element->setRelCoor2D(200, 100);181 182 this->currentlyOpened = element;183 184 this->mainMenuBox->setRelCoorSoft2D(50, 100, 5);185 142 } 186 143 … … 188 145 189 146 190 -
branches/gui/src/world_entities/questGUI/quest_gui.h
r10031 r10066 23 23 /** @param questName sets the name of this quest */ 24 24 inline void setQuestName(const std::string& questName) { this->questName = questName; } 25 inline void setQuestDescription(const std::string& questDescription) { this->questName = questDescription; } 25 inline void setQuestDescription(const std::string& questDescription) { this->questDescription = questDescription; } 26 inline void setQuestPicture(const std::string& questPicture) { this->questPicture = questPicture; } 27 inline void setQuestOutline(const std::string& questOutline) { this->questOutline = questOutline; } 26 28 void guiInit(); 27 28 void showQuest();29 30 void quitMenu();31 32 33 private:34 void showSecondLevelElement(OrxGui::GLGuiBox* element);35 29 36 30 … … 38 32 std::string questName; 39 33 std::string questDescription; 40 OrxGui::GLGuiBox* mainMenuBox; 34 std::string questPicture; 35 std::string questOutline; 41 36 42 37 OrxGui::GLGuiBox* questBox;
Note: See TracChangeset
for help on using the changeset viewer.