Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2500 was 2500, checked in by landauf, 15 years ago

merged pickups2 to presentation

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