Changeset 5760 for code/trunk/src
- Timestamp:
- Sep 22, 2009, 12:44:05 PM (15 years ago)
- Location:
- code/trunk/src/modules/questsystem
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/questsystem/QuestGUI.h
r5748 r5760 60 60 virtual ~QuestGUI(); 61 61 62 void update(void); //!< Update the GUI. 62 63 CEGUI::Window* getGUI(void); //!< Get the root CEGUI Window of the GUI. 63 void update(void); //!< Update the GUI. 64 65 CEGUI::Window* getWindow(void); //!< Get a CEGUI Window to use. 66 void giveWindow(CEGUI::Window* window); //!< Return a no longer needed CEGUI Window for reuse. 67 68 static QuestGUINode* findNode(CEGUI::Window* window); //!< Finde the QuestGUINode belonging to the input CEGUI Window. 64 69 65 70 /** … … 75 80 inline CEGUI::Window* getRootWindow(void) 76 81 { return this->rootWindow_; } 77 78 CEGUI::Window* getWindow(void); //!< Get a CEGUI Window to use.79 void giveWindow(CEGUI::Window* window); //!< Return a no longer needed CEGUI Window for reuse.80 81 82 /** 82 83 @brief Retreive the player. … … 85 86 inline PlayerInfo* getPlayer(void) 86 87 { return this->player_; } 87 88 static QuestGUINode* findNode(CEGUI::Window* window); //!< Finde the QuestGUINode belonging to the input CEGUI Window.89 88 90 89 private: … … 93 92 94 93 void clear(void); //!< Clear the QuestGUI. 95 96 PlayerInfo* player_; //!< The player that owns the GUI.97 CEGUI::WindowManager* windowManager_; //!< The CEGUI WindowManager. //TODO: needed?98 CEGUI::Window* rootWindow_; //!< The root CEGUI Window of the GUI.99 94 100 95 QuestGUINode* root_; //!< An empty QuestGUINode being the parent of all otherwise parent-less nodes. 96 97 CEGUI::WindowManager* windowManager_; //!< The CEGUI WindowManager. 98 CEGUI::Window* rootWindow_; //!< The root CEGUI Window of the GUI. 99 PlayerInfo* player_; //!< The player that owns the GUI. 100 101 101 std::map<CEGUI::Window*, QuestGUINode*> nodes_; //!< A list of all QuestGUINodes, ordered by their respective CEGUI Windows. 102 102 std::list<CEGUI::Window*> windows_; //!< A list of windows to be used. -
code/trunk/src/modules/questsystem/QuestGUINode.cc
r5758 r5760 160 160 stream << this->window_->getName() << "/Details"; 161 161 const QuestDescription* description = this->item_->getDescription(); 162 this->details_ = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/FrameWindow", stream.str());162 this->details_ = this->gui_->getWindowManager()->createWindow("TaharezLook/FrameWindow", stream.str()); 163 163 this->details_->setSize(CEGUI::UVector2(CEGUI::UDim(0.7, 0),CEGUI::UDim(0.7, 0))); 164 164 this->details_->setPosition(CEGUI::UVector2(CEGUI::UDim(0.1, 0),CEGUI::UDim(0.1, 0))); … … 171 171 //! Create a ScrollablePane. 172 172 stream << "/Scrollable"; 173 CEGUI::Window* window = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/ScrollablePane", stream.str());174 window->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, - 10),CEGUI::UDim(1.0, -26)));175 window->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 5),CEGUI::UDim(0, 26)));173 CEGUI::Window* window = this->gui_->getWindowManager()->createWindow("TaharezLook/ScrollablePane", stream.str()); 174 window->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, -2*QuestGUINode::BORDER_WIDTH),CEGUI::UDim(1.0, -QuestGUINode::TITLE_HEIGHT))); 175 window->setPosition(CEGUI::UVector2(CEGUI::UDim(0, QuestGUINode::BORDER_WIDTH),CEGUI::UDim(0, QuestGUINode::TITLE_HEIGHT))); 176 176 this->details_->addChildWindow(window); 177 177 … … 185 185 stream.str(""); 186 186 stream << this->details_->getName() << "/Status"; 187 CEGUI::Window* statusWindow = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText", stream.str());187 CEGUI::Window* statusWindow = this->gui_->getWindowManager()->createWindow("TaharezLook/StaticText", stream.str()); 188 188 window->addChildWindow(statusWindow); 189 189 std::string status = ""; … … 204 204 statusWindow->setText(status); 205 205 statusWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0),CEGUI::UDim(0, offset))); 206 statusWindow->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, - 13),CEGUI::UDim(1.0, 0)));206 statusWindow->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, -QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(1.0, 0))); 207 207 height = setHeight(statusWindow); 208 208 209 209 offset += height; 210 210 } 211 212 //! Display the Description of the QuestItem.211 212 //! Create title pane for the description. 213 213 stream.str(""); 214 214 stream << this->details_->getName() << "/Description"; 215 CEGUI::Window* descriptionWindow = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText", stream.str());216 215 stream << "/Title"; 217 CEGUI::Window* descriptionWindowTitle = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText", stream.str());216 CEGUI::Window* descriptionWindowTitle = this->gui_->getWindowManager()->createWindow("TaharezLook/StaticText", stream.str()); 218 217 window->addChildWindow(descriptionWindowTitle); 219 218 descriptionWindowTitle->setProperty("HorzFormatting", "HorzCentred"); … … 221 220 descriptionWindowTitle->setText("Description:"); 222 221 descriptionWindowTitle->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0),CEGUI::UDim(0, offset))); 223 descriptionWindowTitle->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, -13),CEGUI::UDim(1.0, 0))); 222 descriptionWindowTitle->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, -QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(1.0, 0))); 223 224 224 offset += setHeight(descriptionWindowTitle); 225 226 //! Display the Description of the QuestItem. 227 stream.str(""); 228 stream << this->details_->getName() << "/Description"; 229 CEGUI::Window* descriptionWindow = this->gui_->getWindowManager()->createWindow("TaharezLook/StaticText", stream.str()); 225 230 window->addChildWindow(descriptionWindow); 226 231 descriptionWindow->setProperty("HorzFormatting", "WordWrapLeftAligned"); … … 228 233 descriptionWindow->setText(description->getDescription()); 229 234 descriptionWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0),CEGUI::UDim(0, offset))); 230 descriptionWindow->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, - 13),CEGUI::UDim(1.0, 0)));235 descriptionWindow->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, -QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(1.0, 0))); 231 236 height = setHeight(descriptionWindow); 232 237 … … 241 246 if(dynamic_cast<QuestHint*>((*it)->item_) != NULL) //!< If the subNode belongs to a QuestHint. 242 247 { 243 if(title) 248 if(title) //!< If no title pane for the QuestHints has been created, create one. 244 249 { 245 250 stream.str(""); 246 251 stream << this->details_->getName() << "/Hints/Title"; 247 CEGUI::Window* hintsTitle = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText", stream.str());252 CEGUI::Window* hintsTitle = this->gui_->getWindowManager()->createWindow("TaharezLook/StaticText", stream.str()); 248 253 window->addChildWindow(hintsTitle); 249 254 hintsTitle->setProperty("HorzFormatting", "HorzCentred"); … … 251 256 hintsTitle->setText("Hints:"); 252 257 hintsTitle->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0),CEGUI::UDim(0, offset))); 253 hintsTitle->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, - 13),CEGUI::UDim(1.0, 0)));258 hintsTitle->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, -QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(1.0, 0))); 254 259 offset += setHeight(hintsTitle);; 255 260 title = false; 256 261 } 257 262 QuestGUINode* node = *it; 258 node->window_->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, - 13),CEGUI::UDim(0, 30)));263 node->window_->setSize(CEGUI::UVector2(CEGUI::UDim(1.0, -QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(0, QuestGUINode::BUTTON_HEIGHT))); 259 264 node->window_->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0),CEGUI::UDim(0, offset))); 260 node->window_->setProperty("HorizontalAlignment", "Left"); // TODO: Get this working.261 265 window->addChildWindow(node->window_); 262 offset += 30;266 offset += QuestGUINode::BUTTON_HEIGHT; 263 267 } 264 268 } … … 280 284 281 285 //CEGUI::Window* window = this->gui_->getRootWindow(); 282 CEGUI::Window* window = CEGUI::WindowManager::getSingleton().getWindow("orxonox/QuestGUI/Background");286 CEGUI::Window* window = this->gui_->getWindowManager()->getWindow("orxonox/QuestGUI/Background"); 283 287 284 288 if(window != NULL) … … 295 299 { 296 300 //CEGUI::Window* window = this->gui_->getRootWindow(); 297 CEGUI::Window* window = CEGUI::WindowManager::getSingleton().getWindow("orxonox/QuestGUI/Background");301 CEGUI::Window* window = this->gui_->getWindowManager()->getWindow("orxonox/QuestGUI/Background"); 298 302 window->removeChildWindow(this->details_); 299 303 … … 353 357 void QuestGUINode::updatePosition(void) 354 358 { 355 this->window_->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 20*this->depth_),CEGUI::UDim(0, 30*this->index_)));356 this->window_->setSize(CEGUI::UVector2(CEGUI::UDim(1, - 20*this->depth_-13),CEGUI::UDim(0, 30)));359 this->window_->setPosition(CEGUI::UVector2(CEGUI::UDim(0, QuestGUINode::INDENT_WIDTH*this->depth_),CEGUI::UDim(0, QuestGUINode::BUTTON_HEIGHT*this->index_))); 360 this->window_->setSize(CEGUI::UVector2(CEGUI::UDim(1, -QuestGUINode::INDENT_WIDTH*this->depth_-QuestGUINode::SCROLLBAR_WIDTH),CEGUI::UDim(0, QuestGUINode::BUTTON_HEIGHT))); 357 361 } 358 362 -
code/trunk/src/modules/questsystem/QuestGUINode.h
r5758 r5760 58 58 inline CEGUI::Window* getWindow(void) 59 59 { return this->window_; } 60 CEGUI::Window* getDetails(void); //!< Creates the details window.61 60 62 61 bool openDetails(const CEGUI::EventArgs& e); //!< Opens the details window for the Quest/QuestHint clicked on. … … 64 63 65 64 private: 66 static CEGUI::Rect getStaticTextArea(const CEGUI::Window* window); //Helper method for setHeight(). Gets the StaticTextArea for an input CEGUI Window. 67 static int setHeight(CEGUI::Window* window); //Helper method to adjust the height of an input Window (of type StaticText) to the text it holds. 65 CEGUI::Window* getDetails(void); //!< Creates the details window. 68 66 69 67 void initialize(void); //!< Initialize the object. 70 68 void updatePosition(void); //!< Update the position list item. 71 69 void createWindow(void); //!< Helper method to create the CEGUI Window the node. 70 static CEGUI::Rect getStaticTextArea(const CEGUI::Window* window); //Helper method for setHeight(). Gets the StaticTextArea for an input CEGUI Window. 71 static int setHeight(CEGUI::Window* window); //Helper method to adjust the height of an input Window (of type StaticText) to the text it holds. 72 72 73 73 bool visible_; //!< Boolean determining the visibility of the node. … … 75 75 QuestGUI* gui_; //!< The QuestGUI this node belongs to. 76 76 QuestGUINode* parent_; //!< The parent node. 77 std::list<QuestGUINode*> subNodes_; //!< alist of all subnodes.78 QuestItem* item_; //!< 77 std::list<QuestGUINode*> subNodes_; //!< A list of all subnodes. 78 QuestItem* item_; //!< QuestItem belonging to this node. 79 79 80 80 int depth_; //!< The depth (resp. indentation) of this node in the list of Quests. (Irrelevant for QuestHints) … … 84 84 CEGUI::Window* details_; //!< The details window of this node. 85 85 86 //! Some magic numbers 87 static const int TITLE_HEIGHT = 26; 88 static const int BORDER_WIDTH = 5; 89 static const int SCROLLBAR_WIDTH = 13; 90 static const int BUTTON_HEIGHT = 30; 91 static const int INDENT_WIDTH = 20; 92 86 93 }; 87 94 -
code/trunk/src/modules/questsystem/QuestManager.h
r5748 r5760 65 65 66 66 friend class ScopedSingleton<QuestManager, ScopeID::GSLevel>; 67 friend class QuestGUI; //TODO: better solution. 68 //friend std::map<std::string, Quest*> & QuestGUI::getQuests(void); 67 friend class QuestGUI; 69 68 70 69 public: … … 94 93 std::map<std::string, QuestHint*> hintMap_; //!< All QuestHints registered by their id's. 95 94 96 //TODO: Call destructor of QuestGUI's on destruction of QuestManager?97 95 std::map<PlayerInfo*, QuestGUI*> questGUIs_; //!< All GUI's registered by the players. 98 96 -
code/trunk/src/modules/questsystem/notifications/NotificationManager.cc
r5748 r5760 123 123 this->listenerList_[listener] = index; //!< Add the NotificationListener to the list of listeners. 124 124 125 std::set<std::string> set = listener->getTargetsSet(); //TODO: Works this?125 std::set<std::string> set = listener->getTargetsSet(); //TODO: Does this work? 126 126 127 127 //! If all senders are the target of the listener, then the list of notification for that specific listener is te same as the list of all Notifications.
Note: See TracChangeset
for help on using the changeset viewer.