SDLRuby 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -22
  3. data/LICENSE.txt +21 -21
  4. data/README.md +31 -31
  5. data/Rakefile +12 -12
  6. data/SDLRuby.gemspec +38 -0
  7. data/examples/alert.rb +8 -0
  8. data/examples/window.rb +7 -0
  9. data/lib/SDLRuby/event/accessor.rb +2 -2
  10. data/lib/SDLRuby/event.rb +101 -101
  11. data/lib/SDLRuby/image/include/SDL_image.h.rb +61 -61
  12. data/lib/SDLRuby/mixer/include/SDL_mixer.h.rb +95 -95
  13. data/lib/SDLRuby/rw_ops/rw_object.rb +34 -34
  14. data/lib/SDLRuby/rw_ops.rb +91 -91
  15. data/lib/SDLRuby/sdl/include/SDL.h.rb +44 -44
  16. data/lib/SDLRuby/sdl/include/SDL_audio.h.rb +160 -160
  17. data/lib/SDLRuby/sdl/include/SDL_blendmode.h.rb +30 -30
  18. data/lib/SDLRuby/sdl/include/SDL_clipboard.h.rb +10 -10
  19. data/lib/SDLRuby/sdl/include/SDL_config.h.rb +13 -13
  20. data/lib/SDLRuby/sdl/include/SDL_cpuinfo.h.rb +27 -27
  21. data/lib/SDLRuby/sdl/include/SDL_endian.h.rb +12 -12
  22. data/lib/SDLRuby/sdl/include/SDL_error.h.rb +28 -28
  23. data/lib/SDLRuby/sdl/include/SDL_events.h.rb +472 -472
  24. data/lib/SDLRuby/sdl/include/SDL_filesystem.h.rb +6 -6
  25. data/lib/SDLRuby/sdl/include/SDL_gamecontroller.h.rb +147 -147
  26. data/lib/SDLRuby/sdl/include/SDL_gesture.h.rb +12 -12
  27. data/lib/SDLRuby/sdl/include/SDL_guid.h.rb +13 -13
  28. data/lib/SDLRuby/sdl/include/SDL_hints.h.rb +199 -199
  29. data/lib/SDLRuby/sdl/include/SDL_joystick.h.rb +131 -131
  30. data/lib/SDLRuby/sdl/include/SDL_keyboard.h.rb +35 -35
  31. data/lib/SDLRuby/sdl/include/SDL_keycode.h.rb +292 -292
  32. data/lib/SDLRuby/sdl/include/SDL_locale.h.rb +13 -13
  33. data/lib/SDLRuby/sdl/include/SDL_main.h.rb +3 -3
  34. data/lib/SDLRuby/sdl/include/SDL_messagebox.h.rb +58 -58
  35. data/lib/SDLRuby/sdl/include/SDL_misc.h.rb +5 -5
  36. data/lib/SDLRuby/sdl/include/SDL_mouse.h.rb +57 -57
  37. data/lib/SDLRuby/sdl/include/SDL_pixels.h.rb +285 -285
  38. data/lib/SDLRuby/sdl/include/SDL_platform.h.rb +3 -3
  39. data/lib/SDLRuby/sdl/include/SDL_power.h.rb +6 -6
  40. data/lib/SDLRuby/sdl/include/SDL_rect.h.rb +46 -46
  41. data/lib/SDLRuby/sdl/include/SDL_render.h.rb +131 -131
  42. data/lib/SDLRuby/sdl/include/SDL_revision.h.rb +2 -2
  43. data/lib/SDLRuby/sdl/include/SDL_rwops.h.rb +78 -78
  44. data/lib/SDLRuby/sdl/include/SDL_scancode.h.rb +252 -252
  45. data/lib/SDLRuby/sdl/include/SDL_sensor.h.rb +25 -25
  46. data/lib/SDLRuby/sdl/include/SDL_shape.h.rb +40 -40
  47. data/lib/SDLRuby/sdl/include/SDL_stdinc.h.rb +62 -62
  48. data/lib/SDLRuby/sdl/include/SDL_surface.h.rb +100 -100
  49. data/lib/SDLRuby/sdl/include/SDL_system.h.rb +6 -6
  50. data/lib/SDLRuby/sdl/include/SDL_syswm.h.rb +10 -10
  51. data/lib/SDLRuby/sdl/include/SDL_timer.h.rb +21 -21
  52. data/lib/SDLRuby/sdl/include/SDL_touch.h.rb +15 -15
  53. data/lib/SDLRuby/sdl/include/SDL_types.h.rb +3 -3
  54. data/lib/SDLRuby/sdl/include/SDL_version.h.rb +14 -14
  55. data/lib/SDLRuby/sdl/include/SDL_video.h.rb +264 -264
  56. data/lib/SDLRuby/sdl.rb +218 -218
  57. data/lib/SDLRuby/ttf/include/SDL_ttf.h.rb +54 -54
  58. data/lib/SDLRuby/version.rb +5 -5
  59. data/lib/SDLRuby/window/surfacer.rb +37 -37
  60. data/lib/SDLRuby.rb +32 -16
  61. data/sig/SDLRuby.rbs +4 -4
  62. data/sig/lib/SDLRuby/event/accessor.rbs +157 -157
  63. data/sig/lib/SDLRuby/event/type.rbs +67 -67
  64. data/sig/lib/SDLRuby/event.rbs +47 -47
  65. data/sig/lib/SDLRuby/keyboard.rbs +25 -25
  66. data/sig/lib/SDLRuby/mouse.rbs +35 -35
  67. data/sig/lib/SDLRuby/sdl.rbs +655 -655
  68. data/sig/lib/SDLRuby/timer.rbs +7 -7
  69. metadata +6 -3
