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
File:
1 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    }
Note: See TracChangeset for help on using the changeset viewer.