PHP-SDL extension source code
C PHP Other
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples PollEvent binding added Nov 1, 2016
tests PollEvent binding added Nov 1, 2016
.gitattributes attr Dec 11, 2013
.gitignore PollEvent binding added Nov 1, 2016
.travis.yml Replacing run-tests with make test. Still unsure if it would work May 24, 2015
CREDITS SDL_SetError(), SDL_GetError(), SDL_ClearError Dec 6, 2013
EXPERIMENTAL New extension Dec 2, 2013
LICENSE New extension Dec 2, 2013
README.md Removed duplicated README file. README.md updated to include an examp… May 27, 2015
REFLECTION add class SDL_cond, see #14 Dec 27, 2013
TODO Filesystem functions (GetBasePath, GetPrefPath) ported to PHPSDL. (cl… Feb 23, 2014
blendmode.c new sources for keyboard, see # Dec 22, 2013
blendmode.h attr (2) Dec 11, 2013
check.sh add package.xml checker Dec 8, 2013
config.m4 Various improvements. More SDL API coverage (render/event partially).… Mar 29, 2015
cpuinfo.c new sources for keyboard, see # Dec 22, 2013
cpuinfo.h attr (2) Dec 11, 2013
error.c Upgrading to PHP7 Apr 15, 2016
error.h attr (2) Dec 11, 2013
event.c PollEvent binding added Nov 1, 2016
event.h Various improvements. More SDL API coverage (render/event partially).… Mar 29, 2015
filesystem.c Upgrading to PHP7 Apr 15, 2016
filesystem.h Filesystem functions (GetBasePath, GetPrefPath) ported to PHPSDL. (cl… Feb 23, 2014
glcontext.c PollEvent binding added Nov 1, 2016
glcontext.h Conditional compiling certain SDL 2.0.1 functions and constants (ie S… Feb 23, 2014
keyboard.c Upgrading to PHP7 Apr 15, 2016
keyboard.h new sources for keyboard, see # Dec 22, 2013
messagebox.c Examples are working again Apr 17, 2016
messagebox.h read property of SDL_MessageBoxData, fix #10 Dec 17, 2013
mouse.c Examples are working again Apr 17, 2016
mouse.h add SDL_GetMouseState(), SDL_GetRelativeMouseState(), SDL_WarpMouseIn… Dec 22, 2013
mutex.c Examples are working again Apr 17, 2016
mutex.h add class SDL_cond, see #14 Dec 27, 2013
package.xml Some render and timer functions were added. New examples. Mar 22, 2015
php_sdl.c Various improvements. More SDL API coverage (render/event partially).… Mar 29, 2015
php_sdl.h Various improvements. More SDL API coverage (render/event partially).… Mar 29, 2015
pixels.c Examples are working again Apr 17, 2016
pixels.h add SDL_Pixels class for memory access Dec 13, 2013
platform.c Upgrading to PHP7 Apr 15, 2016
platform.h attr (2) Dec 11, 2013
power.c Fixing tests May 24, 2015
power.h attr (2) Dec 11, 2013
rect.c PollEvent binding added Nov 1, 2016
rect.h Some render and timer functions were added. New examples. Mar 22, 2015
render.c Examples are working again Apr 17, 2016
render.h Some render and timer functions were added. New examples. Mar 22, 2015
rwops.c Examples are working again Apr 17, 2016
rwops.h fix ZTS build Dec 17, 2013
sdl.c cleanup proto and static methods Dec 23, 2013
sdl.h attr (2) Dec 11, 2013
shape.c Upgrading to PHP7 Apr 15, 2016
shape.h move include, see #13 Dec 27, 2013
surface.c PollEvent binding added Nov 1, 2016
surface.h attr Dec 11, 2013
timer.c Some render and timer functions were added. New examples. Mar 22, 2015
timer.h Some render and timer functions were added. New examples. Mar 22, 2015
version.c Upgrading to PHP7 Apr 15, 2016
version.h attr (2) Dec 11, 2013
video.c PollEvent binding added Nov 1, 2016
video.h attr (2) Dec 11, 2013
window.c Examples are working again Apr 17, 2016
window.h add SDL_GL_MakeCurrent(), SDL_GL_GetCurrentWindow(), SDL_GL_GetCurren… Dec 21, 2013

README.md

Build Status

PHP-SDL

Installation

Requirements

  • C compiler
  • Automake tools
  • PHP devel
  • libSDL v1.2.* devel libraries and headers

Via PECL (recommended)

pecl install sdl-beta

Manual

Download the source code and within the main directory run these commands:

phpize

./configure --with-sdl (or --with-sdl=) make make test sudo make install

Then add

extension=sdl.so

to your php.ini file.

Installing on Windows

We are working on the Windows build. Stay tuned.

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.

Example

Standard SDL2 API is available in procedural style:

    $w = SDL_CreateWindow( "Foo window", 500, 50, 350, 300, SDL_WINDOW_SHOWN+SDL_WINDOW_RESIZABLE);
    SDL_SetWindowTitle($w, "Some new title");
    SDL_DestroyWindow($w);

And is also available in object oriented style:

    $w = new SDL_Window( "Foo window", 100, 50, 350, 300, SDL_Window::SHOWN|SDL_Window::RESIZABLE);
    $w->SetTitle("Some new title");
    unset($w); // will destroy the window

BUILDING ON UNIX etc.

To compile your new extension, you will have to execute the following steps:

  1. $ ./phpize
  2. $ ./configure [--enable--sdl]
  3. $ make
  4. $ make test
  5. $ [sudo] make install

BUILDING ON WINDOWS

Not supported yet.

Support / Feedback / Bugs / Feature Requests

Please submit anything that needs our attention to issues section on Github. We are commited to attend any request in a short timespan if it's a sensible matter.