rubysdl 1.3.1 → 2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/MANIFEST +22 -2
  2. data/NEWS.en +80 -0
  3. data/NEWS.ja +83 -0
  4. data/README.en +2 -1
  5. data/README.ja +2 -2
  6. data/doc-en/Makefile +18 -0
  7. data/doc-en/cdrom.rsd +417 -0
  8. data/doc-en/collision.rsd +174 -0
  9. data/doc-en/event.rsd +1476 -0
  10. data/doc-en/font.rsd +811 -0
  11. data/doc-en/general.rsd +43 -0
  12. data/doc-en/init.rsd +168 -0
  13. data/doc-en/joystick.rsd +401 -0
  14. data/doc-en/mixer.rsd +869 -0
  15. data/doc-en/mpeg.rsd +585 -0
  16. data/doc-en/opengl.rsd +155 -0
  17. data/doc-en/sdlskk.rsd +472 -0
  18. data/doc-en/time.rsd +46 -0
  19. data/doc-en/video.rsd +2806 -0
  20. data/doc-en/wm.rsd +112 -0
  21. data/doc/Makefile +1 -1
  22. data/doc/cdrom.rsd +3 -3
  23. data/doc/event.rsd +178 -179
  24. data/doc/general.rsd +10 -0
  25. data/doc/init.rsd +2 -2
  26. data/doc/joystick.rsd +29 -5
  27. data/doc/mixer.rsd +20 -0
  28. data/doc/rsd.rb +42 -9
  29. data/doc/sdlskk.rsd +7 -7
  30. data/doc/video.rsd +461 -168
  31. data/doc/wm.rsd +2 -2
  32. data/extconf.rb +1 -8
  33. data/lib/rubysdl_aliases.rb +52 -190
  34. data/lib/rubysdl_compatible_ver1.rb +243 -0
  35. data/lib/sdl.rb +58 -92
  36. data/rubysdl.h +59 -68
  37. data/rubysdl_cdrom.c +125 -102
  38. data/{rubysdl_doc.en.rd → rubysdl_doc_old.en.rd} +3 -2
  39. data/rubysdl_event.c +318 -255
  40. data/rubysdl_event_key.c +299 -287
  41. data/rubysdl_image.c +37 -13
  42. data/rubysdl_joystick.c +180 -67
  43. data/rubysdl_kanji.c +61 -75
  44. data/rubysdl_main.c +65 -138
  45. data/rubysdl_mixer.c +339 -214
  46. data/rubysdl_mouse.c +50 -43
  47. data/rubysdl_opengl.c +31 -28
  48. data/rubysdl_pixel.c +17 -28
  49. data/rubysdl_ref.en.html +5658 -0
  50. data/rubysdl_ref.en.rd +6337 -0
  51. data/rubysdl_ref.html +2253 -1964
  52. data/rubysdl_ref.rd +823 -469
  53. data/rubysdl_rwops.c +9 -6
  54. data/rubysdl_sdlskk.c +137 -165
  55. data/rubysdl_sge_video.c +355 -469
  56. data/rubysdl_smpeg.c +189 -190
  57. data/rubysdl_time.c +1 -1
  58. data/rubysdl_ttf.c +147 -215
  59. data/rubysdl_video.c +486 -405
  60. data/rubysdl_wm.c +30 -30
  61. data/sample/aadraw.rb +9 -9
  62. data/sample/alpha.rb +12 -13
  63. data/sample/alphadraw.rb +10 -10
  64. data/sample/bfont.rb +4 -4
  65. data/sample/cdrom.rb +11 -4
  66. data/sample/collision.rb +20 -20
  67. data/sample/cursor.rb +5 -5
  68. data/sample/ellipses.rb +20 -16
  69. data/sample/event2.rb +11 -9
  70. data/sample/font.rb +4 -4
  71. data/sample/fpstimer.rb +3 -3
  72. data/sample/icon.bmp.gz +0 -0
  73. data/sample/icon.png +0 -0
  74. data/sample/joy2.rb +14 -14
  75. data/sample/kanji.rb +7 -7
  76. data/sample/load_from_io.rb +44 -0
  77. data/sample/movesp.rb +13 -12
  78. data/sample/playmod.rb +2 -3
  79. data/sample/plaympeg.rb +8 -8
  80. data/sample/playwave.rb +5 -6
  81. data/sample/sdlskk.rb +11 -11
  82. data/sample/sgetest.rb +14 -12
  83. data/sample/stetris.rb +12 -13
  84. data/sample/testgl.rb +13 -14
  85. data/sample/testsprite.rb +12 -11
  86. data/sample/transformblit.rb +23 -22
  87. metadata +62 -35
  88. data/rubysdl_event2.c +0 -417
