First shot at V8, trying to get a js object cast to a c++ struct and cannot find more info on the web.
lets say I have:
var brush = {
r:255,
g:255,
b:255,
a:255
}
and I want to pass it to a function accepting a struct like the following:
struct brush{
int r;
int g;
int b;
int a;
} ;
How should I go about maping this?
Got a solution but i must say V8 is not well documented IMHO!
v8::Local<v8::Object> options(args[i]->ToObject());
int r = (options->Has(v8::String::NewSymbol("red")) ? (float)options->Get(v8::String::NewSymbol("red"))->IntegerValue() : 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With