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 | |
---|
37 | namespace orxonox { |
---|
38 | |
---|
39 | NotificationQueue* NotificationQueue::queue_s = 0; |
---|
40 | |
---|
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) |
---|
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 | } |
---|
55 | } |
---|
56 | |
---|
57 | NotificationQueue::~NotificationQueue() |
---|
58 | { |
---|
59 | |
---|
60 | } |
---|
61 | |
---|
62 | void NotificationQueue::XMLPort(Element& xmlElement, XMLPort::Mode mode) |
---|
63 | { |
---|
64 | SUPER(NotificationQueue, XMLPort, xmlElement, mode); |
---|
65 | |
---|
66 | XMLPortParam(NotificationQueue, "length", setLength, getLength, xmlElement, mode); |
---|
67 | } |
---|
68 | |
---|
69 | void NotificationQueue::tick(float dt) |
---|
70 | { |
---|
71 | NotificationManager::tick(dt); |
---|
72 | |
---|
73 | update(); |
---|
74 | } |
---|
75 | |
---|
76 | bool NotificationQueue::setLength(int length) |
---|
77 | { |
---|
78 | if(length > 0) |
---|
79 | { |
---|
80 | this->length_ = length; |
---|
81 | return true; |
---|
82 | } |
---|
83 | return false; |
---|
84 | } |
---|
85 | |
---|
86 | void NotificationQueue::setQueueText(const std::string & text) |
---|
87 | { |
---|
88 | this->queueText_ = text; |
---|
89 | } |
---|
90 | |
---|
91 | void NotificationQueue::update(void) |
---|
92 | { |
---|
93 | this->text_->setCaption(queueText_); |
---|
94 | } |
---|
95 | |
---|
96 | } |
---|