data/MANIFEST CHANGED
@@ -8,12 +8,15 @@ depend
8
8
  extconf.rb
9
9
  lib/rubysdl_aliases.rb
10
10
  lib/sdl.rb
11
+ lib/rubysdl_compatible_ver1.rb
11
12
  rubysdl.h
12
13
  rubysdl_const_list.txt
13
14
  rubysdl_doc_old.rd
14
15
  rubysdl_ref.rd
15
16
  rubysdl_ref.html
16
- rubysdl_doc.en.rd
17
+ rubysdl_ref.en.rd
18
+ rubysdl_ref.en.html
19
+ rubysdl_doc_old.en.rd
17
20
  rubysdl_event.c
18
21
  rubysdl_event_key.c
19
22
  rubysdl_main.c
@@ -29,7 +32,6 @@ rubysdl_joystick.c
29
32
  rubysdl_image.c
30
33
  rubysdl_opengl.c
31
34
  rubysdl_pixel.c
32
- rubysdl_event2.c
33
35
  rubysdl_smpeg.c
34
36
  rubysdl_sdlskk.c
35
37
  rubysdl_kanji.c
@@ -64,6 +66,9 @@ sample/bfont.rb
64
66
  sample/font.bmp
65
67
  sample/kanji.rb
66
68
  sample/sample.ttf
69
+ sample/load_from_io.rb
70
+ sample/icon.png
71
+ sample/icon.bmp.gz
67
72
  doc/Makefile
68
73
  doc/rsd.rb
69
74
  doc/cdrom.rsd
@@ -79,3 +84,18 @@ doc/sdlskk.rsd
79
84
  doc/time.rsd
80
85
  doc/video.rsd
81
86
  doc/wm.rsd
