NAME

SDLx::XScreenSaver - prepare environment for writing SDL based XScreenSaver hacks

SYNOPSIS

use SDLx::XScreenSaver;

SDLx::XScreenSaver::init();
# GetOptions(...); # parse your own options, if any

my $app = SDLx::XScreenSaver::start();

while (1) {
   # draw your scene here
   SDLx::XScreenSaver::update();
}

DESCRIPTION

This module provides a framework to write SDL XScreenSaver hacks in Perl. It provides the same basic interface as OpenGL::XScreenSaver.

Description of functions

The init() function will return a true value if a window to draw on has been found, and a false value if a window will have to be created. This value can be ignored unless you want special behavior when the screenhack is executed outside of XScreenSaver.

The start() function will create a SDLx::App object bound to the window ID provided by XScreenSaver with the correct width and height. Any parameters supplied to start() will be passed through the SDLx::App->new(). The return value is the SDLx::App object.

The update() function should be called when you finish drawing a frame. It will sync the SDLx::App object and poll for exit events.

The dimensions() function returns a list with the width and the height of the currently used window.

SEE ALSO

SDL SDLx::App OpenGL::XScreenSaver

AUTHOR

John Lightsey, <john@nixnuts.net>

COPYRIGHT AND LICENSE

Copyright (C) 2011 by John Lightsey

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.