Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Failing to use SDL

by grondilu (Pilgrim)
on Jun 17, 2013 at 05:27 UTC ( #1039267=perlquestion: print w/ replies, xml ) Need Help??
grondilu has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

I was reading SDL::Manual, and after having followed instructions for installation (with cpan), I tried the first examples.

Creating a window works. I get a black window with this basic code:

use strict; use warnings; use SDL; use SDLx::App; my $app = SDLx::App->new(w => 400, h => 400); sleep(4);

But if I try to draw something, such as a line (as in the book):

use strict; use warnings; use SDL; use SDLx::App; my $app = SDLx::App->new(w => 400, h => 400, d => 32); $app->draw_line( [200, 20], [20, 200], [255, 255, 0, 255] ); $app->update(); sleep(4);

Then the screen stays totally black. No error message, no warning. I guess something is wrong with the installation of the library. Any idea on how I could fix that?

UPDATE: It seems that I can make things appear when I call $app->run();

It's not what is in the manual, though. And when I call this, I can't stop the processus anymore, not even with Ctrl-C :/

Comment on Failing to use SDL
Select or Download Code
Re: Failing to use SDL
by Anonymous Monk on Jun 17, 2013 at 06:08 UTC

    Then the screen stays totally black. No error message, no warning. I guess something is wrong with the installation of the library. Any idea on how I could fix that?

    Nope, that is not a conclusion I would jump to -- did the test suite run and pass all its test?

    Try SDL-2.541_10/examples/SDLx/app.pl

    ... SDL::Manual ...

    What is that?

      SDL::Manual is https://raw.github.com/PerlGameDev/SDL_Manual/master/dist/SDL_Manual.pdf

      I'm currently upgrading my modules on CPAN to make sure this is not the issue. It takes ages. When it's done, I'll try the test suite.

Re: Failing to use SDL
by rnewsham (Hermit) on Jun 17, 2013 at 06:41 UTC

    I have tested your code and it works for me, which does indicate the problem lies with your computer.

    Without any error messages it is hard to know what to suggest. In these cases I would generally strace the process to see if anything unexpected is happening. If you have access to another machine, or just setup a virtual machine, test it there and if it works compare the configuration. Failing that updating or reinstalling associated libraries is worth a try.

      > I have tested your code and it works for me, which does indicate the problem lies with your computer.

      Yeah I fear it's my computer indeed. It's an eeepc with a cedarview chip and this thing is known not to work well with linux (some 3D apps do not work at all for instance).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1039267]
Approved by Happy-the-monk
Front-paged by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-08-30 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls