Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Did perl tidy. Stole rc from padre. bricas++

  • Loading branch information...
commit e6e146eee6780cf6af76e8040173d1d4ea2e64a2 1 parent 1de2909
@kthakore kthakore authored
Showing with 14,005 additions and 12,877 deletions.
  1. +2 −0  .gitignore
  2. +517 −515 Build.PL
  3. +26 −32 examples/GFX/script_roto.pl
  4. +31 −23 examples/SDLx/SDLx_controller_two_squares.pl
  5. +24 −19 examples/SDLx/SDLx_sprite.pl
  6. +27 −28 examples/SDLx/SDLx_sprite_animated.pl
  7. +65 −58 examples/SDLx/pong.pl
  8. +139 −130 examples/adventure/adventure.pl
  9. +8 −12 examples/cookbook/1.pl
  10. +76 −70 examples/cookbook/openglapp.pl
  11. +43 −44 examples/cookbook/pogl_sdl_texture.pl
  12. +23 −16 examples/pixel_operations/fast_pixel_write.pl
  13. +39 −49 examples/pixel_operations/sols/ch02.pl
  14. +33 −43 examples/pixel_operations/starry.pl
  15. +21 −15 examples/pixel_operations/tie_matrix.pl
  16. +110 −106 inc/My/Builder.pm
  17. +41 −42 inc/My/Builder/Darwin.pm
  18. +4 −5 inc/My/Builder/Windows.pm
  19. +21 −23 lib/SDL.pm
  20. +3 −3 lib/SDL/Audio.pm
  21. +3 −3 lib/SDL/AudioCVT.pm
  22. +3 −3 lib/SDL/AudioSpec.pm
  23. +19 −18 lib/SDL/CD.pm
  24. +4 −4 lib/SDL/CDROM.pm
  25. +4 −4 lib/SDL/CDTrack.pm
  26. +8 −8 lib/SDL/Color.pm
  27. +5 −6 lib/SDL/Config.pm
  28. +1,116 −1,051 lib/SDL/Constants.pm
  29. +10 −10 lib/SDL/Event.pm
  30. +10 −10 lib/SDL/Events.pm
  31. +2 −2 lib/SDL/GFX.pm
  32. +2 −2 lib/SDL/GFX/BlitFunc.pm
  33. +2 −2 lib/SDL/GFX/FPSManager.pm
  34. +2 −2 lib/SDL/GFX/Framerate.pm
  35. +2 −2 lib/SDL/GFX/ImageFilter.pm
  36. +2 −2 lib/SDL/GFX/Primitives.pm
  37. +2 −2 lib/SDL/GFX/Rotozoom.pm
  38. +2 −2 lib/SDL/Image.pm
  39. +18 −18 lib/SDL/Internal/Loader.pm
  40. +29 −28 lib/SDL/MPEG.pm
  41. +11 −8 lib/SDL/Mixer.pm
  42. +12 −9 lib/SDL/Mixer/Channels.pm
  43. +12 −9 lib/SDL/Mixer/Effects.pm
  44. +12 −9 lib/SDL/Mixer/Groups.pm
  45. +11 −8 lib/SDL/Mixer/MixChunk.pm
  46. +11 −8 lib/SDL/Mixer/MixMusic.pm
  47. +12 −9 lib/SDL/Mixer/Music.pm
  48. +11 −8 lib/SDL/Mixer/Samples.pm
  49. +2 −2 lib/SDL/Net.pm
  50. +1 −1  lib/SDL/Net/IPaddress.pm
  51. +1 −1  lib/SDL/Net/TCP.pm
  52. +1 −1  lib/SDL/Net/UDP.pm
  53. +8 −8 lib/SDL/Overlay.pm
  54. +8 −8 lib/SDL/Palette.pm
  55. +3 −3 lib/SDL/Pango.pm
  56. +3 −3 lib/SDL/Pango/Context.pm
  57. +8 −8 lib/SDL/PixelFormat.pm
  58. +2 −2 lib/SDL/RWOps.pm
  59. +8 −8 lib/SDL/Rect.pm
  60. +40 −36 lib/SDL/SMPEG.pm
  61. +8 −8 lib/SDL/Surface.pm
  62. +3 −3 lib/SDL/TTF.pm
  63. +1 −0  lib/SDL/TTF.pod
  64. +3 −3 lib/SDL/TTF/Font.pm
  65. +70 −68 lib/SDL/TTFont.pm
  66. +8 −8 lib/SDL/Tutorial.pm
  67. +46 −63 lib/SDL/Tutorial/Animation.pm
  68. +905 −905 lib/SDL/Tutorial/LunarLander.pm
  69. +8 −8 lib/SDL/Video.pm
  70. +8 −8 lib/SDL/VideoInfo.pm
  71. +2 −2 lib/SDL_perl.pm
  72. +145 −120 lib/SDLx/App.pm
  73. +2 −3 lib/SDLx/Controller.pm
  74. +41 −44 lib/SDLx/Controller/Timer.pm
  75. +34 −27 lib/SDLx/FPS.pm
  76. +352 −322 lib/SDLx/Rect.pm
  77. +5 −6 lib/SDLx/SFont.pm
  78. +175 −198 lib/SDLx/Sprite.pm
  79. +483 −483 lib/SDLx/Sprite/Animated.pm
  80. +1 −1  lib/SDLx/Surface.pm
  81. +16 −16 lib/SDLx/Surface/TiedMatrix.pm
  82. +15 −16 lib/SDLx/Surface/TiedMatrixRow.pm
  83. +1 −0  lib/pods/SDL.pod
  84. +1 −0  lib/pods/SDL/Audio.pod
  85. +1 −0  lib/pods/SDL/AudioCVT.pod
  86. +1 −0  lib/pods/SDL/AudioSpec.pod
  87. +1 −0  lib/pods/SDL/CD.pod
  88. +1 −0  lib/pods/SDL/CDROM.pod
  89. +1 −0  lib/pods/SDL/CDTrack.pod
  90. +1 −0  lib/pods/SDL/Color.pod
  91. +1 −0  lib/pods/SDL/Cookbook.pod
  92. +1 −0  lib/pods/SDL/Cookbook/OpenGL.pod
  93. +1 −0  lib/pods/SDL/Cookbook/PDL.pod
  94. +1 −0  lib/pods/SDL/Credits.pod
  95. +1 −0  lib/pods/SDL/Cursor.pod
  96. +1 −0  lib/pods/SDL/Deprecated.pod
  97. +1 −0  lib/pods/SDL/Event.pod
  98. +1 −0  lib/pods/SDL/Events.pod
  99. +1 −0  lib/pods/SDL/GFX/BlitFunc.pod
  100. +1 −0  lib/pods/SDL/GFX/FPSManager.pod
  101. +1 −0  lib/pods/SDL/GFX/Framerate.pod
  102. +1 −0  lib/pods/SDL/GFX/ImageFilter.pod
  103. +1 −0  lib/pods/SDL/GFX/Primitives.pod
  104. +1 −0  lib/pods/SDL/GFX/Rotozoom.pod
  105. +1 −0  lib/pods/SDL/Image.pod
  106. +1 −0  lib/pods/SDL/Joystick.pod
  107. +1 −0  lib/pods/SDL/MPEG.pod
  108. +1 −0  lib/pods/SDL/Mixer.pod
  109. +1 −0  lib/pods/SDL/Mixer/Channels.pod
  110. +1 −0  lib/pods/SDL/Mixer/Effects.pod
  111. +1 −0  lib/pods/SDL/Mixer/Groups.pod
  112. +1 −0  lib/pods/SDL/Mixer/MixChunk.pod
  113. +1 −0  lib/pods/SDL/Mixer/MixMusic.pod
  114. +1 −0  lib/pods/SDL/Mixer/Music.pod
  115. +1 −0  lib/pods/SDL/Mixer/Samples.pod
  116. +1 −0  lib/pods/SDL/Mouse.pod
  117. +1 −0  lib/pods/SDL/MultiThread.pod
  118. +1 −0  lib/pods/SDL/Overlay.pod
  119. +1 −0  lib/pods/SDL/Palette.pod
  120. +1 −0  lib/pods/SDL/Pango.pod
  121. +1 −0  lib/pods/SDL/Pango/Context.pod
  122. +1 −0  lib/pods/SDL/PixelFormat.pod
  123. +1 −0  lib/pods/SDL/RWOps.pod
  124. +1 −0  lib/pods/SDL/Rect.pod
  125. +1 −0  lib/pods/SDL/SMPEG.pod
  126. +1 −0  lib/pods/SDL/Surface.pod
  127. +1 −0  lib/pods/SDL/TTF.pod
  128. +1 −0  lib/pods/SDL/TTF/Font.pod
  129. +1 −0  lib/pods/SDL/Time.pod
  130. +1 −0  lib/pods/SDL/Tutorial.pod
  131. +31 −20 lib/pods/SDL/Tutorial/Animation.pod
  132. +1 −0  lib/pods/SDL/Tutorial/LunarLander.pod
  133. +1 −0  lib/pods/SDL/Version.pod
  134. +1 −0  lib/pods/SDL/Video.pod
  135. +1 −0  lib/pods/SDL/VideoInfo.pod
  136. +1 −0  lib/pods/SDLx/App.pod
  137. +1 −0  lib/pods/SDLx/Controller.pod
  138. +1 −0  lib/pods/SDLx/SFont.pod
  139. +1 −0  lib/pods/SDLx/Sprite.pod
  140. +1 −0  lib/pods/SDLx/Surface.pod
  141. +78 −0 perltidyrc
  142. +5 −6 scripts/MultiThreadPOC.pl
  143. +420 −422 scripts/OpenGL/Constants.pm
  144. +259 −261 scripts/SDL/Constants.pm
  145. +121 −131 scripts/SDLpp.pl
  146. +186 −185 scripts/auto_constants.pl
  147. +103 −112 scripts/const.pl
  148. +18 −18 scripts/gl_const.pl
  149. +15 −14 scripts/sdl_const.pl
  150. +55 −55 t/00-load.t
  151. +21 −17 t/config.t
  152. +79 −68 t/core.t
  153. +57 −59 t/core_audio.t
  154. +39 −37 t/core_audiospec.t
  155. +87 −64 t/core_cd.t
  156. +13 −12 t/core_error.t
  157. +417 −303 t/core_events.t
  158. +28 −27 t/core_joystick.t
  159. +17 −20 t/core_mouse.t
  160. +38 −35 t/core_multi.t
  161. +10 −14 t/core_overlay.t
  162. +22 −22 t/core_palette.t
  163. +34 −34 t/core_rwops.t
  164. +31 −39 t/core_surface.t
  165. +20 −22 t/core_timer.t
  166. +319 −272 t/core_video.t
  167. +21 −21 t/core_video_convert_surface.t
  168. +16 −16 t/extendingrect.t
  169. +4 −5 t/gfx.t
  170. +12 −17 t/gfx_fpsmanager.t
  171. +13 −18 t/gfx_framerate.t
  172. +81 −80 t/gfx_imagefilter.t
  173. +388 −192 t/gfx_primitives.t
  174. +289 −67 t/gfx_primitives2.t
  175. +86 −65 t/gfx_rotozoom.t
  176. +152 −142 t/image.t
  177. +70 −77 t/image_xpm_array.t
  178. +52 −49 t/intergation1.t
  179. +40 −44 t/lib/SDL/TestTool.pm
  180. +58 −52 t/mixer.t
  181. +101 −71 t/mixer_channels.t
  182. +146 −121 t/mixer_effects.t
  183. +72 −59 t/mixer_groups.t
  184. +24 −27 t/mixer_mixchunk.t
  185. +31 −31 t/mixer_mixmusic.t
  186. +117 −99 t/mixer_music.t
  187. +60 −55 t/mixer_samples.t
  188. +31 −22 t/mpegpm.t
  189. +70 −54 t/pango.t
  190. +137 −133 t/sdlgamerect.t
  191. +65 −45 t/sdlx_app.t
  192. +35 −46 t/sdlx_sfont.t
  193. +34 −43 t/sdlx_sprite.t
  194. +54 −48 t/sdlx_surface.t
  195. +30 −26 t/smpeg.t
  196. +282 −181 t/ttf.t
  197. +28 −20 t/ttf_font.t
  198. +2 −2 t_backcompat/64encode.pl
  199. +14 −16 t_backcompat/Font.pm
  200. +13 −17 t_backcompat/MoP/Build.PL
  201. +16 −18 t_backcompat/MoP/lib/SDL/Tutorial/MoP.pm
  202. +2 −3 t_backcompat/MoP/lib/SDL/Tutorial/MoP/Base.pm
  203. +4 −6 t_backcompat/MoP/lib/SDL/Tutorial/MoP/Controller/CPUSpinner.pm
  204. +40 −41 t_backcompat/MoP/lib/SDL/Tutorial/MoP/Controller/Game.pm
  205. +42 −43 t_backcompat/MoP/lib/SDL/Tutorial/MoP/Controller/Keyboard.pm
  206. +10 −16 t_backcompat/MoP/lib/SDL/Tutorial/MoP/EventManager.pm
  207. +123 −140 t_backcompat/MoP/lib/SDL/Tutorial/MoP/Model/Map.pm
  208. +23 −26 t_backcompat/MoP/lib/SDL/Tutorial/MoP/Models.pm
  209. +87 −91 t_backcompat/MoP/lib/SDL/Tutorial/MoP/View.pm
  210. +53 −53 t_backcompat/MoP/lib/SDL/Tutorial/MoP/View/Map.pm
  211. +3 −4 t_backcompat/MoP/t/001_load.t
  212. +56 −52 t_backcompat/OpenGL/test1.pl
  213. +85 −84 t_backcompat/OpenGL/test2.pl
  214. +44 −38 t_backcompat/OpenGL/test3.pl
  215. +91 −75 t_backcompat/OpenGL/test4.pl
  216. +101 −90 t_backcompat/OpenGL/test5.pl
  217. +83 −95 t_backcompat/OpenGL/tutorial/lesson02.pl
  218. +86 −102 t_backcompat/OpenGL/tutorial/lesson03.pl
  219. +94 −111 t_backcompat/OpenGL/tutorial/lesson04.pl
  220. +163 −176 t_backcompat/OpenGL/tutorial/lesson05.pl
  221. +295 −298 t_backcompat/OpenGL/tutorial/lesson06.pl
  222. +302 −302 t_backcompat/OpenGL/tutorial/lesson07.pl
  223. +328 −329 t_backcompat/OpenGL/tutorial/lesson08.pl
  224. +337 −372 t_backcompat/OpenGL/tutorial/lesson18.pl
  225. +35 −32 t_backcompat/Timer.pm
  226. +45 −48 t_backcompat/checkkeys.pl
  227. +27 −21 t_backcompat/core_event_filter.pl
  228. +10 −9 t_backcompat/fontpm.t
  229. +38 −33 t_backcompat/graywin.pl
  230. +31 −31 t_backcompat/loopwave.pl
  231. +15 −13 t_backcompat/palettepm.t
  232. +11 −9 t_backcompat/soundpm.t
  233. +35 −29 t_backcompat/testcolor.pl
  234. +38 −30 t_backcompat/testcolor.spl
  235. +56 −54 t_backcompat/testfonttool.pl
  236. +201 −173 t_backcompat/testgfxprim.pl
  237. +159 −164 t_backcompat/testgfxroto.pl
  238. +34 −29 t_backcompat/testgraphictool.pl
  239. +187 −155 t_backcompat/testjoystick.pl
  240. +113 −119 t_backcompat/testsprite.pl
  241. +18 −11 t_backcompat/testtimer.pl
  242. +34 −26 t_backcompat/toolfontpm.t
  243. +10 −10 t_backcompat/toolgraphicpm.t
  244. +32 −29 t_backcompat/ttfontpm.t
  245. +1 −3 t_backcompat/wave.pl
  246. +1 −2  test/checkkeys.pl
  247. +4 −6 test/graywin.pl
  248. +7 −6 test/testmenu.pl
  249. +14 −12 tools/GFX_headers_digest.pl
  250. +9 −12 tools/make_XS_stub.pl
  251. +12 −13 tools/nopaste.pl
  252. +19 −15 tools/smokeNsend.pl
  253. +28 −21 tools/smolder_smoke_signal
  254. +4 −5 tools/stubPod.pl
  255. +1 −1  xt/01_podspell.t
  256. +1 −1  xt/02_perlcritic.t
  257. +12 −14 xt/05_manifest.t
  258. +33 −35 xt/06_surfaceML.t
  259. +5 −7 xt/07_core_memleak.t
  260. +16 −8 xt/constantspm.t
  261. +27 −23 xt/net.t
