joseph-montanez / raylib-php Goto Github PK
View Code? Open in Web Editor NEWPHP 8 Bindings to raylib
License: zlib License
PHP 8 Bindings to raylib
License: zlib License
Hello,
I really liked the project with PHP support, could you help me please?
I am trying to run the make command in raylib-php, but the following errors are occurring that make it impossible to execute the project successfully, how can I revolve them?
PS: I'm running PHP 8.0.2
/var/www/html/raylib-php/raylib-texture.c:5394:66: error: ‘FILTER_TRILINEAR’ undeclared (first use in this function); did you mean ‘FILTER_BILINEAR’?
594 | REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG ("FILTER_TRILINEAR", FILTER_TRILINEAR);
/var/www/html/raylib-php/raylib-texture.c:318:107: note: in definition of macro ‘REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG’
318 | zend_declare_class_constant_long (php_raylib_texture_ce, const_name, sizeof (const_name) -1, (zend_long) value);
/var/www/html/raylib-php/raylib-texture.c 16:94:66: note: each undeclared identifier is reported only once for each function it appears in
594 | REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG ("FILTER_TRILINEAR", FILTER_TRILINEAR);
/var/www/html/raylib-php/raylib-texture.c:318:107: note: in definition of macro ‘REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG’
318 | zend_declare_class_constant_long (php_raylib_texture_ce, const_name, sizeof (const_name) -1, (zend_long)
/var/www/html/raylib-php/raylib-texture.c:5395:71: error: ‘FILTER_ANISOTROPIC_4X’ undeclared (first use in this function); did you mean ‘TEXTURE_FILTER_ANISOTROPIC_4X’?
595 | REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG ("FILTER_ANISOTROPIC_4X", FILTER_ANISOTROPIC_4X);
/var/www/html/raylib-php/raylib-texture.c:318:107: note: in definition of macro ‘REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG’
318 | zend_declare_class_constant_long (php_raylib_texture_ce, const_name, sizeof (const_name) -1, (zend_long)
/var/www/html/raylib-php/raylib-texture.c/1696:71: error: ‘FILTER_ANISOTROPIC_8X’ undeclared (first use in this function); did you mean ‘TEXTURE_FILTER_ANISOTROPIC_8X’?
596 | REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG ("FILTER_ANISOTROPIC_8X", FILTER_ANISOTROPIC_8X);
/var/www/html/raylib-php/raylib-texture.c:318:107: note: in definition of macro ‘REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG’
318 | zend_declare_class_constant_long (php_raylib_texture_ce, const_name, sizeof (const_name) -1, (zend_long)
/var/www/html/raylib-php/raylib-texture.c:5397:72: error: ‘FILTER_ANISOTROPIC_16X’ undeclared (first use in this function); did you mean ‘TEXTURE_FILTER_ANISOTROPIC_16X’?
597 | REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG ("FILTER_ANISOTROPIC_16X",
/var/www/html/raylib-php/raylib-texture.c:318:107: note: in definition of macro ‘REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG’
318 | zend_declare_class_constant_long (php_raylib_texture_ce, const_name, sizeof (const_name) -1, (zend_long)
/var/www/html/raylib-php/raylib-texture.c:600:61: error: ‘WRAP_REPEAT’ undeclared (first use in this function)
600 | REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG ("WRAP_REPEAT", WRAP_REPEAT);
/var/www/html/raylib-php/raylib-texture.c:318:107: note: in definition of macro ‘REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG’
318 | zend_declare_class_constant_long (php_raylib_texture_ce, const_name, sizeof (const_name) -1, (zend_long)
/var/www/html/raylib-php/raylib-texture.c:601:60: error: ‘WRAP_CLAMP’ undeclared (first use in this function)
601 | REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG ("WRAP_CLAMP",
/var/www/html/raylib-php/raylib-texture.c:318:107: note: in definition of macro ‘REGISTER_RAYLIB_TEXTURE_CLASS_CONST_LONG’
318
zend_declare_class_constant_long (php_raylib_texture_ce, const_name, sizeof (const_name) -1, (zend_long) value);
Since PHP 7.3 zend_object_alloc is available, far less code, and less error prone.
Right now you can clone vectors, but not rectangle, this is a basic class and should be cloneable.
Right now most parameters that take in an object are not type checked, only the stub has the type defined.
For example:
Z_PARAM_ZVAL(image)
Is used to pull in an \raylib\Image object. However you could pass in any object and crash your program. Instead I can move to type checking i.e:
Z_PARAM_OBJ_OF_CLASS(image, php_raylib_image_ce)
This will correctly those an error in PHP that the object is not correct.
This will force PHP 5.6 to no longer be possible, but also provide a large code clean up.
When compiling against the PHP 7.4 version on Mac OS the process fails during make
due to the following errors:
/Users/dpock/GitProjects/raylib-php/raylib-camera3d.c:526:9: error: implicit declaration of function 'Z_PARAM_OBJ_OF_CLASS_OR_NULL' is invalid in
C99 [-Werror,-Wimplicit-function-declaration]
Z_PARAM_OBJ_OF_CLASS_OR_NULL(position, php_raylib_vector3_ce)
^
/Users/dpock/GitProjects/raylib-php/raylib-camera3d.c:526:70: error: expected ';' after expression
Z_PARAM_OBJ_OF_CLASS_OR_NULL(position, php_raylib_vector3_ce)
/Users/dpock/GitProjects/raylib-php/raylib-camera3d.c:717:9: error: implicit declaration of function 'Z_PARAM_OBJ_OF_CLASS' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
Z_PARAM_OBJ_OF_CLASS(mousePosition, php_raylib_vector2_ce)
/Users/dpock/GitProjects/raylib-php/raylib-camera3d.c:784:9: error: implicit declaration of function 'Z_PARAM_OBJ_OF_CLASS' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
Z_PARAM_OBJ_OF_CLASS(position, php_raylib_vector3_ce)
^
/Users/dpock/GitProjects/raylib-php/raylib-camera3d.c:785:9: error: expression is not assignable
Z_PARAM_LONG(width)
However when using PHP 8.0 this extension makes properly and can be subsequently installed and activated.
When trying to create a 2d camera following an entity, the camera doesn't follow.
the exemple on the repo doesn't work either
The Font class still uses the old implementation and cashes when using var_dump on the class object.
Can haz composer require Raylib???
Hello, is there a way to help out to revive the project?
I get various errors on REGISTER_NS_LONG_CONSTANT while compiling, i thought adding some new constants should be something i can manage in C but then i have no idea what to choose and what is the intended way of this project.
Just for info my build log
/bin/sh /home/xuedi/Projects/libs/raylib-php/libtool --mode=compile cc -I. -I/home/xuedi/Projects/libs/raylib-php -I/home/xuedi/Projects/libs/raylib-php/include -I/home/xuedi/Projects/libs/raylib-php/main -I/home/xuedi/Projects/libs/raylib-php -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /home/xuedi/Projects/libs/raylib-php/raylib.c -o raylib.lo
cc -I. -I/home/xuedi/Projects/libs/raylib-php -I/home/xuedi/Projects/libs/raylib-php/include -I/home/xuedi/Projects/libs/raylib-php/main -I/home/xuedi/Projects/libs/raylib-php -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /home/xuedi/Projects/libs/raylib-php/raylib.c -fPIC -DPIC -o .libs/raylib.o
In file included from /home/xuedi/Projects/libs/raylib-php/raylib.c:52:
/home/xuedi/Projects/libs/raylib-php/raylib-charinfo.h:12:5: error: unknown type name ‘CharInfo’
12 | CharInfo charinfo;
| ^~~~~~~~
In file included from /usr/include/php/main/php.h:439,
from /home/xuedi/Projects/libs/raylib-php/php_raylib.h:30,
from /home/xuedi/Projects/libs/raylib-php/raylib.c:25:
/home/xuedi/Projects/libs/raylib-php/raylib.c: In function ‘zm_startup_raylib’:
/home/xuedi/Projects/libs/raylib-php/raylib.c:236:80: error: ‘UNCOMPRESSED_GRAYSCALE’ undeclared (first use in this function); did you mean ‘PIXELFORMAT_UNCOMPRESSED_GRAYSCALE’?
236 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_GRAYSCALE", UNCOMPRESSED_GRAYSCALE, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:236:80: note: each undeclared identifier is reported only once for each function it appears in
236 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_GRAYSCALE", UNCOMPRESSED_GRAYSCALE, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:237:81: error: ‘UNCOMPRESSED_GRAY_ALPHA’ undeclared (first use in this function); did you mean ‘PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA’?
237 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_GRAY_ALPHA", UNCOMPRESSED_GRAY_ALPHA, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:238:77: error: ‘UNCOMPRESSED_R5G6B5’ undeclared (first use in this function)
238 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_R5G6B5", UNCOMPRESSED_R5G6B5, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:239:77: error: ‘UNCOMPRESSED_R8G8B8’ undeclared (first use in this function)
239 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_R8G8B8", UNCOMPRESSED_R8G8B8, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:240:79: error: ‘UNCOMPRESSED_R5G5B5A1’ undeclared (first use in this function)
240 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_R5G5B5A1", UNCOMPRESSED_R5G5B5A1, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:241:79: error: ‘UNCOMPRESSED_R4G4B4A4’ undeclared (first use in this function)
241 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_R4G4B4A4", UNCOMPRESSED_R4G4B4A4, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:242:79: error: ‘UNCOMPRESSED_R8G8B8A8’ undeclared (first use in this function)
242 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_R8G8B8A8", UNCOMPRESSED_R8G8B8A8, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:243:74: error: ‘UNCOMPRESSED_R32’ undeclared (first use in this function)
243 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_R32", UNCOMPRESSED_R32, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:244:80: error: ‘UNCOMPRESSED_R32G32B32’ undeclared (first use in this function); did you mean ‘PIXELFORMAT_UNCOMPRESSED_R32G32B32’?
244 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_R32G32B32", UNCOMPRESSED_R32G32B32, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:245:83: error: ‘UNCOMPRESSED_R32G32B32A32’ undeclared (first use in this function); did you mean ‘PIXELFORMAT_UNCOMPRESSED_R32G32B32A32’?
245 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "UNCOMPRESSED_R32G32B32A32", UNCOMPRESSED_R32G32B32A32, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:246:77: error: ‘COMPRESSED_DXT1_RGB’ undeclared (first use in this function)
246 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_DXT1_RGB", COMPRESSED_DXT1_RGB, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:247:78: error: ‘COMPRESSED_DXT1_RGBA’ undeclared (first use in this function)
247 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_DXT1_RGBA", COMPRESSED_DXT1_RGBA, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:248:78: error: ‘COMPRESSED_DXT3_RGBA’ undeclared (first use in this function)
248 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_DXT3_RGBA", COMPRESSED_DXT3_RGBA, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:249:78: error: ‘COMPRESSED_DXT5_RGBA’ undeclared (first use in this function)
249 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_DXT5_RGBA", COMPRESSED_DXT5_RGBA, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:250:77: error: ‘COMPRESSED_ETC1_RGB’ undeclared (first use in this function)
250 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_ETC1_RGB", COMPRESSED_ETC1_RGB, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:251:77: error: ‘COMPRESSED_ETC2_RGB’ undeclared (first use in this function)
251 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_ETC2_RGB", COMPRESSED_ETC2_RGB, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:252:82: error: ‘COMPRESSED_ETC2_EAC_RGBA’ undeclared (first use in this function); did you mean ‘PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA’?
252 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_ETC2_EAC_RGBA", COMPRESSED_ETC2_EAC_RGBA, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:253:77: error: ‘COMPRESSED_PVRT_RGB’ undeclared (first use in this function)
253 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_PVRT_RGB", COMPRESSED_PVRT_RGB, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:254:78: error: ‘COMPRESSED_PVRT_RGBA’ undeclared (first use in this function)
254 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_PVRT_RGBA", COMPRESSED_PVRT_RGBA, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:255:82: error: ‘COMPRESSED_ASTC_4x4_RGBA’ undeclared (first use in this function); did you mean ‘PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA’?
255 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_ASTC_4x4_RGBA", COMPRESSED_ASTC_4x4_RGBA, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
/home/xuedi/Projects/libs/raylib-php/raylib.c:256:82: error: ‘COMPRESSED_ASTC_8x8_RGBA’ undeclared (first use in this function); did you mean ‘PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA’?
256 | REGISTER_NS_LONG_CONSTANT("raylib\\PixelFormat", "COMPRESSED_ASTC_8x8_RGBA", COMPRESSED_ASTC_8x8_RGBA, CONST_CS | CONST_PERSISTENT);
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_constants.h:57:146: note: in definition of macro ‘REGISTER_NS_LONG_CONSTANT’
57 | #define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags) zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number)
| ^~~~
make: *** [Makefile:209: raylib.lo] Error 1
Raylib has a handful of aliases missing for backwards compatibility. These are in the define section of the json file.
{
"name": "MOUSE_LEFT_BUTTON",
"type": "UNKNOWN",
"value": "MOUSE_BUTTON_LEFT",
"description": ""
},
{
"name": "MOUSE_RIGHT_BUTTON",
"type": "UNKNOWN",
"value": "MOUSE_BUTTON_RIGHT",
"description": ""
},
{
"name": "MOUSE_MIDDLE_BUTTON",
"type": "UNKNOWN",
"value": "MOUSE_BUTTON_MIDDLE",
"description": ""
},
{
"name": "MATERIAL_MAP_DIFFUSE",
"type": "UNKNOWN",
"value": "MATERIAL_MAP_ALBEDO",
"description": ""
},
{
"name": "MATERIAL_MAP_SPECULAR",
"type": "UNKNOWN",
"value": "MATERIAL_MAP_METALNESS",
"description": ""
},
{
"name": "SHADER_LOC_MAP_DIFFUSE",
"type": "UNKNOWN",
"value": "SHADER_LOC_MAP_ALBEDO",
"description": ""
},
{
"name": "SHADER_LOC_MAP_SPECULAR",
"type": "UNKNOWN",
"value": "SHADER_LOC_MAP_METALNESS",
"description": ""
}
So MATERIAL_MAP_DIFFUSE
would map to raylib\MaterialMapIndex\MATERIAL_MAP_ALBEDO
.
I came to report an issue while compiling the extension using php 7.3.16
.
The ZEND_THIS constant
Seems like the constant ZEND_THIS
is not available there. Before this value used to be fetched with getThis()
in this repo. With php 7.4
it works. Replacing ZEND_THIS
with getThis()
solves the issue on php 7.3.
The zend_std_write_property() call
Another thing quite common in this repo is the following line:
value = zend_std_write_property(object, member, value, cache_slot);
This happens, for example, here:
Line 231 in 89a9f1f
This seems to be problematic on php 7.3.16
as zend_std_write_property()
returns void and value
is a zval, passed for writing as the third parameter. Removing the assignment seems to solve the issue.
Note: I'm running MacOS Catalina. But this seems to be independent from build environment.
What is the minimum version supported?
I'd be happy to send out some pull requests if php 7.3 is supposed to be supported. I'm not a C expert but I think I can help a bit there.
Cheers!
Hi, I'm trying your framework with php and linux mint.
I am sad to say raylib release a new version, the 3.5, and there's a couple of incompatibilities with your framework. I was able to quick fix but I think some funcions would be redefinied or deleted because the changelog of november is about 150 lines of added / deleted functionalities.
Finally I was able, after a quick fix on code, to compile the .so library and start build a game, but still, some functions are not working perfectly.
Good work btw!
Greetings from Italy.
Hello
I would like to activate the auto reload but I don't know how to do it
Can you help me?
Version: PHP 7.4
Os: Windows 10
It says ext-parallel.dll not found, but i did everything right like this same at ext-raylib.dll
Hey I cant seem to figure out how to make sound work, could I have some help please?
I'm trying to buld raylib-php on Raspberry Pi 4.
I get the following error after running ./configure
checking for raylib support... yes, shared
checking whether to enable raylib support... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking for libraylib... configure: error: pkg-config not found
Please advise.
Initial work is done to change the implementation as needed to work off RayLib 3.5, but a full audit of the changelog is still in process.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.