OK, I'm going to confess, I'm still new to C++ but learning as I go, anyway. I'm trying to implement a simple 2d collision check using rectangles (my own type "Rectangle2d") that doesn't require the physics engine and I want to check for overlaps against another rectangles. Sounds simple but I hit a problem when trying to bind the method and compile. I've got modules working before so this is a specific problem.
so far I have the header, very simple ...
public:
bool overlaps(const Rectangle2d& p_other) const;
I have the implementation in the cpp file (defaults true for now)
bool Rectangle2d::overlaps(const Rectangle2d& p_other) const {
return true;}
with the method bind
ObjectTypeDB::bind_method(_MD("overlaps","other"),&Rectangle2d::overlaps);
But when I go to compile, I get the following error
'return': cannot convert from 'const Variant' to 'Rectangle2d'
Am I not a allowed to pass a reference to the same type, or am I missing something more fundamental? I have been trying to follow other examples in the code base where a Vector3 might be passed in, I would appreciate any help or even a link to an example where something like this (self type reference passing) has been done before that I could follow along with.
Thanks.