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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0e0bde3276687797e754fb38566b3c23258a0cabedd2cb1b3b8c89fd20f03b1
|
4
|
+
data.tar.gz: 18ed3f916732eac3c54978dd251b4a01b86dfb71e33a8a4d105d906edeecf8dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c86c17d1f78f2a4d1835221a08490fc3c1cd5d4fb7848e9a926b7c6d89c3afcc758054f667c5242e2773dbe1a554bd92872bf23cc1f214fc58312527f79ffbda
|
7
|
+
data.tar.gz: e5314ba882de2a93c433b336590286482f9485092da806f711fbabda9e78ee0cb6781310e97f8f11270048bb3acfbcc261628c3bbadf1d17c8a38abb15c9b14c
|
data/.gitignore
CHANGED
@@ -11,6 +11,8 @@ mixer.c
|
|
11
11
|
joystick.c
|
12
12
|
gamecontroller.c
|
13
13
|
extconf.h
|
14
|
+
sdl2.rbi
|
15
|
+
sdl2.rbs
|
14
16
|
pkg/
|
15
17
|
TAGS
|
16
18
|
local/
|
@@ -20,4 +22,5 @@ sample/sample.wav
|
|
20
22
|
.yardoc/
|
21
23
|
doc/doc-*
|
22
24
|
doc/po/rubysdl2.pot
|
23
|
-
extconf-options.txt
|
25
|
+
extconf-options.txt
|
26
|
+
.gem_rbs_collection/
|
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem "rake"
|
7
|
+
gem "yard"
|
8
|
+
gem "sord", path: "../sord/main" # For locally modified sord, PR is already sent.
|
9
|
+
gem "steep", "~> 1.3.0" # sord depends on rbs 2.x, but steep 1.4.x depends rbs 3.x
|
10
|
+
gem "parallel", "~> 1.22.0" # parallel >= 1.23.0 breaks compatibility
|
11
|
+
end
|
data/README.md
CHANGED
@@ -12,8 +12,11 @@ Before installing Ruby/SDL2, you need to install:
|
|
12
12
|
* [SDL_mixer](https://www.libsdl.org/projects/SDL_mixer/)
|
13
13
|
* [SDL_ttf](https://www.libsdl.org/projects/SDL_ttf/)
|
14
14
|
|
15
|
-
After installing these libraries, you can install Ruby/SDL2
|
16
|
-
|
15
|
+
After installing these libraries, you can install Ruby/SDL2 by gem command as follows:
|
16
|
+
|
17
|
+
gem install ruby-sdl2
|
18
|
+
|
19
|
+
Alternatively You can also install the master version of Ruby/SDL2 from github:
|
17
20
|
|
18
21
|
git clone https://github.com/ohai/ruby-sdl2.git
|
19
22
|
cd ruby-sdl2
|
data/Rakefile
CHANGED
@@ -10,7 +10,9 @@ RB_FILES = Dir.glob("lib/**/*.rb")
|
|
10
10
|
O_FILES = Rake::FileList[*C_FILES].pathmap('%n.o')
|
11
11
|
|
12
12
|
POT_SOURCES = RB_FILES + ["main.c"] + (C_FILES - ["main.c"])
|
13
|
+
YARD_DOC_FILES = ["README.md", "COPYING.txt"] + POT_SOURCES
|
13
14
|
YARD_SOURCES = "-m markdown --main README.md --files COPYING.txt #{POT_SOURCES.join(" ")}"
|
15
|
+
YARD_CHECKSUM_FILE = ".yardoc/checksums"
|
14
16
|
|
15
17
|
WATCH_TARGETS = (C_FILES - C_FROM_M4_FILES) + C_M4_FILES + ["README.md"]
|
16
18
|
|
@@ -51,7 +53,6 @@ def gem_spec
|
|
51
53
|
spec.files = `git ls-files`.split(/\n/) + C_FROM_M4_FILES
|
52
54
|
spec.test_files = []
|
53
55
|
spec.extensions = ["extconf.rb"]
|
54
|
-
spec.has_rdoc = false
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
@@ -75,7 +76,7 @@ if locale
|
|
75
76
|
sh "yard doc -o doc/doc-#{locale} --locale #{locale} --po-dir doc/po #{YARD_SOURCES}"
|
76
77
|
end
|
77
78
|
else
|
78
|
-
task "doc" =>
|
79
|
+
task "doc" => YARD_DOC_FILES do
|
79
80
|
sh "yard doc -o doc/doc-en #{YARD_SOURCES}"
|
80
81
|
end
|
81
82
|
end
|
@@ -85,7 +86,7 @@ task "doc-all" do
|
|
85
86
|
end
|
86
87
|
|
87
88
|
desc "List undocumented classes/modules/methods/constants"
|
88
|
-
task "doc-stat-undocumented" =>
|
89
|
+
task "doc-stat-undocumented" => YARD_DOC_FILES do
|
89
90
|
sh "yard stats --list-undoc --compact #{YARD_SOURCES}"
|
90
91
|
end
|
91
92
|
|
@@ -111,3 +112,21 @@ task "watch-doc" do
|
|
111
112
|
sh "inotifywait -e modify #{WATCH_TARGETS.join(" ")} && rake doc && notify-send -u low \"Ruby/SDL2 build doc OK\""
|
112
113
|
end
|
113
114
|
end
|
115
|
+
|
116
|
+
file YARD_CHECKSUM_FILE => YARD_DOC_FILES do
|
117
|
+
sh "yard doc -n #{YARD_SOURCES}"
|
118
|
+
end
|
119
|
+
|
120
|
+
file "sdl2.rbs" => YARD_CHECKSUM_FILE do
|
121
|
+
sh "sord --no-regenerate --rbs sdl2.rbs"
|
122
|
+
end
|
123
|
+
|
124
|
+
file "sdl2.rbi" => YARD_CHECKSUM_FILE do
|
125
|
+
sh "sord --no-regenerate --rbi sdl2.rbi"
|
126
|
+
end
|
127
|
+
|
128
|
+
task "clean" do
|
129
|
+
sh "rm -r .yardoc"
|
130
|
+
sh "rm -r doc/doc-en"
|
131
|
+
sh "rm #{C_FROM_M4_FILES.join(' ')}"
|
132
|
+
end
|
data/Steepfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
D = Steep::Diagnostic
|
2
|
+
|
3
|
+
# target :lib do
|
4
|
+
# signature "sdl2.rbs"
|
5
|
+
# library "rbs"
|
6
|
+
|
7
|
+
# check "lib"
|
8
|
+
# end
|
9
|
+
|
10
|
+
target :sample_testspriteminimal do
|
11
|
+
signature "sample/testspriteminimal.rbs"
|
12
|
+
signature "sdl2.rbs"
|
13
|
+
library "rbs"
|
14
|
+
|
15
|
+
check "sample/testspriteminimal.rb"
|
16
|
+
|
17
|
+
|
18
|
+
# configure_code_diagnostics(D::Ruby.strict)
|
19
|
+
# configure_code_diagnostics(D::Ruby.lenient)
|
20
|
+
configure_code_diagnostics do |hash|
|
21
|
+
hash[D::Ruby::MethodDefinitionMissing] = :information
|
22
|
+
hash[D::Ruby::UnknownConstant] = :information
|
23
|
+
end
|
24
|
+
end
|
data/doc/DEVELOP.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# For Developer
|
2
|
+
|
3
|
+
|
4
|
+
## Check out and build a gem
|
5
|
+
|
6
|
+
git clone https://github.com/ohai/ruby-sdl2.git
|
7
|
+
cd ruby-sdl2
|
8
|
+
bundle install
|
9
|
+
bundle exec rake gem # To build a gem
|
10
|
+
bundle exec rake doc # To build API documents
|
11
|
+
|
12
|
+
## Build C extension and run samples
|
13
|
+
|
14
|
+
bundle exec rake build # To build sdl2_ext.so
|
15
|
+
cd sample
|
16
|
+
ruby -I .. -I ../lib testspriteminimal.rb
|
17
|
+
|
18
|
+
## For type checking
|
19
|
+
|
20
|
+
Preparation
|
21
|
+
|
22
|
+
bundle exec rbs collection install
|
23
|
+
|
24
|
+
Generate ruby-sdl2's rbs file
|
25
|
+
|
26
|
+
bundle exec rake sdl2.rbs
|
27
|
+
|
28
|
+
Signature file validation
|
29
|
+
|
30
|
+
bundle exec steep validate
|
31
|
+
|
32
|
+
Type checking with Steep
|
33
|
+
|
34
|
+
bundle exec steep check
|
35
|
+
|
data/event.c
CHANGED
@@ -326,11 +326,11 @@ static VALUE EvWindow_inspect(VALUE self)
|
|
326
326
|
*
|
327
327
|
* @attribute pressed
|
328
328
|
* key is pressed
|
329
|
-
* @return [
|
329
|
+
* @return [boolean]
|
330
330
|
*
|
331
331
|
* @attribute repeat
|
332
332
|
* key repeat
|
333
|
-
* @return [
|
333
|
+
* @return [boolean]
|
334
334
|
*
|
335
335
|
* @attribute scancode
|
336
336
|
* physical key code
|
@@ -690,7 +690,7 @@ static VALUE EvJoyButton_inspect(VALUE self)
|
|
690
690
|
EVENT_ACCESSOR_INT(JoyAxisMotion, which, jaxis.which);
|
691
691
|
EVENT_ACCESSOR_UINT8(JoyAxisMotion, axis, jaxis.axis);
|
692
692
|
EVENT_ACCESSOR_INT(JoyAxisMotion, value, jaxis.value);
|
693
|
-
/* @return [
|
693
|
+
/* @return [String] inspection string */
|
694
694
|
static VALUE EvJoyAxisMotion_inspect(VALUE self)
|
695
695
|
{
|
696
696
|
SDL_Event* ev; Data_Get_Struct(self, SDL_Event, ev);
|
data/extconf.rb
CHANGED
@@ -53,6 +53,8 @@ have_header("SDL_filesystem.h")
|
|
53
53
|
have_const("MIX_INIT_MODPLUG", "SDL_mixer.h")
|
54
54
|
have_const("MIX_INIT_FLUIDSYNTH", "SDL_mixer.h")
|
55
55
|
have_const("MIX_INIT_MID", "SDL_mixer.h")
|
56
|
-
|
56
|
+
have_const("SDL_RENDERER_PRESENTVSYNC", "SDL_render.h")
|
57
|
+
have_const("SDL_WINDOW_ALLOW_HIGHDPI", "SDL_video.h")
|
58
|
+
have_const("SDL_WINDOW_MOUSE_CAPTURE", "SDL_video.h")
|
57
59
|
|
58
60
|
create_makefile('sdl2_ext')
|
data/gamecontroller.c
CHANGED
@@ -302,6 +302,7 @@ static VALUE GameController_axis(VALUE self, VALUE axis)
|
|
302
302
|
* Return true if a button is pressed.
|
303
303
|
*
|
304
304
|
* @param button [Integer] the index of a button, one of the constants in {Button}
|
305
|
+
* @return [Boolean]
|
305
306
|
*/
|
306
307
|
static VALUE GameController_button_pressed_p(VALUE self, VALUE button)
|
307
308
|
{
|
@@ -353,56 +354,56 @@ void rubysdl2_init_gamecontorller(void)
|
|
353
354
|
mButton = rb_define_module_under(cGameController, "Button");
|
354
355
|
|
355
356
|
/* */
|
356
|
-
/*
|
357
|
+
/* @return [Integer] index for invalid axis*/
|
357
358
|
rb_define_const(mAxis, "INVALID", INT2NUM(SDL_CONTROLLER_AXIS_INVALID));
|
358
|
-
/* Left X axis */
|
359
|
+
/* @return [Integer] index for Left X axis */
|
359
360
|
rb_define_const(mAxis, "LEFTX", INT2NUM(SDL_CONTROLLER_AXIS_LEFTX));
|
360
|
-
/* Left Y axis */
|
361
|
+
/* @return [Integer] index for Left Y axis */
|
361
362
|
rb_define_const(mAxis, "LEFTY", INT2NUM(SDL_CONTROLLER_AXIS_LEFTY));
|
362
|
-
/* Right X axis */
|
363
|
+
/* @return [Integer] index for Right X axis */
|
363
364
|
rb_define_const(mAxis, "RIGHTX", INT2NUM(SDL_CONTROLLER_AXIS_RIGHTX));
|
364
|
-
/* Right Y axis */
|
365
|
+
/* @return [Integer] index for Right Y axis */
|
365
366
|
rb_define_const(mAxis, "RIGHTY", INT2NUM(SDL_CONTROLLER_AXIS_RIGHTY));
|
366
|
-
/* Left trigger axis */
|
367
|
+
/* @return [Integer] index for Left trigger axis */
|
367
368
|
rb_define_const(mAxis, "TRIGGERLEFT", INT2NUM(SDL_CONTROLLER_AXIS_TRIGGERLEFT));
|
368
|
-
/* Right trigger axis */
|
369
|
+
/* @return [Integer] index for Right trigger axis */
|
369
370
|
rb_define_const(mAxis, "TRIGGERRIGHT", INT2NUM(SDL_CONTROLLER_AXIS_TRIGGERRIGHT));
|
370
|
-
/*
|
371
|
+
/* @return [Integer] the max value of axis indices */
|
371
372
|
rb_define_const(mAxis, "MAX", INT2NUM(SDL_CONTROLLER_AXIS_MAX));
|
372
373
|
|
373
374
|
/* */
|
374
|
-
/* Invalid button
|
375
|
+
/* @return [Integer] index for Invalid button */
|
375
376
|
rb_define_const(mButton, "INVALID", INT2NUM(SDL_CONTROLLER_BUTTON_INVALID));
|
376
|
-
/* Button A */
|
377
|
+
/* @return [Integer] index for Button A */
|
377
378
|
rb_define_const(mButton, "A", INT2NUM(SDL_CONTROLLER_BUTTON_A));
|
378
|
-
/* Button B */
|
379
|
+
/* @return [Integer] index for Button B */
|
379
380
|
rb_define_const(mButton, "B", INT2NUM(SDL_CONTROLLER_BUTTON_B));
|
380
|
-
/* Button X */
|
381
|
+
/* @return [Integer] index for Button X */
|
381
382
|
rb_define_const(mButton, "X", INT2NUM(SDL_CONTROLLER_BUTTON_X));
|
382
|
-
/* Button Y */
|
383
|
+
/* @return [Integer] index for Button Y */
|
383
384
|
rb_define_const(mButton, "Y", INT2NUM(SDL_CONTROLLER_BUTTON_Y));
|
384
|
-
/* Back Button */
|
385
|
+
/* @return [Integer] index for Back Button */
|
385
386
|
rb_define_const(mButton, "BACK", INT2NUM(SDL_CONTROLLER_BUTTON_BACK));
|
386
|
-
/* Guide Button */
|
387
|
+
/* @return [Integer] index for Guide Button */
|
387
388
|
rb_define_const(mButton, "GUIDE", INT2NUM(SDL_CONTROLLER_BUTTON_GUIDE));
|
388
|
-
/* Start Button */
|
389
|
+
/* @return [Integer] index for Start Button */
|
389
390
|
rb_define_const(mButton, "START", INT2NUM(SDL_CONTROLLER_BUTTON_START));
|
390
|
-
/* Left stick Button */
|
391
|
+
/* @return [Integer] index for Left stick Button */
|
391
392
|
rb_define_const(mButton, "LEFTSTICK", INT2NUM(SDL_CONTROLLER_BUTTON_LEFTSTICK));
|
392
|
-
/* Right stick Button */
|
393
|
+
/* @return [Integer] index for Right stick Button */
|
393
394
|
rb_define_const(mButton, "RIGHTSTICK", INT2NUM(SDL_CONTROLLER_BUTTON_RIGHTSTICK));
|
394
|
-
/* Left shoulder Button */
|
395
|
+
/* @return [Integer] index for Left shoulder Button */
|
395
396
|
rb_define_const(mButton, "LEFTSHOULDER", INT2NUM(SDL_CONTROLLER_BUTTON_LEFTSHOULDER));
|
396
|
-
/* Right shoulder Button */
|
397
|
+
/* @return [Integer] index for Right shoulder Button */
|
397
398
|
rb_define_const(mButton, "RIGHTSHOULDER", INT2NUM(SDL_CONTROLLER_BUTTON_RIGHTSHOULDER));
|
398
|
-
/* D-pad UP Button */
|
399
|
+
/* @return [Integer] index for D-pad UP Button */
|
399
400
|
rb_define_const(mButton, "DPAD_UP", INT2NUM(SDL_CONTROLLER_BUTTON_DPAD_UP));
|
400
|
-
/* D-pad DOWN Button */
|
401
|
+
/* @return [Integer] index for D-pad DOWN Button */
|
401
402
|
rb_define_const(mButton, "DPAD_DOWN", INT2NUM(SDL_CONTROLLER_BUTTON_DPAD_DOWN));
|
402
|
-
/* D-pad LEFT Button */
|
403
|
+
/* @return [Integer] index for D-pad LEFT Button */
|
403
404
|
rb_define_const(mButton, "DPAD_LEFT", INT2NUM(SDL_CONTROLLER_BUTTON_DPAD_LEFT));
|
404
|
-
/* D-pad RIGHT Button */
|
405
|
+
/* @return [Integer] index for D-pad RIGHT Button */
|
405
406
|
rb_define_const(mButton, "DPAD_RIGHT", INT2NUM(SDL_CONTROLLER_BUTTON_DPAD_RIGHT));
|
406
|
-
/* The max of
|
407
|
+
/* @return [Integer] The max value of button indices */
|
407
408
|
rb_define_const(mButton, "MAX", INT2NUM(SDL_CONTROLLER_BUTTON_MAX));
|
408
409
|
}
|
data/gamecontroller.c.m4
CHANGED
@@ -302,6 +302,7 @@ static VALUE GameController_axis(VALUE self, VALUE axis)
|
|
302
302
|
* Return true if a button is pressed.
|
303
303
|
*
|
304
304
|
* @param button [Integer] the index of a button, one of the constants in {Button}
|
305
|
+
* @return [Boolean]
|
305
306
|
*/
|
306
307
|
static VALUE GameController_button_pressed_p(VALUE self, VALUE button)
|
307
308
|
{
|
@@ -353,56 +354,56 @@ void rubysdl2_init_gamecontorller(void)
|
|
353
354
|
mButton = rb_define_module_under(cGameController, "Button");
|
354
355
|
|
355
356
|
/* define(`DEFINE_CONTROLLER_AXIS_CONST',`rb_define_const(mAxis, "$1", INT2NUM(SDL_CONTROLLER_AXIS_$1))') */
|
356
|
-
/*
|
357
|
+
/* @return [Integer] index for invalid axis*/
|
357
358
|
DEFINE_CONTROLLER_AXIS_CONST(INVALID);
|
358
|
-
/* Left X axis */
|
359
|
+
/* @return [Integer] index for Left X axis */
|
359
360
|
DEFINE_CONTROLLER_AXIS_CONST(LEFTX);
|
360
|
-
/* Left Y axis */
|
361
|
+
/* @return [Integer] index for Left Y axis */
|
361
362
|
DEFINE_CONTROLLER_AXIS_CONST(LEFTY);
|
362
|
-
/* Right X axis */
|
363
|
+
/* @return [Integer] index for Right X axis */
|
363
364
|
DEFINE_CONTROLLER_AXIS_CONST(RIGHTX);
|
364
|
-
/* Right Y axis */
|
365
|
+
/* @return [Integer] index for Right Y axis */
|
365
366
|
DEFINE_CONTROLLER_AXIS_CONST(RIGHTY);
|
366
|
-
/* Left trigger axis */
|
367
|
+
/* @return [Integer] index for Left trigger axis */
|
367
368
|
DEFINE_CONTROLLER_AXIS_CONST(TRIGGERLEFT);
|
368
|
-
/* Right trigger axis */
|
369
|
+
/* @return [Integer] index for Right trigger axis */
|
369
370
|
DEFINE_CONTROLLER_AXIS_CONST(TRIGGERRIGHT);
|
370
|
-
/*
|
371
|
+
/* @return [Integer] the max value of axis indices */
|
371
372
|
DEFINE_CONTROLLER_AXIS_CONST(MAX);
|
372
373
|
|
373
374
|
/* define(`DEFINE_CONTROLLER_BUTTON_CONST',`rb_define_const(mButton, "$1", INT2NUM(SDL_CONTROLLER_BUTTON_$1))') */
|
374
|
-
/* Invalid button
|
375
|
+
/* @return [Integer] index for Invalid button */
|
375
376
|
DEFINE_CONTROLLER_BUTTON_CONST(INVALID);
|
376
|
-
/* Button A */
|
377
|
+
/* @return [Integer] index for Button A */
|
377
378
|
DEFINE_CONTROLLER_BUTTON_CONST(A);
|
378
|
-
/* Button B */
|
379
|
+
/* @return [Integer] index for Button B */
|
379
380
|
DEFINE_CONTROLLER_BUTTON_CONST(B);
|
380
|
-
/* Button X */
|
381
|
+
/* @return [Integer] index for Button X */
|
381
382
|
DEFINE_CONTROLLER_BUTTON_CONST(X);
|
382
|
-
/* Button Y */
|
383
|
+
/* @return [Integer] index for Button Y */
|
383
384
|
DEFINE_CONTROLLER_BUTTON_CONST(Y);
|
384
|
-
/* Back Button */
|
385
|
+
/* @return [Integer] index for Back Button */
|
385
386
|
DEFINE_CONTROLLER_BUTTON_CONST(BACK);
|
386
|
-
/* Guide Button */
|
387
|
+
/* @return [Integer] index for Guide Button */
|
387
388
|
DEFINE_CONTROLLER_BUTTON_CONST(GUIDE);
|
388
|
-
/* Start Button */
|
389
|
+
/* @return [Integer] index for Start Button */
|
389
390
|
DEFINE_CONTROLLER_BUTTON_CONST(START);
|
390
|
-
/* Left stick Button */
|
391
|
+
/* @return [Integer] index for Left stick Button */
|
391
392
|
DEFINE_CONTROLLER_BUTTON_CONST(LEFTSTICK);
|
392
|
-
/* Right stick Button */
|
393
|
+
/* @return [Integer] index for Right stick Button */
|
393
394
|
DEFINE_CONTROLLER_BUTTON_CONST(RIGHTSTICK);
|
394
|
-
/* Left shoulder Button */
|
395
|
+
/* @return [Integer] index for Left shoulder Button */
|
395
396
|
DEFINE_CONTROLLER_BUTTON_CONST(LEFTSHOULDER);
|
396
|
-
/* Right shoulder Button */
|
397
|
+
/* @return [Integer] index for Right shoulder Button */
|
397
398
|
DEFINE_CONTROLLER_BUTTON_CONST(RIGHTSHOULDER);
|
398
|
-
/* D-pad UP Button */
|
399
|
+
/* @return [Integer] index for D-pad UP Button */
|
399
400
|
DEFINE_CONTROLLER_BUTTON_CONST(DPAD_UP);
|
400
|
-
/* D-pad DOWN Button */
|
401
|
+
/* @return [Integer] index for D-pad DOWN Button */
|
401
402
|
DEFINE_CONTROLLER_BUTTON_CONST(DPAD_DOWN);
|
402
|
-
/* D-pad LEFT Button */
|
403
|
+
/* @return [Integer] index for D-pad LEFT Button */
|
403
404
|
DEFINE_CONTROLLER_BUTTON_CONST(DPAD_LEFT);
|
404
|
-
/* D-pad RIGHT Button */
|
405
|
+
/* @return [Integer] index for D-pad RIGHT Button */
|
405
406
|
DEFINE_CONTROLLER_BUTTON_CONST(DPAD_RIGHT);
|
406
|
-
/* The max of
|
407
|
+
/* @return [Integer] The max value of button indices */
|
407
408
|
DEFINE_CONTROLLER_BUTTON_CONST(MAX);
|
408
409
|
}
|
data/gl.c
CHANGED
@@ -115,8 +115,7 @@ static VALUE GLContext_make_current(VALUE self, VALUE window)
|
|
115
115
|
/*
|
116
116
|
* Get the current OpenGL context.
|
117
117
|
*
|
118
|
-
* @return [SDL2::GL::Context] the
|
119
|
-
* @return [nil] if there is no current context
|
118
|
+
* @return [SDL2::GL::Context,nil] the current context, nil if there is no current context
|
120
119
|
*
|
121
120
|
* @see #make_current
|
122
121
|
*/
|
@@ -130,6 +129,7 @@ static VALUE GLContext_s_current(VALUE self)
|
|
130
129
|
* Return true if the current context supports **extension**
|
131
130
|
*
|
132
131
|
* @param extension [String] the name of an extension
|
132
|
+
* @return [Boolean]
|
133
133
|
* @example
|
134
134
|
* SDL2::GL.extension_supported?("GL_EXT_framebuffer_blit")
|
135
135
|
*/
|
@@ -190,7 +190,7 @@ static VALUE GL_s_get_attribute(VALUE self, VALUE attr)
|
|
190
190
|
*
|
191
191
|
* @param attr [Integer] the OpenGL attribute to set
|
192
192
|
* @param value [Integer] the desired value for the attribute
|
193
|
-
* @return [
|
193
|
+
* @return [void]
|
194
194
|
*/
|
195
195
|
static VALUE GL_s_set_attribute(VALUE self, VALUE attr, VALUE value)
|
196
196
|
{
|
@@ -217,56 +217,48 @@ void rubysdl2_init_gl(void)
|
|
217
217
|
rb_define_module_function(mGL, "set_attribute", GL_s_set_attribute, 2);
|
218
218
|
|
219
219
|
/* */
|
220
|
-
/* OpenGL attribute - minimal bits of red channel in color buffer, default is 3 */
|
220
|
+
/* @return [Integer] index for OpenGL attribute - minimal bits of red channel in color buffer, default is 3 */
|
221
221
|
rb_define_const(mGL, "RED_SIZE", INT2NUM(SDL_GL_RED_SIZE));
|
222
|
-
/* OpenGL attribute - minimal bits of green channel in color buffer, default is 3 */
|
222
|
+
/* @return [Integer] index for OpenGL attribute - minimal bits of green channel in color buffer, default is 3 */
|
223
223
|
rb_define_const(mGL, "GREEN_SIZE", INT2NUM(SDL_GL_GREEN_SIZE));
|
224
|
-
/* OpenGL attribute - minimal bits of blue channel in color buffer, default is 2 */
|
224
|
+
/* @return [Integer] index for OpenGL attribute - minimal bits of blue channel in color buffer, default is 2 */
|
225
225
|
rb_define_const(mGL, "BLUE_SIZE", INT2NUM(SDL_GL_BLUE_SIZE));
|
226
|
-
/* OpenGL attribute - minimal bits of alpha channel in color buffer, default is 0 */
|
226
|
+
/* @return [Integer] index for OpenGL attribute - minimal bits of alpha channel in color buffer, default is 0 */
|
227
227
|
rb_define_const(mGL, "ALPHA_SIZE", INT2NUM(SDL_GL_ALPHA_SIZE));
|
228
|
-
/* OpenGL attribute - minimal bits of framebufer, default is 0 */
|
228
|
+
/* @return [Integer] index for OpenGL attribute - minimal bits of framebufer, default is 0 */
|
229
229
|
rb_define_const(mGL, "BUFFER_SIZE", INT2NUM(SDL_GL_BUFFER_SIZE));
|
230
|
-
/* OpenGL attribute - whether the single buffer (0) or double buffer (1), default
|
231
|
-
is double buffer */
|
230
|
+
/* @return [Integer] index for OpenGL attribute - whether the single buffer (0) or double buffer (1), default is double buffer */
|
232
231
|
rb_define_const(mGL, "DOUBLEBUFFER", INT2NUM(SDL_GL_DOUBLEBUFFER));
|
233
|
-
/* OpenGL attribute - bits of depth buffer, default is 16 */
|
232
|
+
/* @return [Integer] index for OpenGL attribute - bits of depth buffer, default is 16 */
|
234
233
|
rb_define_const(mGL, "DEPTH_SIZE", INT2NUM(SDL_GL_DEPTH_SIZE));
|
235
|
-
/* OpenGL attribute - bits of stencil buffer, default is 0 */
|
234
|
+
/* @return [Integer] index for OpenGL attribute - bits of stencil buffer, default is 0 */
|
236
235
|
rb_define_const(mGL, "STENCIL_SIZE", INT2NUM(SDL_GL_STENCIL_SIZE));
|
237
|
-
/* OpenGL attribute - minimal bits of red channel in accumlation buffer,
|
238
|
-
default is 0 */
|
236
|
+
/* @return [Integer] index for OpenGL attribute - minimal bits of red channel in accumlation buffer, default is 0 */
|
239
237
|
rb_define_const(mGL, "ACCUM_RED_SIZE", INT2NUM(SDL_GL_ACCUM_RED_SIZE));
|
240
|
-
/* OpenGL attribute - minimal bits of green channel in accumlation buffer,
|
241
|
-
default is 0 */
|
238
|
+
/* @return [Integer] index for OpenGL attribute - minimal bits of green channel in accumlation buffer, default is 0 */
|
242
239
|
rb_define_const(mGL, "ACCUM_GREEN_SIZE", INT2NUM(SDL_GL_ACCUM_GREEN_SIZE));
|
243
|
-
/* OpenGL attribute - minimal bits of blue channel in accumlation buffer,
|
244
|
-
default is 0 */
|
240
|
+
/* @return [Integer] index for OpenGL attribute - minimal bits of blue channel in accumlation buffer, default is 0 */
|
245
241
|
rb_define_const(mGL, "ACCUM_BLUE_SIZE", INT2NUM(SDL_GL_ACCUM_BLUE_SIZE));
|
246
|
-
/* OpenGL attribute - minimal bits of alpha channel in accumlation buffer,
|
247
|
-
default is 0 */
|
242
|
+
/* @return [Integer] index for OpenGL attribute - minimal bits of alpha channel in accumlation buffer, default is 0 */
|
248
243
|
rb_define_const(mGL, "ACCUM_ALPHA_SIZE", INT2NUM(SDL_GL_ACCUM_ALPHA_SIZE));
|
249
|
-
/* OpenGL attribute - whether output is stereo (1) or not (0), default is 0 */
|
244
|
+
/* @return [Integer] index for OpenGL attribute - whether output is stereo (1) or not (0), default is 0 */
|
250
245
|
rb_define_const(mGL, "STEREO", INT2NUM(SDL_GL_STEREO));
|
251
|
-
/* OpenGL attribuite - the number of buffers used for multisampe anti-aliasing,
|
252
|
-
default is 0 */
|
246
|
+
/* @return [Integer] index for OpenGL attribuite - the number of buffers used for multisampe anti-aliasing, default is 0 */
|
253
247
|
rb_define_const(mGL, "MULTISAMPLEBUFFERS", INT2NUM(SDL_GL_MULTISAMPLEBUFFERS));
|
254
|
-
/* OpenGL attribute - the number of samples used around the current pixel
|
255
|
-
use for multisample anti-aliasing, default is 0 */
|
248
|
+
/* @return [Integer] index for OpenGL attribute - the number of samples used around the current pixel use for multisample anti-aliasing, default is 0 */
|
256
249
|
rb_define_const(mGL, "MULTISAMPLESAMPLES", INT2NUM(SDL_GL_MULTISAMPLESAMPLES));
|
257
|
-
/* OpenGL attribute - 1 for requiring hardware acceleration, 0 for software rendering,
|
258
|
-
default is allowing either */
|
250
|
+
/* @return [Integer] index for OpenGL attribute - 1 for requiring hardware acceleration, 0 for software rendering, default is allowing either */
|
259
251
|
rb_define_const(mGL, "ACCELERATED_VISUAL", INT2NUM(SDL_GL_ACCELERATED_VISUAL));
|
260
|
-
/* OpenGL attribute - not used (deprecated) */
|
252
|
+
/* @return [Integer] index for OpenGL attribute - not used (deprecated) */
|
261
253
|
rb_define_const(mGL, "RETAINED_BACKING", INT2NUM(SDL_GL_RETAINED_BACKING));
|
262
|
-
/* OpenGL attribute - OpenGL context major version */
|
254
|
+
/* @return [Integer] index for OpenGL attribute - OpenGL context major version */
|
263
255
|
rb_define_const(mGL, "CONTEXT_MAJOR_VERSION", INT2NUM(SDL_GL_CONTEXT_MAJOR_VERSION));
|
264
|
-
/* OpenGL attribute - OpenGL context minor version */
|
256
|
+
/* @return [Integer] index for OpenGL attribute - OpenGL context minor version */
|
265
257
|
rb_define_const(mGL, "CONTEXT_MINOR_VERSION", INT2NUM(SDL_GL_CONTEXT_MINOR_VERSION));
|
266
258
|
/*
|
267
259
|
* INT2NUM(SDL_GL_CONTEXT_FLAGS):
|
268
260
|
*
|
269
|
-
* OpenGL attribute - the bit combination of following constants, or 0.
|
261
|
+
* @return [Integer] index for OpenGL attribute - the bit combination of following constants, or 0.
|
270
262
|
* default is 0
|
271
263
|
*
|
272
264
|
* * {SDL2::GL::CONTEXT_DEBUG_FLAG}
|
@@ -282,7 +274,7 @@ void rubysdl2_init_gl(void)
|
|
282
274
|
rb_define_const(mGL, "CONTEXT_FLAGS", INT2NUM(SDL_GL_CONTEXT_FLAGS));
|
283
275
|
/* INT2NUM(SDL_GL_CONTEXT_PROFILE_MASK):
|
284
276
|
*
|
285
|
-
* OpenGL attribute - type of GL context, one of the following constants,
|
277
|
+
* @return [Integer] index for OpenGL attribute - type of GL context, one of the following constants,
|
286
278
|
* defaults depends on platform
|
287
279
|
*
|
288
280
|
* * {CONTEXT_PROFILE_CORE}
|
@@ -292,58 +284,59 @@ void rubysdl2_init_gl(void)
|
|
292
284
|
* https://wiki.libsdl.org/SDL_GLprofile
|
293
285
|
*/
|
294
286
|
rb_define_const(mGL, "CONTEXT_PROFILE_MASK", INT2NUM(SDL_GL_CONTEXT_PROFILE_MASK));
|
295
|
-
/* OpenGL attribute - OpenGL context sharing, default is 0 */
|
287
|
+
/* @return [Integer] index for OpenGL attribute - OpenGL context sharing, default is 0 */
|
296
288
|
rb_define_const(mGL, "SHARE_WITH_CURRENT_CONTEXT", INT2NUM(SDL_GL_SHARE_WITH_CURRENT_CONTEXT));
|
297
289
|
#if SDL_VERSION_ATLEAST(2,0,1)
|
298
|
-
/* OpenGL attribute - 1 for requesting sRGB capable visual, default to 0 */
|
290
|
+
/* @return [Integer] index for OpenGL attribute - 1 for requesting sRGB capable visual, default to 0 */
|
299
291
|
rb_define_const(mGL, "FRAMEBUFFER_SRGB_CAPABLE", INT2NUM(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE));
|
300
292
|
#endif
|
301
|
-
/* OpenGL attribute - not used (deprecated) */
|
293
|
+
/* @return [Integer] index for OpenGL attribute - not used (deprecated) */
|
302
294
|
rb_define_const(mGL, "CONTEXT_EGL", INT2NUM(SDL_GL_CONTEXT_EGL));
|
303
295
|
|
304
296
|
/* */
|
305
297
|
|
306
|
-
/*
|
307
|
-
*
|
308
|
-
*
|
309
|
-
*
|
298
|
+
/* @return [Integer]
|
299
|
+
* This flag maps to GLX_CONTEXT_DEBUG_BIT_ARB in
|
300
|
+
* the GLX_ARB_create_context extension for X11
|
301
|
+
* and WGL_CONTEXT_DEBUG_BIT_ARB in the WGL_ARB_create_context
|
302
|
+
* extension for Windows.
|
310
303
|
*/
|
311
304
|
rb_define_const(mGL, "CONTEXT_DEBUG_FLAG", INT2NUM(SDL_GL_CONTEXT_DEBUG_FLAG));
|
312
|
-
/*
|
313
|
-
*
|
314
|
-
*
|
315
|
-
*
|
316
|
-
*
|
305
|
+
/* @return [Integer]
|
306
|
+
* This flag maps to GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB in the
|
307
|
+
* GLX_ARB_create_context extension for X11 and
|
308
|
+
* WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB in the WGL_ARB_create_context
|
309
|
+
* extension for Windows.
|
317
310
|
*/
|
318
311
|
rb_define_const(mGL, "CONTEXT_FORWARD_COMPATIBLE_FLAG", INT2NUM(SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG));
|
319
|
-
/*
|
320
|
-
*
|
321
|
-
*
|
322
|
-
*
|
323
|
-
*
|
312
|
+
/* @return [Integer]
|
313
|
+
* This flag maps to GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB in the
|
314
|
+
* GLX_ARB_create_context_robustness extension for X11 and
|
315
|
+
* WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB in the WGL_ARB_create_context_robustness
|
316
|
+
* extension for Windows.
|
324
317
|
*/
|
325
318
|
rb_define_const(mGL, "CONTEXT_ROBUST_ACCESS_FLAG", INT2NUM(SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG));
|
326
|
-
/*
|
327
|
-
*
|
328
|
-
*
|
329
|
-
*
|
330
|
-
*
|
319
|
+
/* @return [Integer]
|
320
|
+
* This flag maps to GLX_CONTEXT_RESET_ISOLATION_BIT_ARB in the
|
321
|
+
* GLX_ARB_robustness_isolation extension for X11 and
|
322
|
+
* WGL_CONTEXT_RESET_ISOLATION_BIT_ARB in the WGL_ARB_create_context_robustness
|
323
|
+
* extension for Windows.
|
331
324
|
*/
|
332
325
|
rb_define_const(mGL, "CONTEXT_RESET_ISOLATION_FLAG", INT2NUM(SDL_GL_CONTEXT_RESET_ISOLATION_FLAG));
|
333
326
|
|
334
|
-
/*
|
335
|
-
*
|
336
|
-
*
|
327
|
+
/* @return [Integer]
|
328
|
+
* OpenGL core profile - deprecated
|
329
|
+
* functions are disabled
|
337
330
|
*/
|
338
331
|
rb_define_const(mGL, "CONTEXT_PROFILE_CORE", INT2NUM(SDL_GL_CONTEXT_PROFILE_CORE));
|
339
|
-
/*
|
340
|
-
*
|
341
|
-
*
|
332
|
+
/* @return [Integer]
|
333
|
+
* OpenGL compatibility profile -
|
334
|
+
* deprecated functions are allowed
|
342
335
|
*/
|
343
336
|
rb_define_const(mGL, "CONTEXT_PROFILE_COMPATIBILITY", INT2NUM(SDL_GL_CONTEXT_PROFILE_COMPATIBILITY));
|
344
|
-
/*
|
345
|
-
*
|
346
|
-
*
|
337
|
+
/* @return [Integer]
|
338
|
+
* OpenGL ES profile - only a subset of the
|
339
|
+
* base OpenGL functionality is available
|
347
340
|
*/
|
348
341
|
rb_define_const(mGL, "CONTEXT_PROFILE_ES", INT2NUM(SDL_GL_CONTEXT_PROFILE_ES));
|
349
342
|
|