fail to use enum BIT_OR enum as parameter
in AS: Fun0(NX_FORCE|NX_FORCE);//succeed Fun1(NX_FORCE);//succeed Fun1(NX_FORCE|NX_FORCE);//fail!print:"No matching signatures to Fun1(uint)" void Fun0(uint u){} void Fun1(NxForceMode e){} in c++ r=engine->RegisterEnum("NxForceMode"); assert( r >= 0 ); r=engine->RegisterEnumValue("NxForceMode","NX_FORCE",NX_FORCE); [Edited by - huangyous on May 23, 2009 2:24:39 AM]
Integers can't be implicitly cast to enum types. You can however use an explicit cast if you wish.
I do however recommend doing what you did for Fun0, i.e. write the function to take an uint instead of an enum value. This is because you do not really want an enum value, but rather a combination of them.
[Edited by - WitchLord on May 23, 2009 11:00:22 AM]
Fun1(NxForceMode(NX_FORCE|NX_FORCE));
I do however recommend doing what you did for Fun0, i.e. write the function to take an uint instead of an enum value. This is because you do not really want an enum value, but rather a combination of them.
[Edited by - WitchLord on May 23, 2009 11:00:22 AM]
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement