Advertisement

wrapping an array of floats, and generic interface?

Started by June 12, 2008 09:04 AM
0 comments, last by WitchLord 16 years, 5 months ago
1) In my engine I define a vector as:
typedef float vec_t;
typedef vec_t vec3_t[3];


They are always stack- or globally-allocated, never from the heap. What's the optimal way to bind this to AngelScript? 2) In asIScriptGeneric, what's the difference between GetArgAddress, GetArgObject, and GetArgPointer? I'm using the library from C, so there's only pointers (which are only allocated in C code), will there be any effective difference?
You can register it with:

float &f(unsigned int i, vec_t &v){  if( i > 2 )    asGetActiveContext()->SetException("Out of bounds");   return v;}engine->RegisterObjectType("vec_t", sizeof(vec_t), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS);engine->RegisterObjectBehaviour("vec_t", asBEHAVE_INDEX, "float &f(uint)", asFUNCTION(vec_index), asCALL_CDECL_OBJLAST);


GetArgAddress should be used when accessing a reference or handle argument.

GetArgObject should be used when accessing an object argument.

GetArgPointer returns the address of the argument, so that it can be read. This method will be renamed in a future version to something like GetAddressOfArg.

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