diff options
author | Chad Austin <chad@imvu.com> | 2013-04-01 18:47:55 -0700 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-12 14:27:03 +0300 |
commit | e5af621a189f729d8c1513f739a6a085adf39842 (patch) | |
tree | bc810bfc5553cfbcab494ad996ab006ccee75991 /tests/embind/embind_test.cpp | |
parent | de48fdc5b028df627b7070c17d37479654f71a13 (diff) |
Generalize support for struct fields
Diffstat (limited to 'tests/embind/embind_test.cpp')
-rw-r--r-- | tests/embind/embind_test.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp index e9feccfe..156c8680 100644 --- a/tests/embind/embind_test.cpp +++ b/tests/embind/embind_test.cpp @@ -758,6 +758,14 @@ struct StructVector { float x, y, z;
};
+float readStructVectorZ(const StructVector& v) {
+ return v.z;
+}
+
+void writeStructVectorZ(StructVector& v, float z) {
+ v.z = z;
+}
+
StructVector emval_test_return_StructVector() {
StructVector v;
v.x = 1;
@@ -1354,7 +1362,7 @@ EMSCRIPTEN_BINDINGS(tests) { value_struct<StructVector>("StructVector")
.field("x", &StructVector::x)
.field("y", &StructVector::y)
- .field("z", &StructVector::z)
+ .field("z", &readStructVectorZ, &writeStructVectorZ)
;
function("emval_test_return_StructVector", &emval_test_return_StructVector);
|