[Orxonox-commit 2503] r7210 - in code/trunk: data/levels src/modules/notifications src/modules/notifications/dispatchers
dafrick at orxonox.net
dafrick at orxonox.net
Tue Aug 24 14:26:39 CEST 2010
Author: dafrick
Date: 2010-08-24 14:26:39 +0200 (Tue, 24 Aug 2010)
New Revision: 7210
Added:
code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc
code/trunk/src/modules/notifications/dispatchers/SimpleNotification.h
Modified:
code/trunk/data/levels/tutorial.oxw
code/trunk/src/modules/notifications/NotificationsPrereqs.h
code/trunk/src/modules/notifications/dispatchers/CMakeLists.txt
code/trunk/src/modules/notifications/dispatchers/CommandNotification.h
Log:
Created new NotificationDispatcher. It just displays, upon being triggered, some predefined Notification message.
Modified: code/trunk/data/levels/tutorial.oxw
===================================================================
--- code/trunk/data/levels/tutorial.oxw 2010-08-24 08:59:12 UTC (rev 7209)
+++ code/trunk/data/levels/tutorial.oxw 2010-08-24 12:26:39 UTC (rev 7210)
@@ -38,6 +38,18 @@
</trigger>
</events>
</CommandNotification>
+
+ <SimpleNotification message="Awesome!!!">
+ <events>
+ <trigger>
+ <DistanceTrigger name=trigger position="0,0,100" distance=10 target="Pawn">
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0,1.0" material="Examples/Flare" />
+ </attached>
+ </DistanceTrigger>
+ </trigger>
+ </events>
+ </SimpleNotification>
<Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
<attached>
Modified: code/trunk/src/modules/notifications/NotificationsPrereqs.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationsPrereqs.h 2010-08-24 08:59:12 UTC (rev 7209)
+++ code/trunk/src/modules/notifications/NotificationsPrereqs.h 2010-08-24 12:26:39 UTC (rev 7210)
@@ -72,6 +72,7 @@
//dispatchers
class CommandNotification;
+ class SimpleNotification;
}
#endif /* _NotificationsPrereqs_H__ */
Modified: code/trunk/src/modules/notifications/dispatchers/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/CMakeLists.txt 2010-08-24 08:59:12 UTC (rev 7209)
+++ code/trunk/src/modules/notifications/dispatchers/CMakeLists.txt 2010-08-24 12:26:39 UTC (rev 7210)
@@ -1,3 +1,4 @@
ADD_SOURCE_FILES(NOTIFICATIONS_SRC_FILES
CommandNotification.cc
+ SimpleNotification.cc
)
Modified: code/trunk/src/modules/notifications/dispatchers/CommandNotification.h
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/CommandNotification.h 2010-08-24 08:59:12 UTC (rev 7209)
+++ code/trunk/src/modules/notifications/dispatchers/CommandNotification.h 2010-08-24 12:26:39 UTC (rev 7210)
@@ -55,7 +55,7 @@
CommandNotification(BaseObject* creator); //!< Default Constructor.
virtual ~CommandNotification(); //!< Destructor.
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a NotificationDispatcher object through XML.
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CommandNotification object through XML.
/**
@brief Get the command, whose key is displayed.
Added: code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc (rev 0)
+++ code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc 2010-08-24 12:26:39 UTC (rev 7210)
@@ -0,0 +1,69 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "SimpleNotification.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox {
+
+ CreateFactory(SimpleNotification);
+
+ /**
+ @brief
+ Default Constructor. Registers the object and initializes variables.
+ */
+ SimpleNotification::SimpleNotification(BaseObject* creator) : NotificationDispatcher(creator)
+ {
+ RegisterObject(SimpleNotification);
+
+ this->setSender("simpleNotification");
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ SimpleNotification::~SimpleNotification()
+ {
+
+ }
+
+ /**
+ @brief
+ Method for creating a SimpleNotification object through XML.
+ */
+ void SimpleNotification::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(SimpleNotification, XMLPort, xmlelement, mode);
+
+ XMLPortParam(SimpleNotification, "message", setMessage, getMessage, xmlelement, mode);
+ }
+
+}
Added: code/trunk/src/modules/notifications/dispatchers/SimpleNotification.h
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/SimpleNotification.h (rev 0)
+++ code/trunk/src/modules/notifications/dispatchers/SimpleNotification.h 2010-08-24 12:26:39 UTC (rev 7210)
@@ -0,0 +1,81 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _SimpleNotification_H__
+#define _SimpleNotification_H__
+
+#include "notifications/NotificationsPrereqs.h"
+
+#include "notifications/NotificationDispatcher.h"
+#include <string>
+
+namespace orxonox {
+
+ /**
+ @brief
+ The SimpleNotification class enables the sending of (in XML) predefined Notifications upon some kind of triggering event.
+ @author
+ Damian 'Mozork' Frick
+ */
+ class _NotificationsExport SimpleNotification : public NotificationDispatcher
+ {
+ public:
+ SimpleNotification(BaseObject* creator); //!< Default Constructor.
+ virtual ~SimpleNotification(); //!< Destructor.
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleNotification object through XML.
+
+ /**
+ @brief Get the message, that is displayed.
+ @return Returns the message, that is displayed.
+ */
+ const std::string& getMessage(void)
+ { return this->message_; }
+
+ protected:
+ /**
+ @brief Creates the notification message that should be sent upon the SimpleNotification triggering.
+ @return Returns the notification message.
+ */
+ virtual const std::string& createNotificationMessage(void)
+ { return this->message_; }
+
+ private:
+ std::string message_; //!< The message that is displayed.
+
+ /**
+ @brief Sets the message that is to be displayed.
+ @param message The message to be displayed.
+ */
+ void setMessage(const std::string& message)
+ { this->message_ = message; }
+ };
+
+}
+
+#endif // _SimpleNotification_H__
More information about the Orxonox-commit
mailing list