The extern class Camera2D is a c struct and when calling the create function it was being created as an empty struct and so the fields in the class were not set.
I added arguments to the create function so that the initial values can be passed in and the struct will not be empty.
When I was trying to set the x value of target within the Camera2D class I was seeing the error base operand of ‘->’ has non-pointer type ‘Vector2‘. The generated c code was camera.target->x = x; The fix for this error is usually to add @:structAccess to the extern binding but this was already present.
By changing the field types used in the extern bindings from Vector2 to RlVector2 there is no more error and the fields can be set as expected. I think this is due to Vector2 being a typedef that wraps RlVector2 in cpp.Struct which confuses matters -
The
extern class Camera2D
is a c struct and when calling thecreate
function it was being created as an empty struct and so the fields in the class were not set.I added arguments to the
create
function so that the initial values can be passed in and the struct will not be empty.When I was trying to set the
x
value oftarget
within theCamera2D
class I was seeing the errorbase operand of ‘->’ has non-pointer type ‘Vector2‘
. The generated c code wascamera.target->x = x;
The fix for this error is usually to add@:structAccess
to the extern binding but this was already present.By changing the field types used in the extern bindings from
Vector2
toRlVector2
there is no more error and the fields can be set as expected. I think this is due toVector2
being a typedef that wrapsRlVector2
incpp.Struct
which confuses matters -