[Orxonox-commit 6702] r11331 - in code/branches/Dialog_HS16/src/modules: notifications/dispatchers overlays/hud
dmoritz at orxonox.net
dmoritz at orxonox.net
Mon Dec 12 15:16:38 CET 2016
Author: dmoritz
Date: 2016-12-12 15:16:38 +0100 (Mon, 12 Dec 2016)
New Revision: 11331
Modified:
code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.cc
code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.h
code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.cc
code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.h
Log:
Final changes.
Modified: code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.cc
===================================================================
--- code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.cc 2016-12-12 14:04:10 UTC (rev 11330)
+++ code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.cc 2016-12-12 14:16:38 UTC (rev 11331)
@@ -1,6 +1,4 @@
-
-
#include "Dialogue.h"
#include "core/CoreIncludes.h"
#include "core/EventIncludes.h"
@@ -14,6 +12,10 @@
RegisterClass(Dialogue);
+ /**
+ @brief
+ Default Constructor. Registers the object and initializes variables.
+ */
Dialogue::Dialogue(Context* context):NotificationDispatcher(context){
RegisterObject(Dialogue);
@@ -21,11 +23,18 @@
this->setSyncMode(ObjectDirection::None);
}
-
+ /**
+ @brief
+ Destructor.
+ */
Dialogue::~Dialogue()
{
}
+ /**
+ @brief
+ Method for creating a Dialogue object through XML.
+ */
void Dialogue::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(Dialogue, XMLPort, xmlelement, mode);
@@ -35,12 +44,19 @@
XMLPortParam(Dialogue, "portrait", setPortrait, getPortrait, xmlelement, mode);
}
- void Dialogue::update()
- {
+ /**
+ @brief
+ Passes the name of the picture over to the HUDDialogue class
+ */
+ void Dialogue::update()
+ {
for(HUDDialogue* huddialogue : ObjectList<HUDDialogue>())
huddialogue->updateTarget(portrait_);
}
-
+ /**
+ @brief Creates the notification message,Pconsisting of a speaker and a message, that should be sent upon the Dialgue triggering.
+ @return Returns the notification message.
+ */
const std::string& Dialogue::createNotificationMessage(void)
{
dialogue_ = speaker_ + ": " + message_;
Modified: code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.h
===================================================================
--- code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.h 2016-12-12 14:04:10 UTC (rev 11330)
+++ code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.h 2016-12-12 14:16:38 UTC (rev 11331)
@@ -10,35 +10,84 @@
namespace orxonox{
+ /**
+ @brief
+ The Dialogue class enables the sending of (in XML) predefined Notifications upon some kind of triggering event.
+
+ In use it would like this:
+ @code
+ <Dialogue message="some message..." speaker="speaker" portrait="Orxonox/some_file">
+ <events>
+ <trigger>
+ <PlayerTrigger />
+ </trigger>
+ </events>
+ </Dialogue>
+ @endcode
+ For more information on what can be used for @code <PlayerTrigger /> @endcode see the @ref orxonox::NotificationDispatcher "NotificationDispatcher" documentation.
+ For more information about the Dialogue class take a look at the Notifications entry in the wiki.
+ */
+
class _NotificationsExport Dialogue: public NotificationDispatcher{
public:
Dialogue(Context* context); //!< Default Constructor.
virtual ~Dialogue(); //!< Destructor.
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Dialogue 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_; }
+ /**
+ @brief Get the name of the speaker.
+ @return Returns the name of the speaker.
+ */
const std::string& getSpeaker(void)
{return this->speaker_;}
+ /**
+ @brief Get the name of the file of the picture
+ @return Returns the name of the file.
+ */
const std::string& getPortrait(void)
{ return this->portrait_;}
protected:
+ /**
+ @brief Creates the notification message that should be sent upon the Dialgue triggering.
+ @return Returns the notification message.
+ */
virtual const std::string& createNotificationMessage(void);
+ /**
+ @brief Updates the picture that is displayed by passing the name of the picture over to the HUDDialogue class.
+ */
virtual void update(void);
private:
- std::string message_;
- std::string speaker_;
- std::string dialogue_;
- std::string portrait_;
+ std::string message_; //!< The message.
+ std::string speaker_; //!< The name of the speaker.
+ std::string dialogue_; //!< The speaker and the message that is displayed.
+ std::string portrait_; //!< The name of the file.
+ /**
+ @brief Sets the name of the speaker.
+ @param speaker The name of the speaker.
+ */
void setSpeaker(const std::string& speaker)
{ this->speaker_ = speaker;}
+ /**
+ @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; }
+ /**
+ @brief Sets the name of the file of the picture.
+ @param portrait Name of the file which is used.
+ */
void setPortrait(const std::string& portrait)
{ this->portrait_ = portrait;}
} ;
Modified: code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.cc
===================================================================
--- code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.cc 2016-12-12 14:04:10 UTC (rev 11330)
+++ code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.cc 2016-12-12 14:16:38 UTC (rev 11331)
@@ -14,13 +14,20 @@
namespace orxonox
{
- RegisterClass (HUDDialogue);
-
- HUDDialogue::HUDDialogue(Context* context) :
- OrxonoxOverlay(context)
+ RegisterClass (HUDDialogue);
+ /**
+ @brief
+ Default Constructor. Registers the object and initializes variables.
+ */
+ HUDDialogue::HUDDialogue(Context* context) :
+ OrxonoxOverlay(context)
{
RegisterObject(HUDDialogue);
- }
+ }
+ /**
+ @brief
+ Updates the picture to the picture which was declared in the Dialogue class and sets a timer to set the picture on invisible again.
+ */
void HUDDialogue::updateTarget(std::string portrait)
{
overlayElementIcon_ = static_cast<Ogre::PanelOverlayElement* >(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Dialogue" + getUniqueNumberString()));
@@ -32,14 +39,22 @@
this->setVisible(true);
portraitTimer.setTimer(2.9f,false,createExecutor(createFunctor(&HUDDialogue::invisible, this)));
}
+ /**
+ @brief
+ Sets the picture back to invisible again.
+ */
void HUDDialogue::invisible()
{
this->setVisible(false);
Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->overlayElementIcon_);
}
- HUDDialogue::~HUDDialogue()
- {
+ /**
+ @brief
+ Default Destructor.
+ */
+ HUDDialogue::~HUDDialogue()
+ {
- }
+ }
}
\ No newline at end of file
Modified: code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.h
===================================================================
--- code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.h 2016-12-12 14:04:10 UTC (rev 11330)
+++ code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.h 2016-12-12 14:16:38 UTC (rev 11331)
@@ -17,17 +17,22 @@
class _OverlaysExport HUDDialogue : public OrxonoxOverlay
{
public:
- HUDDialogue(Context* context);
- virtual ~HUDDialogue();
+ HUDDialogue(Context* context); //!< Default Constructor.
+ virtual ~HUDDialogue(); //!< Destructor.
+ /**
+ @brief Sets the active picture.
+ */
virtual void updateTarget(std::string portrait);
-
+ /**
+ @brief Sets the picture to invivsible when Dialogue is over.
+ */
virtual void invisible();
private:
Ogre::PanelOverlayElement* overlayElementIcon_;
- Timer portraitTimer;
+ Timer portraitTimer; //!< The Timer which is used to set the picture back to invisible.
};
}
#endif
\ No newline at end of file
More information about the Orxonox-commit
mailing list