[2280] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Damian 'Mozork' Frick |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #include "OrxonoxStableHeaders.h" |
---|
| 30 | #include "NotificationQueue.h" |
---|
| 31 | |
---|
| 32 | #include "core/CoreIncludes.h" |
---|
| 33 | #include "core/XMLPort.h" |
---|
| 34 | |
---|
| 35 | #include "NotificationManager.h" |
---|
| 36 | |
---|
[2435] | 37 | namespace orxonox |
---|
| 38 | { |
---|
[2287] | 39 | NotificationQueue* NotificationQueue::queue_s = 0; |
---|
[2500] | 40 | |
---|
[2280] | 41 | CreateFactory(NotificationQueue); |
---|
| 42 | |
---|
| 43 | NotificationQueue::NotificationQueue(BaseObject* creator) : OverlayText(creator) |
---|
| 44 | { |
---|
| 45 | RegisterObject(NotificationQueue); |
---|
| 46 | //TDO: Does this work? |
---|
| 47 | if(queue_s != NULL) |
---|
[2435] | 48 | { |
---|
| 49 | COUT(2) << "There is now more than one NotificationQueue, this shouldn't happen, since only the first NotificationQueue will be targeted by the NotificationManager." << std::endl; |
---|
| 50 | } |
---|
| 51 | else |
---|
| 52 | { |
---|
| 53 | queue_s = this; |
---|
| 54 | } |
---|
[2500] | 55 | |
---|
[2435] | 56 | this->length_ = 3; |
---|
| 57 | this->width_ = 50; |
---|
[2500] | 58 | COUT(0) << "added notification queue" << std::endl; |
---|
[2280] | 59 | } |
---|
[2500] | 60 | |
---|
[2280] | 61 | NotificationQueue::~NotificationQueue() |
---|
| 62 | { |
---|
[2500] | 63 | COUT(0) << "deleted notification queue" << std::endl; |
---|
| 64 | |
---|
[2280] | 65 | } |
---|
[2500] | 66 | |
---|
[2280] | 67 | void NotificationQueue::XMLPort(Element& xmlElement, XMLPort::Mode mode) |
---|
| 68 | { |
---|
| 69 | SUPER(NotificationQueue, XMLPort, xmlElement, mode); |
---|
[2500] | 70 | |
---|
[2281] | 71 | XMLPortParam(NotificationQueue, "length", setLength, getLength, xmlElement, mode); |
---|
[2346] | 72 | XMLPortParam(NotificationQueue, "width", setWidth, getWidth, xmlElement, mode); |
---|
[2280] | 73 | } |
---|
[2500] | 74 | |
---|
[2280] | 75 | void NotificationQueue::tick(float dt) |
---|
| 76 | { |
---|
| 77 | NotificationManager::tick(dt); |
---|
[2500] | 78 | |
---|
[2287] | 79 | update(); |
---|
[2280] | 80 | } |
---|
[2500] | 81 | |
---|
[2280] | 82 | bool NotificationQueue::setLength(int length) |
---|
| 83 | { |
---|
| 84 | if(length > 0) |
---|
| 85 | { |
---|
| 86 | this->length_ = length; |
---|
| 87 | return true; |
---|
| 88 | } |
---|
| 89 | return false; |
---|
| 90 | } |
---|
[2500] | 91 | |
---|
[2346] | 92 | bool NotificationQueue::setWidth(int width) |
---|
| 93 | { |
---|
| 94 | if(width > 0) |
---|
| 95 | { |
---|
| 96 | this->width_ = width; |
---|
| 97 | return true; |
---|
| 98 | } |
---|
| 99 | return false; |
---|
| 100 | } |
---|
[2500] | 101 | |
---|
[2280] | 102 | void NotificationQueue::setQueueText(const std::string & text) |
---|
| 103 | { |
---|
[2500] | 104 | COUT(0) << "queue: " << text << std::endl; |
---|
[2280] | 105 | this->queueText_ = text; |
---|
| 106 | } |
---|
[2500] | 107 | |
---|
[2280] | 108 | void NotificationQueue::update(void) |
---|
| 109 | { |
---|
| 110 | this->text_->setCaption(queueText_); |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | } |
---|