🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

wrapping an array of floats, and generic interface?

Started by
0 comments, last by WitchLord 16 years 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?
Advertisement
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