parrotcode: Parrot extension for SDL Applications | |
Contents | Libraries |
SDL::App - Parrot extension for SDL Applications
# load this library
load_bytecode 'library/SDL/App.pir'
# create a new SDL::App object
.local pmc app
app = new 'SDL::App'
# set the app's arguments
.local pmc app_args
app_args = new 'Hash'
app_args[ 'height' ] = 480
app_args[ 'width' ] = 640
app_args[ 'bpp' ] = 0
app_args[ 'flags' ] = 1
# initialize the object and get the main surface
.local pmc main_surface
main_surface = app.'BUILD'( app_args )
# go to town filling, blitting, and updating the app
# for example:
main_surface.update()
...
# then, shut down cleanly
app.'quit'()
The parrot SDL libraries require the C SDL library: See http://www.libsdl.org/ for information on how to obtain and install this library.
SDL::App is the entry point for all SDL Applications. It handles most of the other setup for you. Trust me, there's a little bit -- if you care, it will initialize the SDL library.
This object represents the main window and the associated drawing surface. There should only be one of those per program. As this represents an SDL::Surface object, you can call any method of that class on objects of this class.
Note: It's not yet complete. Please let me know if you have added or would like someone to add missing features.
The SDL::App object has the following methods:
width
height
bpp
0
here, you'll receive the recommended bit depth.flags
SDL::Constants
. See that module for ideas on what to pass here, or give me a better suggestion about the interface here.Written and maintained by chromatic, <chromatic at wgz dot org>, with suggestions from Jens Rieks. Please send patches, feedback, and suggestions to the Perl 6 Internals mailing list.
Copyright (C) 2004-2007, The Perl Foundation.
|