data/lib/SDLRuby.rb CHANGED
@@ -1,16 +1,32 @@
1
- # frozen_string_literal: true
2
-
3
- require 'forwardable'
4
- require_relative 'SDLRuby/version'
5
- require_relative 'SDLRuby/sdl'
6
-
7
- # Extended libraries
8
- #
9
- require_relative 'SDLRuby/font'
10
- require_relative 'SDLRuby/image'
11
- require_relative 'SDLRuby/mixer'
12
- require_relative 'SDLRuby/music'
13
-
14
- module SDLRuby
15
- class Error < StandardError; end
16
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'forwardable'
4
+ require_relative 'SDLRuby/version'
5
+
6
+ module SDLRuby
7
+ class Error < StandardError; end
8
+
9
+ class << self
10
+ def load_sdl
11
+ require_relative 'SDLRuby/sdl'
12
+ end
13
+
14
+ # Extended libraries
15
+ #
16
+ def load_sdl_font
17
+ require_relative 'SDLRuby/font'
18
+ end
19
+
20
+ def load_sdl_image
21
+ require_relative 'SDLRuby/image'
22
+ end
23
+
24
+ def load_sdl_mixer
25
+ require_relative 'SDLRuby/mixer'
26
+ end
27
+
28
+ def load_sdl_music
29
+ require_relative 'SDLRuby/music'
30
+ end
31
+ end
32
+ end
data/sig/SDLRuby.rbs CHANGED
@@ -1,4 +1,4 @@
1
- module SDLRuby
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end
1
+ module SDLRuby
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
@@ -1,157 +1,157 @@
1
- module SDLRuby
2
- class Event
3
- module Accessor
4
- include SDL
5
-
6
- def self.[]: (Symbol sym) -> Module
7
-
8
- def axis: () -> Integer?
9
-
10
- def ball: () -> Integer?
11
-
12
- def button: () -> Integer?
13
-
14
- def clicks: () -> Integer?
15
-
16
- def code: () -> Integer?
17
-
18
- def dDist: () -> Float?
19
-
20
- def dTheta: () -> Float?
21
-
22
- def data: () -> Array[Float]?
23
-
24
- def data1: () -> (Integer | untyped)?
25
-
26
- def data2: () -> (Integer | untyped)?
27
-
28
- def direction: () -> Integer?
29
-
30
- def display: () -> Integer?
31
-
32
- def dx: () -> Integer?
33
-
34
- def dy: () -> Integer?
35
-
36
- def error: () -> Float?
37
-
38
- def event: () -> Integer?
39
-
40
- def file: () -> String?
41
-
42
- def finger: () -> Integer?
43
-
44
- def fingerId: () -> Integer?
45
-
46
- def gestureId: () -> Integer?
47
-
48
- def hat: () -> Integer?
49
-
50
- def iscapture: () -> Integer?
51
-
52
- def keysym: () -> Hash[String, Integer]?
53
-
54
- def length: () -> Integer?
55
-
56
- def level: () -> Integer?
57
-
58
- def mouseX: () -> Integer?
59
-
60
- def mouseY: () -> Integer?
61
-
62
- def msg: () -> untyped?
63
-
64
- def numFingers: () -> Integer?
65
-
66
- def padding: () -> void
67
-
68
- def padding1: () -> void
69
-
70
- def padding2: () -> void
71
-
72
- def padding3: () -> void
73
-
74
- def padding4: () -> void
75
-
76
- def preciseX: () -> Float?
77
-
78
- def preciseY: () -> Float?
79
-
80
- def pressure: () -> Float?
81
-
82
- def repeat: () -> Integer?
83
-
84
- def sensor: () -> Integer?
85
-
86
- def start: () -> Integer?
87
-
88
- def state: () -> Integer?
89
-
90
- def text: () -> String?
91
-
92
- def timestamp: () -> Integer
93
-
94
- def timestamp_us: () -> Integer?
95
-
96
- def touchId: () -> Integer?
97
-
98
- def touchpad: () -> Integer?
99
-
100
- def type: () -> Integer
101
-
102
- def value: () -> Integer?
103
-
104
- def which: () -> Integer?
105
-
106
- def windowID: () -> Integer?
107
-
108
- def x: () -> (Integer | Float)?
109
-
110
- def xrel: () -> Integer?
111
-
112
- def y: () -> (Integer | Float)?
113
-
114
- def yrel: () -> Integer?
115
-
116
- alias d_dist dDist
117
-
118
- alias d_theta dTheta
119
-
120
- alias finger_id fingerId
121
-
122
- alias gesture_id gestureId
123
-
124
- alias mouse_x mouseX
125
-
126
- alias mouse_y mouseY
127
-
128
- alias num_fingers numFingers
129
-
130
- alias precise_x preciseX
131
-
132
- alias precise_y preciseY
133
-
134
- alias touch_id touchId
135
-
136
- alias window_id windowID
137
-
138
- def capture?: () -> bool
139
-
140
- def pressed?: () -> bool
141
-
142
- def scancode: () -> Integer?
143
-
144
- def sym: () -> Integer?
145
-
146
- def mod: () -> Integer?
147
-
148
- private
149
-
150
- def char_ary_to_str: (Array[Integer] a) -> ("" | String)
151
-
152
- def char_ptr_to_str: (untyped ptr) -> ("" | String)
153
-
154
- def keep_member_pointer: (untyped) -> void
155
- end
156
- end
157
- end
1
+ module SDLRuby
2
+ class Event
3
+ module Accessor
4
+ include SDL
5
+
6
+ def self.[]: (Symbol sym) -> Module
7
+
8
+ def axis: () -> Integer?
9
+
10
+ def ball: () -> Integer?
11
+
12
+ def button: () -> Integer?
13
+
14
+ def clicks: () -> Integer?
15
+
16
+ def code: () -> Integer?
17
+
18
+ def dDist: () -> Float?
19
+
20
+ def dTheta: () -> Float?
21
+
22
+ def data: () -> Array[Float]?
23
+
24
+ def data1: () -> (Integer | untyped)?
25
+
26
+ def data2: () -> (Integer | untyped)?
27
+
28
+ def direction: () -> Integer?
29
+
30
+ def display: () -> Integer?
31
+
32
+ def dx: () -> Integer?
33
+
34
+ def dy: () -> Integer?
35
+
36
+ def error: () -> Float?
37
+
38
+ def event: () -> Integer?
39
+
40
+ def file: () -> String?
41
+
42
+ def finger: () -> Integer?
43
+
44
+ def fingerId: () -> Integer?
45
+
46
+ def gestureId: () -> Integer?
47
+
48
+ def hat: () -> Integer?
49
+
50
+ def iscapture: () -> Integer?
51
+
52
+ def keysym: () -> Hash[String, Integer]?
53
+
54
+ def length: () -> Integer?
55
+
56
+ def level: () -> Integer?
57
+
58
+ def mouseX: () -> Integer?
59
+
60
+ def mouseY: () -> Integer?
61
+
62
+ def msg: () -> untyped?
63
+
64
+ def numFingers: () -> Integer?
65
+
66
+ def padding: () -> void
67
+
68
+ def padding1: () -> void
69
+
70
+ def padding2: () -> void
71
+
72
+ def padding3: () -> void
73
+
74
+ def padding4: () -> void
75
+
76
+ def preciseX: () -> Float?
77
+
78
+ def preciseY: () -> Float?
79
+
80
+ def pressure: () -> Float?
81
+
82
+ def repeat: () -> Integer?
83
+
84
+ def sensor: () -> Integer?
85
+
86
+ def start: () -> Integer?
87
+
88
+ def state: () -> Integer?
89
+
90
+ def text: () -> String?
91
+
92
+ def timestamp: () -> Integer
93
+
94
+ def timestamp_us: () -> Integer?
95
+
96
+ def touchId: () -> Integer?
97
+
98
+ def touchpad: () -> Integer?
99
+
100
+ def type: () -> Integer
101
+
102
+ def value: () -> Integer?
103
+
104
+ def which: () -> Integer?
105
+
106
+ def windowID: () -> Integer?
107
+
108
+ def x: () -> (Integer | Float)?
109
+
110
+ def xrel: () -> Integer?
111
+
112
+ def y: () -> (Integer | Float)?
113
+
114
+ def yrel: () -> Integer?
115
+
116
+ alias d_dist dDist
117
+
118
+ alias d_theta dTheta
119
+
120
+ alias finger_id fingerId
121
+
122
+ alias gesture_id gestureId
123
+
124
+ alias mouse_x mouseX
125
+
126
+ alias mouse_y mouseY
127
+
128
+ alias num_fingers numFingers
129
+
130
+ alias precise_x preciseX
131
+
132
+ alias precise_y preciseY
133
+
134
+ alias touch_id touchId
135
+
136
+ alias window_id windowID
137
+
138
+ def capture?: () -> bool
139
+
140
+ def pressed?: () -> bool
141
+
142
+ def scancode: () -> Integer?
143
+
144
+ def sym: () -> Integer?
145
+
146
+ def mod: () -> Integer?
147
+
148
+ private
149
+
150
+ def char_ary_to_str: (Array[Integer] a) -> ("" | String)
151
+
152
+ def char_ptr_to_str: (untyped ptr) -> ("" | String)
153
+
154
+ def keep_member_pointer: (untyped) -> void
155
+ end
156
+ end
157
+ end
@@ -1,67 +1,67 @@
1
- module SDLRuby
2
- class Event
3
- module Type
4
- include SDL
5
-
6
- QUIT_EVENT: ::Range[Integer]
7
-
8
- DISPLAY_EVENT: ::Range[Integer]
9
-
10
- WINDOW_EVENT: ::Range[Integer]
11
-
12
- SYSWM_EVENT: ::Range[Integer]
13
-
14
- KEY_EVENT: ::Range[Integer]
15
-
16
- EDIT_EVENT: ::Range[Integer]
17
-
18
- TEXT_EVENT: ::Range[Integer]
19
-
20
- EDIT_EXT_EVENT: ::Range[Integer]
21
-
22
- MOTION_EVENT: ::Range[Integer]
23
-
24
- BUTTON_EVENT: ::Range[Integer]
25
-
26
- WHEEL_EVENT: ::Range[Integer]
27
-
28
- JAXIS_EVENT: ::Range[Integer]
29
-
30
- JBALL_EVENT: ::Range[Integer]
31
-
32
- JHAT_EVENT: ::Range[Integer]
33
-
34
- JBUTTON_EVENT: ::Range[Integer]
35
-
36
- JDEVICE_EVENT: ::Range[Integer]
37
-
38
- JBATTERY_EVENT: ::Range[Integer]
39
-
40
- CAXIS_EVENT: ::Range[Integer]
41
-
42
- CBUTTON_EVENT: ::Range[Integer]
43
-
44
- CDEVICE_EVENT: ::Range[Integer]
45
-
46
- CTOUCHPAD_EVENT: ::Range[Integer]
47
-
48
- CSENSOR_EVENT: ::Range[Integer]
49
-
50
- TFINGER_EVENT: ::Range[Integer]
51
-
52
- DGESTURE_EVENT: ::Range[Integer]
53
-
54
- MGESTURE_EVENT: ::Range[Integer]
55
-
56
- DROP_EVENT: ::Range[Integer]
57
-
58
- ADEVICE_EVENT: ::Range[Integer]
59
-
60
- SENSOR_EVENT: ::Range[Integer]
61
-
62
- USER_EVENT: ::Range[Integer]
63
-
64
- def self.to_sym: (Integer `type`) -> Symbol
65
- end
66
- end
67
- end
1
+ module SDLRuby
2
+ class Event
3
+ module Type
4
+ include SDL
5
+
6
+ QUIT_EVENT: ::Range[Integer]
7
+
8
+ DISPLAY_EVENT: ::Range[Integer]
9
+
10
+ WINDOW_EVENT: ::Range[Integer]
11
+
12
+ SYSWM_EVENT: ::Range[Integer]
13
+
14
+ KEY_EVENT: ::Range[Integer]
15
+
16
+ EDIT_EVENT: ::Range[Integer]
17
+
18
+ TEXT_EVENT: ::Range[Integer]
19
+
20
+ EDIT_EXT_EVENT: ::Range[Integer]
21
+
22
+ MOTION_EVENT: ::Range[Integer]
23
+
24
+ BUTTON_EVENT: ::Range[Integer]
25
+
26
+ WHEEL_EVENT: ::Range[Integer]
27
+
28
+ JAXIS_EVENT: ::Range[Integer]
29
+
30
+ JBALL_EVENT: ::Range[Integer]
31
+
32
+ JHAT_EVENT: ::Range[Integer]
33
+
34
+ JBUTTON_EVENT: ::Range[Integer]
35
+
36
+ JDEVICE_EVENT: ::Range[Integer]
37
+
38
+ JBATTERY_EVENT: ::Range[Integer]
39
+
40
+ CAXIS_EVENT: ::Range[Integer]
41
+
42
+ CBUTTON_EVENT: ::Range[Integer]
43
+
44
+ CDEVICE_EVENT: ::Range[Integer]
45
+
46
+ CTOUCHPAD_EVENT: ::Range[Integer]
47
+
48
+ CSENSOR_EVENT: ::Range[Integer]
49
+
50
+ TFINGER_EVENT: ::Range[Integer]
51
+
52
+ DGESTURE_EVENT: ::Range[Integer]
53
+
54
+ MGESTURE_EVENT: ::Range[Integer]
55
+
56
+ DROP_EVENT: ::Range[Integer]
57
+
58
+ ADEVICE_EVENT: ::Range[Integer]
59
+
60
+ SENSOR_EVENT: ::Range[Integer]
61
+
62
+ USER_EVENT: ::Range[Integer]
63
+
64
+ def self.to_sym: (Integer `type`) -> Symbol
65
+ end
66
+ end
67
+ end
@@ -1,47 +1,47 @@
1
- module SDLRuby
2
- class Event
3
- include Accessor
4
-
5
- include SDL
6
-
7
- private
8
-
9
- def self.__malloc__: () -> untyped
10
-
11
- public
12
-
13
- def self.clear: () -> void
14
-
15
- def self.deq: (?bool non_block) -> (self | nil)
16
-
17
- def self.disable: (Integer `type`) -> void
18
-
19
- def self.empty?: () -> untyped
20
-
21
- def self.enable: (Integer `type`) -> void
22
-
23
- def self.get: () -> Event
24
-
25
- def self.length: () -> Integer
26
-
27
- alias self.size self.length
28
-
29
- def self.quit?: () -> bool
30
-
31
- def self.reserve: (Integer num) -> Integer
32
-
33
- def self.update: () -> void
34
-
35
- def self.wait: (?Integer|Float|Rational? timeout) -> boolish
36
-
37
- def initialize: (untyped ptr) -> void
38
-
39
- private
40
-
41
- attr_reader entity: untyped
42
-
43
- public
44
-
45
- def to_ptr: () -> untyped
46
- end
47
- end
1
+ module SDLRuby
2
+ class Event
3
+ include Accessor
4
+
5
+ include SDL
6
+
7
+ private
8
+
9
+ def self.__malloc__: () -> untyped
10
+
11
+ public
12
+
13
+ def self.clear: () -> void
14
+
15
+ def self.deq: (?bool non_block) -> (self | nil)
16
+
17
+ def self.disable: (Integer `type`) -> void
18
+
19
+ def self.empty?: () -> untyped
20
+
21
+ def self.enable: (Integer `type`) -> void
22
+
23
+ def self.get: () -> Event
24
+
25
+ def self.length: () -> Integer
26
+
27
+ alias self.size self.length
28
+
29
+ def self.quit?: () -> bool
30
+
31
+ def self.reserve: (Integer num) -> Integer
32
+
33
+ def self.update: () -> void
34
+
35
+ def self.wait: (?Integer|Float|Rational? timeout) -> boolish
36
+
37
+ def initialize: (untyped ptr) -> void
38
+
39
+ private
40
+
41
+ attr_reader entity: untyped
42
+
43
+ public
44
+
45
+ def to_ptr: () -> untyped
46
+ end
47
+ end
@@ -1,25 +1,25 @@
1
- module SDLRuby
2
- module Keyboard
3
- include SDL
4
-
5
- def self.==: (untyped other) -> bool
6
-
7
- def self.any?: () -> bool
8
-
9
- def self.clear: () -> void
10
-
11
- def self.mod: () -> Integer
12
-
13
- def self.scancode: (String | Symbol s) -> Integer
14
-
15
- def self.scancode_name: (Integer num) -> String
16
-
17
- def self.size: () -> Integer
18
-
19
- alias self.length self.size
20
-
21
- def self.to_a: () -> Array[Integer]
22
-
23
- def self.to_str: () -> String
24
- end
25
- end
1
+ module SDLRuby
2
+ module Keyboard
3
+ include SDL
4
+
5
+ def self.==: (untyped other) -> bool
6
+
7
+ def self.any?: () -> bool
8
+
9
+ def self.clear: () -> void
10
+
11
+ def self.mod: () -> Integer
12
+
13
+ def self.scancode: (String | Symbol s) -> Integer
14
+
15
+ def self.scancode_name: (Integer num) -> String
16
+
17
+ def self.size: () -> Integer
18
+
19
+ alias self.length self.size
20
+
21
+ def self.to_a: () -> Array[Integer]
22
+
23
+ def self.to_str: () -> String
24
+ end
25
+ end