Parrot Parrot Compiler Toolkit #60

Method and subroutine calls in NQP

# create an SDL::App object
my $app := SDL::App.new();
$app.init( :height(480), :width(640), :bpp(0), :flags(1) );

# fetch the SDL::Surface representing the main window
my $main_screen := $app.surface();

# create an SDL::Rect object
my $rect := SDL::Rect.new();
$rect.init( :height(100), :width(100), :x(270), :y(190) );

# create an SDL::Color object
my $color := SDL::Color.new();
$color.init( :r(0), :g(0), :b(255) );

# draw the rectangle to the surface and update it
$main_screen.fill_rect( $rect, $color );
$main_screen.update_rect( $rect );
Copyright © 2009
http://www.pmichaud.com/2009/pres/