[PHP-DEV] Tracking Object Property Changes

2021-03-10 Thread Kirill Nesmeyanov
Hello, Joseph! I faced exactly the same problems and believe that the Observer API is necessary. To solve a similar problem, I implemented my own API over FFI, however, it does not work very stable (I have little experience in send api), but it may help to solve your problems: https://github.c

Re: [PHP-DEV] Tracking Object Property Changes

2021-03-10 Thread Joseph Montanez
While attempting this I ran into the need to use GC_ADDREF() or else the returned sub-object data would be gargled. Here is an example struct: typedef struct _php_raylib_camera2d_object { Camera2D camera2d; HashTable *prop_handler; php_raylib_vector2_object *offset; php_raylib_vec

Re: [PHP-DEV] Tracking Object Property Changes

2021-03-09 Thread Joseph Montanez
Michael, Thanks for the feedback! The part about having Zend Object at the end of a struct saved me because I was starting to have issues with cloning objects. This is for an extension I was working on and have picked back up, I was just isolating it to make it easy to work with. Its bindings for

Re: [PHP-DEV] Tracking Object Property Changes

2021-03-09 Thread Michael Wallner
Hi Joseph! Is this for educational purposes or real world usage? I ask, because, if you don't have to adhere to a predefined C-API you would avoid lots of headache by baking all this stuff into your PHP objects with the APIs provided by Zend. But then again, it would be way more efficient to just

[PHP-DEV] Tracking Object Property Changes

2021-03-08 Thread Joseph Montanez
I am not sure what to title this but the gist is that I have two structs with a one way dependency: // Vector3 type typedef struct Vector3 { float x; float y; float z; } Vector3; // Ray type (useful for raycast) typedef struct Ray { Vector3 position; // Ray position (origin)