Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 28, 2011, 4:21:14 PM (13 years ago)
Author:
dafrick
Message:

Making NotificationQueue XML-loadable. Adding notifications to all levels.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutoriallevel3/src/modules/notifications/NotificationQueueCEGUI.cc

    r8453 r8636  
    4747{
    4848
     49    CreateFactory(NotificationQueueCEGUI);
     50
    4951    // Register tolua_open function when loading the library.
    5052    DeclareToluaInterface(Notifications);
     
    5254    /*static*/ const std::string NotificationQueueCEGUI::NOTIFICATION_LAYER("NotificationLayer");
    5355
    54     NotificationQueueCEGUI::NotificationQueueCEGUI(const std::string& name, const std::string& senders, unsigned int size, unsigned int displayTime) : NotificationQueue(name, senders, size, displayTime)
     56    NotificationQueueCEGUI::NotificationQueueCEGUI(BaseObject* creator) : NotificationQueue(creator)
    5557    {
    5658        RegisterObject(NotificationQueueCEGUI);
    5759
     60        this->initialize();
     61    }
     62   
     63    NotificationQueueCEGUI::~NotificationQueueCEGUI()
     64    {
     65        if(GameMode::showsGraphics())
     66            GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeQueue(\"" + this->getName() +  "\")");
     67    }
     68
     69    /**
     70    @brief
     71        Initializes The NotificationQueueCEGUI.
     72    */
     73    void NotificationQueueCEGUI::initialize(void)
     74    {
    5875        this->displaySize_ = Vector4(1.0, 0.0, 0.0, 0.0);
    5976        this->position_ = Vector4(0.0, 0.0, 0.0, 0.0);
     
    6279        this->fontColor_ = Vector4(1.0, 1.0, 1.0, 1.0);
    6380        this->fontColorStr_ = "FFFFFFFF";
    64        
    65         // Create the NotificationQueueCEGUI in lua.
    66         this->create();
    67     }
    68    
    69     NotificationQueueCEGUI::~NotificationQueueCEGUI()
    70     {
    71        
     81    }
     82
     83    void NotificationQueueCEGUI::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     84    {
     85        SUPER(NotificationQueueCEGUI, XMLPort, xmlelement, mode);
     86
     87        XMLPortParam(NotificationQueueCEGUI, "position", setPosition, getPosition, xmlelement, mode);
     88        XMLPortParam(NotificationQueueCEGUI, "fontSize", setFontSize, getFontSize, xmlelement, mode);
     89        XMLPortParam(NotificationQueueCEGUI, "fontColor", setFontColor, getFontColor, xmlelement, mode);
     90        XMLPortParam(NotificationQueueCEGUI, "alignment", setAlignment, getAlignment, xmlelement, mode);
     91        XMLPortParam(NotificationQueueCEGUI, "displaySize", setDisplaySize, getDisplaySize, xmlelement, mode);
    7292    }
    7393
     
    266286    void NotificationQueueCEGUI::create(void)
    267287    {
    268         if(GameMode::showsGraphics())
     288        this->NotificationQueue::create();
     289       
     290        if(this->isRegistered() && GameMode::showsGraphics())
    269291            GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".createQueue(\"" + this->getName() +  "\", " + multi_cast<std::string>(this->getMaxSize()) + ")");
    270292    }
Note: See TracChangeset for help on using the changeset viewer.