Пример #1
0
int FontDemo::getAutoScaleMode()
{
    CEGUI::String autoScaleString = d_fontAutoScaleCombobox->getSelectedItem()->getText();

    for(unsigned int i = 0; i < d_autoScaleOptionsArray.size(); ++i)
    {
        if(autoScaleString.compare(d_autoScaleOptionsArray.at(i)) == 0)
            return i;
    }

    return 0;
}
Пример #2
0
void WidgetDemo::initialiseAvailableWidgetsMap()
{
    //Retrieve the widget look types and add a Listboxitem for each widget, to the right scheme in the map
    CEGUI::WindowFactoryManager& windowFactorymanager = CEGUI::WindowFactoryManager::getSingleton();
    CEGUI::WindowFactoryManager::FalagardMappingIterator falMappingIter = windowFactorymanager.getFalagardMappingIterator();

    while(!falMappingIter.isAtEnd())
    {
        CEGUI::String falagardBaseType = falMappingIter.getCurrentValue().d_windowType;

        int slashPos = falagardBaseType.find_first_of('/');
        CEGUI::String group = falagardBaseType.substr(0, slashPos);
        CEGUI::String name = falagardBaseType.substr(slashPos + 1, falagardBaseType.size() - 1);

        if(group.compare("SampleBrowserSkin") != 0)
        {

            std::map<CEGUI::String, WidgetListType>::iterator iter = d_skinListItemsMap.find(group);
            if(iter == d_skinListItemsMap.end())
            {
                //Create new list
                d_skinListItemsMap[group];
            }

            WidgetListType& widgetList = d_skinListItemsMap.find(group)->second;
            addItemToWidgetList(name, widgetList);
        }

        ++falMappingIter;
    }

    //Add the default types as well
    d_skinListItemsMap["No Skin"];
    WidgetListType& defaultWidgetsList = d_skinListItemsMap["No Skin"];

    addItemToWidgetList("DefaultWindow", defaultWidgetsList);
    addItemToWidgetList("DragContainer", defaultWidgetsList);
    addItemToWidgetList("VerticalLayoutContainer", defaultWidgetsList);
    addItemToWidgetList("HorizontalLayoutContainer", defaultWidgetsList);
    addItemToWidgetList("GridLayoutContainer", defaultWidgetsList);
}
Пример #3
0
void FontDemo::changeFontSelectorFontSelection(const CEGUI::String& font)
{
    while(d_fontSelector->getFirstSelectedItem())
    {
        d_fontSelector->setItemSelectState(d_fontSelector->getFirstSelectedItem(), false);
    }

    unsigned int itemCount = d_fontSelector->getItemCount();
    for(unsigned int i = 0; i < itemCount; ++i)
    {
        CEGUI::ListboxItem* item = d_fontSelector->getListboxItemFromIndex(i);

        CEGUI::String itemFontName = item->getText();

        if(itemFontName.compare(font) == 0)
        {
            d_fontSelector->setItemSelectState(item, true);
            return;
        }
    }
}
Пример #4
0
int GamePlate::getPoints()
{
    CEGUI::Window* window = d_window->getChild("ImageWindowObject");

    CEGUI::String objectImage = window->getProperty("Image");

    if(objectImage.compare(HUDDemo::s_imageNameBread) == 0)
        return 2;
    else if(objectImage.compare(HUDDemo::s_imageNamePoo) == 0)
        return -6;
    else if(objectImage.compare(HUDDemo::s_imageNameSteak) == 0)
        return -13;
    else if(objectImage.compare(HUDDemo::s_imageNamePrizza) == 0)
        return 3;
    else if(objectImage.compare(HUDDemo::s_imageNameVegPeople) == 0)
        return 1;
    else if(objectImage.compare(HUDDemo::s_imageNameVegFruits) == 0)
        return 88;

    return 0;
}
void ImplChatNetworkingVRC::postChatText( const CEGUI::String& text, const std::string& recipient )
{
    // check for commands
    if ( !text.compare( 0, 1, "/" ) )
    {
        std::vector< std::string > args;
        yaf3d::explode( text.c_str(), " ", &args );

        // all commands without arguments go here
        if ( args.size() == 1 )
        {
            if ( ( args[ 0 ] == "/names" ) || ( args[ 0 ] == "/NAMES" ) )
            {
                tChatData chatdata;
                chatdata._sessionID = _clientSID;
                NOMINATED_REPLICAS_FUNCTION_CALL( 1, &_serverSID, RPC_RequestMemberList( chatdata ) );
                return;
            }
            else
            {
                _p_protVRC->recvMessage( "", "", VRC_CMD_LIST );
                return;
            }

        }
        // all commands with one single argument go here
        else if ( ( args.size() > 1 ) && ( ( args[ 0 ] == "/nick" ) || ( args[ 0 ] == "/NICK" ) ) )
        {
            tChatData chatdata;
            chatdata._sessionID = _clientSID;
            strcpy( chatdata._nickname, &( text.c_str()[ 6 ] ) );
            NOMINATED_REPLICAS_FUNCTION_CALL( 1, &_serverSID, RPC_RequestChangeNickname( chatdata ) );
            return;
        }
        else
        {
            _p_protVRC->recvMessage( "", "", VRC_CMD_LIST );
            return;
        }
    }
    else // if no command given then send the raw text
    {
        // prepare the telegram
        tChatMsg textdata;
        memset( textdata._text, 0, sizeof( textdata._text ) );  // zero out the text buffer
        textdata._recipientID = 0 ;                             // init to non-whisper message
        // determine the length of utf8 string and copy the content into send buffer
        CEGUI::String lenstr( text );
        memcpy( textdata._text, lenstr.data(), std::min( ( std::size_t )lenstr.utf8_stream_len( sizeof( textdata._text ) - 1, 0 ), ( std::size_t )sizeof( textdata._text ) - 2 ) );
        assert( sizeof( textdata._text ) > 3 );
        textdata._text[ sizeof( textdata._text ) - 1 ] = 0; // terminate the string to be on the safe side
        textdata._text[ sizeof( textdata._text ) - 2 ] = 0; // terminate the string to be on the safe side
        textdata._text[ sizeof( textdata._text ) - 3 ] = 0; // terminate the string to be on the safe side
        textdata._sessionID = _clientSID;

        // are we whispering to somebody?
        if ( recipient.length() )
        {
            // try to find the session ID of recipient
            std::map< int, std::string >::iterator p_recipientID = _nickNames.begin(), p_end = _nickNames.end();
            for ( ; p_recipientID != p_end; ++p_recipientID )
            {
                if ( p_recipientID->second == recipient )
                {
                    // set the recipient session ID
                    textdata._recipientID = p_recipientID->first;
                    break;
                }
            }
        }

        NOMINATED_REPLICAS_FUNCTION_CALL( 1, &_serverSID, RPC_PostChatText( textdata ) );
    }
}