#!/Perl/bin/perl use strict; use warnings; use SDL; use SDL::App; use SDL::Rect; use SDL::Color; use SDL::Surface; use SDL::Tool::Font; use SDL::TTFont; ############################################################ # Definieren der Elemente des Programms # ############################################################ my $app = new SDL::App ( -title => 'Animation', -width => 640, -height => 480, -depth => 32, ); my $color = SDL::Color->new( -r => 0x00, -g => 0x00, -b => 0xff, ); my $rect = new SDL::Rect( -height => 40, -width => 40, ); my $msg = new SDL::Rect( -height => 40, -width => 200, -x => 100, -y => 100, ); my $image = new SDL::Surface(-from => $msg,); ############################################################ # Anpassen der Elemente # ############################################################ $app->fill( $rect, $color ); $app->fill( $msg, $color ); ############################################################ # Actions definieren # ############################################################ my %actions = ( SDL_QUIT() => sub { exit(0); }, SDL_KEYDOWN() => \&keydown, ); ############################################################ # MainLoop # ############################################################ $app->loop(\%actions); ############################################################ # SUBS # ############################################################ sub keydown { SDL::SFont::PutString( $image, 2, 2, "Text",); # my $o = SDL::Tool::Font->new( # -ttfont => "verdana.TTF", # font@C:\WINDOWS\Fonts # -size => 12, # -fg => $SDL::Color::black, # -bg => $SDL::Color::white, # ); # $o->print( $image, 2, 2, "Text"); } # /keydown