ruby-sdl2 0.3.4 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/Gemfile +11 -0
- data/README.md +5 -2
- data/Rakefile +22 -3
- data/Steepfile +24 -0
- data/doc/DEVELOP.md +35 -0
- data/event.c +3 -3
- data/extconf.rb +3 -1
- data/gamecontroller.c +26 -25
- data/gamecontroller.c.m4 +26 -25
- data/gl.c +56 -63
- data/gl.c.m4 +56 -63
- data/hint.c +3 -3
- data/joystick.c +11 -10
- data/joystick.c.m4 +11 -10
- data/key.c +21 -19
- data/key.c.m4 +21 -19
- data/lib/sdl2/version.rb +3 -3
- data/main.c +13 -16
- data/messagebox.c +7 -7
- data/mixer.c +41 -31
- data/mixer.c.m4 +41 -31
- data/mouse.c +3 -3
- data/rbs_collection.yaml +32 -0
- data/ttf.c +15 -15
- data/ttf.c.m4 +15 -15
- data/video.c +179 -126
- data/video.c.m4 +116 -95
- metadata +7 -4
data/mixer.c
CHANGED
@@ -135,7 +135,7 @@ static void check_channel(VALUE ch, int allow_minus_1)
|
|
135
135
|
int channel = NUM2INT(ch);
|
136
136
|
if (channel >= Mix_AllocateChannels(-1))
|
137
137
|
rb_raise(rb_eArgError, "too large number of channel (%d)", channel);
|
138
|
-
if (channel == -1 && !allow_minus_1 || channel < -1)
|
138
|
+
if ((channel == -1 && !allow_minus_1) || channel < -1)
|
139
139
|
rb_raise(rb_eArgError, "negative number of channel is not allowed");
|
140
140
|
}
|
141
141
|
|
@@ -193,7 +193,7 @@ static VALUE Mixer_s_close(VALUE self)
|
|
193
193
|
*
|
194
194
|
* This method returns the most suitable setting for {.open} the device.
|
195
195
|
*
|
196
|
-
* @return [
|
196
|
+
* @return [Array(Integer, Integer, Integer, Integer)]
|
197
197
|
* the suitable frequency in Hz, the suitable format,
|
198
198
|
* the suitable number of channels (1 for mono, 2 for stereo),
|
199
199
|
* and the number of call of {.open}.
|
@@ -456,6 +456,8 @@ static VALUE Channels_s_fade_out(VALUE self, VALUE channel, VALUE ms)
|
|
456
456
|
* Return true if a specified channel is playing.
|
457
457
|
*
|
458
458
|
* @param channel [Integer] channel to test
|
459
|
+
* @return [Boolean]
|
460
|
+
*
|
459
461
|
* @see .pause?
|
460
462
|
* @see .fading
|
461
463
|
*/
|
@@ -473,6 +475,7 @@ static VALUE Channels_s_play_p(VALUE self, VALUE channel)
|
|
473
475
|
* other halting methods.
|
474
476
|
*
|
475
477
|
* @param channel [Integer] channel to test
|
478
|
+
* @return [Boolean]
|
476
479
|
*
|
477
480
|
* @see .play?
|
478
481
|
* @see .fading
|
@@ -537,6 +540,8 @@ static VALUE Channels_s_playing_chunk(VALUE self, VALUE channel)
|
|
537
540
|
/*
|
538
541
|
* Initialize the channel with given **tag**.
|
539
542
|
*
|
543
|
+
* @param tag [Integer] channel indentifier
|
544
|
+
*
|
540
545
|
* Groups with a common tag are identified.
|
541
546
|
*/
|
542
547
|
static VALUE Group_initialize(VALUE self, VALUE tag)
|
@@ -575,7 +580,7 @@ inline static int Group_tag(VALUE group)
|
|
575
580
|
* **self** and **other** are considered to be same
|
576
581
|
* if they have the same tag.
|
577
582
|
*
|
578
|
-
* @param other [SDL2::Mixer::
|
583
|
+
* @param other [SDL2::Mixer::Channels::Group] a compared object
|
579
584
|
* @return [Boolean]
|
580
585
|
*/
|
581
586
|
static VALUE Group_eq(VALUE self, VALUE other)
|
@@ -749,7 +754,7 @@ static VALUE MusicChannel_s_volume(VALUE self)
|
|
749
754
|
*
|
750
755
|
* @param vol [Integer] the volume for mixing,
|
751
756
|
* from 0 to {SDL2::Mixer::MAX_VOLUME}(128).
|
752
|
-
* @return [
|
757
|
+
* @return [void]
|
753
758
|
*
|
754
759
|
* @see .volume
|
755
760
|
*/
|
@@ -822,6 +827,7 @@ static VALUE MusicChannel_s_halt(VALUE self)
|
|
822
827
|
* @overload fade_out(ms)
|
823
828
|
* Halt the music playback with fade-out effect.
|
824
829
|
*
|
830
|
+
* @param ms [Integer] milliseconds of fade-out effect
|
825
831
|
* @return [nil]
|
826
832
|
*/
|
827
833
|
static VALUE MusicChannel_s_fade_out(VALUE self, VALUE fade_out_ms)
|
@@ -831,6 +837,8 @@ static VALUE MusicChannel_s_fade_out(VALUE self, VALUE fade_out_ms)
|
|
831
837
|
|
832
838
|
/*
|
833
839
|
* Return true if a music is playing.
|
840
|
+
*
|
841
|
+
* @return [Boolean]
|
834
842
|
*/
|
835
843
|
static VALUE MusicChannel_s_play_p(VALUE self)
|
836
844
|
{
|
@@ -839,6 +847,8 @@ static VALUE MusicChannel_s_play_p(VALUE self)
|
|
839
847
|
|
840
848
|
/*
|
841
849
|
* Return true if a music playback is paused.
|
850
|
+
*
|
851
|
+
* @return [Boolean]
|
842
852
|
*/
|
843
853
|
static VALUE MusicChannel_s_pause_p(VALUE self)
|
844
854
|
{
|
@@ -960,7 +970,7 @@ static VALUE Chunk_volume(VALUE self)
|
|
960
970
|
* Set the volume of the sample.
|
961
971
|
*
|
962
972
|
* @param vol [Integer] the new volume
|
963
|
-
* @return [
|
973
|
+
* @return [void]
|
964
974
|
*
|
965
975
|
* @see #volume
|
966
976
|
*/
|
@@ -1067,58 +1077,58 @@ void rubysdl2_init_mixer(void)
|
|
1067
1077
|
rb_define_module_function(mMixer, "query", Mixer_s_query, 0);
|
1068
1078
|
|
1069
1079
|
/* */
|
1070
|
-
/*
|
1080
|
+
/* @return [Integer] bitmask which means initialization of Ogg flac loader */
|
1071
1081
|
rb_define_const(mMixer, "INIT_FLAC", UINT2NUM(MIX_INIT_FLAC));
|
1072
|
-
/*
|
1082
|
+
/* @return [Integer] bitmask which means initialization of MOD loader */
|
1073
1083
|
rb_define_const(mMixer, "INIT_MOD", UINT2NUM(MIX_INIT_MOD));
|
1074
|
-
/*
|
1084
|
+
/* @return [Integer] bitmask which means initialization of MP3 loader */
|
1075
1085
|
rb_define_const(mMixer, "INIT_MP3", UINT2NUM(MIX_INIT_MP3));
|
1076
|
-
/*
|
1086
|
+
/* @return [Integer] bitmask which means initialization of Ogg vorbis loader */
|
1077
1087
|
rb_define_const(mMixer, "INIT_OGG", UINT2NUM(MIX_INIT_OGG));
|
1078
1088
|
|
1079
|
-
#
|
1080
|
-
/*
|
1089
|
+
#ifdef HAVE_CONST_MIX_INIT_MODPLUG
|
1090
|
+
/* @return [Integer] bitmask which means initialization of libmodplug */
|
1081
1091
|
rb_define_const(mMixer, "INIT_MODPLUG", UINT2NUM(MIX_INIT_MODPLUG));
|
1082
1092
|
#endif
|
1083
|
-
#
|
1084
|
-
/*
|
1093
|
+
#ifdef HAVE_CONST_MIX_INIT_FLUIDSYNTH
|
1094
|
+
/* @return [Integer] bitmask which means initialization of fluidsynth */
|
1085
1095
|
rb_define_const(mMixer, "INIT_FLUIDSYNTH", UINT2NUM(MIX_INIT_FLUIDSYNTH));
|
1086
1096
|
#endif
|
1087
|
-
#
|
1088
|
-
/*
|
1097
|
+
#ifdef HAVE_CONST_MIX_INIT_MID
|
1098
|
+
/* @return [Integer] bitmask which means initialization of mid */
|
1089
1099
|
rb_define_const(mMixer, "INIT_MID", UINT2NUM(MIX_INIT_MID));
|
1090
1100
|
#endif
|
1091
1101
|
|
1092
1102
|
/* */
|
1093
|
-
/* Unsiged 8-bit sample format. Used by {Mixer.open} */
|
1103
|
+
/* @return [Integer] the value representing Unsiged 8-bit sample format. Used by {Mixer.open} */
|
1094
1104
|
rb_define_const(mMixer, "FORMAT_U8", UINT2NUM(AUDIO_U8));
|
1095
|
-
/* Siged 8-bit sample format. Used by {Mixer.open} */
|
1105
|
+
/* @return [Integer] the value representing Siged 8-bit sample format. Used by {Mixer.open} */
|
1096
1106
|
rb_define_const(mMixer, "FORMAT_S8", UINT2NUM(AUDIO_S8));
|
1097
|
-
/* Unsiged 16-bit little-endian sample format. Used by {Mixer.open} */
|
1107
|
+
/* @return [Integer] the value representing Unsiged 16-bit little-endian sample format. Used by {Mixer.open} */
|
1098
1108
|
rb_define_const(mMixer, "FORMAT_U16LSB", UINT2NUM(AUDIO_U16LSB));
|
1099
|
-
/* Siged 16-bit little-endian sample format. Used by {Mixer.open} */
|
1109
|
+
/* @return [Integer] the value representing Siged 16-bit little-endian sample format. Used by {Mixer.open} */
|
1100
1110
|
rb_define_const(mMixer, "FORMAT_S16LSB", UINT2NUM(AUDIO_S16LSB));
|
1101
|
-
/* Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
|
1111
|
+
/* @return [Integer] the value representing Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
|
1102
1112
|
rb_define_const(mMixer, "FORMAT_U16MSB", UINT2NUM(AUDIO_U16MSB));
|
1103
|
-
/* Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
|
1113
|
+
/* @return [Integer] the value representing Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
|
1104
1114
|
rb_define_const(mMixer, "FORMAT_S16MSB", UINT2NUM(AUDIO_S16MSB));
|
1105
|
-
/* Unsiged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
|
1115
|
+
/* @return [Integer] the value representing Unsiged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
|
1106
1116
|
rb_define_const(mMixer, "FORMAT_U16SYS", UINT2NUM(AUDIO_U16SYS));
|
1107
|
-
/* Siged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
|
1117
|
+
/* @return [Integer] the value representing Siged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
|
1108
1118
|
rb_define_const(mMixer, "FORMAT_S16SYS", UINT2NUM(AUDIO_S16SYS));
|
1109
|
-
/* Default frequency. 22050 (Hz) */
|
1119
|
+
/* @return [Integer] Default frequency. 22050 (Hz) */
|
1110
1120
|
rb_define_const(mMixer, "DEFAULT_FREQUENCY", UINT2NUM(MIX_DEFAULT_FREQUENCY));
|
1111
|
-
/* Default sample format. Same as {Mixer
|
1121
|
+
/* @return [Integer] Default sample format. Same as {Mixer\:\:FORMAT_S16SYS}. */
|
1112
1122
|
rb_define_const(mMixer, "DEFAULT_FORMAT", UINT2NUM(MIX_DEFAULT_FORMAT));
|
1113
|
-
/* Default number of channels. 2. */
|
1123
|
+
/* @return [Integer] Default number of channels. 2. */
|
1114
1124
|
rb_define_const(mMixer, "DEFAULT_CHANNELS", INT2FIX(MIX_DEFAULT_CHANNELS));
|
1115
|
-
/* Max volume value. 128. */
|
1125
|
+
/* @return [Integer] Max volume value. 128. */
|
1116
1126
|
rb_define_const(mMixer, "MAX_VOLUME", INT2FIX(MIX_MAX_VOLUME));
|
1117
|
-
/*
|
1127
|
+
/* @return [Integer] the value represents that the channel is not fading in and fading out. */
|
1118
1128
|
rb_define_const(mMixer, "NO_FADING", INT2FIX(MIX_NO_FADING));
|
1119
|
-
/*
|
1129
|
+
/* @return [Integer] the value represents that the channel is fading out. */
|
1120
1130
|
rb_define_const(mMixer, "FADING_OUT", INT2FIX(MIX_FADING_OUT));
|
1121
|
-
/*
|
1131
|
+
/* @return [Integer] the value represents that the channel is fading in. */
|
1122
1132
|
rb_define_const(mMixer, "FADING_IN", INT2FIX(MIX_FADING_IN));
|
1123
1133
|
|
1124
1134
|
|
@@ -1154,7 +1164,7 @@ void rubysdl2_init_mixer(void)
|
|
1154
1164
|
rb_define_module_function(mChannels, "pause", Channels_s_pause, 1);
|
1155
1165
|
rb_define_module_function(mChannels, "resume", Channels_s_resume, 1);
|
1156
1166
|
rb_define_module_function(mChannels, "halt", Channels_s_halt, 1);
|
1157
|
-
rb_define_module_function(mChannels, "expire", Channels_s_expire,
|
1167
|
+
rb_define_module_function(mChannels, "expire", Channels_s_expire, 2);
|
1158
1168
|
rb_define_module_function(mChannels, "fade_out", Channels_s_fade_out, 2);
|
1159
1169
|
rb_define_module_function(mChannels, "play?", Channels_s_play_p, 1);
|
1160
1170
|
rb_define_module_function(mChannels, "pause?", Channels_s_pause_p, 1);
|
data/mixer.c.m4
CHANGED
@@ -135,7 +135,7 @@ static void check_channel(VALUE ch, int allow_minus_1)
|
|
135
135
|
int channel = NUM2INT(ch);
|
136
136
|
if (channel >= Mix_AllocateChannels(-1))
|
137
137
|
rb_raise(rb_eArgError, "too large number of channel (%d)", channel);
|
138
|
-
if (channel == -1 && !allow_minus_1 || channel < -1)
|
138
|
+
if ((channel == -1 && !allow_minus_1) || channel < -1)
|
139
139
|
rb_raise(rb_eArgError, "negative number of channel is not allowed");
|
140
140
|
}
|
141
141
|
|
@@ -193,7 +193,7 @@ static VALUE Mixer_s_close(VALUE self)
|
|
193
193
|
*
|
194
194
|
* This method returns the most suitable setting for {.open} the device.
|
195
195
|
*
|
196
|
-
* @return [
|
196
|
+
* @return [Array(Integer, Integer, Integer, Integer)]
|
197
197
|
* the suitable frequency in Hz, the suitable format,
|
198
198
|
* the suitable number of channels (1 for mono, 2 for stereo),
|
199
199
|
* and the number of call of {.open}.
|
@@ -456,6 +456,8 @@ static VALUE Channels_s_fade_out(VALUE self, VALUE channel, VALUE ms)
|
|
456
456
|
* Return true if a specified channel is playing.
|
457
457
|
*
|
458
458
|
* @param channel [Integer] channel to test
|
459
|
+
* @return [Boolean]
|
460
|
+
*
|
459
461
|
* @see .pause?
|
460
462
|
* @see .fading
|
461
463
|
*/
|
@@ -473,6 +475,7 @@ static VALUE Channels_s_play_p(VALUE self, VALUE channel)
|
|
473
475
|
* other halting methods.
|
474
476
|
*
|
475
477
|
* @param channel [Integer] channel to test
|
478
|
+
* @return [Boolean]
|
476
479
|
*
|
477
480
|
* @see .play?
|
478
481
|
* @see .fading
|
@@ -537,6 +540,8 @@ static VALUE Channels_s_playing_chunk(VALUE self, VALUE channel)
|
|
537
540
|
/*
|
538
541
|
* Initialize the channel with given **tag**.
|
539
542
|
*
|
543
|
+
* @param tag [Integer] channel indentifier
|
544
|
+
*
|
540
545
|
* Groups with a common tag are identified.
|
541
546
|
*/
|
542
547
|
static VALUE Group_initialize(VALUE self, VALUE tag)
|
@@ -575,7 +580,7 @@ inline static int Group_tag(VALUE group)
|
|
575
580
|
* **self** and **other** are considered to be same
|
576
581
|
* if they have the same tag.
|
577
582
|
*
|
578
|
-
* @param other [SDL2::Mixer::
|
583
|
+
* @param other [SDL2::Mixer::Channels::Group] a compared object
|
579
584
|
* @return [Boolean]
|
580
585
|
*/
|
581
586
|
static VALUE Group_eq(VALUE self, VALUE other)
|
@@ -749,7 +754,7 @@ static VALUE MusicChannel_s_volume(VALUE self)
|
|
749
754
|
*
|
750
755
|
* @param vol [Integer] the volume for mixing,
|
751
756
|
* from 0 to {SDL2::Mixer::MAX_VOLUME}(128).
|
752
|
-
* @return [
|
757
|
+
* @return [void]
|
753
758
|
*
|
754
759
|
* @see .volume
|
755
760
|
*/
|
@@ -822,6 +827,7 @@ static VALUE MusicChannel_s_halt(VALUE self)
|
|
822
827
|
* @overload fade_out(ms)
|
823
828
|
* Halt the music playback with fade-out effect.
|
824
829
|
*
|
830
|
+
* @param ms [Integer] milliseconds of fade-out effect
|
825
831
|
* @return [nil]
|
826
832
|
*/
|
827
833
|
static VALUE MusicChannel_s_fade_out(VALUE self, VALUE fade_out_ms)
|
@@ -831,6 +837,8 @@ static VALUE MusicChannel_s_fade_out(VALUE self, VALUE fade_out_ms)
|
|
831
837
|
|
832
838
|
/*
|
833
839
|
* Return true if a music is playing.
|
840
|
+
*
|
841
|
+
* @return [Boolean]
|
834
842
|
*/
|
835
843
|
static VALUE MusicChannel_s_play_p(VALUE self)
|
836
844
|
{
|
@@ -839,6 +847,8 @@ static VALUE MusicChannel_s_play_p(VALUE self)
|
|
839
847
|
|
840
848
|
/*
|
841
849
|
* Return true if a music playback is paused.
|
850
|
+
*
|
851
|
+
* @return [Boolean]
|
842
852
|
*/
|
843
853
|
static VALUE MusicChannel_s_pause_p(VALUE self)
|
844
854
|
{
|
@@ -960,7 +970,7 @@ static VALUE Chunk_volume(VALUE self)
|
|
960
970
|
* Set the volume of the sample.
|
961
971
|
*
|
962
972
|
* @param vol [Integer] the new volume
|
963
|
-
* @return [
|
973
|
+
* @return [void]
|
964
974
|
*
|
965
975
|
* @see #volume
|
966
976
|
*/
|
@@ -1067,58 +1077,58 @@ void rubysdl2_init_mixer(void)
|
|
1067
1077
|
rb_define_module_function(mMixer, "query", Mixer_s_query, 0);
|
1068
1078
|
|
1069
1079
|
/* define(`DEFINE_MIX_INIT',`rb_define_const(mMixer, "INIT_$1", UINT2NUM(MIX_INIT_$1))') */
|
1070
|
-
/*
|
1080
|
+
/* @return [Integer] bitmask which means initialization of Ogg flac loader */
|
1071
1081
|
DEFINE_MIX_INIT(FLAC);
|
1072
|
-
/*
|
1082
|
+
/* @return [Integer] bitmask which means initialization of MOD loader */
|
1073
1083
|
DEFINE_MIX_INIT(MOD);
|
1074
|
-
/*
|
1084
|
+
/* @return [Integer] bitmask which means initialization of MP3 loader */
|
1075
1085
|
DEFINE_MIX_INIT(MP3);
|
1076
|
-
/*
|
1086
|
+
/* @return [Integer] bitmask which means initialization of Ogg vorbis loader */
|
1077
1087
|
DEFINE_MIX_INIT(OGG);
|
1078
1088
|
|
1079
|
-
#
|
1080
|
-
/*
|
1089
|
+
#ifdef HAVE_CONST_MIX_INIT_MODPLUG
|
1090
|
+
/* @return [Integer] bitmask which means initialization of libmodplug */
|
1081
1091
|
DEFINE_MIX_INIT(MODPLUG);
|
1082
1092
|
#endif
|
1083
|
-
#
|
1084
|
-
/*
|
1093
|
+
#ifdef HAVE_CONST_MIX_INIT_FLUIDSYNTH
|
1094
|
+
/* @return [Integer] bitmask which means initialization of fluidsynth */
|
1085
1095
|
DEFINE_MIX_INIT(FLUIDSYNTH);
|
1086
1096
|
#endif
|
1087
|
-
#
|
1088
|
-
/*
|
1097
|
+
#ifdef HAVE_CONST_MIX_INIT_MID
|
1098
|
+
/* @return [Integer] bitmask which means initialization of mid */
|
1089
1099
|
DEFINE_MIX_INIT(MID);
|
1090
1100
|
#endif
|
1091
1101
|
|
1092
1102
|
/* define(`DEFINE_MIX_FORMAT',`rb_define_const(mMixer, "FORMAT_$1", UINT2NUM(AUDIO_$1))') */
|
1093
|
-
/* Unsiged 8-bit sample format. Used by {Mixer.open} */
|
1103
|
+
/* @return [Integer] the value representing Unsiged 8-bit sample format. Used by {Mixer.open} */
|
1094
1104
|
DEFINE_MIX_FORMAT(U8);
|
1095
|
-
/* Siged 8-bit sample format. Used by {Mixer.open} */
|
1105
|
+
/* @return [Integer] the value representing Siged 8-bit sample format. Used by {Mixer.open} */
|
1096
1106
|
DEFINE_MIX_FORMAT(S8);
|
1097
|
-
/* Unsiged 16-bit little-endian sample format. Used by {Mixer.open} */
|
1107
|
+
/* @return [Integer] the value representing Unsiged 16-bit little-endian sample format. Used by {Mixer.open} */
|
1098
1108
|
DEFINE_MIX_FORMAT(U16LSB);
|
1099
|
-
/* Siged 16-bit little-endian sample format. Used by {Mixer.open} */
|
1109
|
+
/* @return [Integer] the value representing Siged 16-bit little-endian sample format. Used by {Mixer.open} */
|
1100
1110
|
DEFINE_MIX_FORMAT(S16LSB);
|
1101
|
-
/* Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
|
1111
|
+
/* @return [Integer] the value representing Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
|
1102
1112
|
DEFINE_MIX_FORMAT(U16MSB);
|
1103
|
-
/* Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
|
1113
|
+
/* @return [Integer] the value representing Unsiged 16-bit big-endian sample format. Used by {Mixer.open} */
|
1104
1114
|
DEFINE_MIX_FORMAT(S16MSB);
|
1105
|
-
/* Unsiged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
|
1115
|
+
/* @return [Integer] the value representing Unsiged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
|
1106
1116
|
DEFINE_MIX_FORMAT(U16SYS);
|
1107
|
-
/* Siged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
|
1117
|
+
/* @return [Integer] the value representing Siged 16-bit sample format. Endian is same as system byte order. Used by {Mixer.open} */
|
1108
1118
|
DEFINE_MIX_FORMAT(S16SYS);
|
1109
|
-
/* Default frequency. 22050 (Hz) */
|
1119
|
+
/* @return [Integer] Default frequency. 22050 (Hz) */
|
1110
1120
|
rb_define_const(mMixer, "DEFAULT_FREQUENCY", UINT2NUM(MIX_DEFAULT_FREQUENCY));
|
1111
|
-
/* Default sample format. Same as {Mixer
|
1121
|
+
/* @return [Integer] Default sample format. Same as {Mixer\:\:FORMAT_S16SYS}. */
|
1112
1122
|
rb_define_const(mMixer, "DEFAULT_FORMAT", UINT2NUM(MIX_DEFAULT_FORMAT));
|
1113
|
-
/* Default number of channels. 2. */
|
1123
|
+
/* @return [Integer] Default number of channels. 2. */
|
1114
1124
|
rb_define_const(mMixer, "DEFAULT_CHANNELS", INT2FIX(MIX_DEFAULT_CHANNELS));
|
1115
|
-
/* Max volume value. 128. */
|
1125
|
+
/* @return [Integer] Max volume value. 128. */
|
1116
1126
|
rb_define_const(mMixer, "MAX_VOLUME", INT2FIX(MIX_MAX_VOLUME));
|
1117
|
-
/*
|
1127
|
+
/* @return [Integer] the value represents that the channel is not fading in and fading out. */
|
1118
1128
|
rb_define_const(mMixer, "NO_FADING", INT2FIX(MIX_NO_FADING));
|
1119
|
-
/*
|
1129
|
+
/* @return [Integer] the value represents that the channel is fading out. */
|
1120
1130
|
rb_define_const(mMixer, "FADING_OUT", INT2FIX(MIX_FADING_OUT));
|
1121
|
-
/*
|
1131
|
+
/* @return [Integer] the value represents that the channel is fading in. */
|
1122
1132
|
rb_define_const(mMixer, "FADING_IN", INT2FIX(MIX_FADING_IN));
|
1123
1133
|
|
1124
1134
|
|
@@ -1154,7 +1164,7 @@ void rubysdl2_init_mixer(void)
|
|
1154
1164
|
rb_define_module_function(mChannels, "pause", Channels_s_pause, 1);
|
1155
1165
|
rb_define_module_function(mChannels, "resume", Channels_s_resume, 1);
|
1156
1166
|
rb_define_module_function(mChannels, "halt", Channels_s_halt, 1);
|
1157
|
-
rb_define_module_function(mChannels, "expire", Channels_s_expire,
|
1167
|
+
rb_define_module_function(mChannels, "expire", Channels_s_expire, 2);
|
1158
1168
|
rb_define_module_function(mChannels, "fade_out", Channels_s_fade_out, 2);
|
1159
1169
|
rb_define_module_function(mChannels, "play?", Channels_s_play_p, 1);
|
1160
1170
|
rb_define_module_function(mChannels, "pause?", Channels_s_pause_p, 1);
|
data/mouse.c
CHANGED
@@ -192,7 +192,7 @@ static VALUE Cursor_s_shown_p(VALUE self)
|
|
192
192
|
* @overload warp(window, x, y)
|
193
193
|
* Move the mouse cursor to the given position within the window.
|
194
194
|
*
|
195
|
-
* @param [
|
195
|
+
* @param [SDL2::Window] window the window to move the mouse cursor into
|
196
196
|
* @param [Integer] x the x coordinate within the window
|
197
197
|
* @param [Integer] y the y coordinate within the window
|
198
198
|
* @return [nil]
|
@@ -225,7 +225,7 @@ static VALUE Cursor_s_warp_globally(VALUE self, VALUE x, VALUE y)
|
|
225
225
|
* Return true a mouse button is pressed.
|
226
226
|
*
|
227
227
|
* @param [Integer] index the index of a mouse button, start at index 0
|
228
|
-
*
|
228
|
+
* @return [Boolean]
|
229
229
|
*/
|
230
230
|
static VALUE State_pressed_p(VALUE self, VALUE index)
|
231
231
|
{
|
@@ -273,7 +273,7 @@ void rubysdl2_init_mouse(void)
|
|
273
273
|
rb_define_singleton_method(cCursor, "shown?", Cursor_s_shown_p, 0);
|
274
274
|
rb_define_singleton_method(cCursor, "warp", Cursor_s_warp, 3);
|
275
275
|
#if SDL_VERSION_ATLEAST(2,0,4)
|
276
|
-
rb_define_singleton_method(cCursor, "warp_globally", Cursor_s_warp_globally,
|
276
|
+
rb_define_singleton_method(cCursor, "warp_globally", Cursor_s_warp_globally, 2);
|
277
277
|
#endif
|
278
278
|
|
279
279
|
|
data/rbs_collection.yaml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Download sources
|
2
|
+
sources:
|
3
|
+
- type: git
|
4
|
+
name: ruby/gem_rbs_collection
|
5
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
6
|
+
revision: main
|
7
|
+
repo_dir: gems
|
8
|
+
|
9
|
+
# You can specify local directories as sources also.
|
10
|
+
# - type: local
|
11
|
+
# path: path/to/your/local/repository
|
12
|
+
|
13
|
+
# A directory to install the downloaded RBSs
|
14
|
+
path: .gem_rbs_collection
|
15
|
+
|
16
|
+
gems:
|
17
|
+
# Skip loading rbs gem's RBS.
|
18
|
+
# It's unnecessary if you don't use rbs as a library.
|
19
|
+
- name: rbs
|
20
|
+
ignore: true
|
21
|
+
- name: yard
|
22
|
+
ignore: true
|
23
|
+
- name: rake
|
24
|
+
ignore: true
|
25
|
+
- name: sord
|
26
|
+
ignore: true
|
27
|
+
- name: ast
|
28
|
+
ignore: true
|
29
|
+
- name: rainbow
|
30
|
+
ignore: true
|
31
|
+
- name: steep
|
32
|
+
ignore: true
|
data/ttf.c
CHANGED
@@ -76,7 +76,7 @@ DEFINE_WRAPPER(TTF_Font, TTF, font, cTTF, "SDL2::TTF");
|
|
76
76
|
*
|
77
77
|
* @!attribute kerning
|
78
78
|
* True if kerning is enabled.
|
79
|
-
* @return [
|
79
|
+
* @return [boolean]
|
80
80
|
*
|
81
81
|
* @!attribute [r] height
|
82
82
|
* The maximum pixel height of all glyphs of the font.
|
@@ -193,7 +193,7 @@ TTF_ATTR_READER(face_style_name, FaceStyleName, utf8str_new_cstr);
|
|
193
193
|
*
|
194
194
|
* @param text [String] the string to size up
|
195
195
|
*
|
196
|
-
* @return [
|
196
|
+
* @return [Array(Integer, Integer)] a pair of width and height of the rendered surface
|
197
197
|
*
|
198
198
|
* @raise [SDL2::Error] It is raised when an error occurs, such as a glyph ins the
|
199
199
|
* string not being found.
|
@@ -237,7 +237,7 @@ static VALUE render(SDL_Surface* (*renderer)(TTF_Font*, const char*, SDL_Color,
|
|
237
237
|
* Solid mode rendering is quick but dirty.
|
238
238
|
*
|
239
239
|
* @param text [String] the text to render
|
240
|
-
* @param fg [
|
240
|
+
* @param fg [Array(Integer, Integer, Integer)]
|
241
241
|
* the color to render. An array of r, g, and b components.
|
242
242
|
*
|
243
243
|
* @return [SDL2::Surface]
|
@@ -258,9 +258,9 @@ static VALUE TTF_render_solid(VALUE self, VALUE text, VALUE fg)
|
|
258
258
|
* the background color.
|
259
259
|
*
|
260
260
|
* @param text [String] the text to render
|
261
|
-
* @param fg [
|
261
|
+
* @param fg [Array(Integer, Integer, Integer)]
|
262
262
|
* the color to render. An array of r, g, and b components.
|
263
|
-
* @param bg [
|
263
|
+
* @param bg [Array(Integer, Integer, Integer)]
|
264
264
|
* the background color. An array of r, g, and b components.
|
265
265
|
*
|
266
266
|
* @return [SDL2::Surface]
|
@@ -281,7 +281,7 @@ static VALUE TTF_render_shaded(VALUE self, VALUE text, VALUE fg, VALUE bg)
|
|
281
281
|
* The rendered surface has an alpha channel,
|
282
282
|
*
|
283
283
|
* @param text [String] the text to render
|
284
|
-
* @param fg [
|
284
|
+
* @param fg [Array(Integer, Integer, Integer)]
|
285
285
|
* the color to render. An array of r, g, and b components.
|
286
286
|
*
|
287
287
|
* @return [SDL2::Surface]
|
@@ -344,26 +344,26 @@ void rubysdl2_init_ttf(void)
|
|
344
344
|
|
345
345
|
mStyle = rb_define_module_under(cTTF, "Style");
|
346
346
|
/* */
|
347
|
-
/* normal style */
|
347
|
+
/* @return [Integer] integer representing normal style */
|
348
348
|
rb_define_const(mStyle, "NORMAL", INT2NUM((TTF_STYLE_NORMAL)));
|
349
|
-
/* bold style */
|
349
|
+
/* @return [Integer] integer representing bold style */
|
350
350
|
rb_define_const(mStyle, "BOLD", INT2NUM((TTF_STYLE_BOLD)));
|
351
|
-
/* italic style */
|
351
|
+
/* @return [Integer] integer representing italic style */
|
352
352
|
rb_define_const(mStyle, "ITALIC", INT2NUM((TTF_STYLE_ITALIC)));
|
353
|
-
/* underline style */
|
353
|
+
/* @return [Integer] integer representing underline style */
|
354
354
|
rb_define_const(mStyle, "UNDERLINE", INT2NUM((TTF_STYLE_UNDERLINE)));
|
355
|
-
/* strikethrough style */
|
355
|
+
/* @return [Integer] integer representing strikethrough style */
|
356
356
|
rb_define_const(mStyle, "STRIKETHROUGH", INT2NUM((TTF_STYLE_STRIKETHROUGH)));
|
357
357
|
|
358
358
|
mHinting = rb_define_module_under(cTTF, "Hinting");
|
359
359
|
/* */
|
360
|
-
/* normal hinting, default */
|
360
|
+
/* @return [Integer] integer representing normal hinting, default */
|
361
361
|
rb_define_const(mHinting, "NORMAL", INT2NUM((TTF_HINTING_NORMAL)));
|
362
|
-
/* lighter hinting for non-monochrome modes */
|
362
|
+
/* @return [Integer] integer representing lighter hinting for non-monochrome modes */
|
363
363
|
rb_define_const(mHinting, "LIGHT", INT2NUM((TTF_HINTING_LIGHT)));
|
364
|
-
/* strong hinting only used for monochrome output */
|
364
|
+
/* @return [Integer] integer representing strong hinting, only used for monochrome output */
|
365
365
|
rb_define_const(mHinting, "MONO", INT2NUM((TTF_HINTING_MONO)));
|
366
|
-
/* no hinting */
|
366
|
+
/* @return [Integer] integer representing no hinting */
|
367
367
|
rb_define_const(mHinting, "NONE", INT2NUM((TTF_HINTING_NONE)));
|
368
368
|
}
|
369
369
|
|
data/ttf.c.m4
CHANGED
@@ -76,7 +76,7 @@ DEFINE_WRAPPER(TTF_Font, TTF, font, cTTF, "SDL2::TTF");
|
|
76
76
|
*
|
77
77
|
* @!attribute kerning
|
78
78
|
* True if kerning is enabled.
|
79
|
-
* @return [
|
79
|
+
* @return [boolean]
|
80
80
|
*
|
81
81
|
* @!attribute [r] height
|
82
82
|
* The maximum pixel height of all glyphs of the font.
|
@@ -193,7 +193,7 @@ TTF_ATTR_READER(face_style_name, FaceStyleName, utf8str_new_cstr);
|
|
193
193
|
*
|
194
194
|
* @param text [String] the string to size up
|
195
195
|
*
|
196
|
-
* @return [
|
196
|
+
* @return [Array(Integer, Integer)] a pair of width and height of the rendered surface
|
197
197
|
*
|
198
198
|
* @raise [SDL2::Error] It is raised when an error occurs, such as a glyph ins the
|
199
199
|
* string not being found.
|
@@ -237,7 +237,7 @@ static VALUE render(SDL_Surface* (*renderer)(TTF_Font*, const char*, SDL_Color,
|
|
237
237
|
* Solid mode rendering is quick but dirty.
|
238
238
|
*
|
239
239
|
* @param text [String] the text to render
|
240
|
-
* @param fg [
|
240
|
+
* @param fg [Array(Integer, Integer, Integer)]
|
241
241
|
* the color to render. An array of r, g, and b components.
|
242
242
|
*
|
243
243
|
* @return [SDL2::Surface]
|
@@ -258,9 +258,9 @@ static VALUE TTF_render_solid(VALUE self, VALUE text, VALUE fg)
|
|
258
258
|
* the background color.
|
259
259
|
*
|
260
260
|
* @param text [String] the text to render
|
261
|
-
* @param fg [
|
261
|
+
* @param fg [Array(Integer, Integer, Integer)]
|
262
262
|
* the color to render. An array of r, g, and b components.
|
263
|
-
* @param bg [
|
263
|
+
* @param bg [Array(Integer, Integer, Integer)]
|
264
264
|
* the background color. An array of r, g, and b components.
|
265
265
|
*
|
266
266
|
* @return [SDL2::Surface]
|
@@ -281,7 +281,7 @@ static VALUE TTF_render_shaded(VALUE self, VALUE text, VALUE fg, VALUE bg)
|
|
281
281
|
* The rendered surface has an alpha channel,
|
282
282
|
*
|
283
283
|
* @param text [String] the text to render
|
284
|
-
* @param fg [
|
284
|
+
* @param fg [Array(Integer, Integer, Integer)]
|
285
285
|
* the color to render. An array of r, g, and b components.
|
286
286
|
*
|
287
287
|
* @return [SDL2::Surface]
|
@@ -344,26 +344,26 @@ void rubysdl2_init_ttf(void)
|
|
344
344
|
|
345
345
|
mStyle = rb_define_module_under(cTTF, "Style");
|
346
346
|
/* define(`DEFINE_TTF_STYLE_CONST',`rb_define_const(mStyle, "$1", INT2NUM((TTF_STYLE_$1)))') */
|
347
|
-
/* normal style */
|
347
|
+
/* @return [Integer] integer representing normal style */
|
348
348
|
DEFINE_TTF_STYLE_CONST(NORMAL);
|
349
|
-
/* bold style */
|
349
|
+
/* @return [Integer] integer representing bold style */
|
350
350
|
DEFINE_TTF_STYLE_CONST(BOLD);
|
351
|
-
/* italic style */
|
351
|
+
/* @return [Integer] integer representing italic style */
|
352
352
|
DEFINE_TTF_STYLE_CONST(ITALIC);
|
353
|
-
/* underline style */
|
353
|
+
/* @return [Integer] integer representing underline style */
|
354
354
|
DEFINE_TTF_STYLE_CONST(UNDERLINE);
|
355
|
-
/* strikethrough style */
|
355
|
+
/* @return [Integer] integer representing strikethrough style */
|
356
356
|
DEFINE_TTF_STYLE_CONST(STRIKETHROUGH);
|
357
357
|
|
358
358
|
mHinting = rb_define_module_under(cTTF, "Hinting");
|
359
359
|
/* define(`DEFINE_TTF_HINTING_CONST',`rb_define_const(mHinting, "$1", INT2NUM((TTF_HINTING_$1)))') */
|
360
|
-
/* normal hinting, default */
|
360
|
+
/* @return [Integer] integer representing normal hinting, default */
|
361
361
|
DEFINE_TTF_HINTING_CONST(NORMAL);
|
362
|
-
/* lighter hinting for non-monochrome modes */
|
362
|
+
/* @return [Integer] integer representing lighter hinting for non-monochrome modes */
|
363
363
|
DEFINE_TTF_HINTING_CONST(LIGHT);
|
364
|
-
/* strong hinting only used for monochrome output */
|
364
|
+
/* @return [Integer] integer representing strong hinting, only used for monochrome output */
|
365
365
|
DEFINE_TTF_HINTING_CONST(MONO);
|
366
|
-
/* no hinting */
|
366
|
+
/* @return [Integer] integer representing no hinting */
|
367
367
|
DEFINE_TTF_HINTING_CONST(NONE);
|
368
368
|
}
|
369
369
|
|