Original Post
Hello everyone,
I'm writing an addon for AngelScript to make an easy "binder" between AS and C++
The current implementation looks like this:
The project is hosted on Google Code:
https://code.google.com/p/angelbinder/
I'm writing an addon for AngelScript to make an easy "binder" between AS and C++
The current implementation looks like this:
...
/// Global vars
int g_test1;
unsigned int g_test2;
float g_test3;
std::string g_test4;
/// Global functions
std::string __stdcall func1(float a1, double a2, int a3);
uint __cdecl func2(int a1, unsigned short a2);
void func3();
/// Usage
using namespace AngelBinder;
/// Type translation helpers. If you don't do this, you can end up with a register error later.
AB_TRANSLATE_TYPE(std::string, "string") // Any usage of "std::string" will result in "string" into AngelScript
AB_TRANSLATE_TYPE(Numbers, "numbers") // Same as above.
int main()
{
/// Declares the script class.
Script script("module_name");
/// Exports the global variables
Exporter::Export(script)
[
Exporter::Variables()
.def("global_int", &g_test1);
.def("global_uint", &g_test2);
.def("global_float", &g_test3);
.def("global_double", &g_test4);
];
/// Exports the global functions
Exporter::Export(script)
[
Exporter::Functions()
.def("f1", &func1);
.def("f2", &func2);
.def("f3", &func3);
];
return 0;
}
...
The project is hosted on Google Code:
https://code.google.com/p/angelbinder/