Hi.
I just started programming using perl and found out the sdl-perl project.
Here is my creation

[code]

*#!/usr/bin/perl*
*use* Thread;

*use* SDL::App;
*use* SDL::Event;
*use* SDL::Rect;
*use* SDL::Color;
*use* SDL::Surface;
*use* SDL::Tool::Font;

$FPSTimer = 1000;
$frame = 0;
$thr = new Thread \&event;

*my* $app = SDL::App->new(
        -height => 640,
        *-w*idth => 480,
        *-d*epth => 16,
        *-t*itle => *"*Moteur 2D en PERL par frozon*"*,
);

*my* $screen = SDL::Rect->new(-height => 100, *-w*idth => 100, *-x* =>
0, -*y *=> 0,);
*my* $color = SDL::Color->new(*-r* => 0x00,*-g* => 0x00,*-b* => 0xff,);
$app->fill($screen, $color);
$app->update($screen);

*my* $f = SDL::Tool::Font->new( *-t*tfont=>*"*arial.ttf*"*, );

*while*(1){
        $FrameStart = SDL::GetTicks();
        $frame = $frame + 1;

*#action ici.*

        $ticks = SDL::GetTicks();
        $delay = (($ticks-$FrameStart)+10);
        SDL::Delay($delay);
        *if*(SDL::GetTicks > $FPSTimer)
        {
                $FPSTimer = $FPSTimer + 1000;
                $titre = *"*Moteur 2D en PERL par Frozon (FPS: $frame)*"*;
                $fps = *"*FPS: $frame*"*;
                SDL::WMSetCaption(*"*$titre*"*, NULL);
$f->print($screen, 0, 0, *"*Key Pressed*"*);
                *#SDL::Tool::Font::print($screen, 10, 10, $fps);*
                $frame = 0;
        }
}


*sub *event {
        *my* $event = new SDL::Event;
        *while* ($event->wait()) {
                *my* $type = $event->type();
                exit *if* $type == SDL_QUIT;
        }
}

[/code]

The problem is that when i run the program it works until it try to
use $f->print...
I have looked around using google and found that you already speak about that.
Some one can help me a little about that please.

I waiting forward to your answer.

Reply via email to