sdl2-bindings 0.0.8 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +124 -92
  3. data/LICENSE.txt +1 -1
  4. data/README.md +77 -53
  5. data/lib/sdl2.rb +131 -172
  6. data/lib/sdl2_audio.rb +261 -222
  7. data/lib/sdl2_blendmode.rb +72 -69
  8. data/lib/sdl2_clipboard.rb +56 -51
  9. data/lib/sdl2_cpuinfo.rb +129 -106
  10. data/lib/sdl2_error.rb +71 -64
  11. data/lib/sdl2_events.rb +564 -533
  12. data/lib/sdl2_filesystem.rb +52 -48
  13. data/lib/sdl2_framerate.rb +74 -67
  14. data/lib/sdl2_gamecontroller.rb +329 -274
  15. data/lib/sdl2_gesture.rb +61 -55
  16. data/lib/sdl2_gfxPrimitives.rb +283 -222
  17. data/lib/sdl2_haptic.rb +301 -269
  18. data/lib/sdl2_hidapi.rb +139 -118
  19. data/lib/sdl2_hints.rb +221 -197
  20. data/lib/sdl2_image.rb +232 -185
  21. data/lib/sdl2_imageFilter.rb +164 -132
  22. data/lib/sdl2_joystick.rb +294 -239
  23. data/lib/sdl2_keyboard.rb +125 -99
  24. data/lib/sdl2_keycode.rb +307 -305
  25. data/lib/sdl2_log.rb +131 -115
  26. data/lib/sdl2_main.rb +74 -67
  27. data/lib/sdl2_messagebox.rb +102 -98
  28. data/lib/sdl2_misc.rb +48 -45
  29. data/lib/sdl2_mixer.rb +392 -317
  30. data/lib/sdl2_mouse.rb +136 -117
  31. data/lib/sdl2_pixels.rb +240 -224
  32. data/lib/sdl2_platform.rb +48 -45
  33. data/lib/sdl2_power.rb +54 -51
  34. data/lib/sdl2_rect.rb +145 -102
  35. data/lib/sdl2_render.rb +408 -322
  36. data/lib/sdl2_rotozoom.rb +76 -66
  37. data/lib/sdl2_rwops.rb +238 -208
  38. data/lib/sdl2_scancode.rb +289 -287
  39. data/lib/sdl2_sensor.rb +115 -97
  40. data/lib/sdl2_shape.rb +83 -77
  41. data/lib/sdl2_sound.rb +154 -0
  42. data/lib/sdl2_stdinc.rb +556 -439
  43. data/lib/sdl2_surface.rb +229 -188
  44. data/lib/sdl2_syswm.rb +160 -156
  45. data/lib/sdl2_timer.rb +74 -65
  46. data/lib/sdl2_touch.rb +86 -75
  47. data/lib/sdl2_ttf.rb +358 -202
  48. data/lib/sdl2_version.rb +67 -62
  49. data/lib/sdl2_video.rb +540 -446
  50. data/lib/sdl2_vulkan.rb +72 -64
  51. metadata +19 -4
