SDLRuby 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/SDLRuby/event/accessor.rb +62 -63
- data/lib/SDLRuby/event/type.rb +1 -1
- data/lib/SDLRuby/event.rb +101 -80
- data/lib/SDLRuby/sdl/include/SDL.h.rb +11 -0
- data/lib/SDLRuby/sdl/include/SDL_audio.h.rb +125 -14
- data/lib/SDLRuby/sdl/include/SDL_blendmode.h.rb +24 -0
- data/lib/SDLRuby/sdl/include/SDL_endian.h.rb +10 -1
- data/lib/SDLRuby/sdl/include/SDL_error.h.rb +21 -2
- data/lib/SDLRuby/sdl/include/SDL_events.h.rb +458 -18
- data/lib/SDLRuby/sdl/include/SDL_gamecontroller.h.rb +92 -11
- data/lib/SDLRuby/sdl/include/SDL_guid.h.rb +10 -4
- data/lib/SDLRuby/sdl/include/SDL_hints.h.rb +186 -1
- data/lib/SDLRuby/sdl/include/SDL_joystick.h.rb +72 -10
- data/lib/SDLRuby/sdl/include/SDL_keyboard.h.rb +13 -4
- data/lib/SDLRuby/sdl/include/SDL_keycode.h.rb +287 -2
- data/lib/SDLRuby/sdl/include/SDL_locale.h.rb +9 -2
- data/lib/SDLRuby/sdl/include/SDL_messagebox.h.rb +50 -2
- data/lib/SDLRuby/sdl/include/SDL_mouse.h.rb +39 -8
- data/lib/SDLRuby/sdl/include/SDL_pixels.h.rb +271 -11
- data/lib/SDLRuby/sdl/include/SDL_rect.h.rb +43 -14
- data/lib/SDLRuby/sdl/include/SDL_render.h.rb +112 -75
- data/lib/SDLRuby/sdl/include/SDL_rwops.h.rb +63 -19
- data/lib/SDLRuby/sdl/include/SDL_scancode.h.rb +248 -1
- data/lib/SDLRuby/sdl/include/SDL_shape.h.rb +33 -6
- data/lib/SDLRuby/sdl/include/SDL_stdinc.h.rb +42 -4
- data/lib/SDLRuby/sdl/include/SDL_surface.h.rb +92 -29
- data/lib/SDLRuby/sdl/include/SDL_syswm.h.rb +1 -7
- data/lib/SDLRuby/sdl/include/SDL_timer.h.rb +11 -3
- data/lib/SDLRuby/sdl/include/SDL_version.h.rb +10 -2
- data/lib/SDLRuby/sdl/include/SDL_video.h.rb +221 -74
- data/lib/SDLRuby/sdl/sdl.rb +0 -50
- data/lib/SDLRuby/sdl.rb +7 -8
- data/lib/SDLRuby/version.rb +1 -1
- data/sig/lib/SDLRuby/event/accessor.rbs +157 -0
- data/sig/lib/SDLRuby/event/type.rbs +67 -0
- data/sig/lib/SDLRuby/event.rbs +47 -0
- data/sig/lib/SDLRuby/sdl.rbs +655 -0
- metadata +6 -22
- data/lib/SDLRuby/sdl/sdl_audio.rb +0 -75
- data/lib/SDLRuby/sdl/sdl_blendmode.rb +0 -10
- data/lib/SDLRuby/sdl/sdl_error.rb +0 -5
- data/lib/SDLRuby/sdl/sdl_events.rb +0 -470
- data/lib/SDLRuby/sdl/sdl_hints.rb +0 -9
- data/lib/SDLRuby/sdl/sdl_keyboard.rb +0 -12
- data/lib/SDLRuby/sdl/sdl_locale.rb +0 -8
- data/lib/SDLRuby/sdl/sdl_message_box.rb +0 -7
- data/lib/SDLRuby/sdl/sdl_mouse.rb +0 -32
- data/lib/SDLRuby/sdl/sdl_palette.rb +0 -12
- data/lib/SDLRuby/sdl/sdl_pixels.rb +0 -138
- data/lib/SDLRuby/sdl/sdl_rect.rb +0 -11
- data/lib/SDLRuby/sdl/sdl_render.rb +0 -35
- data/lib/SDLRuby/sdl/sdl_rw_ops.rb +0 -29
- data/lib/SDLRuby/sdl/sdl_scancode.rb +0 -255
- data/lib/SDLRuby/sdl/sdl_surface.rb +0 -27
- data/lib/SDLRuby/sdl/sdl_version.rb +0 -5
- data/lib/SDLRuby/sdl/sdl_video.rb +0 -104
- data/sig/SDLRuby/event.rbs +0 -104
- data/sig/SDLRuby/sdl.rbs +0 -606
@@ -1,10 +1,58 @@
|
|
1
1
|
module SDLRuby::SDL
|
2
|
-
require_relative
|
3
|
-
require_relative
|
2
|
+
require_relative "SDL_stdinc.h"
|
3
|
+
require_relative "SDL_video.h"
|
4
4
|
|
5
|
+
SDL_MESSAGEBOX_ERROR = 0x00000010
|
6
|
+
SDL_MESSAGEBOX_WARNING = 0x00000020
|
7
|
+
SDL_MESSAGEBOX_INFORMATION = 0x00000040
|
8
|
+
SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080
|
9
|
+
SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100
|
5
10
|
typealias "SDL_MessageBoxFlags", "int"
|
11
|
+
|
12
|
+
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001
|
13
|
+
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002
|
6
14
|
typealias "SDL_MessageBoxButtonFlags", "int"
|
15
|
+
|
16
|
+
SDL_MessageBoxButtonData = struct(
|
17
|
+
[
|
18
|
+
"Uint32 flags",
|
19
|
+
"int buttonid",
|
20
|
+
"const char * text",
|
21
|
+
]
|
22
|
+
)
|
23
|
+
SDL_MessageBoxColor = struct(
|
24
|
+
[
|
25
|
+
"Uint8 r",
|
26
|
+
"Uint8 g",
|
27
|
+
"Uint8 b",
|
28
|
+
]
|
29
|
+
)
|
30
|
+
|
31
|
+
SDL_MESSAGEBOX_COLOR_BACKGROUND = 0
|
32
|
+
SDL_MESSAGEBOX_COLOR_TEXT = 1
|
33
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = 2
|
34
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = 3
|
35
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = 4
|
36
|
+
SDL_MESSAGEBOX_COLOR_MAX = 5
|
7
37
|
typealias "SDL_MessageBoxColorType", "int"
|
38
|
+
|
39
|
+
SDL_MessageBoxColorScheme = struct(
|
40
|
+
[
|
41
|
+
"colors[#{SDL_MESSAGEBOX_COLOR_MAX}]": SDL_MessageBoxColor
|
42
|
+
]
|
43
|
+
)
|
44
|
+
SDL_MessageBoxData = struct(
|
45
|
+
[
|
46
|
+
"Uint32 flags",
|
47
|
+
"SDL_Window *window",
|
48
|
+
"const char *title",
|
49
|
+
"const char *message",
|
50
|
+
"int numbuttons",
|
51
|
+
"const SDL_MessageBoxButtonData *buttons",
|
52
|
+
"const SDL_MessageBoxColorScheme *colorScheme",
|
53
|
+
]
|
54
|
+
)
|
55
|
+
|
8
56
|
extern "int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)"
|
9
57
|
extern "int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)"
|
10
58
|
end
|
@@ -1,26 +1,57 @@
|
|
1
1
|
module SDLRuby::SDL
|
2
|
-
require_relative
|
3
|
-
require_relative
|
4
|
-
require_relative
|
2
|
+
require_relative "SDL_stdinc.h"
|
3
|
+
require_relative "SDL_error.h"
|
4
|
+
require_relative "SDL_video.h"
|
5
5
|
|
6
|
-
|
6
|
+
SDL_SYSTEM_CURSOR_ARROW = 0
|
7
|
+
SDL_SYSTEM_CURSOR_IBEAM = 1
|
8
|
+
SDL_SYSTEM_CURSOR_WAIT = 2
|
9
|
+
SDL_SYSTEM_CURSOR_CROSSHAIR = 3
|
10
|
+
SDL_SYSTEM_CURSOR_WAITARROW = 4
|
11
|
+
SDL_SYSTEM_CURSOR_SIZENWSE = 5
|
12
|
+
SDL_SYSTEM_CURSOR_SIZENESW = 6
|
13
|
+
SDL_SYSTEM_CURSOR_SIZEWE = 7
|
14
|
+
SDL_SYSTEM_CURSOR_SIZENS = 8
|
15
|
+
SDL_SYSTEM_CURSOR_SIZEALL = 9
|
16
|
+
SDL_SYSTEM_CURSOR_NO = 10
|
17
|
+
SDL_SYSTEM_CURSOR_HAND = 11
|
18
|
+
SDL_NUM_SYSTEM_CURSORS = 12
|
7
19
|
typealias "SDL_SystemCursor", "int"
|
20
|
+
|
21
|
+
SDL_MOUSEWHEEL_NORMAL = 0
|
22
|
+
SDL_MOUSEWHEEL_FLIPPED = 1
|
8
23
|
typealias "SDL_MouseWheelDirection", "int"
|
24
|
+
|
9
25
|
extern "SDL_Window * SDL_GetMouseFocus(void)"
|
10
26
|
extern "Uint32 SDL_GetMouseState(int *x, int *y)"
|
11
27
|
extern "Uint32 SDL_GetGlobalMouseState(int *x, int *y)"
|
12
28
|
extern "Uint32 SDL_GetRelativeMouseState(int *x, int *y)"
|
13
|
-
extern "void SDL_WarpMouseInWindow(SDL_Window *window, int x, int y)"
|
29
|
+
extern "void SDL_WarpMouseInWindow(SDL_Window * window, int x, int y)"
|
14
30
|
extern "int SDL_WarpMouseGlobal(int x, int y)"
|
15
31
|
extern "int SDL_SetRelativeMouseMode(SDL_bool enabled)"
|
16
32
|
extern "int SDL_CaptureMouse(SDL_bool enabled)"
|
17
33
|
extern "SDL_bool SDL_GetRelativeMouseMode(void)"
|
18
|
-
extern "SDL_Cursor * SDL_CreateCursor(const Uint8 *data, const Uint8 *mask, int w, int h, int hot_x, int hot_y)"
|
34
|
+
extern "SDL_Cursor * SDL_CreateCursor(const Uint8 * data, const Uint8 * mask, int w, int h, int hot_x, int hot_y)"
|
19
35
|
extern "SDL_Cursor * SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)"
|
20
36
|
extern "SDL_Cursor * SDL_CreateSystemCursor(SDL_SystemCursor id)"
|
21
|
-
extern "void SDL_SetCursor(SDL_Cursor *cursor)"
|
37
|
+
extern "void SDL_SetCursor(SDL_Cursor * cursor)"
|
22
38
|
extern "SDL_Cursor * SDL_GetCursor(void)"
|
23
39
|
extern "SDL_Cursor * SDL_GetDefaultCursor(void)"
|
24
|
-
extern "void SDL_FreeCursor(SDL_Cursor *cursor)"
|
40
|
+
extern "void SDL_FreeCursor(SDL_Cursor * cursor)"
|
25
41
|
extern "int SDL_ShowCursor(int toggle)"
|
42
|
+
|
43
|
+
def self.SDL_BUTTON(x)
|
44
|
+
(1 << ((x)-1))
|
45
|
+
end
|
46
|
+
|
47
|
+
SDL_BUTTON_LEFT = 1
|
48
|
+
SDL_BUTTON_MIDDLE = 2
|
49
|
+
SDL_BUTTON_RIGHT = 3
|
50
|
+
SDL_BUTTON_X1 = 4
|
51
|
+
SDL_BUTTON_X2 = 5
|
52
|
+
SDL_BUTTON_LMASK = SDL_BUTTON(SDL_BUTTON_LEFT)
|
53
|
+
SDL_BUTTON_MMASK = SDL_BUTTON(SDL_BUTTON_MIDDLE)
|
54
|
+
SDL_BUTTON_RMASK = SDL_BUTTON(SDL_BUTTON_RIGHT)
|
55
|
+
SDL_BUTTON_X1MASK = SDL_BUTTON(SDL_BUTTON_X1)
|
56
|
+
SDL_BUTTON_X2MASK = SDL_BUTTON(SDL_BUTTON_X2)
|
26
57
|
end
|
@@ -1,25 +1,285 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: US-ASCII
|
3
|
+
|
1
4
|
module SDLRuby::SDL
|
2
|
-
require_relative
|
3
|
-
require_relative
|
5
|
+
require_relative "SDL_stdinc.h"
|
6
|
+
require_relative "SDL_endian.h"
|
7
|
+
|
8
|
+
SDL_ALPHA_OPAQUE = 255
|
9
|
+
SDL_ALPHA_TRANSPARENT = 0
|
4
10
|
|
11
|
+
SDL_PIXELTYPE_UNKNOWN = 0
|
12
|
+
SDL_PIXELTYPE_INDEX1 = 1
|
13
|
+
SDL_PIXELTYPE_INDEX4 = 2
|
14
|
+
SDL_PIXELTYPE_INDEX8 = 3
|
15
|
+
SDL_PIXELTYPE_PACKED8 = 4
|
16
|
+
SDL_PIXELTYPE_PACKED16 = 5
|
17
|
+
SDL_PIXELTYPE_PACKED32 = 6
|
18
|
+
SDL_PIXELTYPE_ARRAYU8 = 7
|
19
|
+
SDL_PIXELTYPE_ARRAYU16 = 8
|
20
|
+
SDL_PIXELTYPE_ARRAYU32 = 9
|
21
|
+
SDL_PIXELTYPE_ARRAYF16 = 10
|
22
|
+
SDL_PIXELTYPE_ARRAYF32 = 11
|
5
23
|
typealias "SDL_PixelType", "int"
|
24
|
+
|
25
|
+
SDL_BITMAPORDER_NONE = 0
|
26
|
+
SDL_BITMAPORDER_4321 = 1
|
27
|
+
SDL_BITMAPORDER_1234 = 2
|
6
28
|
typealias "SDL_BitmapOrder", "int"
|
29
|
+
|
30
|
+
SDL_PACKEDORDER_NONE = 0
|
31
|
+
SDL_PACKEDORDER_XRGB = 1
|
32
|
+
SDL_PACKEDORDER_RGBX = 2
|
33
|
+
SDL_PACKEDORDER_ARGB = 3
|
34
|
+
SDL_PACKEDORDER_RGBA = 4
|
35
|
+
SDL_PACKEDORDER_XBGR = 5
|
36
|
+
SDL_PACKEDORDER_BGRX = 6
|
37
|
+
SDL_PACKEDORDER_ABGR = 7
|
38
|
+
SDL_PACKEDORDER_BGRA = 8
|
7
39
|
typealias "SDL_PackedOrder", "int"
|
40
|
+
|
41
|
+
SDL_ARRAYORDER_NONE = 0
|
42
|
+
SDL_ARRAYORDER_RGB = 1
|
43
|
+
SDL_ARRAYORDER_RGBA = 2
|
44
|
+
SDL_ARRAYORDER_ARGB = 3
|
45
|
+
SDL_ARRAYORDER_BGR = 4
|
46
|
+
SDL_ARRAYORDER_BGRA = 5
|
47
|
+
SDL_ARRAYORDER_ABGR = 6
|
8
48
|
typealias "SDL_ArrayOrder", "int"
|
49
|
+
|
50
|
+
SDL_PACKEDLAYOUT_NONE = 0
|
51
|
+
SDL_PACKEDLAYOUT_332 = 1
|
52
|
+
SDL_PACKEDLAYOUT_4444 = 2
|
53
|
+
SDL_PACKEDLAYOUT_1555 = 3
|
54
|
+
SDL_PACKEDLAYOUT_5551 = 4
|
55
|
+
SDL_PACKEDLAYOUT_565 = 5
|
56
|
+
SDL_PACKEDLAYOUT_8888 = 6
|
57
|
+
SDL_PACKEDLAYOUT_2101010 = 7
|
58
|
+
SDL_PACKEDLAYOUT_1010102 = 8
|
9
59
|
typealias "SDL_PackedLayout", "int"
|
60
|
+
|
61
|
+
def self.SDL_DEFINE_PIXELFOURCC(a, b, c, d)
|
62
|
+
SDL_FOURCC(*[a, b, c, d].join.bytes)
|
63
|
+
end
|
64
|
+
def self.SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes)
|
65
|
+
((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | ((bits) << 8) | ((bytes) << 0))
|
66
|
+
end
|
67
|
+
def self.SDL_PIXELFLAG(x)
|
68
|
+
(((x) >> 28) & 0x0F)
|
69
|
+
end
|
70
|
+
def self.SDL_PIXELTYPE(x)
|
71
|
+
(((x) >> 24) & 0x0F)
|
72
|
+
end
|
73
|
+
def self.SDL_PIXELORDER(x)
|
74
|
+
(((x) >> 20) & 0x0F)
|
75
|
+
end
|
76
|
+
def self.SDL_PIXELLAYOUT(x)
|
77
|
+
(((x) >> 16) & 0x0F)
|
78
|
+
end
|
79
|
+
def self.SDL_BITSPERPIXEL(x)
|
80
|
+
(((x) >> 8) & 0xFF)
|
81
|
+
end
|
82
|
+
def self.SDL_BYTESPERPIXEL(x)
|
83
|
+
(SDL_ISPIXELFORMAT_FOURCC(x) ? ((((x) == SDL_PIXELFORMAT_YUY2) || ((x) == SDL_PIXELFORMAT_UYVY) || ((x) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((x) >> 0) & 0xFF))
|
84
|
+
end
|
85
|
+
def self.SDL_ISPIXELFORMAT_INDEXED(format)
|
86
|
+
(!SDL_ISPIXELFORMAT_FOURCC(format) && ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
|
87
|
+
end
|
88
|
+
def self.SDL_ISPIXELFORMAT_PACKED(format)
|
89
|
+
(!SDL_ISPIXELFORMAT_FOURCC(format) && ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
|
90
|
+
end
|
91
|
+
def self.SDL_ISPIXELFORMAT_ARRAY(format)
|
92
|
+
(!SDL_ISPIXELFORMAT_FOURCC(format) && ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
|
93
|
+
end
|
94
|
+
def self.SDL_ISPIXELFORMAT_ALPHA(format)
|
95
|
+
((SDL_ISPIXELFORMAT_PACKED(format) && ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || (SDL_ISPIXELFORMAT_ARRAY(format) && ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA))))
|
96
|
+
end
|
97
|
+
def self.SDL_ISPIXELFORMAT_FOURCC(format)
|
98
|
+
((format) && (SDL_PIXELFLAG(format) != 1))
|
99
|
+
end
|
100
|
+
|
101
|
+
SDL_PIXELFORMAT_UNKNOWN = 0
|
102
|
+
SDL_PIXELFORMAT_INDEX1LSB =
|
103
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0,
|
104
|
+
1, 0)
|
105
|
+
SDL_PIXELFORMAT_INDEX1MSB =
|
106
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
|
107
|
+
1, 0)
|
108
|
+
SDL_PIXELFORMAT_INDEX4LSB =
|
109
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
|
110
|
+
4, 0)
|
111
|
+
SDL_PIXELFORMAT_INDEX4MSB =
|
112
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
|
113
|
+
4, 0)
|
114
|
+
SDL_PIXELFORMAT_INDEX8 =
|
115
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1)
|
116
|
+
SDL_PIXELFORMAT_RGB332 =
|
117
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
|
118
|
+
SDL_PACKEDLAYOUT_332, 8, 1)
|
119
|
+
SDL_PIXELFORMAT_XRGB4444 =
|
120
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
121
|
+
SDL_PACKEDLAYOUT_4444, 12, 2)
|
122
|
+
SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444
|
123
|
+
SDL_PIXELFORMAT_XBGR4444 =
|
124
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
|
125
|
+
SDL_PACKEDLAYOUT_4444, 12, 2)
|
126
|
+
SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444
|
127
|
+
SDL_PIXELFORMAT_XRGB1555 =
|
128
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
129
|
+
SDL_PACKEDLAYOUT_1555, 15, 2)
|
130
|
+
SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555
|
131
|
+
SDL_PIXELFORMAT_XBGR1555 =
|
132
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
|
133
|
+
SDL_PACKEDLAYOUT_1555, 15, 2)
|
134
|
+
SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555
|
135
|
+
SDL_PIXELFORMAT_ARGB4444 =
|
136
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
|
137
|
+
SDL_PACKEDLAYOUT_4444, 16, 2)
|
138
|
+
SDL_PIXELFORMAT_RGBA4444 =
|
139
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
|
140
|
+
SDL_PACKEDLAYOUT_4444, 16, 2)
|
141
|
+
SDL_PIXELFORMAT_ABGR4444 =
|
142
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
|
143
|
+
SDL_PACKEDLAYOUT_4444, 16, 2)
|
144
|
+
SDL_PIXELFORMAT_BGRA4444 =
|
145
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
|
146
|
+
SDL_PACKEDLAYOUT_4444, 16, 2)
|
147
|
+
SDL_PIXELFORMAT_ARGB1555 =
|
148
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
|
149
|
+
SDL_PACKEDLAYOUT_1555, 16, 2)
|
150
|
+
SDL_PIXELFORMAT_RGBA5551 =
|
151
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
|
152
|
+
SDL_PACKEDLAYOUT_5551, 16, 2)
|
153
|
+
SDL_PIXELFORMAT_ABGR1555 =
|
154
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
|
155
|
+
SDL_PACKEDLAYOUT_1555, 16, 2)
|
156
|
+
SDL_PIXELFORMAT_BGRA5551 =
|
157
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
|
158
|
+
SDL_PACKEDLAYOUT_5551, 16, 2)
|
159
|
+
SDL_PIXELFORMAT_RGB565 =
|
160
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
|
161
|
+
SDL_PACKEDLAYOUT_565, 16, 2)
|
162
|
+
SDL_PIXELFORMAT_BGR565 =
|
163
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
|
164
|
+
SDL_PACKEDLAYOUT_565, 16, 2)
|
165
|
+
SDL_PIXELFORMAT_RGB24 =
|
166
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0,
|
167
|
+
24, 3)
|
168
|
+
SDL_PIXELFORMAT_BGR24 =
|
169
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
|
170
|
+
24, 3)
|
171
|
+
SDL_PIXELFORMAT_XRGB8888 =
|
172
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
|
173
|
+
SDL_PACKEDLAYOUT_8888, 24, 4)
|
174
|
+
SDL_PIXELFORMAT_RGB888 = SDL_PIXELFORMAT_XRGB8888
|
175
|
+
SDL_PIXELFORMAT_RGBX8888 =
|
176
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
|
177
|
+
SDL_PACKEDLAYOUT_8888, 24, 4)
|
178
|
+
SDL_PIXELFORMAT_XBGR8888 =
|
179
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
|
180
|
+
SDL_PACKEDLAYOUT_8888, 24, 4)
|
181
|
+
SDL_PIXELFORMAT_BGR888 = SDL_PIXELFORMAT_XBGR8888
|
182
|
+
SDL_PIXELFORMAT_BGRX8888 =
|
183
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
|
184
|
+
SDL_PACKEDLAYOUT_8888, 24, 4)
|
185
|
+
SDL_PIXELFORMAT_ARGB8888 =
|
186
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
|
187
|
+
SDL_PACKEDLAYOUT_8888, 32, 4)
|
188
|
+
SDL_PIXELFORMAT_RGBA8888 =
|
189
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA,
|
190
|
+
SDL_PACKEDLAYOUT_8888, 32, 4)
|
191
|
+
SDL_PIXELFORMAT_ABGR8888 =
|
192
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR,
|
193
|
+
SDL_PACKEDLAYOUT_8888, 32, 4)
|
194
|
+
SDL_PIXELFORMAT_BGRA8888 =
|
195
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA,
|
196
|
+
SDL_PACKEDLAYOUT_8888, 32, 4)
|
197
|
+
SDL_PIXELFORMAT_ARGB2101010 =
|
198
|
+
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
|
199
|
+
SDL_PACKEDLAYOUT_2101010, 32, 4)
|
200
|
+
|
201
|
+
if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
202
|
+
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888
|
203
|
+
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888
|
204
|
+
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888
|
205
|
+
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888
|
206
|
+
else
|
207
|
+
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888
|
208
|
+
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888
|
209
|
+
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888
|
210
|
+
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888
|
211
|
+
end
|
212
|
+
SDL_PIXELFORMAT_YV12 =
|
213
|
+
SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2')
|
214
|
+
SDL_PIXELFORMAT_IYUV =
|
215
|
+
SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V')
|
216
|
+
SDL_PIXELFORMAT_YUY2 =
|
217
|
+
SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2')
|
218
|
+
SDL_PIXELFORMAT_UYVY =
|
219
|
+
SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y')
|
220
|
+
SDL_PIXELFORMAT_YVYU =
|
221
|
+
SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U')
|
222
|
+
SDL_PIXELFORMAT_NV12 =
|
223
|
+
SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2')
|
224
|
+
SDL_PIXELFORMAT_NV21 =
|
225
|
+
SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1')
|
226
|
+
SDL_PIXELFORMAT_EXTERNAL_OES =
|
227
|
+
SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
|
10
228
|
typealias "SDL_PixelFormatEnum", "int"
|
229
|
+
|
230
|
+
SDL_Color = struct(
|
231
|
+
[
|
232
|
+
"Uint8 r",
|
233
|
+
"Uint8 g",
|
234
|
+
"Uint8 b",
|
235
|
+
"Uint8 a",
|
236
|
+
]
|
237
|
+
)
|
238
|
+
SDL_Colour = SDL_Color
|
239
|
+
SDL_Palette = struct(
|
240
|
+
[
|
241
|
+
"int ncolors",
|
242
|
+
"SDL_Color *colors",
|
243
|
+
"Uint32 version",
|
244
|
+
"int refcount",
|
245
|
+
]
|
246
|
+
)
|
247
|
+
SDL_PixelFormat = struct(
|
248
|
+
[
|
249
|
+
"Uint32 format",
|
250
|
+
"SDL_Palette *palette",
|
251
|
+
"Uint8 BitsPerPixel",
|
252
|
+
"Uint8 BytesPerPixel",
|
253
|
+
"Uint8 padding[2]",
|
254
|
+
"Uint32 Rmask",
|
255
|
+
"Uint32 Gmask",
|
256
|
+
"Uint32 Bmask",
|
257
|
+
"Uint32 Amask",
|
258
|
+
"Uint8 Rloss",
|
259
|
+
"Uint8 Gloss",
|
260
|
+
"Uint8 Bloss",
|
261
|
+
"Uint8 Aloss",
|
262
|
+
"Uint8 Rshift",
|
263
|
+
"Uint8 Gshift",
|
264
|
+
"Uint8 Bshift",
|
265
|
+
"Uint8 Ashift",
|
266
|
+
"int refcount",
|
267
|
+
"struct SDL_PixelFormat *next",
|
268
|
+
]
|
269
|
+
)
|
270
|
+
|
11
271
|
extern "const char* SDL_GetPixelFormatName(Uint32 format)"
|
12
|
-
extern "SDL_bool SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask)"
|
272
|
+
extern "SDL_bool SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask, Uint32 * Gmask, Uint32 * Bmask, Uint32 * Amask)"
|
13
273
|
extern "Uint32 SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)"
|
14
274
|
extern "SDL_PixelFormat * SDL_AllocFormat(Uint32 pixel_format)"
|
15
275
|
extern "void SDL_FreeFormat(SDL_PixelFormat *format)"
|
16
276
|
extern "SDL_Palette * SDL_AllocPalette(int ncolors)"
|
17
|
-
extern "int SDL_SetPixelFormatPalette(SDL_PixelFormat *format, SDL_Palette *palette)"
|
18
|
-
extern "int SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors)"
|
19
|
-
extern "void SDL_FreePalette(SDL_Palette *palette)"
|
20
|
-
extern "Uint32 SDL_MapRGB(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b)"
|
21
|
-
extern "Uint32 SDL_MapRGBA(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a)"
|
22
|
-
extern "void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b)"
|
23
|
-
extern "void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)"
|
24
|
-
extern "void SDL_CalculateGammaRamp(float gamma, Uint16 *ramp)"
|
277
|
+
extern "int SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette)"
|
278
|
+
extern "int SDL_SetPaletteColors(SDL_Palette * palette, const SDL_Color * colors, int firstcolor, int ncolors)"
|
279
|
+
extern "void SDL_FreePalette(SDL_Palette * palette)"
|
280
|
+
extern "Uint32 SDL_MapRGB(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b)"
|
281
|
+
extern "Uint32 SDL_MapRGBA(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b, Uint8 a)"
|
282
|
+
extern "void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * format, Uint8 * r, Uint8 * g, Uint8 * b)"
|
283
|
+
extern "void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * format, Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a)"
|
284
|
+
extern "void SDL_CalculateGammaRamp(float gamma, Uint16 * ramp)"
|
25
285
|
end
|
@@ -1,17 +1,46 @@
|
|
1
1
|
module SDLRuby::SDL
|
2
|
-
require_relative
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
2
|
+
require_relative "SDL_stdinc.h"
|
3
|
+
require_relative "SDL_error.h"
|
4
|
+
require_relative "SDL_pixels.h"
|
5
|
+
require_relative "SDL_rwops.h"
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
SDL_Point = struct(
|
8
|
+
[
|
9
|
+
"int x",
|
10
|
+
"int y",
|
11
|
+
]
|
12
|
+
)
|
13
|
+
SDL_FPoint = struct(
|
14
|
+
[
|
15
|
+
"float x",
|
16
|
+
"float y",
|
17
|
+
]
|
18
|
+
)
|
19
|
+
SDL_Rect = struct(
|
20
|
+
[
|
21
|
+
"int x",
|
22
|
+
"int y",
|
23
|
+
"int w",
|
24
|
+
"int h",
|
25
|
+
]
|
26
|
+
)
|
27
|
+
SDL_FRect = struct(
|
28
|
+
[
|
29
|
+
"float x",
|
30
|
+
"float y",
|
31
|
+
"float w",
|
32
|
+
"float h",
|
33
|
+
]
|
34
|
+
)
|
35
|
+
|
36
|
+
extern "SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B)"
|
37
|
+
extern "SDL_bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)"
|
38
|
+
extern "void SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)"
|
39
|
+
extern "SDL_bool SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, SDL_Rect * result)"
|
40
|
+
extern "SDL_bool SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, int *Y2)"
|
41
|
+
extern "SDL_bool SDL_HasIntersectionF(const SDL_FRect * A, const SDL_FRect * B)"
|
42
|
+
extern "SDL_bool SDL_IntersectFRect(const SDL_FRect * A, const SDL_FRect * B, SDL_FRect * result)"
|
43
|
+
extern "void SDL_UnionFRect(const SDL_FRect * A, const SDL_FRect * B, SDL_FRect * result)"
|
44
|
+
extern "SDL_bool SDL_EncloseFPoints(const SDL_FPoint * points, int count, const SDL_FRect * clip, SDL_FRect * result)"
|
45
|
+
extern "SDL_bool SDL_IntersectFRectAndLine(const SDL_FRect * rect, float *X1, float *Y1, float *X2, float *Y2)"
|
17
46
|
end
|