parrotcode: Parrot extension for SDL Applications | |
Contents | Libraries |
SDL::App - Parrot extension for SDL Applications
# load this library
load_bytecode 'library/SDL/App.imc'
# create a new SDL::App object
.local pmc app
.local int app_type
find_type app_type, 'SDL::App'
app = new app_type
# set the app's arguments
.local pmc app_args
app_args = new PerlHash
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'()
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:
app_args
, should be a PerlHash
PMC containing the following keys: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.SDL::Surface
object representing the main surface. Keep track of it; draw into it and update or flip it if you want to see anything.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, The Perl Foundation.
|