示例#1
0
void CGUILabel_Impl::GetTextColor ( unsigned char& ucRed, unsigned char& ucGreen, unsigned char& ucBlue )
{
    CEGUI::colour r = ( reinterpret_cast < CEGUI::StaticText* > ( m_pWindow ) -> getTextColours () ).getColourAtPoint ( 0, 0 );

    ucRed = (unsigned char) (r.getRed () * 255);
    ucGreen = (unsigned char) (r.getGreen () * 255);
    ucBlue = (unsigned char) (r.getBlue () * 255);
}
long GuiRenderer::colourToOGL(const CEGUI::colour& col) const
{
    CEGUI::ulong cval;
    cval =  (static_cast<CEGUI::ulong>(255 * col.getAlpha())) << 24;
    cval |= (static_cast<CEGUI::ulong>(255 * col.getBlue())) << 16;
    cval |= (static_cast<CEGUI::ulong>(255 * col.getGreen())) << 8;
    cval |= (static_cast<CEGUI::ulong>(255 * col.getRed()));

    return cval;
}
bool CGUIListItem_Impl::GetColor ( unsigned char & ucRed, unsigned char & ucGreen, unsigned char & ucBlue, unsigned char & ucAlpha )
{
    if ( ItemType == TextItem )
    {
        CEGUI::colour color = reinterpret_cast < CEGUI::ListboxTextItem* > ( m_pListItem )->getTextColours ().d_top_left;
        ucRed = static_cast < unsigned char > ( color.getRed () * 255 );
        ucGreen = static_cast < unsigned char > ( color.getGreen () * 255 );
        ucBlue = static_cast < unsigned char > ( color.getBlue () * 255 );
        ucAlpha = static_cast < unsigned char > ( color.getAlpha () * 255 );
        return true;
    }
    else if ( ItemType == NumberItem )
    {
        CEGUI::colour color = reinterpret_cast < CEGUI::ListboxNumberItem* > ( m_pListItem )->getTextColours ().d_top_left;
        ucRed = static_cast < unsigned char > ( color.getRed () * 255 );
        ucGreen = static_cast < unsigned char > ( color.getGreen () * 255 );
        ucBlue = static_cast < unsigned char > ( color.getBlue () * 255 );
        ucAlpha = static_cast < unsigned char > ( color.getAlpha () * 255 );
        return true;
    }
    return false;
}