Skip to content

Commit

Permalink
Update main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
blueloveTH committed May 2, 2024
1 parent 8a003fe commit 093622f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions examples/05 Bind Simple Struct/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@ struct Point{
this->y = y;
}

Point* _() {
return this;
}

float distance(){
return std::sqrt(x*x + y*y);
}

static void _register(VM* vm, PyObject* mod, PyObject* type){
PY_FIELD(Point, "x", _, x)
PY_FIELD(Point, "y", _, y)
PY_FIELD(Point, "x", x)
PY_FIELD(Point, "y", y)

_bind(vm, type, "__init__(self, x, y)", &Point::__init__);
_bind(vm, type, "distance(self)", &Point::distance);
Expand Down

0 comments on commit 093622f

Please sign in to comment.