Leser: 1
3 Einträge, 1 Seite |
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
#!/Perl/bin/perl
use strict;
use warnings;
use Data::Dumper;
use File::Spec;
use SDL;
use SDL::App;
use SDL::Color;
use SDL::SFont;
# Fenster erstellen (alles an Init-Arbeot und dergleichen wird hier getan)
my $app = SDL::App->new(
-title => 'Animation',
-width => 640,
-height => 480,
-depth => 32,
);
# da ist die Schrift zu finden
my $fontPath = File::Spec->catfile('C:','Perl','SDL','verdana.ttf_10_0_146_219.bmp');
# Jetzt die Schrift laden
my $f = SDL::SFont::NewFont($fontPath);
# Un dhier nun sollte m.E. nach ein netter Schriftzug im Fenster erscheinen...
# Edit: war völlig falsch...
#SDL::SFont::PutString($app, $f, 100, 100);
# sp ist es richtig:
SDL::SFont::PutString($app, 100, 100, 'Text');
# nur noch mal zur Sicherheit (wird eigentlich durch den loop erledigt)
$app->update();
# Event-Abfrage
my %actions = (
SDL_QUIT() => sub { exit(0); },
SDL_KEYDOWN() => \&keydown,
);
# quasi MainLoop;
$app->loop(\%actions);
# Sub f+ür den Moment, wo ich mal einen Text ausgeben kann...
sub keydown {
# blah
} # /keydown
3 Einträge, 1 Seite |