You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
cout << strColor.c_str() << endl;
// For the we will add the String Color value that we just get
attrib->addString("ColorString",strColor.c_str());
SColor color = attrib->getAttributeAsColor("Color");
SColor color2 = attrib->getAttributeAsColor("ColorString");
// The two next line don't return the same thing
// The first one print "255, 125, 125"
// The 2nd one print "255, 255, 255"
// But that the same thing
IrrlichtDevice *device =
createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
return 1;
io::IAttributes* attrib = device->getFileSystem()->createEmptyAttributes();
SColor test (255,255,125,25);
attrib->addColor("Color",test);
stringc strColor = attrib->getAttributeAsString("Color");
cout << strColor.c_str() << endl;
// For the we will add the String Color value that we just get
attrib->addString("ColorString",strColor.c_str());
SColor color = attrib->getAttributeAsColor("Color");
SColor color2 = attrib->getAttributeAsColor("ColorString");
// The two next line don't return the same thing
// The first one print "255, 125, 125"
// The 2nd one print "255, 255, 255"
// But that the same thing
cout << "Red: " << color.getRed();
cout << "; Green: " << color.getGreen();
cout << "; Blue: " << color.getBlue() << endl;
cout << "Red: " << color2.getRed();
cout << "; Green: " << color2.getGreen();
cout << "; Blue: " << color2.getBlue() << endl;
device->drop();
However, the color conversion scheme is completely weird. Some values use hex values (with or without 0x prefix), some use color elements, some use strings, ... I don't think that all of these conversions used internally are really are coherent.
Don't know, in the tests I added yesterday SColor and SColorf both worked. And the problem described above will not work, but that is correct as attributes just don't do that. But I've only tested the IAttributes serialization so far which maybe doesn't use string-conversions (not sure). I will add xml-serialization using IAttributes to the tests the next days, that will enforce that also the string-conversions are tested.