bearbecueLe 22/06/2011 à 17:42
// create a special type for the 'Life' field. we're in fact storing the inverse life.
// we still want the user to assign the real life value.
// therefore, when the user writes:
// Life = something;
// we want this to be translated into:
// InvLife = rcp(something);
// create a new type, and overload the assignment and cast operator
SCompilerTypeID float1TypeID = typeLib->TypeFromNative(BaseType_Float);
PCompilerTypeClass tcLife = HH_NEW(CCompilerTypeClass);
SCompilerTypeID lifeTypeID = typeLib->Register("lifeWrapper32f", tcLife);
if (!lifeTypeID.Empty())
{
CCompilerTypeClass::TOverloadsContainer &opAssign = tcLife->Operator(CCompilerTypeClass::Op_Assign);
if (opAssign.Resize(1))
{
opAssign[0].Bind(SCompilerTypeID::VoidType, &_FnInvertFloat1Stream, F_Pure);
opAssign[0].AddArgument(float1TypeID, Compiler::Attribute_Stream);
}