예제 #1
0
void* GetElementUserData(Rocket::Core::Element *element, const Rocket::Core::String& key) {
	void *result = NULL;
    if (element != NULL) {
        Rocket::Core::Variant *value = element->GetAttribute(key);
        if (value != NULL) {
            Rocket::Core::String strval;
            value->GetInto(strval);
            sscanf(strval.CString(), "%x", &result);
        }
    }
	return result;
}
예제 #2
0
void GUIElement::GetAttribute(const char* attribute, char* buffer, size_t buffer_size ) const
{
	if( buffer_size && buffer )
	{
		buffer[0] = 0;
		Rocket::Core::Variant* pVar = m_pElement->GetAttribute(attribute);
		if( pVar )
		{
			Rocket::Core::String strvalue;
			pVar->GetInto( strvalue );
			strcpy_s( buffer, buffer_size, strvalue.CString() );
		}
	}
}
void GUIElement::GetAttribute(const char* attribute, char* buffer, size_t buffer_size ) const
{
	if( buffer_size && buffer )
	{
		buffer[0] = 0;
		Rocket::Core::Variant* pVar = m_pElement->GetAttribute(attribute);
		if( pVar )
		{
			Rocket::Core::String strvalue;
			pVar->GetInto( strvalue );
#ifdef _WIN32
			strcpy_s( buffer, buffer_size, strvalue.CString() );
#else
            strncpy( buffer, strvalue.CString(), buffer_size); //not quite the same, but similar safe effect.
#endif
		}
	}
}