Changeset 10129 in orxonox.OLD for branches/gui/src/world_entities
- Timestamp:
- Dec 20, 2006, 4:34:09 PM (18 years ago)
- Location:
- branches/gui/src/world_entities
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/world_entities/Makefile.am
r10027 r10129 29 29 \ 30 30 questGUI/quest_gui.cc \ 31 questGUI/quest.cc \ 31 32 \ 32 33 effects/explosion.cc \ … … 60 61 \ 61 62 questGUI/quest_gui.h \ 63 questGUI/quest.h \ 62 64 \ 63 65 effects/explosion.h \ -
branches/gui/src/world_entities/questGUI/quest_gui.cc
r10069 r10129 12 12 13 13 ### File Specific: 14 main-programmer: Andreas Hejj 14 main-programmer std::string questName; 15 std::string questDescription; 16 std::string questPicture; 17 std::string questDifficulty; 18 std::string rewardDescription; 19 std::string rewardPicture;: Andreas Hejj 15 20 16 21 */ … … 35 40 #include "sound_source.h" 36 41 42 #include "glgui_widget.h" 37 43 #include "glgui.h" 38 44 #include "menu/glgui_imagebutton.h" … … 41 47 42 48 49 #include "quest.h" 50 43 51 #include "shell_command.h" 44 52 … … 60 68 61 69 this->questBox = NULL; 62 63 if( root != NULL) 64 this->loadParams(root); 70 71 this->bKillGui = false; 72 73 this->myQuest = new Quest(root); 74 if(root) 75 this->loadParams( root); 65 76 66 77 } … … 72 83 QuestGUI::~QuestGUI () 73 84 { 74 } 75 76 77 85 if( this->myQuest) 86 delete this->myQuest; 87 } 78 88 79 89 /** … … 83 93 void QuestGUI::loadParams(const TiXmlElement* root) 84 94 { 85 WorldEntity::loadParams(root); 86 87 LoadParam(root, "quest-name", this, QuestGUI, setQuestName) 88 .describe("sets the name of a quest"); 89 LoadParam(root, "quest-description", this, QuestGUI, setQuestDescription) 90 .describe("sets the description of a quest"); 91 LoadParam(root, "quest-picture", this, QuestGUI, setQuestPicture) 92 .describe("sets the picture of a quest"); 93 LoadParam(root, "quest-difficulty", this, QuestGUI, setQuestDifficulty) 94 .describe("sets the difficulty of a quest"); 95 LoadParam(root, "reward-description", this, QuestGUI, setRewardDescription) 96 .describe("sets the description of a reward"); 97 LoadParam(root, "reward-picture", this, QuestGUI, setRewardPicture) 98 .describe("sets the Picture of a reward"); 99 100 } 95 WorldEntity::loadParams(root); 96 } 97 101 98 102 99 … … 109 106 { 110 107 this->questBox= new OrxGui::GLGuiBox(OrxGui::Vertical); 108 this->bKillGui = false; 111 109 112 110 OrxGui::GLGuiBox* headerBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); … … 114 112 OrxGui::GLGuiImage* questImage = new OrxGui::GLGuiImage(); 115 113 questImage->setWidgetSize(100, 100); 116 questImage->loadImageFromFile( questPicture);114 questImage->loadImageFromFile(this->myQuest->getQuestPicture()); 117 115 questImage->show(); 116 questImage->setBorderBottom(20); 118 117 headerBox->pack(questImage); 118 headerBox->setBorderBottom(20); 119 119 120 120 OrxGui::GLGuiBox* outlineBox = new OrxGui::GLGuiBox(OrxGui::Vertical); 121 121 { 122 122 OrxGui::GLGuiText* questDifficulty = new OrxGui::GLGuiText(); 123 questDifficulty->setText(this-> questDifficulty);123 questDifficulty->setText(this->myQuest->getQuestDifficulty()); 124 124 outlineBox->pack(questDifficulty); 125 125 } 126 126 headerBox->pack(outlineBox); 127 headerBox->setBorderBottom(75); 127 128 128 129 } … … 131 132 { 132 133 OrxGui::GLGuiText* questTxt = new OrxGui::GLGuiText(); 133 questTxt->setText(this-> questDescription);134 questTxt->setText(this->myQuest->getQuestDescription()); 134 135 labelBox->pack(questTxt); 136 labelBox->setBorderBottom(75); 135 137 } 136 138 … … 140 142 OrxGui::GLGuiImage* rewardImage = new OrxGui::GLGuiImage(); 141 143 rewardImage->setWidgetSize(50, 50); 142 rewardImage->loadImageFromFile( rewardPicture);144 rewardImage->loadImageFromFile(this->myQuest->getRewardPicture()); 143 145 rewardImage->show(); 144 146 rewardBox->pack(rewardImage); 147 rewardImage->setBorderBottom(50); 145 148 146 149 OrxGui::GLGuiText* rewardTxt = new OrxGui::GLGuiText(); 147 rewardTxt->setText(this-> rewardDescription);150 rewardTxt->setText(this->myQuest->getRewardDescription()); 148 151 rewardBox->pack(rewardTxt); 152 rewardBox->setBorderBottom(75); 153 149 154 } 150 155 … … 152 157 { 153 158 OrxGui::GLGuiButton* acceptButton = new OrxGui::GLGuiPushButton("Accept"); 159 acceptButton->released.connect(this, &QuestGUI::accept); 154 160 answerBox->pack(acceptButton); 161 acceptButton->select(); 155 162 156 163 OrxGui::GLGuiButton* refuseButton = new OrxGui::GLGuiPushButton("Refuse"); 164 refuseButton->released.connect(this, &QuestGUI::refuse); 157 165 answerBox->pack(refuseButton); 158 166 } … … 170 178 else 171 179 { 172 OrxGui::GLGuiHandler::getInstance()->deactivate(); 173 OrxGui::GLGuiHandler::getInstance()->deactivateCursor(); 174 delete this->questBox; 175 this->questBox = NULL; 180 this->bKillGui = true; 176 181 } 177 182 178 183 } 179 184 180 181 182 185 186 void QuestGUI::tick(float dt) 187 { 188 if( this->bKillGui) 189 this->killgui(); 190 } 191 192 193 void QuestGUI::accept() 194 { 195 this->bKillGui = true; 196 197 } 198 199 void QuestGUI::refuse() 200 { 201 this->bKillGui = true; 202 } 203 204 void QuestGUI::killgui() 205 { 206 OrxGui::GLGuiHandler::getInstance()->deactivate(); 207 OrxGui::GLGuiHandler::getInstance()->deactivateCursor(); 208 delete this->questBox; 209 this->questBox = NULL; 210 } -
branches/gui/src/world_entities/questGUI/quest_gui.h
r10069 r10129 8 8 #include <vector> 9 9 10 10 class Quest; 11 11 12 12 class QuestGUI : public WorldEntity … … 18 18 QuestGUI (const TiXmlElement* root); 19 19 virtual ~QuestGUI (); 20 21 22 virtual void loadParams(const TiXmlElement* root = NULL); 23 24 /** @param questName sets the name of this quest */ 25 inline void setQuestName(const std::string& questName) { this->questName = questName; } 26 inline void setQuestDescription(const std::string& questDescription) { this->questDescription = questDescription; } 27 inline void setQuestPicture(const std::string& questPicture) { this->questPicture = questPicture; } 28 inline void setQuestDifficulty(const std::string& questDifficulty) { this->questDifficulty = questDifficulty; } 29 inline void setRewardDescription(const std::string& rewardDescription){ this->rewardDescription = rewardDescription; } 30 inline void setRewardPicture(const std::string& rewardPicture) { this->rewardPicture = rewardPicture; } 20 21 void loadParams(const TiXmlElement* root); 22 31 23 void guiInit(); 32 24 25 virtual void tick(float dt); 33 26 34 27 private: 35 std::string questName; 36 std::string questDescription; 37 std::string questPicture; 38 std::string questDifficulty; 39 std::string rewardDescription; 40 std::string rewardPicture; 28 Quest* myQuest; 29 bool bKillGui; 41 30 42 31 OrxGui::GLGuiBox* headerBox; … … 50 39 51 40 OrxSound::SoundSource* selectorSource; 41 42 void accept(); 43 void refuse(); 44 void killgui(); 52 45 }; 53 46
Note: See TracChangeset
for help on using the changeset viewer.