View
2  .gitignore
@@ -34,3 +34,5 @@ MANIFEST
*.tar.gz
*.swp
*~
+*.bak
+*.ERR
View
1,032 Build.PL
@@ -1,6 +1,6 @@
#! perl -w
#
-# Copyright (C) 2003 chromatic
+# Copyright (C) 2003 chromatic
# Copyright (C) 2004 David J. Goehrig
# Copyright (C) 2010 Kartik Thakore
@@ -18,19 +18,19 @@ This Release breaks back compatibility support with versions 2.4x and below
BROKENMSG
### we need the platform-specific module
-my %platforms =(
- MSWin32 => 'Windows',
- MacOS => 'Darwin',
- darwin => 'Darwin',
- cygwin => 'Unix',
- freebsd => 'Unix',
- gnukfreebsd => 'Unix',
- linux => 'Unix',
- netbsd => 'Unix',
- openbsd => 'Unix',
- solaris => 'Unix',
+my %platforms = (
+ MSWin32 => 'Windows',
+ MacOS => 'Darwin',
+ darwin => 'Darwin',
+ cygwin => 'Unix',
+ freebsd => 'Unix',
+ gnukfreebsd => 'Unix',
+ linux => 'Unix',
+ netbsd => 'Unix',
+ openbsd => 'Unix',
+ solaris => 'Unix',
);
-my $package = 'My::Builder::' . ($platforms{$^O} || 'Unix');
+my $package = 'My::Builder::' . ( $platforms{$^O} || 'Unix' );
print "Gonna use '$package' class ...\n";
eval "require $package" or croak "Require '$package' failed: $@\n";
@@ -40,366 +40,366 @@ eval "require $package" or croak "Require '$package' failed: $@\n";
# <from> = location of source file
# <to> = location of build file to get name right
# <libraries> = list reqiured libraries, names the same as keys to hash %libraries
-my %subsystems =
-(
- SDL => {
- file => {
- from => 'src/SDL.xs',
- to => 'lib/SDL_perl.xs',
- },
- libraries => [qw( SDL )],
- },
- Time => {
- file => {
- from => 'src/Core/Time.xs',
- to => 'lib/SDL/Time.xs',
- },
- libraries => [qw( SDL )],
- },
- Events => {
- file => {
- from => 'src/Core/Events.xs',
- to => 'lib/SDL/Events.xs',
- },
- libraries => [qw( SDL )],
- },
- Event => {
- file => {
- from => 'src/Core/objects/Event.xs',
- to => 'lib/SDL/Event.xs',
- },
- libraries => [qw( SDL )],
- },
- GFX => {
- file => {
- from => 'src/GFX/GFX.xs',
- to => 'lib/SDL/GFX.xs',
- },
- libraries => [qw( SDL SDL_gfx_primitives )],
- },
- BlitFunc => {
- file => {
- from => 'src/GFX/BlitFunc.xs',
- to => 'lib/SDL/GFX/BlitFunc.xs',
- },
- libraries => [qw( SDL SDL_gfx_blitfunc )],
- },
- Framerate => {
- file => {
- from => 'src/GFX/Framerate.xs',
- to => 'lib/SDL/GFX/Framerate.xs',
- },
- libraries => [qw( SDL SDL_gfx_framerate )],
- },
- FPSManager => {
- file => {
- from => 'src/GFX/FPSManager.xs',
- to => 'lib/SDL/GFX/FPSManager.xs',
- },
- libraries => [qw( SDL SDL_gfx_framerate )],
- },
- ImageFilter => {
- file => {
- from => 'src/GFX/ImageFilter.xs',
- to => 'lib/SDL/GFX/ImageFilter.xs',
- },
- libraries => [qw( SDL SDL_gfx_imagefilter )],
- },
- Primitives => {
- file => {
- from => 'src/GFX/Primitives.xs',
- to => 'lib/SDL/GFX/Primitives.xs',
- },
- libraries => [qw( SDL SDL_gfx_primitives )],
- },
- Rotozoom => {
- file => {
- from => 'src/GFX/Rotozoom.xs',
- to => 'lib/SDL/GFX/Rotozoom.xs',
- },
- libraries => [qw( SDL SDL_gfx_rotozoom )],
- },
- MultiThread => {
- file => {
- from => 'src/Core/MultiThread.xs',
- to => 'lib/SDL/MultiThread.xs',
- },
- libraries => [qw( SDL )],
- },
- Video => {
- file => {
- from => 'src/Core/Video.xs',
- to => 'lib/SDL/Video.xs',
- },
- libraries => [qw( SDL )],
- },
- Audio => {
- file => {
- from => 'src/Core/Audio.xs',
- to => 'lib/SDL/Audio.xs',
- },
- libraries => [qw( SDL )],
- },
- Rect => {
- file => {
- from => 'src/Core/objects/Rect.xs',
- to => 'lib/SDL/Rect.xs',
- },
- libraries => [qw( SDL )],
- },
- Color => {
- file => {
- from => 'src/Core/objects/Color.xs',
- to => 'lib/SDL/Color.xs',
- },
- libraries => [qw( SDL )],
- },
- Surface => {
- file => {
- from => 'src/Core/objects/Surface.xs',
- to => 'lib/SDL/Surface.xs',
- },
- libraries => [qw( SDL )],
- },
- SurfaceX => {
- file => {
- from => 'src/SDLx/Surface.xs',
- to => 'lib/SDLx/Surface.xs',
- },
- libraries => [qw( SDL )],
- },
- Overlay => {
- file => {
- from => 'src/Core/objects/Overlay.xs',
- to => 'lib/SDL/Overlay.xs',
- },
- libraries => [qw( SDL )],
- },
- RWOps => {
- file => {
- from => 'src/Core/objects/RWOps.xs',
- to => 'lib/SDL/RWOps.xs',
- },
- libraries => [qw( SDL )],
- },
- PixelFormat => {
- file => {
- from => 'src/Core/objects/PixelFormat.xs',
- to => 'lib/SDL/PixelFormat.xs',
- },
- libraries => [qw( SDL )],
- },
- AudioSpec => {
- file => {
- from => 'src/Core/objects/AudioSpec.xs',
- to => 'lib/SDL/AudioSpec.xs',
- },
- libraries => [qw( SDL )],
- },
- AudioCVT => {
- file => {
- from => 'src/Core/objects/AudioCVT.xs',
- to => 'lib/SDL/AudioCVT.xs',
- },
- libraries => [qw( SDL )],
- },
- Mixer => {
- file => {
- from => 'src/Mixer/Mixer.xs',
- to => 'lib/SDL/Mixer.xs',
- },
- libraries => [qw( SDL SDL_mixer )],
- },
- MixerSamples => {
- file => {
- from => 'src/Mixer/Samples.xs',
- to => 'lib/SDL/Mixer/Samples.xs',
- },
- libraries => [qw( SDL SDL_mixer )],
- },
- MixerChannels => {
- file => {
- from => 'src/Mixer/Channels.xs',
- to => 'lib/SDL/Mixer/Channels.xs',
- },
- libraries => [qw( SDL SDL_mixer )],
- },
- MixerGroups => {
- file => {
- from => 'src/Mixer/Groups.xs',
- to => 'lib/SDL/Mixer/Groups.xs',
- },
- libraries => [qw( SDL SDL_mixer )],
- },
- MixerMusic => {
- file => {
- from => 'src/Mixer/Music.xs',
- to => 'lib/SDL/Mixer/Music.xs',
- },
- libraries => [qw( SDL SDL_mixer )],
- },
- MixerEffects => {
- file => {
- from => 'src/Mixer/Effects.xs',
- to => 'lib/SDL/Mixer/Effects.xs',
- },
- libraries => [qw( SDL SDL_mixer )],
- },
- MixChunk => {
- file => {
- from => 'src/Mixer/objects/MixChunk.xs',
- to => 'lib/SDL/Mixer/MixChunk.xs',
- },
- libraries => [qw( SDL SDL_mixer )],
- },
- MixMusic => {
- file => {
- from => 'src/Mixer/objects/MixMusic.xs',
- to => 'lib/SDL/Mixer/MixMusic.xs',
- },
- libraries => [qw( SDL SDL_mixer )],
- },
- Palette => {
- file => {
- from => 'src/Core/objects/Palette.xs',
- to => 'lib/SDL/Palette.xs',
- },
- libraries => [qw( SDL )],
- },
- VideoInfo => {
- file => {
- from => 'src/Core/objects/VideoInfo.xs',
- to => 'lib/SDL/VideoInfo.xs',
- },
- libraries => [qw( SDL )],
- },
- Mouse => {
- file => {
- from => 'src/Core/Mouse.xs',
- to => 'lib/SDL/Mouse.xs',
- },
- libraries => [qw( SDL )],
- },
- Cursor => {
- file => {
- from => 'src/Core/objects/Cursor.xs',
- to => 'lib/SDL/Cursor.xs',
- },
- libraries => [qw( SDL )],
- },
- Joystick => {
- file => {
- from => 'src/Core/Joystick.xs',
- to => 'lib/SDL/Joystick.xs',
- },
- libraries => [qw( SDL )],
- },
- CDROM => {
- file => {
- from => 'src/Core/CDROM.xs',
- to => 'lib/SDL/CDROM.xs',
- },
- libraries => [qw( SDL )],
- },
- CDTrack => {
- file => {
- from => 'src/Core/objects/CDTrack.xs',
- to => 'lib/SDL/CDTrack.xs',
- },
- libraries => [qw( SDL )],
- },
- CD => {
- file => {
- from => 'src/Core/objects/CD.xs',
- to => 'lib/SDL/CD.xs',
- },
- libraries => [qw( SDL )],
- },
- TTF => {
- file => {
- from => 'src/TTF/TTF.xs',
- to => 'lib/SDL/TTF.xs',
- },
- libraries => [qw( SDL SDL_ttf )],
- },
- TTF_Font => {
- file => {
- from => 'src/TTF/objects/Font.xs',
- to => 'lib/SDL/TTF/Font.xs',
- },
- libraries => [qw( SDL SDL_ttf )],
- },
- Version => {
- file => {
- from => 'src/Core/objects/Version.xs',
- to => 'lib/SDL/Version.xs',
- },
- libraries => [qw( SDL )],
- },
- Image => {
- file => {
- from => 'src/Image.xs',
- to => 'lib/SDL/Image.xs',
- },
- libraries => [qw( SDL SDL_image )],
- },
- SFont => {
- file => {
- from => 'src/SDLx/SFont.xs',
- to => 'lib/SDLx/SFont.xs',
- },
- libraries => [qw( SDL SDL_image )],
- },
+my %subsystems = (
+ SDL => {
+ file => {
+ from => 'src/SDL.xs',
+ to => 'lib/SDL_perl.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Time => {
+ file => {
+ from => 'src/Core/Time.xs',
+ to => 'lib/SDL/Time.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Events => {
+ file => {
+ from => 'src/Core/Events.xs',
+ to => 'lib/SDL/Events.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Event => {
+ file => {
+ from => 'src/Core/objects/Event.xs',
+ to => 'lib/SDL/Event.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ GFX => {
+ file => {
+ from => 'src/GFX/GFX.xs',
+ to => 'lib/SDL/GFX.xs',
+ },
+ libraries => [qw( SDL SDL_gfx_primitives )],
+ },
+ BlitFunc => {
+ file => {
+ from => 'src/GFX/BlitFunc.xs',
+ to => 'lib/SDL/GFX/BlitFunc.xs',
+ },
+ libraries => [qw( SDL SDL_gfx_blitfunc )],
+ },
+ Framerate => {
+ file => {
+ from => 'src/GFX/Framerate.xs',
+ to => 'lib/SDL/GFX/Framerate.xs',
+ },
+ libraries => [qw( SDL SDL_gfx_framerate )],
+ },
+ FPSManager => {
+ file => {
+ from => 'src/GFX/FPSManager.xs',
+ to => 'lib/SDL/GFX/FPSManager.xs',
+ },
+ libraries => [qw( SDL SDL_gfx_framerate )],
+ },
+ ImageFilter => {
+ file => {
+ from => 'src/GFX/ImageFilter.xs',
+ to => 'lib/SDL/GFX/ImageFilter.xs',
+ },
+ libraries => [qw( SDL SDL_gfx_imagefilter )],
+ },
+ Primitives => {
+ file => {
+ from => 'src/GFX/Primitives.xs',
+ to => 'lib/SDL/GFX/Primitives.xs',
+ },
+ libraries => [qw( SDL SDL_gfx_primitives )],
+ },
+ Rotozoom => {
+ file => {
+ from => 'src/GFX/Rotozoom.xs',
+ to => 'lib/SDL/GFX/Rotozoom.xs',
+ },
+ libraries => [qw( SDL SDL_gfx_rotozoom )],
+ },
+ MultiThread => {
+ file => {
+ from => 'src/Core/MultiThread.xs',
+ to => 'lib/SDL/MultiThread.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Video => {
+ file => {
+ from => 'src/Core/Video.xs',
+ to => 'lib/SDL/Video.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Audio => {
+ file => {
+ from => 'src/Core/Audio.xs',
+ to => 'lib/SDL/Audio.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Rect => {
+ file => {
+ from => 'src/Core/objects/Rect.xs',
+ to => 'lib/SDL/Rect.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Color => {
+ file => {
+ from => 'src/Core/objects/Color.xs',
+ to => 'lib/SDL/Color.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Surface => {
+ file => {
+ from => 'src/Core/objects/Surface.xs',
+ to => 'lib/SDL/Surface.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ SurfaceX => {
+ file => {
+ from => 'src/SDLx/Surface.xs',
+ to => 'lib/SDLx/Surface.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Overlay => {
+ file => {
+ from => 'src/Core/objects/Overlay.xs',
+ to => 'lib/SDL/Overlay.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ RWOps => {
+ file => {
+ from => 'src/Core/objects/RWOps.xs',
+ to => 'lib/SDL/RWOps.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ PixelFormat => {
+ file => {
+ from => 'src/Core/objects/PixelFormat.xs',
+ to => 'lib/SDL/PixelFormat.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ AudioSpec => {
+ file => {
+ from => 'src/Core/objects/AudioSpec.xs',
+ to => 'lib/SDL/AudioSpec.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ AudioCVT => {
+ file => {
+ from => 'src/Core/objects/AudioCVT.xs',
+ to => 'lib/SDL/AudioCVT.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Mixer => {
+ file => {
+ from => 'src/Mixer/Mixer.xs',
+ to => 'lib/SDL/Mixer.xs',
+ },
+ libraries => [qw( SDL SDL_mixer )],
+ },
+ MixerSamples => {
+ file => {
+ from => 'src/Mixer/Samples.xs',
+ to => 'lib/SDL/Mixer/Samples.xs',
+ },
+ libraries => [qw( SDL SDL_mixer )],
+ },
+ MixerChannels => {
+ file => {
+ from => 'src/Mixer/Channels.xs',
+ to => 'lib/SDL/Mixer/Channels.xs',
+ },
+ libraries => [qw( SDL SDL_mixer )],
+ },
+ MixerGroups => {
+ file => {
+ from => 'src/Mixer/Groups.xs',
+ to => 'lib/SDL/Mixer/Groups.xs',
+ },
+ libraries => [qw( SDL SDL_mixer )],
+ },
+ MixerMusic => {
+ file => {
+ from => 'src/Mixer/Music.xs',
+ to => 'lib/SDL/Mixer/Music.xs',
+ },
+ libraries => [qw( SDL SDL_mixer )],
+ },
+ MixerEffects => {
+ file => {
+ from => 'src/Mixer/Effects.xs',
+ to => 'lib/SDL/Mixer/Effects.xs',
+ },
+ libraries => [qw( SDL SDL_mixer )],
+ },
+ MixChunk => {
+ file => {
+ from => 'src/Mixer/objects/MixChunk.xs',
+ to => 'lib/SDL/Mixer/MixChunk.xs',
+ },
+ libraries => [qw( SDL SDL_mixer )],
+ },
+ MixMusic => {
+ file => {
+ from => 'src/Mixer/objects/MixMusic.xs',
+ to => 'lib/SDL/Mixer/MixMusic.xs',
+ },
+ libraries => [qw( SDL SDL_mixer )],
+ },
+ Palette => {
+ file => {
+ from => 'src/Core/objects/Palette.xs',
+ to => 'lib/SDL/Palette.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ VideoInfo => {
+ file => {
+ from => 'src/Core/objects/VideoInfo.xs',
+ to => 'lib/SDL/VideoInfo.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Mouse => {
+ file => {
+ from => 'src/Core/Mouse.xs',
+ to => 'lib/SDL/Mouse.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Cursor => {
+ file => {
+ from => 'src/Core/objects/Cursor.xs',
+ to => 'lib/SDL/Cursor.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Joystick => {
+ file => {
+ from => 'src/Core/Joystick.xs',
+ to => 'lib/SDL/Joystick.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ CDROM => {
+ file => {
+ from => 'src/Core/CDROM.xs',
+ to => 'lib/SDL/CDROM.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ CDTrack => {
+ file => {
+ from => 'src/Core/objects/CDTrack.xs',
+ to => 'lib/SDL/CDTrack.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ CD => {
+ file => {
+ from => 'src/Core/objects/CD.xs',
+ to => 'lib/SDL/CD.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ TTF => {
+ file => {
+ from => 'src/TTF/TTF.xs',
+ to => 'lib/SDL/TTF.xs',
+ },
+ libraries => [qw( SDL SDL_ttf )],
+ },
+ TTF_Font => {
+ file => {
+ from => 'src/TTF/objects/Font.xs',
+ to => 'lib/SDL/TTF/Font.xs',
+ },
+ libraries => [qw( SDL SDL_ttf )],
+ },
+ Version => {
+ file => {
+ from => 'src/Core/objects/Version.xs',
+ to => 'lib/SDL/Version.xs',
+ },
+ libraries => [qw( SDL )],
+ },
+ Image => {
+ file => {
+ from => 'src/Image.xs',
+ to => 'lib/SDL/Image.xs',
+ },
+ libraries => [qw( SDL SDL_image )],
+ },
+ SFont => {
+ file => {
+ from => 'src/SDLx/SFont.xs',
+ to => 'lib/SDLx/SFont.xs',
+ },
+ libraries => [qw( SDL SDL_image )],
+ },
-# SMPEG => {
-# file => {
-# from => 'src/SMPEG.xs',
-# to => 'lib/SDL/SMPEG.xs',
-# },
-# libraries => [qw( SDL smpeg)],
-# },
- Pango => {
- file => {
- from => 'src/Pango/Pango.xs',
- to => 'lib/SDL/Pango.xs',
- },
- libraries => [qw( SDL SDL_Pango )],
- },
- Context => {
- file => {
- from => 'src/Pango/objects/Context.xs',
- to => 'lib/SDL/Pango/Context.xs',
- },
- libraries => [qw( SDL SDL_Pango )],
- },
-# Net => {
-# file => {
-# from => 'src/Net/Net.xs',
-# to => 'lib/SDL/Net.xs',
-# },
-# libraries => [qw( SDL SDL_net )],
-# },
-# TCP => {
-# file => {
-# from => 'src/Net/TCP.xs',
-# to => 'lib/SDL/Net/TCP.xs',
-# },
-# libraries => [qw( SDL SDL_net )],
-# },
-# UDP => {
-# file => {
-# from => 'src/Net/UDP.xs',
-# to => 'lib/SDL/Net/UDP.xs',
-# },
-# libraries => [qw( SDL SDL_net )],
-# },
-# IPaddress => {
-# file => {
-# from => 'src/Net/objects/IPaddress.xs',
-# to => 'lib/SDL/Net/IPaddress.xs',
-# },
-# libraries => [qw( SDL SDL_net )],
-# },
+ # SMPEG => {
+ # file => {
+ # from => 'src/SMPEG.xs',
+ # to => 'lib/SDL/SMPEG.xs',
+ # },
+ # libraries => [qw( SDL smpeg)],
+ # },
+ Pango => {
+ file => {
+ from => 'src/Pango/Pango.xs',
+ to => 'lib/SDL/Pango.xs',
+ },
+ libraries => [qw( SDL SDL_Pango )],
+ },
+ Context => {
+ file => {
+ from => 'src/Pango/objects/Context.xs',
+ to => 'lib/SDL/Pango/Context.xs',
+ },
+ libraries => [qw( SDL SDL_Pango )],
+ },
+
+ # Net => {
+ # file => {
+ # from => 'src/Net/Net.xs',
+ # to => 'lib/SDL/Net.xs',
+ # },
+ # libraries => [qw( SDL SDL_net )],
+ # },
+ # TCP => {
+ # file => {
+ # from => 'src/Net/TCP.xs',
+ # to => 'lib/SDL/Net/TCP.xs',
+ # },
+ # libraries => [qw( SDL SDL_net )],
+ # },
+ # UDP => {
+ # file => {
+ # from => 'src/Net/UDP.xs',
+ # to => 'lib/SDL/Net/UDP.xs',
+ # },
+ # libraries => [qw( SDL SDL_net )],
+ # },
+ # IPaddress => {
+ # file => {
+ # from => 'src/Net/objects/IPaddress.xs',
+ # to => 'lib/SDL/Net/IPaddress.xs',
+ # },
+ # libraries => [qw( SDL SDL_net )],
+ # },
);
@@ -407,163 +407,165 @@ my %subsystems =
# <library name> = symbolic library name
# <define> = value that will be used as -D<value> option when compiling XS code
# <header> = header related to the library that will be used for avalability detection,
-# could be a sigle value or an array of values
+# could be a sigle value or an array of values
# <lib> = value that will be used as -l<value> option when linking XS code
my %libraries = (
- SDL => {
- define => 'HAVE_SDL',
- header => 'SDL.h',
- lib => 'SDL',
- },
- SDL_image => {
- define => 'HAVE_SDL_IMAGE',
- header => 'SDL_image.h',
- lib => 'SDL_image',
- },
- SDL_mixer => {
- define => 'HAVE_SDL_MIXER',
- header => 'SDL_mixer.h',
- lib => 'SDL_mixer',
- },
-# SDL_net => {
-# define => 'HAVE_SDL_NET',
-# header => 'SDL_net.h',
-# lib => 'SDL_net',
-# },
- SDL_ttf => {
- define => 'HAVE_SDL_TTF',
- header => 'SDL_ttf.h',
- lib => 'SDL_ttf',
- },
- SDL_gfx => {
- define => 'HAVE_SDL_GFX',
- header => 'SDL_gfxPrimitives.h',
- lib => 'SDL_gfx',
- },
- SDL_gfx_blitfunc => {
- define => 'HAVE_SDL_GFX_BLITFUNC',
- header => 'SDL_gfxBlitFunc.h',
- lib => 'SDL_gfx',
- },
- SDL_gfx_framerate => {
- define => 'HAVE_SDL_GFX_FRAMERATE',
- header => 'SDL_framerate.h',
- lib => 'SDL_gfx',
- },
- SDL_gfx_imagefilter => {
- define => 'HAVE_SDL_GFX_IMAGEFILTER',
- header => 'SDL_imageFilter.h',
- lib => 'SDL_gfx',
- },
- SDL_gfx_primitives => {
- define => 'HAVE_SDL_GFX_PRIMITIVES',
- header => 'SDL_gfxPrimitives.h',
- lib => 'SDL_gfx',
- },
- SDL_gfx_rotozoom => {
- define => 'HAVE_SDL_GFX_ROTOZOOM',
- header => 'SDL_rotozoom.h',
- lib => 'SDL_gfx',
- },
- SDL_Pango => {
- define => 'HAVE_SDL_PANGO',
- header => 'SDL_Pango.h',
- lib => 'SDL_Pango',
- },
- png => {
- define => 'HAVE_PNG',
- header => 'png.h',
- lib => 'png',
- },
- jpeg => {
- define => 'HAVE_JPEG',
- header => 'jpeglib.h',
- lib => 'jpeg',
- },
- tiff => {
- define => 'HAVE_TIFF',
- header => 'tiff.h',
- lib => 'tiff',
- },
+ SDL => {
+ define => 'HAVE_SDL',
+ header => 'SDL.h',
+ lib => 'SDL',
+ },
+ SDL_image => {
+ define => 'HAVE_SDL_IMAGE',
+ header => 'SDL_image.h',
+ lib => 'SDL_image',
+ },
+ SDL_mixer => {
+ define => 'HAVE_SDL_MIXER',
+ header => 'SDL_mixer.h',
+ lib => 'SDL_mixer',
+ },
+
+ # SDL_net => {
+ # define => 'HAVE_SDL_NET',
+ # header => 'SDL_net.h',
+ # lib => 'SDL_net',
+ # },
+ SDL_ttf => {
+ define => 'HAVE_SDL_TTF',
+ header => 'SDL_ttf.h',
+ lib => 'SDL_ttf',
+ },
+ SDL_gfx => {
+ define => 'HAVE_SDL_GFX',
+ header => 'SDL_gfxPrimitives.h',
+ lib => 'SDL_gfx',
+ },
+ SDL_gfx_blitfunc => {
+ define => 'HAVE_SDL_GFX_BLITFUNC',
+ header => 'SDL_gfxBlitFunc.h',
+ lib => 'SDL_gfx',
+ },
+ SDL_gfx_framerate => {
+ define => 'HAVE_SDL_GFX_FRAMERATE',
+ header => 'SDL_framerate.h',
+ lib => 'SDL_gfx',
+ },
+ SDL_gfx_imagefilter => {
+ define => 'HAVE_SDL_GFX_IMAGEFILTER',
+ header => 'SDL_imageFilter.h',
+ lib => 'SDL_gfx',
+ },
+ SDL_gfx_primitives => {
+ define => 'HAVE_SDL_GFX_PRIMITIVES',
+ header => 'SDL_gfxPrimitives.h',
+ lib => 'SDL_gfx',
+ },
+ SDL_gfx_rotozoom => {
+ define => 'HAVE_SDL_GFX_ROTOZOOM',
+ header => 'SDL_rotozoom.h',
+ lib => 'SDL_gfx',
+ },
+ SDL_Pango => {
+ define => 'HAVE_SDL_PANGO',
+ header => 'SDL_Pango.h',
+ lib => 'SDL_Pango',
+ },
+ png => {
+ define => 'HAVE_PNG',
+ header => 'png.h',
+ lib => 'png',
+ },
+ jpeg => {
+ define => 'HAVE_JPEG',
+ header => 'jpeglib.h',
+ lib => 'jpeg',
+ },
+ tiff => {
+ define => 'HAVE_TIFF',
+ header => 'tiff.h',
+ lib => 'tiff',
+ },
- smpeg => {
- define => 'HAVE_SMPEG',
- header => 'smpeg/smpeg.h',
- lib => 'smpeg',
- },
- GL => {
- define => 'HAVE_GL',
- header => [ 'GL/gl.h', 'GL/glext.h' ],
- lib => ($^O =~ /^(MSWin32|cygwin)$/) ? 'opengl32' : 'GL', # xxx not nice
- },
- GLU => {
- define => 'HAVE_GLU',
- header => 'GL/glu.h',
- lib => ($^O =~ /^(MSWin32|cygwin)$/) ? 'glu32' : 'GLU', # xxx not nice
- },
+ smpeg => {
+ define => 'HAVE_SMPEG',
+ header => 'smpeg/smpeg.h',
+ lib => 'smpeg',
+ },
+ GL => {
+ define => 'HAVE_GL',
+ header => [ 'GL/gl.h', 'GL/glext.h' ],
+ lib => ( $^O =~ /^(MSWin32|cygwin)$/ )
+ ? 'opengl32'
+ : 'GL', # xxx not nice
+ },
+ GLU => {
+ define => 'HAVE_GLU',
+ header => 'GL/glu.h',
+ lib => ( $^O =~ /^(MSWin32|cygwin)$/ ) ? 'glu32' : 'GLU', # xxx not nice
+ },
);
### mangle the compilable files into a format Module::Build can understand
-my %xs = map { $subsystems{$_}{file}{from} => $subsystems{$_}{file}{to} } keys %subsystems;
+my %xs =
+ map { $subsystems{$_}{file}{from} => $subsystems{$_}{file}{to} }
+ keys %subsystems;
### stadard Module::Build stuff
my $build = $package->new(
- module_name => 'SDL',
- dist_name => 'SDL',
- license => 'lgpl',
- dist_version_from => 'lib/SDL.pm',
- configure_requires =>
- {
- 'ExtUtils::CBuilder' => '0.260301',
- 'Alien::SDL' => '1.410',
- 'File::Find' => '0',
- 'File::ShareDir' => '0',
+ module_name => 'SDL',
+ dist_name => 'SDL',
+ license => 'lgpl',
+ dist_version_from => 'lib/SDL.pm',
+ configure_requires => {
+ 'ExtUtils::CBuilder' => '0.260301',
+ 'Alien::SDL' => '1.410',
+ 'File::Find' => '0',
+ 'File::ShareDir' => '0',
+
+ },
+ build_requires => {
+ 'Test::Simple' => '0.88',
+ 'IO::CaptureOutput' => '0',
+ 'Test::Most' => '0.21',
+ 'Alien::SDL' => '1.410',
+ 'File::ShareDir' => '0',
+ 'Tie::Simple' => '0'
+ },
+ build_recommends => {
+ 'Pod::ToDemo' => '0.20'
- },
- build_requires =>
- {
- 'Test::Simple' => '0.88',
- 'IO::CaptureOutput' => '0',
- 'Test::Most' => '0.21',
- 'Alien::SDL' => '1.410',
- 'File::ShareDir' => '0',
- 'Tie::Simple' => '0'
- },
- build_recommends =>
- {
- 'Pod::ToDemo' => '0.20'
+ },
+ c_source => 'src',
+ xs_files => \%xs,
+ meta_add => {},
- },
- c_source => 'src',
- xs_files => \%xs,
- meta_add =>
- {
- },
- #create_readme => 1, ### make sense only if there is some POD doc in the file specified by dist_version_from
- meta_merge => {
- resources => {
- bugtracker => 'http://sdlperl.ath.cx/projects/SDLPerl',
- repository => 'http://github.com/kthakore/SDL_perl'
- }
- },
- dist_abstract => 'SDL bindings to Perl',
- dist_author => 'Kartik Thakore <KTHAKORE@cpan.org>',
+#create_readme => 1, ### make sense only if there is some POD doc in the file specified by dist_version_from
+ meta_merge => {
+ resources => {
+ bugtracker => 'http://sdlperl.ath.cx/projects/SDLPerl',
+ repository => 'http://github.com/kthakore/SDL_perl'
+ }
+ },
+ dist_abstract => 'SDL bindings to Perl',
+ dist_author => 'Kartik Thakore <KTHAKORE@cpan.org>',
);
### Alien::SDL quick check
-warn "###WARNING### Alien::SDL seems to be broken" unless Alien::SDL->config('prefix');
+warn "###WARNING### Alien::SDL seems to be broken"
+ unless Alien::SDL->config('prefix');
### see which subsystems can be built -- do we have headers for them?
print "Gonna autodetect available libraries ...\n";
-my $build_systems = $build->find_subsystems(\%subsystems, \%libraries);
-my $lib_translate = $build->translate_table(\%subsystems, \%libraries);
+my $build_systems = $build->find_subsystems( \%subsystems, \%libraries );
+my $lib_translate = $build->translate_table( \%subsystems, \%libraries );
### save info about available subsystems for future SDL::ConfigData
print "Gonna write config_data ...\n";
-$build->config_data('SDL_cfg', $build_systems);
-$build->config_data('SDL_lib_translate', $lib_translate);
-$build->config_data('subsystems', \%subsystems);
-$build->config_data('libraries', \%libraries);
+$build->config_data( 'SDL_cfg', $build_systems );
+$build->config_data( 'SDL_lib_translate', $lib_translate );
+$build->config_data( 'subsystems', \%subsystems );
+$build->config_data( 'libraries', \%libraries );
### something that was originally special to MacOS/Darwin
# somebody MacOS/Darwin friendly should review whether it is still necessary
@@ -571,12 +573,12 @@ $build->special_build_settings();
### get some info into M::B notes
print "Gonna save some info to 'notes' ...\n";
-$build->notes('subsystems', \%subsystems);
-$build->notes('libraries', \%libraries);
-$build->notes('build_systems', $build_systems);
-$build->notes('sdl_cflags', Alien::SDL->config('cflags'));
-$build->notes('sdl_libs', Alien::SDL->config('libs'));
-$build->set_file_flags(); # creates notes('file_flags')
+$build->notes( 'subsystems', \%subsystems );
+$build->notes( 'libraries', \%libraries );
+$build->notes( 'build_systems', $build_systems );
+$build->notes( 'sdl_cflags', Alien::SDL->config('cflags') );
+$build->notes( 'sdl_libs', Alien::SDL->config('libs') );
+$build->set_file_flags(); # creates notes('file_flags')
# now we're ready to go!
$build->create_build_script();
View
58 examples/GFX/script_roto.pl
@@ -9,57 +9,51 @@
use SDL::Surface;
use SDL::GFX::Rotozoom;
-my $display = SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE );
-my $pixel = SDL::Video::map_RGB( $display->format, 0, 0, 0 );
-SDL::Video::fill_rect( $display, SDL::Rect->new( 0, 0, $display->w, $display->h ), $pixel );
-
-
- croak SDL::get_error if !$display;
+my $display = SDL::Video::set_video_mode( 640, 480, 32, SDL_SWSURFACE );
+my $pixel = SDL::Video::map_RGB( $display->format, 0, 0, 0 );
+SDL::Video::fill_rect( $display,
+ SDL::Rect->new( 0, 0, $display->w, $display->h ), $pixel );
+croak SDL::get_error if !$display;
my $src = SDL::Video::load_BMP('test/data/picture.bmp');
my $temp_surf;
-sub draw
-{
-SDL::Video::fill_rect( $display, SDL::Rect->new( 0, 0, $display->w, $display->h ), $pixel );
+sub draw {
+ SDL::Video::fill_rect( $display,
+ SDL::Rect->new( 0, 0, $display->w, $display->h ), $pixel );
- my $surface = $_[0];
- SDL::Video::blit_surface( $surface, SDL::Rect->new( 0, 0, $surface->w, $surface->h ),
- $display, SDL::Rect->new(0, 0, $display->w, $display->w)
- );
+ my $surface = $_[0];
+ SDL::Video::blit_surface(
+ $surface, SDL::Rect->new( 0, 0, $surface->w, $surface->h ),
+ $display, SDL::Rect->new( 0, 0, $display->w, $display->w )
+ );
+ SDL::Video::update_rect( $display, 0, 0, 640, 480 );
-SDL::Video::update_rect($display, 0, 0, 640, 480);
-
-SDL::delay($_[1]) if $_[1];
+ SDL::delay( $_[1] ) if $_[1];
}
# Note: new surface should be less than 16384 in width and height
-foreach(1..360)
-{
-
-$temp_surf=SDL::GFX::Rotozoom::surface($src, $_, $_/180, 1);
-croak SDL::get_error if !$temp_surf;
- draw($temp_surf, 2);
+foreach ( 1 .. 360 ) {
+
+ $temp_surf = SDL::GFX::Rotozoom::surface( $src, $_, $_ / 180, 1 );
+ croak SDL::get_error if !$temp_surf;
+ draw( $temp_surf, 2 );
}
-$temp_surf=SDL::GFX::Rotozoom::surface_xy($src, 1, 1, 1, 1);
+$temp_surf = SDL::GFX::Rotozoom::surface_xy( $src, 1, 1, 1, 1 );
croak SDL::get_error if !$temp_surf;
- draw($temp_surf, 1000);
+draw( $temp_surf, 1000 );
-$temp_surf=SDL::GFX::Rotozoom::zoom_surface($src, 1, 1, 1);
+$temp_surf = SDL::GFX::Rotozoom::zoom_surface( $src, 1, 1, 1 );
croak SDL::get_error if !$temp_surf;
- draw($temp_surf, 1000);
+draw( $temp_surf, 1000 );
-$temp_surf=SDL::GFX::Rotozoom::shrink_surface($src, 1, 1);
+$temp_surf = SDL::GFX::Rotozoom::shrink_surface( $src, 1, 1 );
croak SDL::get_error if !$temp_surf;
- draw($temp_surf, 1000);
-
-
-
+draw( $temp_surf, 1000 );
SDL::delay(1000);
-
View
54 examples/SDLx/SDLx_controller_two_squares.pl
@@ -1,12 +1,12 @@
use strict;
use warnings;
use Carp;
-use SDL ;
-use SDL::Video ;
+use SDL;
+use SDL::Video;
use SDL::Surface;
use SDL::Rect;
use SDL::Event;
-use SDL::Events ;
+use SDL::Events;
use Data::Dumper;
use Math::Trig;
@@ -27,15 +27,15 @@
};
my $r_ball = {
- x => 0,
- y => 0,
- w => 20,
- h => 20,
+ x => 0,
+ y => 0,
+ w => 20,
+ h => 20,
radians => 0,
rot_vel => 50,
radius => 100,
- c_x => $app->w/2,
- c_y => $app->h/2,
+ c_x => $app->w / 2,
+ c_y => $app->h / 2,
};
sub init {
@@ -64,12 +64,14 @@ sub on_move {
$ball->{x} += $ball->{x_vel} * $dt;
$ball->{y} += $ball->{y_vel} * $dt;
-
+
# Period = $r_ball->{vel}
- # cc_speed = 2 * pi * r / T
+ # cc_speed = 2 * pi * r / T
$r_ball->{radians} += $r_ball->{rot_vel} * $dt;
- $r_ball->{x} = $r_ball->{c_x} + sin( $r_ball->{radians} * pi / 180 ) * $r_ball->{radius};
- $r_ball->{y} = $r_ball->{c_y} + cos( $r_ball->{radians} * pi / 180 ) * $r_ball->{radius};
+ $r_ball->{x} =
+ $r_ball->{c_x} + sin( $r_ball->{radians} * pi / 180 ) * $r_ball->{radius};
+ $r_ball->{y} =
+ $r_ball->{c_y} + cos( $r_ball->{radians} * pi / 180 ) * $r_ball->{radius};
return 1;
}
@@ -79,18 +81,22 @@ sub on_event {
if ( $event->type == SDL_KEYDOWN ) {
my $key = $event->key_sym;
- if($key == SDLK_PRINT)
- {
- my $screen_shot_index = 1;
- map{$screen_shot_index = $1 + 1 if $_ =~ /Shot(\d+)\.bmp/ && $1 >= $screen_shot_index} <Shot*\.bmp>;
- SDL::Video::save_BMP($app, sprintf("Shot%04d.bmp", $screen_shot_index ));
- }
+ if ( $key == SDLK_PRINT ) {
+ my $screen_shot_index = 1;
+ map {
+ $screen_shot_index = $1 + 1
+ if $_ =~ /Shot(\d+)\.bmp/
+ && $1 >= $screen_shot_index
+ } <Shot*\.bmp>;
+ SDL::Video::save_BMP( $app,
+ sprintf( "Shot%04d.bmp", $screen_shot_index ) );
+ }
$ball->{y_vel} -= $ball->{vel} if $key == SDLK_UP;
$ball->{y_vel} += $ball->{vel} if $key == SDLK_DOWN;
$ball->{x_vel} -= $ball->{vel} if $key == SDLK_LEFT;
$ball->{x_vel} += $ball->{vel} if $key == SDLK_RIGHT;
$r_ball->{rot_vel} += 50 if $key == SDLK_SPACE;
-
+
}
elsif ( $event->type == SDL_KEYUP ) {
my $key = $event->key_sym;
@@ -98,7 +104,7 @@ sub on_event {
$ball->{y_vel} -= $ball->{vel} if $key == SDLK_DOWN;
$ball->{x_vel} += $ball->{vel} if $key == SDLK_LEFT;
$ball->{x_vel} -= $ball->{vel} if $key == SDLK_RIGHT;
-
+
}
elsif ( $event->type == SDL_QUIT ) {
return 0;
@@ -119,10 +125,12 @@ sub on_show {
SDL::Rect->new( $ball->{x}, $ball->{y}, $ball->{w}, $ball->{h} ),
SDL::Video::map_RGB( $app->format, 0, 0, 255 )
);
-
+
SDL::Video::fill_rect(
$app,
- SDL::Rect->new( $r_ball->{x}, $r_ball->{y}, $r_ball->{w}, $r_ball->{h} ),
+ SDL::Rect->new(
+ $r_ball->{x}, $r_ball->{y}, $r_ball->{w}, $r_ball->{h}
+ ),
SDL::Video::map_RGB( $app->format, 255, 0, 0 )
);
View
43 examples/SDLx/SDLx_sprite.pl
@@ -8,31 +8,36 @@
use lib '../lib';
use SDLx::Sprite;
+SDL::init(SDL_INIT_VIDEO);
+my $disp = SDL::Video::set_video_mode( 300, 300, 32, SDL_ANYFORMAT );
-SDL::init(SDL_INIT_VIDEO);
+my $pixel =
+ SDL::Video::map_RGB( $disp->format, rand(255), rand(255), rand(255) );
+SDL::Video::fill_rect( $disp, SDL::Rect->new( 0, 0, $disp->w, $disp->h ),
+ $pixel );
-my $disp = SDL::Video::set_video_mode( 300, 300, 32, SDL_ANYFORMAT);
+my $sprite = SDLx::Sprite->new( image => 'test/data/chest.png' );
-my $pixel = SDL::Video::map_RGB( $disp->format, rand(255), rand(255), rand(255) );
-SDL::Video::fill_rect( $disp, SDL::Rect->new( 0, 0, $disp->w, $disp->h ), $pixel );
+$sprite->alpha_key( SDL::Color->new( 0xfc, 0x00, 0xff ) );
+$sprite->alpha(0.8);
+my $angle = 0;
+while ( $angle++ < 360 ) {
+ SDL::Video::fill_rect( $disp, SDL::Rect->new( 0, 0, $disp->w, $disp->h ),
+ $pixel );
-my $sprite = SDLx::Sprite->new(image=>'test/data/chest.png');
-
- $sprite->alpha_key(SDL::Color->new(0xfc, 0x00, 0xff));
- $sprite->alpha(0.8);
+ $sprite->rotation($angle);
- my $angle = 0;
- while ($angle++ < 360) {
- SDL::Video::fill_rect( $disp, SDL::Rect->new( 0, 0, $disp->w, $disp->h ), $pixel );
-
- $sprite->rotation($angle);
-#
- $sprite->draw_xy($disp, $disp->w / 2 - ($sprite->w / 2), $disp->h / 2 - ($sprite->h / 2) );
+ #
+ $sprite->draw_xy(
+ $disp,
+ $disp->w / 2 - ( $sprite->w / 2 ),
+ $disp->h / 2 - ( $sprite->h / 2 )
+ );
- SDL::Video::update_rect($disp, 0, 0, 300,300);
+ SDL::Video::update_rect( $disp, 0, 0, 300, 300 );
- SDL::delay( 2 );
- }
- SDL::delay( 2000 );
+ SDL::delay(2);
+}
+SDL::delay(2000);
View
55 examples/SDLx/SDLx_sprite_animated.pl
@@ -8,37 +8,36 @@
use SDLx::Sprite::Animated;
-
-
SDL::init(SDL_INIT_VIDEO);
-my $disp = SDL::Video::set_video_mode( 300, 300, 32, SDL_ANYFORMAT);
-
-my $pixel = SDL::Video::map_RGB( $disp->format, 0, 0, 0 );
-SDL::Video::fill_rect( $disp, SDL::Rect->new( 0, 0, $disp->w, $disp->h ), $pixel );
+my $disp = SDL::Video::set_video_mode( 300, 300, 32, SDL_ANYFORMAT );
+my $pixel = SDL::Video::map_RGB( $disp->format, 0, 0, 0 );
+SDL::Video::fill_rect( $disp, SDL::Rect->new( 0, 0, $disp->w, $disp->h ),
+ $pixel );
my $sprite = SDLx::Sprite::Animated->new(
- image => 'test/data/hero.png',
- rect => SDL::Rect->new(48,0,48,48),
- ticks_per_frame => 6,
- );
- $sprite->set_sequences(
- left => [ [ 1, 0 ], [1,1], [1,2] ],
- );
- $sprite->alpha_key(SDL::Color->new(0xfc, 0x00, 0xff));
- $sprite->current_sequence('left');
- $sprite->start();
- my $x = 0; my $ticks = 0;
- while ($x++ < 30) {
- SDL::Video::fill_rect( $disp, SDL::Rect->new( 0, 0, $disp->w, $disp->h ), $pixel );
-
- $sprite->x($x * 10);
- $sprite->next();
- $sprite->draw($disp);
-
- SDL::Video::update_rect($disp, 0, 0, 0, 0);
-
- SDL::delay( 100 );
- }
+ image => 'test/data/hero.png',
+ rect => SDL::Rect->new( 48, 0, 48, 48 ),
+ ticks_per_frame => 6,
+);
+$sprite->set_sequences( left => [ [ 1, 0 ], [ 1, 1 ], [ 1, 2 ] ], );
+$sprite->alpha_key( SDL::Color->new( 0xfc, 0x00, 0xff ) );
+$sprite->current_sequence('left');
+$sprite->start();
+my $x = 0;
+my $ticks = 0;
+
+while ( $x++ < 30 ) {
+ SDL::Video::fill_rect( $disp, SDL::Rect->new( 0, 0, $disp->w, $disp->h ),
+ $pixel );
+
+ $sprite->x( $x * 10 );
+ $sprite->next();
+ $sprite->draw($disp);
+
+ SDL::Video::update_rect( $disp, 0, 0, 0, 0 );
+
+ SDL::delay(100);
+}
View
123 examples/SDLx/pong.pl
@@ -2,11 +2,11 @@
use warnings;
use Carp;
use SDL;
-use SDL::Video ;
+use SDL::Video;
use SDL::Surface;
use SDL::Rect;
use SDL::Event;
-use SDL::Events ;
+use SDL::Events;
use Data::Dumper;
use Math::Trig;
@@ -24,7 +24,6 @@
y_vel => 0,
};
-
my $paddle2 = {
x => $app->w - 20,
y => 0,
@@ -35,40 +34,39 @@
};
my $r_ball = {
- x => $app->w /2,
- y => $app->w /2,
+ x => $app->w / 2,
+ y => $app->w / 2,
w => 20,
h => 20,
- x_vel => ( 150 ),
- y_vel => ( 150 ),
+ x_vel => (150),
+ y_vel => (150),
};
sub ball_confine {
- my ($w,$h,$x,$y, $ws, $hs) = @_;
+ my ( $w, $h, $x, $y, $ws, $hs ) = @_;
- my ($m_x,$m_y) = (1,1);
+ my ( $m_x, $m_y ) = ( 1, 1 );
$m_x = -1 if $x + $ws >= $w || $x <= 0;
$m_y = -1 if $y + $hs >= $h || $y <= 0;
- return [$m_x,$m_y];
+ return [ $m_x, $m_y ];
}
-
+
sub paddle_confine {
- #return if $_[0]->{y_vel} == 0;
- my ($p, $dt, $h) = @_;
- if ($p->{y} < 0 )
- {
- $p->{y} = 2;
- return;
- }
- elsif ( $p->{y} + $p->{h} + 2 > $h)
- {
- $p->{y} = $h - $p->{h} -2;
- return;
- }
-
- $p->{y} += $p->{y_vel} * $dt;
-}
+
+ #return if $_[0]->{y_vel} == 0;
+ my ( $p, $dt, $h ) = @_;
+ if ( $p->{y} < 0 ) {
+ $p->{y} = 2;
+ return;
+ }
+ elsif ( $p->{y} + $p->{h} + 2 > $h ) {
+ $p->{y} = $h - $p->{h} - 2;
+ return;
+ }
+
+ $p->{y} += $p->{y_vel} * $dt;
+}
sub init {
@@ -88,29 +86,33 @@ sub init {
return $a;
}
-my $game = SDLx::Controller->new( dt=> 0.1);
+my $game = SDLx::Controller->new( dt => 0.1 );
sub on_move {
my $dt = shift;
$dt = $dt / 1000;
- paddle_confine($paddle, $dt, $app->h);
- paddle_confine($paddle2, $dt, $app->h);
+ paddle_confine( $paddle, $dt, $app->h );
+ paddle_confine( $paddle2, $dt, $app->h );
+
# Period = $r_ball->{vel}
-
- # cc_speed = 2 * pi * r / T
-
- my $transform = ball_confine( $app->w, $app->h, $r_ball->{x} , $r_ball->{y}, $r_ball->{w}, $r_ball->{h} );
- $r_ball->{x_vel } *= $transform->[0];
- $r_ball->{y_vel } *= $transform->[1];
- $r_ball->{x} += $r_ball->{x_vel } * $dt;
- $r_ball->{y} += $r_ball->{y_vel } * $dt;
+ # cc_speed = 2 * pi * r / T
+
+ my $transform = ball_confine(
+ $app->w, $app->h, $r_ball->{x},
+ $r_ball->{y}, $r_ball->{w}, $r_ball->{h}
+ );
+ $r_ball->{x_vel} *= $transform->[0];
+ $r_ball->{y_vel} *= $transform->[1];
+
+ $r_ball->{x} += $r_ball->{x_vel} * $dt;
+ $r_ball->{y} += $r_ball->{y_vel} * $dt;
# "AI" for the other paddle
- if ($r_ball->{y} > $paddle2->{y}) {
+ if ( $r_ball->{y} > $paddle2->{y} ) {
$paddle2->{y_vel} = $paddle2->{vel};
}
- elsif ($r_ball->{y} < $paddle2->{y}) {
+ elsif ( $r_ball->{y} < $paddle2->{y} ) {
$paddle2->{y_vel} = -1 * $paddle2->{vel};
}
else {
@@ -125,16 +127,20 @@ sub on_event {
if ( $event->type == SDL_KEYDOWN ) {
my $key = $event->key_sym;
- if($key == SDLK_PRINT)
- {
- my $screen_shot_index = 1;
- map{$screen_shot_index = $1 + 1 if $_ =~ /Shot(\d+)\.bmp/ && $1 >= $screen_shot_index} <Shot*\.bmp>;
- SDL::Video::save_BMP($app, sprintf("Shot%04d.bmp", $screen_shot_index ));
- }
+ if ( $key == SDLK_PRINT ) {
+ my $screen_shot_index = 1;
+ map {
+ $screen_shot_index = $1 + 1
+ if $_ =~ /Shot(\d+)\.bmp/
+ && $1 >= $screen_shot_index
+ } <Shot*\.bmp>;
+ SDL::Video::save_BMP( $app,
+ sprintf( "Shot%04d.bmp", $screen_shot_index ) );
+ }
$paddle->{y_vel} -= $paddle->{vel} if $key == SDLK_UP;
$paddle->{y_vel} += $paddle->{vel} if $key == SDLK_DOWN;
$r_ball->{rot_vel} += 50 if $key == SDLK_SPACE;
-
+
}
elsif ( $event->type == SDL_KEYUP ) {
my $key = $event->key_sym;
@@ -152,17 +158,19 @@ sub on_event {
# New subroutine "show_paddle" extracted - Thu Mar 18 15:28:02 2010.
#
sub show_paddle {
- my $app = shift;
+ my $app = shift;
my $paddle = shift;
SDL::Video::fill_rect(
$app,
- SDL::Rect->new( $paddle->{x}, $paddle->{y}, $paddle->{w}, $paddle->{h} ),
+ SDL::Rect->new(
+ $paddle->{x}, $paddle->{y}, $paddle->{w}, $paddle->{h}
+ ),
SDL::Video::map_RGB( $app->format, 0, 0, 255 )
);
return ();
-}
+}
sub on_show {
SDL::Video::fill_rect(
@@ -170,19 +178,18 @@ sub on_show {
SDL::Rect->new( 0, 0, $app->w, $app->h ),
SDL::Video::map_RGB( $app->format, 0, 0, 0 )
);
-
-
- show_paddle ($app, $paddle);
-
- show_paddle ($app, $paddle2);
-
+
+ show_paddle( $app, $paddle );
+
+ show_paddle( $app, $paddle2 );
+
SDL::Video::fill_rect(
$app,
- SDL::Rect->new( $r_ball->{x}, $r_ball->{y}, $r_ball->{w}, $r_ball->{h} ),
+ SDL::Rect->new(
+ $r_ball->{x}, $r_ball->{y}, $r_ball->{w}, $r_ball->{h}
+ ),
SDL::Video::map_RGB( $app->format, 255, 0, 0 )
);
-
-
SDL::Video::flip($app);
View
269 examples/adventure/adventure.pl
@@ -7,12 +7,12 @@
# - why isn't it bliting correctly with transparent sprite background?
#
# - work with loading background tiles (world map)
-#
+#
# - making the "world" bigger than the display window and let it scroll.
# the "world" should scroll centering the player, unless the player is
# close enough to a borderline, in which case is the player who actually
# moves
-#
+#
# - quick menu creation
#
# - quick text dialog creation (with picture)
@@ -37,89 +37,104 @@ package Walker;
use SDL::Surface;
use SDL::Color;
-sub wtf
-{
- my $app = shift;
+sub wtf {
+ my $app = shift;
- my $format = $app->format;
- my $pixel = SDL::Video::map_RGB($format, 0xfc, 0x00, 0xff);
- SDL::Video::fill_rect($app, SDL::Rect->new(0, 0, $app->w, $app->h), $pixel );
+ my $format = $app->format;
+ my $pixel = SDL::Video::map_RGB( $format, 0xfc, 0x00, 0xff );
+ SDL::Video::fill_rect( $app, SDL::Rect->new( 0, 0, $app->w, $app->h ),
+ $pixel );
}
-
sub new {
my $class = shift;
- my ($width, $height) = (48, 48);
-
- my $sprite = SDL::Image::load( 'data/hero.png');
- die 'SDL::Image::load of data/hero.png fail'. SDL::get_error if !($sprite);
- $sprite =SDL::Video::display_format($sprite);
- my $pixel = SDL::Color->new(0xfc, 0x00, 0xff );
- SDL::Video::set_color_key($sprite, SDL_SRCCOLORKEY, $pixel);
+ my ( $width, $height ) = ( 48, 48 );
+
+ my $sprite = SDL::Image::load('data/hero.png');
+ die 'SDL::Image::load of data/hero.png fail' . SDL::get_error if !($sprite);
+ $sprite = SDL::Video::display_format($sprite);
+ my $pixel = SDL::Color->new( 0xfc, 0x00, 0xff );
+ SDL::Video::set_color_key( $sprite, SDL_SRCCOLORKEY, $pixel );
my $self = {
'direction' => undef,
- 'source' => $sprite,
- 'up' => [
- # we go down...
- SDL::Rect->new(0, 0, $width, $height),
- SDL::Rect->new(0, 0 + $height, $width, $height),
- SDL::Rect->new(0, 0 + (2 * $height), $width, $height),
- # then we go back...
- SDL::Rect->new(0, 0 + $height, $width, $height),
- ],
- 'right' => [
- # we go down...
- SDL::Rect->new($width, 0, $width, $height),
- SDL::Rect->new($width, 0 + $height, $width, $height),
- SDL::Rect->new($width, 0 + (2 * $height), $width, $height),
- # then we go back...
- SDL::Rect->new($width, 0 + $height, $width, $height),
- ],
- 'down' => [
- # we go down...
- SDL::Rect->new((2 * $width), 0, $width, $height),
- SDL::Rect->new((2 * $width), 0 + $height, $width, $height),
- SDL::Rect->new((2 * $width), 0 + (2 * $height), $width, $height),
- # then we go back...
- SDL::Rect->new((2 * $width), 0 + $height, $width, $height),
- ],
- 'left' => [
- # we go down...
- SDL::Rect->new((3 * $width), 0, $width, $height),
- SDL::Rect->new((3 * $width), 0 + $height, $width, $height),
- SDL::Rect->new((3 * $width), 0 + (2 * $height), $width, $height),
- # then we go back...
- SDL::Rect->new((3 * $width), 0 + $height, $width, $height),
- ],
+ 'source' => $sprite,
+ 'up' => [
+
+ # we go down...
+ SDL::Rect->new( 0, 0, $width, $height ),
+ SDL::Rect->new( 0, 0 + $height, $width, $height ),
+ SDL::Rect->new( 0, 0 + ( 2 * $height ), $width, $height ),
+
+ # then we go back...
+ SDL::Rect->new( 0, 0 + $height, $width, $height ),
+ ],
+ 'right' => [
+
+ # we go down...
+ SDL::Rect->new( $width, 0, $width, $height ),
+ SDL::Rect->new( $width, 0 + $height, $width, $height ),
+ SDL::Rect->new( $width, 0 + ( 2 * $height ), $width, $height ),
+
+ # then we go back...
+ SDL::Rect->new( $width, 0 + $height, $width, $height ),
+ ],
+ 'down' => [
+
+ # we go down...
+ SDL::Rect->new( ( 2 * $width ), 0, $width, $height ),
+ SDL::Rect->new( ( 2 * $width ), 0 + $height, $width, $height ),
+ SDL::Rect->new(
+ ( 2 * $width ),
+ 0 + ( 2 * $height ),
+ $width, $height
+ ),
+
+ # then we go back...
+ SDL::Rect->new( ( 2 * $width ), 0 + $height, $width, $height ),
+ ],
+ 'left' => [
+
+ # we go down...
+ SDL::Rect->new( ( 3 * $width ), 0, $width, $height ),
+ SDL::Rect->new( ( 3 * $width ), 0 + $height, $width, $height ),
+ SDL::Rect->new(
+ ( 3 * $width ),
+ 0 + ( 2 * $height ),
+ $width, $height
+ ),
+
+ # then we go back...
+ SDL::Rect->new( ( 3 * $width ), 0 + $height, $width, $height ),
+ ],
};
bless $self, $class;
return $self;
}
-sub blit { SDL::Video::blit_surface(shift->{'source'} ,@_) }
+sub blit { SDL::Video::blit_surface( shift->{'source'}, @_ ) }
# accessor for direction attribute
-sub direction {
+sub direction {
my $self = shift;
$self->{'direction'} = shift if (@_);
return $self->{'direction'};
}
sub current {
- my $self = shift;
+ my $self = shift;
my $direction = $self->{direction};
return $self->{$direction}->[0];
}
sub move {
- my $self = shift;
+ my $self = shift;
my $direction = $self->{direction};
-
+
# cycle the rects around, grabbing a copy
# of current animation
- my $rect = shift @{$self->{$direction}};
- push @{$self->{$direction}}, $rect;
-
+ my $rect = shift @{ $self->{$direction} };
+ push @{ $self->{$direction} }, $rect;
+
return $rect;
}
@@ -134,117 +149,111 @@ package main;
use SDL::Color;
# change these values as necessary
-my $title = 'Keldar Chronicles';
-my ($width, $height, $depth) = ( 640, 480, 16 );
-my ($bg_r, $bg_g, $bg_b) = ( 0x77, 0xee, 0x77 );
-my $sleep_msec = 0.05;
+my $title = 'Keldar Chronicles';
+my ( $width, $height, $depth ) = ( 640, 480, 16 );
+my ( $bg_r, $bg_g, $bg_b ) = ( 0x77, 0xee, 0x77 );