Changeset 8662 for code/branches/presentation/src
- Timestamp:
- May 29, 2011, 5:24:04 PM (14 years ago)
- Location:
- code/branches/presentation/src/modules/notifications
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/modules/notifications/NotificationQueue.cc
r8656 r8662 56 56 RegisterObject(NotificationQueue); 57 57 58 this->initialize(); 58 this->size_ = 0; 59 this->tickTime_ = 0.0f; 60 this->maxSize_ = NotificationQueue::DEFAULT_SIZE; 61 this->displayTime_ = NotificationQueue::DEFAULT_DISPLAY_TIME; 62 63 this->creationTime_ = std::time(0); 64 59 65 this->registerVariables(); 60 66 } … … 96 102 /** 97 103 @brief 98 Initializes the NotificationQueue. 99 */ 100 void NotificationQueue::initialize(void) 101 { 102 this->size_ = 0; 103 this->tickTime_ = 0.0f; 104 this->maxSize_ = NotificationQueue::DEFAULT_SIZE; 105 this->displayTime_ = NotificationQueue::DEFAULT_DISPLAY_TIME; 106 107 this->creationTime_ = std::time(0); 104 Is called when the name of the NotificationQueue has changed. 105 Clears and re-creates the NotificationQueue. 106 */ 107 void NotificationQueue::changedName(void) 108 { 109 SUPER(NotificationQueue, changedName); 110 111 if(this->isRegistered()) 112 this->clear(); 113 114 this->create(); 115 116 this->targetsChanged(); 117 this->maxSizeChanged(); 118 this->displayTimeChanged(); 108 119 } 109 120 … … 159 170 XMLPortParam(NotificationQueue, "size", setMaxSize, getMaxSize, xmlelement, mode); 160 171 XMLPortParam(NotificationQueue, "displayTime", setDisplayTime, getDisplayTime, xmlelement, mode); 161 162 this->create();163 172 } 164 173 -
code/branches/presentation/src/modules/notifications/NotificationQueue.h
r8656 r8662 99 99 virtual void tick(float dt); // To update from time to time. 100 100 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 101 void registerVariables(); 101 102 virtual void changedName(void); 102 103 103 104 void update(void); // Updates the NotificationQueue. … … 159 160 160 161 protected: 162 void registerVariables(); 163 161 164 /** 162 165 @brief Is called when a notification was pushed. … … 184 187 185 188 private: 186 void initialize(void); // Initializes the NotificationQueue. 187 188 time_t creationTime_; // The time this NotificationQueue was created. 189 time_t creationTime_; //!< The time this NotificationQueue was created. 189 190 190 191 unsigned int maxSize_; //!< The maximal number of Notifications displayed. -
code/branches/presentation/src/modules/notifications/NotificationQueueCEGUI.cc
r8659 r8662 65 65 NotificationQueueCEGUI::~NotificationQueueCEGUI() 66 66 { 67 if( GameMode::showsGraphics())67 if(this->isRegistered() && GameMode::showsGraphics()) 68 68 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeQueue(\"" + this->getName() + "\")"); 69 69 } … … 103 103 } 104 104 105 void NotificationQueueCEGUI::changedName(void) 106 { 107 SUPER(NotificationQueueCEGUI, changedName); 108 109 this->positionChanged(); 110 this->fontSizeChanged(); 111 this->fontColorChanged(); 112 this->alignmentChanged(); 113 this->displaySizeChanged(); 114 } 115 105 116 /** 106 117 @brief … … 113 124 { 114 125 // Remove the NotificationQueue in lua. 115 if( GameMode::showsGraphics() && !noGraphics)126 if(this->isRegistered() && GameMode::showsGraphics() && !noGraphics) 116 127 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeQueue(\"" + this->getName() + "\")"); 117 128 … … 151 162 void NotificationQueueCEGUI::displaySizeChanged(void) 152 163 { 153 if( GameMode::showsGraphics())164 if(this->isRegistered() && GameMode::showsGraphics()) 154 165 { 155 166 if(this->displaySize_.z == 0.0 && this->displaySize_.w == 0.0) … … 191 202 void NotificationQueueCEGUI::positionChanged(void) 192 203 { 193 if( GameMode::showsGraphics())204 if(this->isRegistered() && GameMode::showsGraphics()) 194 205 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".moveQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->position_.x) + ", " + multi_cast<std::string>(this->position_.y) + ", " + multi_cast<std::string>(this->position_.z) + ", " + multi_cast<std::string>(this->position_.w) + ")"); 195 206 } … … 218 229 void NotificationQueueCEGUI::alignmentChanged(void) 219 230 { 220 if( GameMode::showsGraphics())231 if(this->isRegistered() && GameMode::showsGraphics()) 221 232 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueAlignment(\"" + this->getName() + "\", \"" + this->alignment_ + "\")"); 222 233 } … … 243 254 void NotificationQueueCEGUI::fontSizeChanged(void) 244 255 { 245 if( GameMode::showsGraphics())256 if(this->isRegistered() && GameMode::showsGraphics()) 246 257 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueFontSize(\"" + this->getName() + "\", " + multi_cast<std::string>(this->fontSize_) + ")"); 247 258 } … … 274 285 this->fontColorStr_ = stream.str(); 275 286 276 if( GameMode::showsGraphics())287 if(this->isRegistered() && GameMode::showsGraphics()) 277 288 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueFontColor(\"" + this->getName() + "\", \"" + this->fontColorStr_ + "\")"); 278 289 } … … 303 314 { 304 315 // Push the Notification to the GUI. 305 if( GameMode::showsGraphics())316 if(this->isRegistered() && GameMode::showsGraphics()) 306 317 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")"); 307 318 } … … 314 325 { 315 326 // Pops the Notification from the GUI. 316 if( GameMode::showsGraphics())327 if(this->isRegistered() && GameMode::showsGraphics()) 317 328 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".popNotification(\"" + this->getName() + "\")"); 318 329 } … … 325 336 { 326 337 // Removes the Notification from the GUI. 327 if( GameMode::showsGraphics())338 if(this->isRegistered() && GameMode::showsGraphics()) 328 339 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeNotification(\"" + this->getName() + "\", " + multi_cast<std::string>(index) + ")"); 329 340 } … … 340 351 341 352 // Clear the NotificationQueue in the GUI. 342 if( GameMode::showsGraphics() && !noGraphics)353 if(this->isRegistered() && GameMode::showsGraphics() && !noGraphics) 343 354 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".clearQueue(\"" + this->getName() + "\")"); 344 355 } … … 350 361 void NotificationQueueCEGUI::create(void) 351 362 { 363 if(this->isRegistered() && GameMode::showsGraphics()) 364 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeQueue(\"" + this->getName() + "\")"); 365 352 366 this->NotificationQueue::create(); 353 367 -
code/branches/presentation/src/modules/notifications/NotificationQueueCEGUI.h
r8656 r8662 74 74 75 75 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 76 void registerVariables(); 76 77 virtual void changedName(void); 77 78 78 79 void destroy(bool noGraphics = false); // Destroys the NotificationQueue. … … 133 134 134 135 protected: 136 void registerVariables(); 137 135 138 virtual void create(void); // Creates the NotificationQueue in lua. 136 139
Note: See TracChangeset
for help on using the changeset viewer.