File: testgraphictool.pl

package info (click to toggle)
sdlperl 1.20.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,804 kB
  • ctags: 2,169
  • sloc: perl: 7,397; ansic: 232; makefile: 72; sh: 1
file content (51 lines) | stat: -rwxr-xr-x 1,078 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env perl

use strict;
use warnings;

use SDL;
use SDL::Surface;
use SDL::App;
use SDL::Tool::Graphic;

my $app = new SDL::App(-title	=> "Graphic Tool Test",
		       -width	=> 640,
		       -height	=> 480,
		       -depth	=> 16,
		       -fullscreen => 0);
my $app_rect = new SDL::Rect(	-x=>0,
				-y=>0,
				-width=>$app->width,
				-height=>$app->height);

my $sprite = new SDL::Surface(-name => "data/logo.png");
$sprite->set_color_key(SDL_SRCCOLORKEY,$sprite->pixel(0,0));
$sprite->display_format();

#Test Zoom
my $graphicTool = new SDL::Tool::Graphic();
$graphicTool->zoom($sprite, .5, .5, 1);

my $sprite_rect = new SDL::Rect(	-x=>0,
				-y=>0,
				-width=>$sprite->width,
				-height=>$sprite->height);
$sprite->blit($sprite_rect, $app, $sprite_rect);
$app->flip();
sleep 4;
$app->fill($app_rect, $SDL::Color::black);


#Test Rotate
$graphicTool->rotoZoom($sprite, 90, 1, 1);

$sprite_rect = new SDL::Rect(	-x=>0,
				-y=>0,
				-width=>$sprite->width,
				-height=>$sprite->height);
$sprite->blit($sprite_rect, $app, $sprite_rect);
$app->flip();
sleep 4;