Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 37 lines (23 sloc) 0.817 kB
f801b07 @kthakore Final drawing example
kthakore authored
1 use SDL;
2 use SDLx::App;
3 use SDLx::Sprite;
4
5 my $app = SDLx::App->new( w => 500, h => 500, d => 32, title => 'Pretty Flowers' );
6
f305408 @kthakore use common color format for sanity's sake
kthakore authored
7 # Draw Code Starts here
f801b07 @kthakore Final drawing example
kthakore authored
8
9 my $flower = SDLx::Sprite->new ( width => 50, height => 100 );
10
f305408 @kthakore use common color format for sanity's sake
kthakore authored
11 $flower->surface->draw_rect ( [0,0,50,100], [0,0,0,0] );
f801b07 @kthakore Final drawing example
kthakore authored
12
f305408 @kthakore use common color format for sanity's sake
kthakore authored
13 $flower->surface->draw_rect ( [23,30, 4, 100], [0,255,0,255] );
14 $flower->surface->draw_circle_filled ( [25,25], 10, [150,0,0,255] );
15 $flower->surface->draw_circle ( [25,25], 10, [255,0,0,255] );
f801b07 @kthakore Final drawing example
kthakore authored
16 $flower->alpha_key( 0 );
17
18 $app->draw_rect( [0,0,500,500], [20,50,170, 255] );
19
20 $app->draw_rect( [0,400,500,100], [50,170,20,100] );
21
22 foreach( 0..500 )
23 {
24 my $y = 425 - rand( 50 );
25 $flower->draw_xy( $app, rand(500)-20, $y );
26 }
f305408 @kthakore use common color format for sanity's sake
kthakore authored
27
28 #Draw Code Ends Here
29
f801b07 @kthakore Final drawing example
kthakore authored
30 $app->update();
fb0bcf8 @kthakore Added code and example that will structure rest of drawing
kthakore authored
31
32 require SDL::Video;
33
34 SDL::Video::save_BMP( $app, 'flower.bmp');
35
f801b07 @kthakore Final drawing example
kthakore authored
36 sleep(2);
Something went wrong with that request. Please try again.