- Notifications
You must be signed in to change notification settings - Fork0
PHP bindings for raylib, a simple and easy-to-use library to enjoy videogames programming
License
oraoto/raylib-phpcpp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
PHP bindings forraylib, a simple and easy-to-use library to learn videogames programming.
It’s developed usingPHP-CPP, so it’s called raylib-phpcpp.
<?phpInitWindow(800,450,"raylib [core] example - basic window");SetTargetFPS(60);while (!WindowShouldClose()){BeginDrawing();ClearBackground(RAYWHITE());DrawText("Congrats! You created your first window!",190,200,20,LIGHTGRAY());EndDrawing();}CloseWindow();
See moreexamples.
Run
mkdir build&&cd buildcmake ..make -j$(nproc)
Then you havelibraylib-phpcpp.so
in build directory.
- All C functions are exposed as PHP global functions, for example:
C raylib-phpcpp WindowShouldClose() WindowShouldClose() InitWindow(800, 450, “title”) InitWindow(800, 450, “title”) - Color constants are exposed as global functions, for example:
C raylib-phpcpp LIGHTGRAY LIGHTGRAY() GREEN GREEN() - All C enums are exposed as global constants with
RL_
prefix:C raylib-phpcpp FLAG_SHOW_LOGO RL_FLAG_SHOW_LOGO KEY_COMMA RL_KEY_COMMA - Constructor for simple structs (struct without array and pointer members) are exposed as function, for example to create a
Camera2D
:<?php$offset =Vector2(1,1);$target =Vector2(0,0);$camera =Camera2D($offset,$target,1.0,1.0);
- Accessor for struct fields are implemented as
__get
and__set
, some update operation are more cumbersome:<?php$v =Vector2(1,2);// $v->x += 1; doesn't work$v->x =$v->x +1;$camera =Camera2D(Vector2(1,1),Vector2(0,0),1.0,1.0);// $camera->target->x = 1; // doesn't work$target =$camera->target;$target->x =1;$camera->target =$target;
- Known name conflicts
raylib-phpcpp PHP ImageCopy gd extension ImageCrop gd extension You should disable gd extension while exploring raylib :)
- API differences
TBD.
Function GetDroppedFiles ImageExtractPalette LoadModelAnimations LoadMeshes LoadMaterials
Most functions and features are supported.
For most file and text functions, you can use counterparts in PHP.
raylib-phpcpp is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. CheckLICENSE for further details.
About
PHP bindings for raylib, a simple and easy-to-use library to enjoy videogames programming
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.