foreignsasquatch / raylib-hx

Haxe bindings for raylib, a simple and easy-to-use library to learn videogame programming
https://raylib.com
zlib License
55 stars 13 forks source link

Camera2D fixes #28

Closed jobf closed 1 year ago

jobf commented 1 year ago

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 -

typedef Vector2 = cpp.Struct<RlVector2>;
foreignsasquatch commented 1 year ago

thank you