87
+ doc-en/Makefile
88
+ doc-en/cdrom.rsd
89
+ doc-en/collision.rsd
90
+ doc-en/event.rsd
91
+ doc-en/font.rsd
92
+ doc-en/general.rsd
93
+ doc-en/init.rsd
94
+ doc-en/joystick.rsd
95
+ doc-en/mixer.rsd
96
+ doc-en/mpeg.rsd
97
+ doc-en/opengl.rsd
98
+ doc-en/sdlskk.rsd
99
+ doc-en/time.rsd
100
+ doc-en/video.rsd
101
+ doc-en/wm.rsd
data/NEWS.en CHANGED
@@ -1,3 +1,83 @@
1
+ version 2.0
2
+ some changes for ruby 1.9
3
+ fix SDL_RWops code
4
+ Fix/Improve documents
5
+ Improve English documents
6
+ Add following methods
7
+ * SDL::Surface#load_bmp_from_string
8
+ * SDL::Surface#load_from_string
9
+ * SDL::Mixer::Wave#load_from_string
10
+ * SDL::Mixer.playing_channels
11
+
12
+ version 2.0 alpha 1
13
+ Remove following methods
14
+ * SDL::Surface#draw_ellispe
15
+ * SDL::Surface#draw_filled_ellispe
16
+ * SDL::Surface#rotate_surface
17
+ * SDL::Surface#rotate_scaled_surface
18
+ * SDL.rotate
19
+ * SDL.rotate_blit
20
+ * SDL.rotate_scaled_blit
21
+ * SDL.rotate_xy_scaled
22
+ Remove Old SDL::Event, and rename SDL::Event2 to SDL::Event
23
+ Change internal implementation
24
+ Add following methods
25
+ * SDL::Surface#destroy
26
+ * SDL::Joystick#close
27
+ * SDL::Mixer#close
28
+ * SDL::Mixer::Wave#destroy
29
+ * SDL::Mixer::Music#destroy
30
+ Add module SDL::GL
31
+ Change behavior of following methods
32
+ * SDL::Surface#draw_line
33
+ * SDL::Surface#draw_circle
34
+ * SDL::Surface#draw_rect
35
+ * SDL::Surface#draw_ellipse
36
+ * SDL::Surface#draw_bezier
37
+ Rename following methods
38
+ * SDL.auto_lock? -> SDL::Surface.auto_lock?
39
+ * SDL.auto_lock_on -> SDL::Surface.auto_lock_on
40
+ * SDL.auto_lock_off -> SDL::Surface.auto_lock_off
41
+ * SDL.transform_blit -> SDL::Surface#transform_blit
42
+ * SDL.blitSurface -> SDL::Surface.blit
43
+ * SDL.get_video_surface -> SDL::Screen.get
44
+ * SDL.set_video_mode -> SDL::Screen.open
45
+ * SDL.check_video_mode -> SDL::Screen.check_mode
46
+ * SDL.list_modes -> SDL::Screen.list_modes
47
+ * SDL.set_gamma -> SDL::Screen.set_gamma
48
+ * SDL.get_gamma_ramp -> SDL::Screen.get_gamma_ramp
49
+ * SDL.set_gamma_ramp -> SDL::Screen.set_gamma_ramp
50
+ * SDL.video_driver_name -> SDL::Screen.driver_name
51
+ * SDL.video_info -> SDL::Screen.info
52
+ * SDL::Surface#get_rgb -> SDL::PixelFormat#get_rgb
53
+ * SDL::Surface#get_rgba -> SDL::PixelFormat#get_rgba
54
+ * SDL::Surface#map_rgb -> SDL::PixelFormat#map_rgb
55
+ * SDL::Surface#map_rgba -> SDL::PixelFormat#map_rgba
56
+ * SDL::Surface#get_palette -> SDL::PixelFormat#palette
57
+ * SDL::Surface#bpp -> SDL::PixelFormat#bpp
58
+ * SDL::Surface#bytes_per_pixel -> SDL::PixelFormat#bytes_per_pixel
59
+ * SDL::Surface#[RGBA]mask -> SDL::PixelFormat#[RGBA]mask
60
+ * SDL::Surface#[RGBA]shift -> SDL::PixelFormat#[RGBA]shift
61
+ * SDL::Surface#[RGBA]loss -> SDL::PixelFormat#[RGBA]loss
62
+ * SDL::Surface#colorkey -> SDL::PixelFormat#colorkey
63
+ * SDL::Surface#alpha -> SDL::PixelFormat#alpha
64
+ * SDL.get_GL_attr -> SDL::GL.get_attr
65
+ * SDL.set_GL_attr -> SDL::GL.set_attr
66
+ * SDL.GL_swap_buffers -> SDL::GL.swap_buffers
67
+ Move following constants
68
+ * GL_RED_SIZE -> GL::RED_SIZE
69
+ * GL_GREEN_SIZE -> GL::GREEN_SIZE
70
+ * GL_BLUE_SIZE -> GL::BLUE_SIZE
71
+ * GL_ALPHA_SIZE -> GL::ALPHA_SIZE
72
+ * GL_BUFFER_SIZE -> GL::BUFFER_SIZE
73
+ * GL_DOUBLEBUFFER -> GL::DOUBLEBUFFER
74
+ * GL_DEPTH_SIZE -> GL::DEPTH_SIZE
75
+ * GL_STENCIL_SIZE -> GL::STENCIL_SIZE
76
+ * GL_ACCUM_RED_SIZE -> GL::ACCUM_RED_SIZE
77
+ * GL_ACCUM_GREEN_SIZE -> GL::ACCUM_GREEN_SIZE
78
+ * GL_ACCUM_BLUE_SIZE -> GL::ACCUM_BLUE_SIZE
79
+ * GL_ACCUM_ALPHA_SIZE -> GL::ACCUM_ALPHA_SIZE
80
+
1
81
  version 1.3.1
