Skip to content

Ponup/php-sdl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

96a6c7f · Aug 6, 2023
Jan 23, 2022
Dec 27, 2022
Dec 31, 2022
Aug 6, 2023
Jun 20, 2020
Dec 11, 2013
Mar 7, 2022
Mar 23, 2022
Jan 19, 2022
Jan 18, 2022
Jul 23, 2022
Sep 22, 2018
Mar 23, 2022
Oct 12, 2021
Jun 20, 2020
Jun 21, 2020
Jul 22, 2022

Repository files navigation

Build and test

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 ini and 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