Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2008, 9:11:12 AM (15 years ago)
Author:
landauf
Message:
  • GlobalShader in dedicated mode works again
  • Shooting as a client works
  • Fixed problem with NotificationQueue
Location:
code/branches/presentation/src/orxonox/overlays/notifications
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/overlays/notifications/NotificationManager.cc

    r2436 r2501  
    4949        //TDO: Destroy the containers
    5050    }
    51    
     51
    5252    void NotificationManager::tick(float dt)
    5353    {
    5454        bool update = false;
    55    
     55
    5656        for (std::list<NotificationContainer*>::iterator notification = notifications_s.begin(); notification != notifications_s.end(); ++notification)
    5757        {
     
    7171            }
    7272        }
    73    
     73
    7474        if(update)
    7575            updateQueue();
    7676    }
    77    
     77
    7878    bool NotificationManager::insertNotification(Notification* notification)
    7979    {
    8080        if(notification == NULL)
    8181            return false;
    82            
     82
    8383        NotificationContainer* container = new NotificationContainer;
    8484        container->notification = notification;
    8585        container->remainingTime = notification->getDisplayTime();
    8686        notifications_s.push_front(container);
    87        
     87
    8888        updateQueue();
    89        
     89
    9090        COUT(4) << "Notification inserted. Title: " << notification->getTitle() << std::endl;
    91        
     91
    9292        return true;
    9393    }
    94    
     94
    9595    void NotificationManager::updateQueue(void)
    9696    {
    9797        std::string text = "";
    98        
     98
     99        if (!NotificationQueue::queue_s)
     100            return;
     101
    99102        int i = NotificationQueue::queue_s->getLength();
    100103        for (std::list<NotificationContainer*>::iterator notification = notifications_s.begin(); notification != notifications_s.end() && i > 0; ++notification)
     
    104107            if(container->remainingTime == 0.0)
    105108                continue;
    106            
     109
    107110            text = text + "\n\n\n------------\n\n" + clipMessage(container->notification->getTitle()) + "\n\n" + clipMessage(container->notification->getMessage());
    108111        }
    109        
     112
    110113        NotificationQueue::queue_s->setQueueText(text);
    111114    }
    112    
     115
    113116    const std::string NotificationManager::clipMessage(const std::string & str)
    114117    {
    115    
     118
    116119        std::string message = str;
    117120        unsigned int i = 0;
    118        
     121
    119122        unsigned int found = message.find("\\n", i);
    120123        while(found != std::string::npos)
     
    124127            found = message.find("\\n", i);
    125128        }
    126    
     129
    127130        std::string clippedMessage = "";
    128131        int wordLength = 0;
     
    136139                wordLength++;
    137140            }
    138            
     141
    139142            if(wordLength <= widthLeft)
    140143            {
     
    165168            }
    166169        }
    167        
     170
    168171        return clippedMessage;
    169172    }
  • code/branches/presentation/src/orxonox/overlays/notifications/NotificationQueue.cc

    r2500 r2501  
    5656        this->length_ = 3;
    5757        this->width_ = 50;
    58 COUT(0) << "added notification queue" << std::endl;
    5958    }
    6059
    6160    NotificationQueue::~NotificationQueue()
    6261    {
    63 COUT(0) << "deleted notification queue" << std::endl;
    6462
    6563    }
     
    102100    void NotificationQueue::setQueueText(const std::string & text)
    103101    {
    104 COUT(0) << "queue: " << text << std::endl;
    105102        this->queueText_ = text;
    106103    }
     
    110107        this->text_->setCaption(queueText_);
    111108    }
    112 
    113109}
  • code/branches/presentation/src/orxonox/overlays/notifications/NotificationQueue.h

    r2436 r2501  
    4242    /**
    4343    @brief
    44        
     44
    4545    @author
    4646        Damian 'Mozork' Frick
     
    5151        NotificationQueue(BaseObject* creator);
    5252        virtual ~NotificationQueue();
    53        
     53
    5454        static NotificationQueue* queue_s; //TDO Singleton? oder im level.
    55        
     55
    5656        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
    57        
     57
    5858        virtual void tick(float dt);
    59        
     59
    6060        void update(void);
    61        
     61
    6262        int getLength(void) const
    6363                { return this->length_; }
    6464        int getWidth(void) const
    6565                { return this->width_; }
    66        
     66
    6767        void setQueueText(const std::string & text);
    6868        bool setLength(int length);
    6969        bool setWidth(int width);
    70        
     70
    7171    private:
    7272        Ogre::UTFString queueText_;
    7373        int length_;
    7474        int width_;
    75    
     75
    7676    };
    7777
Note: See TracChangeset for help on using the changeset viewer.