Permalink
Browse files

Tidied code

  • Loading branch information...
jtpalmer committed Jul 28, 2012
1 parent c4cf2cf commit d30b4334cd185d0e92ffd8fa32f7d5a55602bcab
Showing with 1,614 additions and 1,613 deletions.
  1. +32 −32 Build.PL
  2. +3 −2 examples/SDLx/SDLx_C_Interface.pl
  3. +23 −22 examples/SDLx/SDLx_Sound.pl
  4. +1 −1 examples/SDLx/SDLx_text.pl
  5. +11 −9 examples/SDLx/SDLx_text_shadow.pl
  6. +6 −6 examples/SDLx/SDLx_text_styles.pl
  7. +1 −1 examples/SDLx/SDLx_text_wordwrap.pl
  8. +19 −16 examples/SDLx/SDLx_text_zoom.pl
  9. +3 −3 examples/cookbook/pogl_sdl_texture.pl
  10. +1 −1 examples/pixel_operations/tie_matrix.pl
  11. +10 −9 inc/My/Builder.pm
  12. +82 −89 inc/My/Builder/Darwin.pm
  13. +3 −3 inc/My/Builder/Unix.pm
  14. +195 −193 lib/Module/Build/SDL.pm
  15. +19 −17 lib/SDL.pm
  16. +1 −1 lib/SDL/Audio.pm
  17. +1 −1 lib/SDL/AudioCVT.pm
  18. +1 −1 lib/SDL/AudioSpec.pm
  19. +1 −1 lib/SDL/CD.pm
  20. +1 −1 lib/SDL/CDROM.pm
  21. +1 −1 lib/SDL/CDTrack.pm
  22. +1 −1 lib/SDL/Color.pm
  23. +1 −1 lib/SDL/Cursor.pm
  24. +1 −1 lib/SDL/Event.pm
  25. +1 −1 lib/SDL/Events.pm
  26. +1 −1 lib/SDL/GFX.pm
  27. +1 −1 lib/SDL/GFX/BlitFunc.pm
  28. +1 −1 lib/SDL/GFX/FPSManager.pm
  29. +1 −1 lib/SDL/GFX/Framerate.pm
  30. +1 −1 lib/SDL/GFX/ImageFilter.pm
  31. +1 −1 lib/SDL/GFX/Primitives.pm
  32. +1 −1 lib/SDL/GFX/Rotozoom.pm
  33. +1 −1 lib/SDL/Image.pm
  34. +1 −1 lib/SDL/Joystick.pm
  35. +1 −1 lib/SDL/Mixer.pm
  36. +1 −1 lib/SDL/Mixer/Channels.pm
  37. +1 −1 lib/SDL/Mixer/Effects.pm
  38. +1 −1 lib/SDL/Mixer/Groups.pm
  39. +1 −1 lib/SDL/Mixer/MixChunk.pm
  40. +1 −1 lib/SDL/Mixer/MixMusic.pm
  41. +1 −1 lib/SDL/Mixer/Music.pm
  42. +1 −1 lib/SDL/Mixer/Samples.pm
  43. +1 −1 lib/SDL/Mouse.pm
  44. +1 −1 lib/SDL/MultiThread.pm
  45. +1 −1 lib/SDL/Net.pm
  46. +1 −1 lib/SDL/Net/IPaddress.pm
  47. +1 −1 lib/SDL/Net/TCP.pm
  48. +1 −1 lib/SDL/Net/UDP.pm
  49. +1 −1 lib/SDL/Overlay.pm
  50. +1 −1 lib/SDL/Palette.pm
  51. +1 −1 lib/SDL/Pango.pm
  52. +1 −1 lib/SDL/Pango/Context.pm
  53. +1 −1 lib/SDL/PixelFormat.pm
  54. +1 −1 lib/SDL/RWOps.pm
  55. +1 −1 lib/SDL/Rect.pm
  56. +12 −11 lib/SDL/SMPEG.pm
  57. +13 −12 lib/SDL/SMPEG/Info.pm
  58. +1 −1 lib/SDL/Surface.pm
  59. +1 −1 lib/SDL/TTF.pm
  60. +1 −1 lib/SDL/TTF/Font.pm
  61. +1 −1 lib/SDL/Time.pm
  62. +6 −7 lib/SDL/Version.pm
  63. +1 −1 lib/SDL/Video.pm
  64. +1 −1 lib/SDL/VideoInfo.pm
  65. +1 −1 lib/SDL_perl.pm
  66. +108 −99 lib/SDLx/App.pm
  67. +113 −109 lib/SDLx/Controller.pm
  68. +7 −7 lib/SDLx/Controller/Interface.pm
  69. +1 −1 lib/SDLx/Controller/State.pm
  70. +1 −1 lib/SDLx/FPS.pm
  71. +1 −1 lib/SDLx/Layer.pm
  72. +1 −1 lib/SDLx/LayerManager.pm
  73. +88 −92 lib/SDLx/Music.pm
  74. +11 −16 lib/SDLx/Music/Data.pm
  75. +2 −4 lib/SDLx/Music/Default.pm
  76. +1 −1 lib/SDLx/Rect.pm
  77. +1 −1 lib/SDLx/SFont.pm
  78. +50 −47 lib/SDLx/Sound.pm
  79. +15 −15 lib/SDLx/Sprite/Animated.pm
  80. +24 −29 lib/SDLx/Surface.pm
  81. +22 −26 lib/SDLx/TTF.pm
  82. +190 −194 lib/SDLx/Text.pm
  83. +5 −5 lib/SDLx/Validate.pm
  84. +1 −0 lib/pods/SDL/Events.pod
  85. +1 −0 lib/pods/SDLx/App.pod
  86. +1 −0 lib/pods/SDLx/Controller.pod
  87. +1 −0 lib/pods/SDLx/Controller/State.pod
  88. +1 −1 scripts/sdl_module_maker.pl
  89. +5 −8 t/00-load.t
  90. +1 −1 t/core_joystick.t
  91. +4 −2 t/image.t
  92. +1 −1 t/lib/SDL/TestTool.pm
  93. +52 −53 t/mixer_channels.t
  94. +66 −67 t/mixer_effects.t
  95. +3 −4 t/mixer_groups.t
  96. +1 −1 t/mixer_music.t
  97. +4 −4 t/mixer_samples.t
  98. +4 −4 t/release-pod-syntax.t
  99. +1 −1 t/sdlx_app.t
  100. +160 −146 t/sdlx_controller.t
  101. +8 −8 t/sdlx_controller_interface.t
  102. +3 −3 t/sdlx_fps.t
  103. +49 −54 t/sdlx_music.t
  104. +30 −30 t/sdlx_rect.t
  105. +27 −28 t/sdlx_sound.t
  106. +24 −19 t/sdlx_surface.t
  107. +12 −13 t/sdlx_text.t
  108. +17 −18 t/smpeg.t
  109. +8 −14 t/ttf.t
  110. +1 −3 t/ttf_font.t
