-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathttt.pl
112 lines (60 loc) · 1.79 KB
/
ttt.pl
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/perl
use strict;
use warnings;
use lib 'local/lib/perl5';
use SDL;
use SDLx::App;
use SDL::Event;
use SDL::Events;
my $app = SDLx::App->new(
width => 800,
height => 600,
);
my $event = SDL::Event->new; # create a new event
SDL::Events::pump_events();
while ( SDL::Events::poll_event( $event ) ) {
my $type = $event->type(); # get event type
print "$type\n";
exit if $type == SDL_QUIT;
}
sleep 3;
__END__
my $run = 30;
while ( $run < 300 ) {
$app->draw_rect( [ $run, $run, 100, 100], [ 20, 20, 155, 255 ] );
$app->update;
sleep 1;
$app->draw_rect( [ $run, $run, 100, 100], [ 0, 0, 0, 255 ] );
$run = $run + 40;
}
$app->update;
__END__
# $app->draw_rect( [ 15, 15, 100, 100], [ 0, 0, 0, 255 ] );
# $app->draw_rect( [ 35, 35, 100, 100], [ 20, 20, 155, 255 ] );
# $app->update;
# sleep 1;
# $app->draw_rect( [ 35, 35, 100, 100], [ 0, 0, 0, 255 ] );
# $app->draw_rect( [ 75, 75, 100, 100], [ 20, 20, 155, 255 ] );
# $app->update;
# sleep 1;
# $app->draw_rect( [ 75, 75, 100, 100], [ 0, 0, 0, 255 ] );
# $app->draw_rect( [ 105, 105, 100, 100], [ 20, 20, 155, 255 ] );
# $app->update;
# sleep 1;
# $app->draw_rect( [ 105, 105, 100, 100], [ 0, 0, 0, 255 ] );
# $app->draw_rect( [ 145, 145, 100, 100], [ 20, 20, 155, 255 ] );
# $app->update;
# sleep 1;
# my $app1 = SDLx::App->new(
# width => 800,
# height => 600,
# );
# my $app1->draw_rect( [ 500, 30, 50, 50], [ 255, 255, 0, 255 ] );
# $app1->update;
sleep 5;
# my $app = SDLx::App->new;
# $app->add_move_handler( \&update );
# $app->add_event_handler( \&player_1 );
# $app->add_event_handler( \&player_2 );
# $app->add_show_handler( \&scene );
# $app->run;