2
82
  Fix the bug that we cannot compile when SMEPG is installed but SDL_mixer is not installed.(1.2.0's change is incomplete)
3
83
  Add following methods
data/NEWS.ja CHANGED
@@ -1,3 +1,86 @@
1
+ version 2.0
2
+ ruby 1.9$B$G;H$($k$h$&$KJQ99(B
3
+ SDL_RWops$BBP1~$r=$@5$7!"(BSDL::Mixer::Wave.load_from_io$B$,;H$($k$h$&$K$7$?!#(B
4
+ $B%I%-%e%a%s%H$N2~A1(B($BFC$K1Q8lHG(B)
5
+ $B0J2<$N%a%=%C%I$rDI2C(B
6
+ * SDL::Surface#load_bmp_from_string
7
+ * SDL::Surface#load_from_string
8
+ * SDL::Mixer::Wave#load_from_string
9
+ * SDL::Mixer.playing_channels
10
+
11
+ version 2.0 alpha 1
12
+ $BFbIt9=B$$rBgI}$KJQ99(B
13
+ SDL::Event2$B$r(BSDL::Event$B$KJQ99$7!"$+$D$F$N(BSDL::Event$B$OGQ;_(B
14
+ $B0J2<$N%a%=%C%I$rGQ;_(B
15
+ * SDL::Surface#draw_ellispe
16
+ * SDL::Surface#draw_filled_ellispe
17
+ * SDL::Surface#rotate_surface
18
+ * SDL::Surface#rotate_scaled_surface
19
+ * SDL.rotate
20
+ * SDL.rotate_blit
21
+ * SDL.rotate_scaled_blit
22
+ * SDL.rotate_xy_scaled
23
+ $B0J2<$N%a%=%C%I$rDI2C(B
24
+ * SDL::Surface#destroy
25
+ * SDL::Joystick#close
26
+ * SDL::Mixer#close
27
+ * SDL::Mixer::Wave#destroy
28
+ * SDL::Mixer::Music#destroy
29
+ SDL::GL$B%b%8%e!<%k$rDI2C(B
30
+ SDL::PixelFormat(SDL::Surface::Format$B$N$[$&$,NI$$!)(B)$B$N<BAu$rJQ99(B
31
+ Surface$B$N%U%)!<%^%C%H$r;XDj$9$k$N$K(BSDL::PixelFormat$B$,;H$($k$h$&$KJQ99(B
32
+ $B0J2<$NIA2h%a%=%C%I$N(B(antialias, fill, alpha$B$r$"$i$o$9(B)$B0z?t$rDI2C(B
33
+ * SDL::Surface#draw_line
34
+ * SDL::Surface#draw_circle
35
+ * SDL::Surface#draw_rect
36
+ * SDL::Surface#draw_ellipse
37
+ * SDL::Surface#draw_bezier
38
+ $B0J2<$N$h$&$K%a%=%C%I$r0\F0!"5lMh$N$b$N$bMxMQ$O$G$-$^$9(B
39
+ * SDL.auto_lock? -> SDL::Surface.auto_lock?
40
+ * SDL.auto_lock_on -> SDL::Surface.auto_lock_on
41
+ * SDL.auto_lock_off -> SDL::Surface.auto_lock_off
42
+ * SDL.transform_blit -> SDL::Surface#transform_blit
43
+ * SDL.blitSurface -> SDL::Surface.blit
44
+ * SDL.get_video_surface -> SDL::Screen.get
45
+ * SDL.set_video_mode -> SDL::Screen.open
46
+ * SDL.check_video_mode -> SDL::Screen.check_mode
47
+ * SDL.list_modes -> SDL::Screen.list_modes
48
+ * SDL.set_gamma -> SDL::Screen.set_gamma
49
+ * SDL.get_gamma_ramp -> SDL::Screen.get_gamma_ramp
50
+ * SDL.set_gamma_ramp -> SDL::Screen.set_gamma_ramp
51
+ * SDL.video_driver_name -> SDL::Screen.driver_name
52
+ * SDL.video_info -> SDL::Screen.info
53
+ * SDL::Surface#get_rgb -> SDL::PixelFormat#get_rgb
54
+ * SDL::Surface#get_rgba -> SDL::PixelFormat#get_rgba
55
+ * SDL::Surface#map_rgb -> SDL::PixelFormat#map_rgb
56
+ * SDL::Surface#map_rgba -> SDL::PixelFormat#map_rgba
57
+ * SDL::Surface#get_palette -> SDL::PixelFormat#palette
58
+ * SDL::Surface#bpp -> SDL::PixelFormat#bpp
59
+ * SDL::Surface#bytes_per_pixel -> SDL::PixelFormat#bytes_per_pixel
60
+ * SDL::Surface#[RGBA]mask -> SDL::PixelFormat#[RGBA]mask
61
+ * SDL::Surface#[RGBA]shift -> SDL::PixelFormat#[RGBA]shift
62
+ * SDL::Surface#[RGBA]loss -> SDL::PixelFormat#[RGBA]loss
63
+ * SDL::Surface#colorkey -> SDL::PixelFormat#colorkey
64
+ * SDL::Surface#alpha -> SDL::PixelFormat#alpha
65
+ * SDL.get_GL_attr -> SDL::GL.get_attr
66
+ * SDL.set_GL_attr -> SDL::GL.set_attr
67
+ * SDL.GL_swap_buffers -> SDL::GL.swap_buffers
68
+ $B0J2<$N$h$&$KDj?t$r0\F0!#5lMh$N$b$N$bMxMQ$O$G$-$^$9!#(B
69
+ * GL_RED_SIZE -> GL::RED_SIZE
70
+ * GL_GREEN_SIZE -> GL::GREEN_SIZE
71
+ * GL_BLUE_SIZE -> GL::BLUE_SIZE
72
+ * GL_ALPHA_SIZE -> GL::ALPHA_SIZE
73
+ * GL_BUFFER_SIZE -> GL::BUFFER_SIZE
74
+ * GL_DOUBLEBUFFER -> GL::DOUBLEBUFFER
75
+ * GL_DEPTH_SIZE -> GL::DEPTH_SIZE
76
+ * GL_STENCIL_SIZE -> GL::STENCIL_SIZE
77
+ * GL_ACCUM_RED_SIZE -> GL::ACCUM_RED_SIZE
78
+ * GL_ACCUM_GREEN_SIZE -> GL::ACCUM_GREEN_SIZE
79
+ * GL_ACCUM_BLUE_SIZE -> GL::ACCUM_BLUE_SIZE
80
+ * GL_ACCUM_ALPHA_SIZE -> GL::ACCUM_ALPHA_SIZE
81
+ OpenGL$B4XO"$N%I%-%e%a%s%H$rDI2C(B
82
+
83
+
1
84
  version 1.3.1
2
85
  SMPEG$BM-!"(BSDL_mixer$BL5$N>l9g$NLdBj$r=$@5(B
3
86
  $B0J2<$N%a%=%C%I$rDI2C(B
data/README.en CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- Ruby/SDL 1.3.1
2
+ Ruby/SDL 2.0
3
3
  Ohbayashi Ippei
4
4
 
5
5
  1 What's Ruby/SDL
@@ -106,6 +106,7 @@ install on Linux
106
106
  SDLdoc Japanese translation project : base of Ruby/SDL's reference manual
107
107
  Hara Yutaka: Sample TrueTypeFont
108
108
  Members of #sdl-fan-jp @ FriendChat: bug reports and advices
109
+ Cyross: Windows version maintainance
109
110
 
110
111
  9 OTHER
111
112
  Some functions, especially SDL::MPEG methods and pallete handling methods,
data/README.ja CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- Ruby/SDL 1.3.1
2
+ Ruby/SDL 2.0
3
3
  ���Ӱ�ʿ
4
4
 
5
5
  1 ����
@@ -152,7 +152,7 @@ FreeBSD
152
152
  * SDLdoc ���ܸ������ץ��������Ȥˤ�����ä��ߤʤ���
153
153
  * ����ץ��ѤΥե���Ȥ��󶡤��Ƥ��줿������
154
154
  * #sdl-fan-jp@friend chat �Τߤʤ���
155
-
155
+ * Windows�Ǥδ����򤷤Ƥ������륵����������
156
156
  9 ����¾
157
157
  �ޤ��ƥ��Ȥ���Ƥ��ʤ���ǽ��¿������ޤ�(�ѥ�åȴ�Ϣ
158
158
  ��MPEG��Ϣ�Υ᥽�åɤ����Ĥ��ʤ�)��
data/doc-en/Makefile ADDED
@@ -0,0 +1,18 @@
1
+
2
+ RSD = ruby ../doc/rsd.rb -e
3
+ RDFILES = general.rd init.rd video.rd opengl.rd wm.rd event.rd joystick.rd cdrom.rd mixer.rd time.rd font.rd collision.rd sdlskk.rd mpeg.rd
4
+ RD2 = rd2
5
+ RD2OPT = -r rd/rd2html-lib.rb --html-lang=ja --html-charset=EUC-JP
6
+
7
+
8
+ rubysdl_ref.en.html: rubysdl_ref.en.rd
9
+ $(RD2) $(RD2OPT) --html-title="Ruby/SDL Reference Manual" $< > $@ || rm -f $@
10
+
11
+ rubysdl_ref.en.rd: $(RDFILES)
12
+ cat $(RDFILES) > rubysdl_ref.en.rd
13
+
14
+ %.rd: %.rsd
15
+ $(RSD) < $< > $@
16
+
17
+ install: rubysdl_ref.en.html
18
+ cp rubysdl_ref.en.html rubysdl_ref.en.rd ..
data/doc-en/cdrom.rsd ADDED
@@ -0,0 +1,417 @@
1
+ = CD-ROM
2
+ * ((<CD-ROM outline>))
3
+ * ((<SDL::CD>))
4
+ * ((<CD-ROM methods>))
5
+ TOC
6
+
7
+ == CD-ROM outline
8
+ SDL supports audio control of up to 32 local CD-ROM drives at once.
9
+
10
+ You use this API to perform all the basic functions of a CD player, including
11
+ listing the tracks, playing, stopping, and ejecting the CD-ROM. (Currently,
12
+ multi-changer CD drives are not supported.)
13
+
14
+ Before you call any of the SDL CD-ROM functions, you must first call
15
+ @[init](SDL::INIT_CDROM),
16
+ which scans the system for CD-ROM drives, and sets the program
17
+ up for audio control.
18
+
19
+ After you have initialized the library, you can find out how many drives are
20
+ available using the @[CD.num_drives]. The first drive listed is the
21
+ system default CD-ROM drive. After you have chosen a drive, and have opened it
22
+ with @[CD.open], you can check the status and start playing if there's a CD in
23
+ the drive.
24
+
25
+ A CD-ROM is organized into one or more tracks, each consisting of a certain number
26
+ of "frames". Each frame is ~2K in size, and at normal playing speed,
27
+ a CD plays 75(SDL::CD::FPS)
28
+ frames per second. SDL works with the number of frames on a CD, but this can
29
+ easily be converted to the more familiar minutes/seconds format by using
30
+ @[CD.frames_to_msf].
31
+
32
+ == SDL::CD
33
+ This class represents opened CDROM device and stores information on the
34
+ layout of the tracks on the disc.
35
+
36
+ == CD-ROM methods
37
+ %%%
38
+ NAME num_drives
39
+ MOD CD
40
+ TYPE .
41
+ PURPOSE Returns the number of CD-ROM drives on the system.
42
+ RVAL Integer
43
+
44
+ PROTO
45
+ num_drives
46
+ numDrives
47
+
48
+ DESC
49
+ Returns the number of CD-ROM drives on the system.
50
+
51
+ SEEALSO
52
+ CD.open
53
+
54
+ %%
55
+ NAME index_name
56
+ MOD CD
57
+ TYPE .
58
+ PURPOSE Returns a human-readable, system-dependent identifier for the CD-ROM.
59
+ RVAL String
60
+
61
+ PROTO
62
+ index_name(drive)
63
+ indexName(drive)
64
+
65
+ DESC
66
+ Returns a human-readable, system-dependent identifier for the CD-ROM. $[drive]
67
+ is the index of the drive.
68
+ Drive indices start to 0 and end at @[CD.num_drives]-1.
69
+
70
+ Examples of return strings.
71
+ * "/dev/cdrom"
72
+ * "E:"
73
+ * "/dev/disk/ide/1/master"
74
+
75
+ SEEALSO
76
+ CD.num_drives
77
+
78
+ %%
79
+ NAME open
80
+ MOD CD
81
+ TYPE .
82
+ PURPOSE Opens a CD-ROM drive for access.
83
+ RVAL SDL::CD
84
+
85
+ PROTO
86
+ open(drive)
87
+
88
+ DESC
89
+ Opens a CD-ROM drive for access. It returns @[CD] object on success.
90
+
91
+ Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
92
+
93
+ EXCEPTION
94
+ Raise @[Error] if the drive was invalid or busy.
95
+
96
+ EXAMPLE
97
+ SDL.init SDL::INIT_CDROM
98
+
99
+ # Check for CD drives
100
+ if SDL::CD.num_drives == 0
101
+ # None found
102
+ STDERR.print "No CDROM devices available\n"
103
+ exit 255
104
+ end
105
+
106
+ begin
107
+ # Open the default drive
108
+ cdrom = SDL::CD.open(0)
109
+ rescue SDL::Error
110
+ STDERR.puts "Couldn't open drive"
111
+ exit 255
112
+ end
113
+
114
+ # Print volume info
115
+ printf "Name: %s\n", SDL::CD.index_name(0)
116
+ printf "Tracks: %d\n", cdrom.num_tracks
117
+ num_tracks.times do |cur_track|
118
+ min, sec, frame = SDL::CD.frames_to_msf(cdrom.track_length(cur_track))
119
+ printf "\tTrack %d: Length %d:%d\n", cur_track, min, sec
120
+ end
121
+
122
+ %%
123
+ NAME status
124
+ MOD CD
125
+ TYPE #
126
+ PURPOSE Returns the current status of the given drive.
127
+ RVAL UINT
128
+
129
+ PROTO
130
+ status
131
+
132
+ DESC
133
+ This method returns the current status of the given drive. Status is described
134
+ like so:
135
+ * SDL::CD::TRAYEMPTY
136
+ * SDL::CD::STOPPED
137
+ * SDL::CD::PLAYING
138
+ * SDL::CD::PAUSED
139
+ * SDL::CD::ERROR
140
+
141
+ If the drive has a CD in it,
142
+ @[current_track], @[current_frame], @[num_tracks], @[track_type],
143
+ and @[track_length] are updated.
144
+
145
+ EXAMPLE
146
+ def play_track(track)
147
+ raise "not cd in drive" unless $cdrom.in_drive?
148
+
149
+ # clamp to the actual number of tracks on the CD
150
+ track = $cdrom.num_tracks-1 if track >= $cdrom.num_tracks
151
+ $cdrom.play_tracks(track, 0, 1, 0)
152
+ end
153
+
154
+ %%
155
+ NAME play
156
+ MOD CD
157
+ TYPE #
158
+ PURPOSE Play a CD
159
+
160
+ PROTO
161
+ play(start, length)
162
+
163
+ DESC
164
+ Plays the given cdrom, starting a frame $[start] for length $[frames].
165
+
166
+ EXCEPTION *
167
+
168
+ SEEALSO
169
+ CD#play_tracks
170
+
171
+ %%
172
+ NAME play_tracks
173
+ MOD CD
174
+ TYPE #
175
+ PURPOSE Play the given CD track(s)
176
+
177
+ PROTO
178
+ play_tracks(start_track, start_frame, ntracks, nframes)
179
+
180
+ DESC
181
+ This method plays the given CD starting at track $[start_track], for $[ntracks]
182
+ tracks.
183
+
184
+ $[start_frame] is the frame offset, from the beginning of the $[start_track],
185
+ at which to start. $nframes] is the frame offset, from the beginning
186
+ of the last track
187
+ ($[start_track]+$[ntracks]), at which to end playing.
188
+
189
+ THis methods should only be called after calling @[CD#status] to get track
190
+ information about the CD.
191
+
192
+ NOTES
193
+ Data tracks are ignored.
194
+
195
+ EXCEPTION *
196
+
197
+ EXAMPLE
198
+ # assuming cdrom is a previously opened device
199
+ # Play the entire CD
200
+ if cdrom.in_drive?
201
+ cdrom.play_tracks 0, 0, 0, 0
202
+ end
203
+ # Play the first track
204
+ if cdrom.in_drive?
205
+ cdrom.play_tracks 0, 0, 1, 0
206
+ end
207
+ # 2 Play first 15 seconds of the 2nd track
208
+ if cdrom.in_drive?
209
+ cdrom.play_tracks 1, 0, 0, SDL::CD::FPS*15
210
+ end
211
+ SEEALSO
212
+ CD#play
213
+ CD#status
214
+
215
+ %%
216
+ NAME pause
217
+ MOD CD
218
+ TYPE #
219
+ PURPOSE Pauses a CDROM
220
+
221
+ PROTO
222
+ pause
223
+
224
+ DESC
225
+ Pauses play on the given cdrom.
226
+
227
+ EXCEPTION *
228
+
229
+ SEEALSO
230
+ CD#play
231
+ CD#resume
232
+
233
+ %%
234
+ NAME resume
235
+ MOD CD
236
+ TYPE #
237
+ PURPOSE Resumes a CDROM
238
+
239
+ PROTO
240
+ resume
241
+
242
+ DESC
243
+ Resumes play on the given cdrom.
244
+
245
+ EXCEPTION *
246
+
247
+ SEEALSO
248
+ CD#play
249
+ CD#pause
250
+
251
+ %%
252
+ NAME stop
253
+ MOD CD
254
+ TYPE #
255
+ PURPOSE Stops a CDROM
256
+
257
+ PROTO
258
+ stop
259
+
260
+ DESC
261
+ Stops play on the given cdrom.
262
+
263
+ EXCEPTION *
264
+
265
+ SEEALSO
266
+ CD#play
267
+
268
+ %%
269
+ NAME eject
270
+ MOD CD
271
+ TYPE #
272
+ PURPOSE Ejects a CDROM
273
+
274
+ PROTO
275
+ eject
276
+
277
+ DESC
278
+ Ejects the given cdrom.
279
+
280
+ EXCEPTION *
281
+
282
+ %%
283
+ NAME num_tracks
284
+ MOD CD
285
+ TYPE #
286
+ PURPOSE Gets number of tracks on the CD.
287
+ RVAL Integer
288
+
289
+ PROTO
290
+ num_tracks
291
+ numTracks
292
+
293
+ DESC
294
+ Returns the number of tracks on the given cdrom.
295
+ @[CD#status] updates this value.
296
+
297
+ SEEALSO
298
+ CD#status
299
+
300
+ %%
301
+ NAME current_track
302
+ MOD CD
303
+ TYPE #
304
+ PURPOSE Gets current track.
305
+ RVAL Integer
306
+
307
+ PROTO
308
+ current_track
309
+ currentTrack
310
+
311
+ DESC
312
+ Returns the currently playing track.
313
+ @[CD#status] updates this value.
314
+
315
+ SEEALSO
316
+ CD#status
317
+
318
+ %%
319
+ NAME current_frame
320
+ MOD CD
321
+ TYPE #
322
+ PURPOSE Gets current frame offset within the track
323
+ RVAL Integer
324
+
325
+ PROTO
326
+ current_frame
327
+ currentFrame
328
+
329
+ DESC
330
+ Returns the current frame offset with the playing track.
331
+ @[CD#status] updates this value.
332
+
333
+ SEEALSO
334
+ CD#status
335
+
336
+ %%
337
+ NAME track_type
338
+ MOD CD
339
+ TYPE #
340
+ PURPOSE Gets track type.
341
+ RVAL UINT
342
+
343
+ PROTO
344
+ track_type(track)
345
+ trackType(track)
346
+
347
+ DESC
348
+ Returns the track type in $[track].
349
+ SDL::CD::AUDIO_TRACK or SDL::CD::DATA_TRACK is returned.
350
+
351
+ %%
352
+ NAME track_length
353
+ MOD CD
354
+ TYPE #
355
+ PURPOSE Gets length of track.
356
+ RVAL Integer
357
+
358
+ PROTO
359
+ track_length(track)
360
+ trackLength(track)
361
+
362
+ DESC
363
+ Returns length, in frame, of $[track].
364
+
365
+ %%
366
+ NAME in_drive?
367
+ MOD CD
368
+ TYPE #
369
+ PURPOSE Check disc in drive
370
+ RVAL true/false
371
+
372
+ PROTO
373
+ in_drive?
374
+
375
+ DESC
376
+ Returns true if drive is not empty, otherwise returns false.
377
+
378
+ SEEALSO
379
+ CD#status
380
+
381
+ %%
382
+ NAME frames_to_msf
383
+ MOD CD
384
+ TYPE .
385
+ PURPOSE Convert frames into minitus/seconds/frames
386
+ RVAL [Integer, Integer, Integer]
387
+
388
+ PROTO
389
+ frames_to_msf(frames)
390
+ framesToMSF(frames)
391
+
392
+ DESC
393
+ Converts frames into minitus/seconds/frames, and returns an array like
394
+ [min, sec, frames].
395
+
396
+ SEEALSO
397
+ CD.msf_to_frames
398
+
399
+ %%
400
+ NAME msf_to_frames
401
+ MOD CD
402
+ TYPE .
403
+ PURPOSE Convert minitus/seconds/frames into frames
404
+ RVAL Integer
405
+
406
+ PROTO
407
+ msf_to_frames(min, sec, frames)
408
+ MSFToFrames(min, sec, frames)
409
+
410
+ DESC
411
+ Convert minitus/seconds/frames into frames and returns frames.
412
+
413
+ SEEALSO
414
+ CD.frames_to_msf
415
+
416
+
417
+