Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation/src/orxonox/overlays/notifications/NotificationQueue.cc @ 2499

Last change on this file since 2499 was 2436, checked in by rgrieder, 16 years ago

Added svn:eol-style "native" to all files.

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