data/lib/sdl2_mouse.rb CHANGED
@@ -1,117 +1,136 @@
1
- # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/sdl2-bindings
4
- #
5
- # [NOTICE] This is an automatically generated file.
6
-
7
- require 'ffi'
8
-
9
- module SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
- SDL_BUTTON_LEFT = 1
14
- SDL_BUTTON_MIDDLE = 2
15
- SDL_BUTTON_RIGHT = 3
16
- SDL_BUTTON_X1 = 4
17
- SDL_BUTTON_X2 = 5
18
-
19
- # Enum
20
-
21
- SDL_SYSTEM_CURSOR_ARROW = 0
22
- SDL_SYSTEM_CURSOR_IBEAM = 1
23
- SDL_SYSTEM_CURSOR_WAIT = 2
24
- SDL_SYSTEM_CURSOR_CROSSHAIR = 3
25
- SDL_SYSTEM_CURSOR_WAITARROW = 4
26
- SDL_SYSTEM_CURSOR_SIZENWSE = 5
27
- SDL_SYSTEM_CURSOR_SIZENESW = 6
28
- SDL_SYSTEM_CURSOR_SIZEWE = 7
29
- SDL_SYSTEM_CURSOR_SIZENS = 8
30
- SDL_SYSTEM_CURSOR_SIZEALL = 9
31
- SDL_SYSTEM_CURSOR_NO = 10
32
- SDL_SYSTEM_CURSOR_HAND = 11
33
- SDL_NUM_SYSTEM_CURSORS = 12
34
- SDL_MOUSEWHEEL_NORMAL = 0
35
- SDL_MOUSEWHEEL_FLIPPED = 1
36
-
37
- # Typedef
38
-
39
- typedef :int, :SDL_SystemCursor
40
- typedef :int, :SDL_MouseWheelDirection
41
-
42
- # Struct
43
-
44
-
45
- # Function
46
-
47
- def self.setup_mouse_symbols()
48
- symbols = [
49
- :SDL_GetMouseFocus,
50
- :SDL_GetMouseState,
51
- :SDL_GetGlobalMouseState,
52
- :SDL_GetRelativeMouseState,
53
- :SDL_WarpMouseInWindow,
54
- :SDL_WarpMouseGlobal,
55
- :SDL_SetRelativeMouseMode,
56
- :SDL_CaptureMouse,
57
- :SDL_GetRelativeMouseMode,
58
- :SDL_CreateCursor,
59
- :SDL_CreateColorCursor,
60
- :SDL_CreateSystemCursor,
61
- :SDL_SetCursor,
62
- :SDL_GetCursor,
63
- :SDL_GetDefaultCursor,
64
- :SDL_FreeCursor,
65
- :SDL_ShowCursor,
66
- ]
67
- args = {
68
- :SDL_GetMouseFocus => [],
69
- :SDL_GetMouseState => [:pointer, :pointer],
70
- :SDL_GetGlobalMouseState => [:pointer, :pointer],
71
- :SDL_GetRelativeMouseState => [:pointer, :pointer],
72
- :SDL_WarpMouseInWindow => [:pointer, :int, :int],
73
- :SDL_WarpMouseGlobal => [:int, :int],
74
- :SDL_SetRelativeMouseMode => [:int],
75
- :SDL_CaptureMouse => [:int],
76
- :SDL_GetRelativeMouseMode => [],
77
- :SDL_CreateCursor => [:pointer, :pointer, :int, :int, :int, :int],
78
- :SDL_CreateColorCursor => [:pointer, :int, :int],
79
- :SDL_CreateSystemCursor => [:int],
80
- :SDL_SetCursor => [:pointer],
81
- :SDL_GetCursor => [],
82
- :SDL_GetDefaultCursor => [],
83
- :SDL_FreeCursor => [:pointer],
84
- :SDL_ShowCursor => [:int],
85
- }
86
- retvals = {
87
- :SDL_GetMouseFocus => :pointer,
88
- :SDL_GetMouseState => :uint,
89
- :SDL_GetGlobalMouseState => :uint,
90
- :SDL_GetRelativeMouseState => :uint,
91
- :SDL_WarpMouseInWindow => :void,
92
- :SDL_WarpMouseGlobal => :int,
93
- :SDL_SetRelativeMouseMode => :int,
94
- :SDL_CaptureMouse => :int,
95
- :SDL_GetRelativeMouseMode => :int,
96
- :SDL_CreateCursor => :pointer,
97
- :SDL_CreateColorCursor => :pointer,
98
- :SDL_CreateSystemCursor => :pointer,
99
- :SDL_SetCursor => :void,
100
- :SDL_GetCursor => :pointer,
101
- :SDL_GetDefaultCursor => :pointer,
102
- :SDL_FreeCursor => :void,
103
- :SDL_ShowCursor => :int,
104
- }
105
- symbols.each do |sym|
106
- begin
107
- attach_function sym, args[sym], retvals[sym]
108
- rescue FFI::NotFoundError => error
109
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
110
- end
111
- end
112
- end
113
-
114
- end
115
-
116
- # TODO : def SDL_BUTTON(X); (1 << ((X)-1)); end;
117
-
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ BUTTON_LEFT = 1
14
+ BUTTON_MIDDLE = 2
15
+ BUTTON_RIGHT = 3
16
+ BUTTON_X1 = 4
17
+ BUTTON_X2 = 5
18
+
19
+ # Enum
20
+
21
+ SYSTEM_CURSOR_ARROW = 0
22
+ SYSTEM_CURSOR_IBEAM = 1
23
+ SYSTEM_CURSOR_WAIT = 2
24
+ SYSTEM_CURSOR_CROSSHAIR = 3
25
+ SYSTEM_CURSOR_WAITARROW = 4
26
+ SYSTEM_CURSOR_SIZENWSE = 5
27
+ SYSTEM_CURSOR_SIZENESW = 6
28
+ SYSTEM_CURSOR_SIZEWE = 7
29
+ SYSTEM_CURSOR_SIZENS = 8
30
+ SYSTEM_CURSOR_SIZEALL = 9
31
+ SYSTEM_CURSOR_NO = 10
32
+ SYSTEM_CURSOR_HAND = 11
33
+ NUM_SYSTEM_CURSORS = 12
34
+ MOUSEWHEEL_NORMAL = 0
35
+ MOUSEWHEEL_FLIPPED = 1
36
+
37
+ # Typedef
38
+
39
+ typedef :int, :SDL_SystemCursor
40
+ typedef :int, :SDL_MouseWheelDirection
41
+
42
+ # Struct
43
+
44
+
45
+ # Function
46
+
47
+ def self.setup_mouse_symbols(output_error = false)
48
+ symbols = [
49
+ :SDL_GetMouseFocus,
50
+ :SDL_GetMouseState,
51
+ :SDL_GetGlobalMouseState,
52
+ :SDL_GetRelativeMouseState,
53
+ :SDL_WarpMouseInWindow,
54
+ :SDL_WarpMouseGlobal,
55
+ :SDL_SetRelativeMouseMode,
56
+ :SDL_CaptureMouse,
57
+ :SDL_GetRelativeMouseMode,
58
+ :SDL_CreateCursor,
59
+ :SDL_CreateColorCursor,
60
+ :SDL_CreateSystemCursor,
61
+ :SDL_SetCursor,
62
+ :SDL_GetCursor,
63
+ :SDL_GetDefaultCursor,
64
+ :SDL_FreeCursor,
65
+ :SDL_ShowCursor,
66
+ ]
67
+ apis = {
68
+ :SDL_GetMouseFocus => :GetMouseFocus,
69
+ :SDL_GetMouseState => :GetMouseState,
70
+ :SDL_GetGlobalMouseState => :GetGlobalMouseState,
71
+ :SDL_GetRelativeMouseState => :GetRelativeMouseState,
72
+ :SDL_WarpMouseInWindow => :WarpMouseInWindow,
73
+ :SDL_WarpMouseGlobal => :WarpMouseGlobal,
74
+ :SDL_SetRelativeMouseMode => :SetRelativeMouseMode,
75
+ :SDL_CaptureMouse => :CaptureMouse,
76
+ :SDL_GetRelativeMouseMode => :GetRelativeMouseMode,
77
+ :SDL_CreateCursor => :CreateCursor,
78
+ :SDL_CreateColorCursor => :CreateColorCursor,
79
+ :SDL_CreateSystemCursor => :CreateSystemCursor,
80
+ :SDL_SetCursor => :SetCursor,
81
+ :SDL_GetCursor => :GetCursor,
82
+ :SDL_GetDefaultCursor => :GetDefaultCursor,
83
+ :SDL_FreeCursor => :FreeCursor,
84
+ :SDL_ShowCursor => :ShowCursor,
85
+ }
86
+ args = {
87
+ :SDL_GetMouseFocus => [],
88
+ :SDL_GetMouseState => [:pointer, :pointer],
89
+ :SDL_GetGlobalMouseState => [:pointer, :pointer],
90
+ :SDL_GetRelativeMouseState => [:pointer, :pointer],
91
+ :SDL_WarpMouseInWindow => [:pointer, :int, :int],
92
+ :SDL_WarpMouseGlobal => [:int, :int],
93
+ :SDL_SetRelativeMouseMode => [:int],
94
+ :SDL_CaptureMouse => [:int],
95
+ :SDL_GetRelativeMouseMode => [],
96
+ :SDL_CreateCursor => [:pointer, :pointer, :int, :int, :int, :int],
97
+ :SDL_CreateColorCursor => [:pointer, :int, :int],
98
+ :SDL_CreateSystemCursor => [:int],
99
+ :SDL_SetCursor => [:pointer],
100
+ :SDL_GetCursor => [],
101
+ :SDL_GetDefaultCursor => [],
102
+ :SDL_FreeCursor => [:pointer],
103
+ :SDL_ShowCursor => [:int],
104
+ }
105
+ retvals = {
106
+ :SDL_GetMouseFocus => :pointer,
107
+ :SDL_GetMouseState => :uint,
108
+ :SDL_GetGlobalMouseState => :uint,
109
+ :SDL_GetRelativeMouseState => :uint,
110
+ :SDL_WarpMouseInWindow => :void,
111
+ :SDL_WarpMouseGlobal => :int,
112
+ :SDL_SetRelativeMouseMode => :int,
113
+ :SDL_CaptureMouse => :int,
114
+ :SDL_GetRelativeMouseMode => :int,
115
+ :SDL_CreateCursor => :pointer,
116
+ :SDL_CreateColorCursor => :pointer,
117
+ :SDL_CreateSystemCursor => :pointer,
118
+ :SDL_SetCursor => :void,
119
+ :SDL_GetCursor => :pointer,
120
+ :SDL_GetDefaultCursor => :pointer,
121
+ :SDL_FreeCursor => :void,
122
+ :SDL_ShowCursor => :int,
123
+ }
124
+ symbols.each do |sym|
125
+ begin
126
+ attach_function apis[sym], sym, args[sym], retvals[sym]
127
+ rescue FFI::NotFoundError => error
128
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
129
+ end
130
+ end
131
+ end
132
+
133
+ end
134
+
135
+ # TODO : def self.BUTTON(X); (1 << ((X)-1)); end;
136
+