From 949e781d8d00e40a1265b158bcf7273a321f02d1 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 25 Nov 2013 18:09:33 +0100 Subject: php-pecl-sdl: 0.9.0 (beta) - New package --- example.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 example.php (limited to 'example.php') diff --git a/example.php b/example.php new file mode 100644 index 0000000..4ac324e --- /dev/null +++ b/example.php @@ -0,0 +1,37 @@ + + */ + +// require 'common.php'; + +SDL_Init( SDL_INIT_VIDEO ); + +$screen = SDL_SetVideoMode( 640, 480, 16, SDL_HWSURFACE ); +if( null == $screen ) +{ + fprintf( STDERR, 'Error: %s' . PHP_EOL, SDL_GetError() ); +} + +for( $i = 3; $i > 0; $i-- ) +{ + SDL_WM_SetCaption( "Switching to fullscreen mode in $i seconds...", null ); + SDL_Delay( 1000 ); +} + +SDL_WM_ToggleFullscreen( $screen ); + +SDL_Delay( 3000 ); + +SDL_WM_ToggleFullscreen( $screen ); + +SDL_WM_SetCaption( "Back from fullscreen mode. Quitting in 2 seconds...", null ); + +SDL_Delay( 2000 ); + +SDL_FreeSurface( $screen ); + +SDL_Quit(); + -- cgit