php-sdl fork used by the JumPHP engine builds (pinned commit 89855c8)
- C 90.6%
- PHP 8.7%
- M4 0.4%
- JavaScript 0.1%
- Dockerfile 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .github/workflows | ||
| examples | ||
| src | ||
| tests | ||
| .dockerignore | ||
| .gitattributes | ||
| .gitignore | ||
| check-files-are-in-package-xml.sh | ||
| config.m4 | ||
| config.w32 | ||
| CREDITS | ||
| docker-entrypoint.sh | ||
| Dockerfile | ||
| input-handling-example.gif | ||
| LICENSE | ||
| package.xml | ||
| README.md | ||
PHP-SDL
SDL (Simple DirectMedia Layer) bindings for the PHP language. The extension allows you to create multimedia desktop applications with windows, input handling, events, and more.
Installation
Requirements
- C compiler
- Automake tools
- PHP8.1 devel
- libSDL2 devel libraries and headers
- UN*X OS (eg Linux, Macos)
Via PECL
pecl install sdl-beta
Then add
extension=sdl.so
to your php.ini file.
If you have no idea about your ini file position you can run
php -i | grep iniand see the list of you ini files.
Documentation
The SDL extension mimics in almost every single aspect to the official C library, so until we write our own documentation, refer to the C counterpart.
Examples
Standard SDL2 API is available in procedural style:
$window = SDL_CreateWindow( "Foo window", 500, 50, 350, 300, SDL_WINDOW_SHOWN+SDL_WINDOW_RESIZABLE);
SDL_SetWindowTitle($window, "Some new title");
SDL_DestroyWindow($window);
Complete examples can be found in the examples folder.
Related projects
Projects using the extension
Building
To compile your new extension, you will have to execute the following steps:
phpize
./configure [--with--sdl]
make
make test
sudo make install
