Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/overlays/notifications/NotificationQueue.cc @ 2802

Last change on this file since 2802 was 2662, checked in by rgrieder, 16 years ago

Merged presentation branch back to trunk.

  • Property svn:eol-style set to native
File size: 2.8 KB
RevLine 
[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]37namespace 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;
[2280]58    }
[2500]59
[2280]60    NotificationQueue::~NotificationQueue()
61    {
[2500]62
[2280]63    }
[2500]64
[2280]65    void NotificationQueue::XMLPort(Element& xmlElement, XMLPort::Mode mode)
66    {
67        SUPER(NotificationQueue, XMLPort, xmlElement, mode);
[2500]68
[2281]69        XMLPortParam(NotificationQueue, "length", setLength, getLength, xmlElement, mode);
[2346]70        XMLPortParam(NotificationQueue, "width", setWidth, getWidth, xmlElement, mode);
[2280]71    }
[2500]72
[2280]73    void NotificationQueue::tick(float dt)
74    {
75        NotificationManager::tick(dt);
[2500]76
[2287]77        update();
[2280]78    }
[2500]79
[2280]80    bool NotificationQueue::setLength(int length)
81    {
82        if(length > 0)
83        {
84            this->length_ = length;
85            return true;
86        }
87        return false;
88    }
[2500]89
[2346]90    bool NotificationQueue::setWidth(int width)
91    {
92        if(width > 0)
93        {
94            this->width_ = width;
95            return true;
96        }
97        return false;
98    }
[2500]99
[2280]100    void NotificationQueue::setQueueText(const std::string & text)
101    {
102        this->queueText_ = text;
103    }
[2500]104
[2280]105    void NotificationQueue::update(void)
106    {
107        this->text_->setCaption(queueText_);
108    }
109}
Note: See TracBrowser for help on using the repository browser.