sdl2-bindings 0.1.0 → 0.1.3

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 +134 -108
  3. data/LICENSE.txt +0 -0
  4. data/README.md +86 -68
  5. data/lib/sdl2.rb +131 -127
  6. data/lib/sdl2_audio.rb +261 -261
  7. data/lib/sdl2_blendmode.rb +72 -72
  8. data/lib/sdl2_clipboard.rb +56 -56
  9. data/lib/sdl2_cpuinfo.rb +129 -129
  10. data/lib/sdl2_error.rb +71 -71
  11. data/lib/sdl2_events.rb +564 -552
  12. data/lib/sdl2_filesystem.rb +52 -52
  13. data/lib/sdl2_framerate.rb +74 -74
  14. data/lib/sdl2_gamecontroller.rb +329 -329
  15. data/lib/sdl2_gesture.rb +61 -61
  16. data/lib/sdl2_gfxPrimitives.rb +283 -283
  17. data/lib/sdl2_haptic.rb +301 -301
  18. data/lib/sdl2_hidapi.rb +139 -139
  19. data/lib/sdl2_hints.rb +221 -207
  20. data/lib/sdl2_image.rb +296 -232
  21. data/lib/sdl2_imageFilter.rb +164 -164
  22. data/lib/sdl2_joystick.rb +294 -294
  23. data/lib/sdl2_keyboard.rb +125 -117
  24. data/lib/sdl2_keycode.rb +307 -307
  25. data/lib/sdl2_log.rb +131 -131
  26. data/lib/sdl2_main.rb +74 -74
  27. data/lib/sdl2_messagebox.rb +102 -102
  28. data/lib/sdl2_misc.rb +48 -48
  29. data/lib/sdl2_mixer.rb +464 -392
  30. data/lib/sdl2_mouse.rb +136 -136
  31. data/lib/sdl2_pixels.rb +240 -240
  32. data/lib/sdl2_platform.rb +48 -48
  33. data/lib/sdl2_power.rb +54 -54
  34. data/lib/sdl2_rect.rb +145 -109
  35. data/lib/sdl2_render.rb +408 -404
  36. data/lib/sdl2_rotozoom.rb +76 -76
  37. data/lib/sdl2_rwops.rb +242 -238
  38. data/lib/sdl2_scancode.rb +289 -289
  39. data/lib/sdl2_sensor.rb +115 -115
  40. data/lib/sdl2_shape.rb +83 -83
  41. data/lib/sdl2_sound.rb +154 -0
  42. data/lib/sdl2_stdinc.rb +548 -564
  43. data/lib/sdl2_surface.rb +229 -229
  44. data/lib/sdl2_syswm.rb +160 -160
  45. data/lib/sdl2_timer.rb +74 -74
  46. data/lib/sdl2_touch.rb +86 -82
  47. data/lib/sdl2_ttf.rb +414 -357
  48. data/lib/sdl2_version.rb +67 -67
  49. data/lib/sdl2_video.rb +540 -540
  50. data/lib/sdl2_vulkan.rb +72 -72
  51. metadata +3 -2
data/lib/sdl2_mouse.rb CHANGED
@@ -1,136 +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 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
-
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
+