View
@@ -250,8 +250,8 @@ my %subsystems = (
from => 'src/Mixer/Mixer.xs',
to => 'lib/SDL/Mixer.xs',
},
- libraries => [qw( SDL SDL_mixer )],
- load_libs => [qw( vorbisfile flac mikmod smpeg )],
+ libraries => [qw( SDL SDL_mixer )],
+ load_libs => [qw( vorbisfile flac mikmod smpeg )],
},
MixerSamples => {
file => {
@@ -403,20 +403,20 @@ my %subsystems = (
load_libs => [qw( png jpeg tiff )],
},
-# SMPEG => {
-# file => {
-# from => 'src/SMPEG.xs',
-# to => 'lib/SDL/SMPEG.xs',
-# },
-# libraries => [qw( SDL smpeg)],
-# },
-# MPEG => {
-# file => {
-# from => 'src/SMPEG/Info.xs',
-# to => 'lib/SDL/SMPEG/Info.xs',
-# },
-# libraries => [qw( SDL smpeg)],
-# },
+ # SMPEG => {
+ # file => {
+ # from => 'src/SMPEG.xs',
+ # to => 'lib/SDL/SMPEG.xs',
+ # },
+ # libraries => [qw( SDL smpeg)],
+ # },
+ # MPEG => {
+ # file => {
+ # from => 'src/SMPEG/Info.xs',
+ # to => 'lib/SDL/SMPEG/Info.xs',
+ # },
+ # libraries => [qw( SDL smpeg)],
+ # },
Pango => {
file => {
from => 'src/Pango/Pango.xs',
@@ -547,13 +547,13 @@ my %libraries = (
lib => 'tiff',
},
vorbisfile => {
- lib => 'vorbisfile',
+ lib => 'vorbisfile',
},
flac => {
- lib => 'FLAC',
+ lib => 'FLAC',
},
mikmod => {
- lib => 'mikmod',
+ lib => 'mikmod',
},
smpeg => {
define => 'HAVE_SMPEG',
@@ -580,7 +580,7 @@ my %xs =
keys %subsystems;
### Standard Module::Build stuff
-$My::Builder::config = $My::Builder::config; # Prevent a warning
+$My::Builder::config = $My::Builder::config; # Prevent a warning
my $build = $package->new(
module_name => 'SDL',
dist_name => 'SDL',
@@ -596,14 +596,14 @@ my $build = $package->new(
'Capture::Tiny' => '0',
},
build_requires => {
- 'Test::Simple' => '0.88',
- 'Capture::Tiny' => '0',
- 'Test::Most' => '0.21',
- 'Alien::SDL' => '1.435_7',
- 'File::Find' => '0',
- 'File::ShareDir' => '1.0',
- 'Tie::Simple' => '0',
- 'Scalar::Util' => '0',
+ 'Test::Simple' => '0.88',
+ 'Capture::Tiny' => '0',
+ 'Test::Most' => '0.21',
+ 'Alien::SDL' => '1.435_7',
+ 'File::Find' => '0',
+ 'File::ShareDir' => '1.0',
+ 'Tie::Simple' => '0',
+ 'Scalar::Util' => '0',
},
requires => {
'Scalar::Util' => '0',
@@ -617,10 +617,10 @@ my $build = $package->new(
build_recommends => {
'Pod::ToDemo' => '0.20',
},
- config => $My::Builder::config,
- c_source => 'src',
- xs_files => \%xs,
- meta_add => {},
+ config => $My::Builder::config,
+ c_source => 'src',
+ xs_files => \%xs,
+ meta_add => {},
typemap_files => { 'typemap' => 'lib/SDL/typemap' },
#create_readme => 1, ### make sense only if there is some POD doc in the file specified by dist_version_from
@@ -38,10 +38,11 @@
$app->add_show_handler( sub { $app->draw_rect( [ 0, 0, $app->w, $app->h ], 0x000000 ) } );
#add the spring
-$spring->attach($app, $render );
+$spring->attach( $app, $render );
#add the constant_velocity
-$constant->attach( $app,
+$constant->attach(
+ $app,
sub {
my $state = shift;
$app->draw_rect( [ $state->x, $state->y, 4, 4 ], 0xFFFFFF );
@@ -3,8 +3,8 @@
#
# FILE: SDLx_Sound.pl
#
-# USAGE: ./examples/SDLx_Sound.pl
-#
+# USAGE: ./examples/SDLx_Sound.pl
+#
#
# DESCRIPTION: Sound tests
# A SDLx::Sound can play, pause, resume and stop
@@ -28,34 +28,35 @@
use SDLx::Sound;
use SDLx::App;
use SDL::Event;
-use SDL::Events;
+use SDL::Events;
my $app = SDLx::App->new(
- height => 120,
- width => 480,
- depth => 16,
- title => 'Sound example',
- );
+ height => 120,
+ width => 480,
+ depth => 16,
+ title => 'Sound example',
+);
my $snd = SDLx::Sound->new();
# load and play a sound
my $play = $snd->play('test/data/sample.wav');
-# pause or resume on keydown
-$app->add_event_handler( sub{
+# pause or resume on keydown
+$app->add_event_handler(
+ sub {
my $e = $_[0];
- if( $e->type == SDL_KEYDOWN )
- {
- print "Ai\n";
- if($play){
- $snd->pause;
- $play=0;
- }else{
- $snd->resume;
- $play=1;
- }
- }
- } );
+ if ( $e->type == SDL_KEYDOWN ) {
+ print "Ai\n";
+ if ($play) {
+ $snd->pause;
+ $play = 0;
+ } else {
+ $snd->resume;
+ $play = 1;
+ }
+ }
+ }
+);
$app->run();
@@ -9,7 +9,7 @@
my $text = SDLx::Text->new;
-$app->draw_rect( [0, 0, $app->w, $app->h], 0x00ffff );
+$app->draw_rect( [ 0, 0, $app->w, $app->h ], 0x00ffff );
$text->write_to( $app, 'Hello, World!' );
$app->update;
@@ -14,18 +14,20 @@
# other variations
my $shadow_off = SDLx::Text->new( shadow => 1, shadow_offset => 4 );
-my $shadow_color = SDLx::Text->new( shadow => 1, shadow_color => [150, 150, 0] );
+my $shadow_color = SDLx::Text->new( shadow => 1, shadow_color => [ 150, 150, 0 ] );
-$app->add_show_handler( sub {
- $app->draw_rect( [0, 0, $app->w, $app->h], 0x00ffff );
+$app->add_show_handler(
+ sub {
+ $app->draw_rect( [ 0, 0, $app->w, $app->h ], 0x00ffff );
- $normal->write_xy( $app, 10, 0, 'Hello, World!' );
- $shadow->write_xy( $app, 10, 50, 'Hello, Shadow!' );
+ $normal->write_xy( $app, 10, 0, 'Hello, World!' );
+ $shadow->write_xy( $app, 10, 50, 'Hello, Shadow!' );
- $shadow_off->write_xy( $app, 10, 100, 'Hello, Shadow with offset!' );
- $shadow_color->write_xy( $app, 10, 150, 'Hello, colored Shadow!' );
+ $shadow_off->write_xy( $app, 10, 100, 'Hello, Shadow with offset!' );
+ $shadow_color->write_xy( $app, 10, 150, 'Hello, colored Shadow!' );
- $app->update;
-});
+ $app->update;
+ }
+);
$app->run;
@@ -9,7 +9,7 @@
my $text = SDLx::Text->new;
-$app->draw_rect( [0, 0, $app->w, $app->h], 0x00ffff );
+$app->draw_rect( [ 0, 0, $app->w, $app->h ], 0x00ffff );
$text->write_xy( $app, 300, 10, 'Normal Text' );
@@ -36,11 +36,11 @@
$text->write_xy( $app, 300, 250, 'All in one!' );
my $another = SDLx::Text->new(
- bold => 1,
- italic => 1,
- underline => 1,
- strikethrough => 1,
- shadow => 1,
+ bold => 1,
+ italic => 1,
+ underline => 1,
+ strikethrough => 1,
+ shadow => 1,
);
$another->write_xy( $app, 50, 300, 'Can even be set with others (like shadow), during startup!' );
@@ -9,7 +9,7 @@
my $text = SDLx::Text->new( word_wrap => 450 );
-$app->draw_rect( [0, 0, $app->w, $app->h], 0x00ffff );
+$app->draw_rect( [ 0, 0, $app->w, $app->h ], 0x00ffff );
my $message = <<'EOT';
All lines come from a single string.
@@ -11,24 +11,27 @@
my $text = SDLx::Text->new;
-my $size = 1;
+my $size = 1;
my $direction = 1;
-$app->add_move_handler( sub {
- $size += $direction;
- $text->size( $size );
+$app->add_move_handler(
+ sub {
+ $size += $direction;
+ $text->size($size);
- if ($direction == 1) {
- $direction = -1 if $size > 60;
- }
- else {
- $direction = 1 if $size < 2;
- }
-});
+ if ( $direction == 1 ) {
+ $direction = -1 if $size > 60;
+ } else {
+ $direction = 1 if $size < 2;
+ }
+ }
+);
-$app->add_show_handler( sub {
- $app->draw_rect( [0, 0, $app->w, $app->h], 0x00ffff );
- $text->write_to( $app, 'Hello, World!' );
- $app->update;
-});
+$app->add_show_handler(
+ sub {
+ $app->draw_rect( [ 0, 0, $app->w, $app->h ], 0x00ffff );
+ $text->write_to( $app, 'Hello, World!' );
+ $app->update;
+ }
+);
$app->run;
@@ -116,9 +116,9 @@ sub LoadTexture {
my $texture_format;
my $texture = 0;
my $img = $ARGV[0] || 'test/data/picture.bmp';
-
- $surface = SDL::Image::load( $img );
- die "Couldn't load image: ".SDL::get_error() unless $surface;
+
+ $surface = SDL::Image::load($img);
+ die "Couldn't load image: " . SDL::get_error() unless $surface;
SDL::Video::lock_surface($surface);
#get the number of channels in the SDL surface
@@ -75,7 +75,7 @@ sub update {
foreach ( 0 ... rand( $surface->w ) ) {
- $matrix->[$_][ rand( $surface->h ) ] = int(0xFFFFFFFF / ( $_ + 1 ));
+ $matrix->[$_][ rand( $surface->h ) ] = int( 0xFFFFFFFF / ( $_ + 1 ) );
}
SDL::Video::unlock_surface($surface);
View
@@ -80,7 +80,8 @@ sub find_subsystems {
$found{$_} = 1 foreach (@$h);
$param->{libs}->{$library} = 1;
push @{ $param->{defines} }, "-D$libraries->{$library}{define}";
- push @{ $param->{links} }, Alien::SDL::ConfigData->config('build_cc') eq 'cl'
+ push @{ $param->{links} },
+ Alien::SDL::ConfigData->config('build_cc') eq 'cl'
? "lib$libraries->{$library}{lib}.lib"
: "-l$libraries->{$library}{lib}";
} else {
@@ -136,16 +137,16 @@ sub set_file_flags {
$arch = '-arch' . $ENV{SDL_ARCH} if $ENV{SDL_ARCH};
while ( my ( $subsystem, $param ) = each %build_systems ) {
- my $sub_file = $self->notes('subsystems')->{$subsystem}{file}{to};
+ my $sub_file = $self->notes('subsystems')->{$subsystem}{file}{to};
my $extra_compiler_flags = [
( split( ' ', $arch . $debug . $self->notes('sdl_cflags') ) ),
@{ $param->{defines} },
];
- push(@{$extra_compiler_flags}, '-DUSE_THREADS') if defined $Config{usethreads};
- push(@{$extra_compiler_flags}, '-fPIC') if $^O ne 'MSWin32';
+ push( @{$extra_compiler_flags}, '-DUSE_THREADS' ) if defined $Config{usethreads};
+ push( @{$extra_compiler_flags}, '-fPIC' ) if $^O ne 'MSWin32';
$file_flags{$sub_file} = {
extra_compiler_flags => $extra_compiler_flags,
- extra_linker_flags => [
+ extra_linker_flags => [
( split( ' ', $self->notes('sdl_libs') ) ),
@{ $param->{links} },
],
@@ -155,12 +156,12 @@ sub set_file_flags {
}
sub process_pod_files {
- my ($self, $ext) = @_;
+ my ( $self, $ext ) = @_;
- my $files = $self->_find_file_by_type($ext, 'lib');
- while (my ($file, $dest) = each %$files) {
+ my $files = $self->_find_file_by_type( $ext, 'lib' );
+ while ( my ( $file, $dest ) = each %$files ) {
$dest =~ s!^(lib/)pods/!$1!;
- $self->copy_if_modified(from => $file, to => File::Spec->catfile($self->blib, $dest));
+ $self->copy_if_modified( from => $file, to => File::Spec->catfile( $self->blib, $dest ) );
}
}
Oops, something went wrong.

0 comments on commit d30b433

Please sign in to comment.