summaryrefslogtreecommitdiffstats
path: root/example.php
blob: 4ac324e5edf1b6dc6fcef8b90074469d82c62dcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
 * Example of how to change screen properties such as title, icon or state using the PHP-SDL extension.
 *
 * @author Santiago Lizardo <santiagolizardo@php.net>
 */

// 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();