Subject: | SDL::App initializes the world even if you only want video |
This is one is less a bug than an annoyance.
Currently SDL::App->new() calls:
SDL::Init(SDL_INIT_EVERYTHING());
which is a bit overpowered, and slow, if you just want video.
Also, in my case I don't have sound hardware configured, so I get a
bunch of warning messages from ALSA as it tries to initialize, even
though I don't want sound.
Calling:
SDL::Init(SDL_INIT_VIDEO());
previously doesn't prevent SDL::App initializing everything either.
Obviously the final solution is up to you - even leaving it as it is,
but I've included a patch with one possible solution - adding a -init
method that defines which subsystems are to be initialized.
--- lib/SDL/App.pm.orig 2006-01-10 15:19:43.000000000 +1100
+++ lib/SDL/App.pm 2006-01-10 15:28:14.000000000 +1100
@@ -26,10 +26,13 @@
-red_accum_size -ras -blue_accum_size -bas
-green_accum_sizee -gas
-alpha_accum_size -aas
-double_buffer -db -buffer_size -bs
-stencil_size -st
- -asyncblit
+ -asyncblit -init
/ ) if ($SDL::DEBUG);
- SDL::Init(SDL_INIT_EVERYTHING());
+ # SDL_INIT_VIDEO() is 0, so check defined instead of truth.
+ my $init = defined $options{-init} ? $options{-init} :
SDL_INIT_EVERYTHING();
+
+ SDL::Init($init);
my $t = $options{-title} || $options{-t} || $0;
my $it = $options{-icon_title} || $options{-it} || $t;
--- lib/SDL/App.pm.orig 2006-01-10 15:19:43.000000000 +1100
+++ lib/SDL/App.pm 2006-01-10 15:28:14.000000000 +1100
@@ -26,10 +26,13 @@
-red_accum_size -ras -blue_accum_size -bas
-green_accum_sizee -gas -alpha_accum_size -aas
-double_buffer -db -buffer_size -bs -stencil_size -st
- -asyncblit
+ -asyncblit -init
/ ) if ($SDL::DEBUG);
- SDL::Init(SDL_INIT_EVERYTHING());
+ # SDL_INIT_VIDEO() is 0, so check defined instead of truth.
+ my $init = defined $options{-init} ? $options{-init} : SDL_INIT_EVERYTHING();
+
+ SDL::Init($init);
my $t = $options{-title} || $options{-t} || $0;
my $it = $options{-icon_title} || $options{-it} || $t;