Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 29, 2011, 11:24:31 AM (14 years ago)
Author:
dafrick
Message:

Adding network callbacks. Still doesn't work yet, though.

File:
1 edited

Legend:

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

    r8651 r8656  
    9595    void NotificationQueueCEGUI::registerVariables()
    9696    {
    97         registerVariable( this->position_, VariableDirection::ToClient );
    98         registerVariable( this->fontSize_, VariableDirection::ToClient );
    99         registerVariable( this->fontColor_, VariableDirection::ToClient );
    100         registerVariable( this->alignment_, VariableDirection::ToClient );
    101         registerVariable( this->displaySize_, VariableDirection::ToClient );
     97        registerVariable( this->position_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::positionChanged));
     98        registerVariable( this->fontSize_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::fontSizeChanged));
     99        registerVariable( this->fontColor_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::fontColorChanged));
     100        registerVariable( this->alignment_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::alignmentChanged));
     101        registerVariable( this->displaySize_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::displaySizeChanged));
    102102    }
    103103
     
    141141
    142142        this->displaySize_ = size;
     143        this->displaySizeChanged();
     144    }
     145
     146    /**
     147    @brief
     148        Is called when the display size has changed.
     149    */
     150    void NotificationQueueCEGUI::displaySizeChanged(void)
     151    {
    143152        if(GameMode::showsGraphics())
    144153        {
    145             if(size.z == 0.0 && size.w == 0.0)
     154            if(this->displaySize_.z == 0.0 && this->displaySize_.w == 0.0)
    146155                GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".resizeQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->displaySize_.x) + ", " + multi_cast<std::string>(this->displaySize_.y) + ")");
    147156            else
     
    172181
    173182        this->position_ = position;
     183        this->positionChanged();
     184    }
     185
     186    /**
     187    @brief
     188        Is called when the NotificationQueue's position has changed.
     189    */
     190    void NotificationQueueCEGUI::positionChanged(void)
     191    {
    174192        if(GameMode::showsGraphics())
    175193            GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".moveQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->position_.x) + ", " + multi_cast<std::string>(this->position_.y) + ", " + multi_cast<std::string>(this->position_.z) + ", " + multi_cast<std::string>(this->position_.w) + ")");
     
    190208        // TODO: Check whether the alignment string is correct?
    191209        this->alignment_ = alignment;
     210        this->alignmentChanged();
     211    }
     212
     213    /**
     214    @brief
     215        Is called when the horizontal alignment of the Notifications text has changed.
     216    */
     217    void NotificationQueueCEGUI::alignmentChanged(void)
     218    {
    192219        if(GameMode::showsGraphics())
    193220            GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueAlignment(\"" + this->getName() + "\", \"" + this->alignment_ + "\")");
     
    206233
    207234        this->fontSize_ = size;
     235        this->fontSizeChanged();
     236    }
     237
     238    /**
     239    @brief
     240        Is called when the font size of the text displayed by this NotificationQueue has changed.
     241    */
     242    void NotificationQueueCEGUI::fontSizeChanged(void)
     243    {
    208244        if(GameMode::showsGraphics())
    209245            GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueFontSize(\"" + this->getName() + "\", " + multi_cast<std::string>(this->fontSize_) + ")");
     
    222258
    223259        this->fontColor_ = color;
     260        this->fontColorChanged();
     261    }
     262
     263    /**
     264    @brief
     265        Is called when the font color if the text displayed by this NotificationQueue.
     266    */
     267    void NotificationQueueCEGUI::fontColorChanged(void)
     268    {
    224269        // Convert to ARGB format.
    225270        std::stringstream stream;
     
    227272            stream << std::hex << std::setw(2) << std::setfill('0') << int(this->fontColor_[(i+3)%4]*255);
    228273        this->fontColorStr_ = stream.str();
     274
    229275        if(GameMode::showsGraphics())
    230276            GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueFontColor(\"" + this->getName() + "\", \"" + this->fontColorStr_ + "\")");
     
    249295    /**
    250296    @brief
    251         Is called by the NotificationQueue when a notification was pushed.
     297        Is called by the NotificationQueue when a Notification was pushed.
    252298    @param notification
    253299        The Notification that was pushed.
     
    262308    /**
    263309    @brief
    264         Is called by the NotificationQueue when a notification was popped.
     310        Is called by the NotificationQueue when a Notification was popped.
    265311    */
    266312    void NotificationQueueCEGUI::notificationPopped(void)
     
    273319    /**
    274320    @brief Is called when a notification was removed.
    275     @param index The index the removed notification was at.
     321    @param index The index the removed Notification was at.
    276322    */
    277323    void NotificationQueueCEGUI::notificationRemoved(unsigned int index)
Note: See TracChangeset for help on using the changeset viewer.