Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7489


Ignore:
Timestamp:
Sep 24, 2010, 4:01:04 PM (14 years ago)
Author:
dafrick
Message:

Mostly more documentation.

Location:
code/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/doc/api/Groups.dox

    r7488 r7489  
    129129    You first have to decide on a message, it shouldn't be too long but be long enough to get your point accross.
    130130    Then you have to decide on a sender. The sender is a string by which the different @ref orxonox::NotificationQueue "NotificationQueues" (the entities that display the @ref orxonox::Notification "Notifications") can decide whether they should display the @ref orxonox::Notification "Notification" or not. So the sender is some string that identifies a group of @ref orxonox::Notification "Notifications" that have something in common or some entity that is sending them. For example: All @ref orxonox::Notification "Notifications" sent by any part of the Questsystem have "questsystem" as sender and thus we could create a @ref orxonox::NotificationQueue "NotificationQueue" that only displays @ref orxonox::Notification "Notifications" from the Questsystem, but more to that later.
    131     And lastly you have to decide to whom you want to send this @ref orxonox::Notification "Notification". You have to get the clientId of the intended recipient (e.g. trought a @ref orxonox::PlayerInfo "PlayerInfo") or you only send the @ref orxonox::Notification "Notification" locally, either by setting the clientId to Host::getPlayerID() or by setting the variable 'isLocal' to true, and setting clientId to what ever you want, since it will be ignored.
     131    And lastly you have to decide to whom you want to send this @ref orxonox::Notification "Notification". You have to get the clientId of the intended recipient (e.g. trough a @ref orxonox::PlayerInfo "PlayerInfo") or you only send the @ref orxonox::Notification "Notification" locally, either by setting the clientId to Host::getPlayerID() or by setting the variable 'isLocal' to true, and setting clientId to what ever you want, since it will be ignored.
    132132    Once you have decided all that you can send the Notification by calling:
    133133    @code
     
    136136
    137137    @subsection NotificationsDisplay Displaying notifications
    138     Displaying @ref oroxnox::Notification "Notifications" is even easier, all you need to do is to load the NotificationLayer in the level, where you want @ref orxonox::Notification "Notifications" displayed. You can either do this manually by executing the following command in the console:
     138    Displaying @ref orxonox::Notification "Notifications" is even easier, all you need to do is to load the NotificationLayer in the level, where you want @ref orxonox::Notification "Notifications" displayed. You can either do this manually by executing the following command in the console:
    139139    @code
    140140    showGUI NotificationLayer false true
     
    154154
    155155    @subsection NotificationQueue NotificationQueue
    156     The @ref orxonox::NotificationQueue "NotificationQueue" is the entity, that (as said earlier) logically displays @ref orxonox::Notification "Notifications". Furthermore a @ref orxonox::NotificationQueue "NotificationQueue" displays only a subset of all the @ref orxonox::Notification "Notifications". The parameters that reduce the range of @ref orxonox::Notification "Notifications" are:
    157     - @b senders The senders, set of targets of a @ref orxonox::NotificationQueue "NotificationQueue" is the set of senders a @ref orxonox::NotificationQueue "NotificationQueue" displays  @ref orxonox::Notification "Notifications" from. E.g. If one would set the senders to "questsystem" then only  @ref orxonox::Notification "Notifications" from the Questsystem wouuld be displayed in that particular queue. If you set senders to "all" then all Notifications will be displayed. Different senders can be concatinated with commas.
    158     - @b size The size specifies how many @ref orxonox::Notification "Notifications" are displayed at the most, if there are more @ref orxonox::Notification "Notifications" that could be displayed but the size is smaller than the number of @ref orxonox::Notification "Notifications", then only the most recent are displayed.
     156    The @ref orxonox::NotificationQueue "NotificationQueue" is the entity, that (as said earlier) logically displays @ref orxonox::Notification "Notifications". Furthermore a @ref orxonox::NotificationQueue "NotificationQueue" displays only a subset of all the @ref orxonox::Notification "Notifications". The parameters that reduce the range of displayed @ref orxonox::Notification "Notifications" are:
     157    - @b senders The senders, the set of targets of a @ref orxonox::NotificationQueue "NotificationQueue" is the set of senders a @ref orxonox::NotificationQueue "NotificationQueue" displays  @ref orxonox::Notification "Notifications" from. E.g. If one would set the senders to "questsystem" then only  @ref orxonox::Notification "Notifications" from the Questsystem would be displayed in that particular queue. If you set senders to "all" then all Notifications will be displayed. Different senders can be concatinated with commas.
     158    - @b size The size specifies how many @ref orxonox::Notification "Notifications" are displayed at the most, if there are more @ref orxonox::Notification "Notifications" that could be displayed, then only the most recent are displayed.
    159159    - @b displayTime The display time specifies how long a @ref orxonox::Notification "Notification" is displayed at the most.
    160160
    161161    @subsection NotificationLayer NotificationLayer
    162     The NotificationLayer is a GUI sheet, that displays all the @ref orxonox::NotificationQueue "NotificationQueues" and their @ref orxonox::Notification "Notifications". In its normal mode of operation it is transparent to input, meaning that it only functions as a means of displaying, however if switched to edit mode the NotificationLayer no longer is transparent to input and allows for the adding, removal and modification of @ref orxonox::NotificationQueue "NotificationQueues".
     162    The NotificationLayer is a GUI sheet, that displays all the @ref orxonox::NotificationQueue "NotificationQueues" and their @ref orxonox::Notification "Notifications". In its normal mode of operation it is transparent to input, meaning that it only functions as a means of displaying, however if switched to edit mode the NotificationLayer no longer is transparent to input and allows for the adding, removal and modification of @ref orxonox::NotificationQueue "NotificationQueues". For every @ref orxonox::NotificationQueue "NotificationQueue" there is the equivalent representation in the NotificationLayer. So @ref orxonox::NotificationQueue "NotificationQueues" are not each represented by a GUI sheet, but thely all belong to one and the same GUI sheet, the NotificationLayer.
    163163
    164164    @subsection NotificationManager NotificationManager
    165     The @ref orxonox::NotificationManager "NotificationManager" is (hence the name) the managing entity in this setting. It is responsible for the registering and unregistering of @ref orxonox::NotificationListener "NotificationListeners" (which the @ref orxonox::NotificationQueue "NotificationQueue" is) and also informs them about changes related to @ref orxonox::Notification "Notifications". It is also responsible for the creation and destruction of @ref orxonox::NotificationQueue "NotificationQueues" through the NotificationLayer and is also the point of approach for the NotificationLayer to get information it needs. Finally the @ref orxonox::NotificationManager "NotificationManager" is responsible for sending (and in the process creating) @ref orxonox::Notification "Notifications" and is a means for the @ref orxonox::NotificationQueue "NotificationQueues" to get the information they need about @ref orxonox::Notification "Notifications".
     165    The @ref orxonox::NotificationManager "NotificationManager" is (hence the name) the managing entity in this setting. It is responsible for the registering and unregistering of @ref orxonox::NotificationListener "NotificationListeners" (which the @ref orxonox::NotificationQueue "NotificationQueue" is) and also informs them about changes related to @ref orxonox::Notification "Notifications". It is also responsible for the creation and destruction of @ref orxonox::NotificationQueue "NotificationQueues" through the NotificationLayer and is also the point of approach for the NotificationLayer to get information it needs to display the queues. Finally the @ref orxonox::NotificationManager "NotificationManager" is responsible for sending (and in the process creating) @ref orxonox::Notification "Notifications" and is a means for the @ref orxonox::NotificationQueue "NotificationQueues" to get the information they need about @ref orxonox::Notification "Notifications".
    166166
    167167    @subsection Notification Notification
    168     The @ref orxonox::Notification "Notification" class is more or less a data structure that groups the notification message and the sender, and possibly other future parameters together to form a comprehensive structure that we call Notification.
     168    The @ref orxonox::Notification "Notification" class is more or less a data structure that groups the notification message and the sender, and possibly other future parameters, together to form a comprehensive structure that we call Notification.
    169169
    170170    Additionally there is another important class of objects belonging to the Notifications module. The @ref orxonox::NotificationDispatcher "NotificationDispatchers".
  • code/trunk/src/modules/notifications/Notification.cc

    r7488 r7489  
    3535
    3636#include "core/CoreIncludes.h"
    37 #include "network/NetworkFunction.h"
    38 #include "network/Host.h"
    3937#include "NotificationManager.h"
    4038
     
    4442    /**
    4543    @brief
    46         Default constructor. Initializes the object.
    47     */
    48     Notification::Notification()
    49     {
    50         RegisterRootObject(Notification);
    51         this->initialize();
    52     }
    53 
    54     /**
    55     @brief
    56         Constructor. Creates a Notification with the input message.
    57     @param creator
    58         The creator.
     44        Constructor. Creates a Notification with the input message and sender.
    5945    @param message
    6046        The message of the Notification.
     47    @param sender
     48        The sender of the Notification.
    6149    */
    6250    Notification::Notification(const std::string& message, const std::string& sender)
  • code/trunk/src/modules/notifications/Notification.h

    r7488 r7489  
    3939
    4040#include <string>
    41 #include "core/BaseObject.h"
     41#include "core/OrxonoxClass.h"
    4242
    4343namespace orxonox
     
    4646    /**
    4747    @brief
    48         A Notification is a short message used to inform the player about something that just happened. A Notification can be sent from any part of orxonox and is then displayed in the proper @ref orxonox::NotificationQueue "NotificationQueue" (depending on which senders the specific @ref orxonox::NotificationQueue "NotificationQueue" accepts).
     48        A Notification represents a short message used to inform the player about something that just happened. With the @ref orxonox::NotificationManager "NotificationManager" a Notification can be sent from any part of orxonox and is then displayed by the proper @ref orxonox::NotificationQueue "NotificationQueue(s)" (depending on which senders the specific @ref orxonox::NotificationQueue "NotificationQueues" accepts).
     49
     50        A Notification is just a datastructure that is used internally by the Notifications module.
    4951    @author
    5052        Damian 'Mozork' Frick
     
    5355    {
    5456        public:
    55             Notification();
    5657            Notification(const std::string& message, const std::string& sender);
    5758            virtual ~Notification();
    5859
    5960            /**
    60             @brief Returns the message of the Notification.
     61            @brief Get the message of the Notification.
    6162            @return Returns the message of the Notification.
    6263            */
     
    6465                { return this->message_; }
    6566
     67            /**
     68            @brief Get the sender of the Notification.
     69            @return Returns the sender of the Notification.
     70            */
    6671            inline const std::string & getSender(void) const
    6772                { return this->sender_; }
  • code/trunk/src/modules/notifications/NotificationDispatcher.cc

    r7488 r7489  
    4444#include "worldentities/pawns/Pawn.h"
    4545
    46 #include "Notification.h"
    4746#include "NotificationManager.h"
    4847
  • code/trunk/src/modules/notifications/NotificationManager.cc

    r7488 r7489  
    104104        // Destroys all NotificationQueues that have been registered with the NotificationManager.
    105105        for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++)
    106         {
    107106            it->second->destroy(true);
    108         }
     107
    109108        this->queues_.clear();
    110109    }
     
    343342    void NotificationManager::enterEditMode(void)
    344343    {
    345         GUIManager::getInstance().hideGUI("NotificationLayer");
    346         GUIManager::getInstance().showGUI("NotificationLayer", false, false);
    347         GUIManager::getInstance().getLuaState()->doString("NotificationLayer.enterEditMode()");
     344        if(GameMode::showsGraphics())
     345        {
     346            GUIManager::getInstance().hideGUI("NotificationLayer");
     347            GUIManager::getInstance().showGUI("NotificationLayer", false, false);
     348            GUIManager::getInstance().getLuaState()->doString("NotificationLayer.enterEditMode()");
     349        }
    348350    }
    349351
  • code/trunk/src/modules/notifications/NotificationManager.h

    r7486 r7489  
    5252        The Singleton NotificationManager functions as a gateway between @ref orxonox::Notification "Notifications" and @ref orxonox::NotificationListener "NotificationListeners".
    5353        It receives, organizes @ref orxonox::Notification "Notifications" and the redistributes them to the specific @ref orxonox::NotificationListener "NotificationListeners".
    54         It also provides a static function to send @ref orxonox::Notification "Notifications" and works as a liaison between the @ref orxonox>>NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer.
     54        It also provides a static function to send @ref orxonox::Notification "Notifications" and works as a liaison between the @ref orxonox::NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer.
    5555    @author
    5656        Damian 'Mozork' Frick
  • code/trunk/src/modules/notifications/NotificationQueue.cc

    r7488 r7489  
    9090        this->create(); // Creates the NotificationQueue in lua.
    9191
    92         // register the NotificationQueue as NotificationListener with the NotificationManager.
     92        // Register the NotificationQueue as NotificationListener with the NotificationManager.
    9393        bool listenerRegistered = NotificationManager::getInstance().registerListener(this);
    9494        if(!listenerRegistered) // If the registration has failed.
     
    9696            this->registered_ = false;
    9797            // Remove the NotificationQueue in lua.
    98             GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
     98            if(GameMode::showsGraphics())
     99                GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
    99100            NotificationManager::getInstance().unregisterQueue(this);
    100101            COUT(1) << "Error: NotificationQueue '" << this->getName() << "' could not be registered." << std::endl;
     
    210211    void NotificationQueue::update(Notification* notification, const std::time_t & time)
    211212    {
     213        assert(notification);
     214
    212215        this->push(notification, time);
    213216
     
    226229    void NotificationQueue::push(Notification* notification, const std::time_t & time)
    227230    {
     231        assert(notification);
     232
    228233        NotificationContainer* container = new NotificationContainer;
    229234        container->notification = notification;
     
    254259        // Get all the NotificationContainers that were sent the same time the NotificationContainer we want to pop was sent.
    255260        std::pair<std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator, std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator> iterators = this->ordering_.equal_range(container);
    256         // Iterate thourgh all suspects and remove the container as soon as we find it.
     261        // Iterate through all suspects and remove the container as soon as we find it.
    257262        for(std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator it = iterators.first; it != iterators.second; it++)
    258263        {
     
    311316
    312317        this->notifications_.clear();
    313 
    314318        this->size_ = 0;
    315319
  • code/trunk/src/modules/notifications/NotificationQueue.h

    r7488 r7489  
    4343#include <vector>
    4444
     45#include "NotificationManager.h"
     46
    4547#include "tools/interfaces/Tickable.h"
    46 
    4748#include "interfaces/NotificationListener.h"
    48 #include "NotificationManager.h"
    4949
    5050namespace orxonox // tolua_export
     
    5454    struct NotificationContainer
    5555    {
    56         Notification* notification; // The Notification displayed.
    57         time_t time; // The time the Notification was sent and thus first displayed.
     56        Notification* notification; //!< The Notification displayed.
     57        time_t time; //!< The time the Notification was sent and thus first displayed.
    5858    };
    5959
     
    6161    struct NotificationContainerCompare {
    6262        bool operator() (const NotificationContainer* const & a, const NotificationContainer* const & b) const
    63             { return a->time < b->time; } // Ordered by time.
     63            { return a->time < b->time; } //!< Ordering by time.
    6464    };
    6565
  • code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc

    r7484 r7489  
    6464    CommandNotification::~CommandNotification()
    6565    {
    66        
     66
    6767    }
    6868
     
    114114        Returns a human readable version of the input binding.
    115115    */
     116    //TODO: Move to KeyBinderManager...
    116117    const std::string& CommandNotification::bindingNiceifyer(const std::string& binding)
    117118    {
  • code/trunk/src/modules/notifications/dispatchers/CommandNotification.h

    r7488 r7489  
    4646    @brief
    4747        This class implements a method of displaying a Notification with information to an input command and the key the command is mapped to.
    48         The message that is displayed is a string made out uf the concatenation of the preMessage, the key the specified command is mapped to and the postMessage.
     48        The message that is displayed is a string made out of the concatenation of the preMessage, the key the specified command is mapped to and the postMessage.
    4949
    5050        In use it would like this:
     
    120120                 { this->postMessage_ = message; }
    121121
    122             const std::string& bindingNiceifyer(const std::string& binding);
     122            const std::string& bindingNiceifyer(const std::string& binding); //!< Transforms the input binding into a human readable form.
    123123
    124124    };
  • code/trunk/src/modules/questsystem/QuestEffectBeacon.h

    r7456 r7489  
    5656    @brief
    5757        A QuestEffectBeacon is a physical entity in the game which can (under some condition(s)) invoke a number of @ref orxonox::QuestEffect "QuestEffects" on players meeting the condition(s).
    58         The conditions under which the @ref orxonox::QuestEffect "QuestEffects" are invoked on the player are defined by @ref orxonox::Trigger "Triggers" (or really any kind of entity firing events, e.g. @ref oroxnox::EventListener "EventListeners"). The trigger the event originates from, however has to be a @ref orxonox::PlayerTrigger PlayerTrigger.
     58        The conditions under which the @ref orxonox::QuestEffect "QuestEffects" are invoked on the player are defined by @ref orxonox::Trigger "Triggers" (or really any kind of entity firing events, e.g. @ref orxonox::EventListener "EventListeners"). The trigger the event originates from, however has to be a @ref orxonox::PlayerTrigger PlayerTrigger.
    5959        A QuestEffectBeacon can be executed a defined number of times.
    6060        A QuestEffectBeacon can be inactive or active. While inactive it can't be executed.
Note: See TracChangeset for help on using the changeset viewer.