rubygl 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. checksums.yaml +8 -8
  2. data/Gemfile.lock +2 -0
  3. data/README.md +1 -1
  4. data/Rakefile +17 -9
  5. data/bin/ffi_code_gen.rb +11 -3
  6. data/ext/macosx/RubyGL.so +0 -0
  7. data/ext/macosx/SDL2.framework/Headers/SDL.h +163 -0
  8. data/ext/macosx/SDL2.framework/Headers/SDL_assert.h +284 -0
  9. data/ext/macosx/SDL2.framework/Headers/SDL_atomic.h +260 -0
  10. data/ext/macosx/SDL2.framework/Headers/SDL_audio.h +506 -0
  11. data/ext/macosx/SDL2.framework/Headers/SDL_bits.h +97 -0
  12. data/ext/macosx/SDL2.framework/Headers/SDL_blendmode.h +63 -0
  13. data/ext/macosx/SDL2.framework/Headers/SDL_clipboard.h +71 -0
  14. data/ext/macosx/SDL2.framework/Headers/SDL_config.h +55 -0
  15. data/ext/macosx/SDL2.framework/Headers/SDL_config_macosx.h +184 -0
  16. data/ext/macosx/SDL2.framework/Headers/SDL_copying.h +20 -0
  17. data/ext/macosx/SDL2.framework/Headers/SDL_cpuinfo.h +156 -0
  18. data/ext/macosx/SDL2.framework/Headers/SDL_endian.h +239 -0
  19. data/ext/macosx/SDL2.framework/Headers/SDL_error.h +76 -0
  20. data/ext/macosx/SDL2.framework/Headers/SDL_events.h +723 -0
  21. data/ext/macosx/SDL2.framework/Headers/SDL_filesystem.h +136 -0
  22. data/ext/macosx/SDL2.framework/Headers/SDL_gamecontroller.h +316 -0
  23. data/ext/macosx/SDL2.framework/Headers/SDL_gesture.h +87 -0
  24. data/ext/macosx/SDL2.framework/Headers/SDL_haptic.h +1225 -0
  25. data/ext/macosx/SDL2.framework/Headers/SDL_hints.h +517 -0
  26. data/ext/macosx/SDL2.framework/Headers/SDL_joystick.h +253 -0
  27. data/ext/macosx/SDL2.framework/Headers/SDL_keyboard.h +217 -0
  28. data/ext/macosx/SDL2.framework/Headers/SDL_keycode.h +341 -0
  29. data/ext/macosx/SDL2.framework/Headers/SDL_loadso.h +81 -0
  30. data/ext/macosx/SDL2.framework/Headers/SDL_log.h +211 -0
  31. data/ext/macosx/SDL2.framework/Headers/SDL_main.h +155 -0
  32. data/ext/macosx/SDL2.framework/Headers/SDL_messagebox.h +144 -0
  33. data/ext/macosx/SDL2.framework/Headers/SDL_mouse.h +224 -0
  34. data/ext/macosx/SDL2.framework/Headers/SDL_mutex.h +251 -0
  35. data/ext/macosx/SDL2.framework/Headers/SDL_name.h +33 -0
  36. data/ext/macosx/SDL2.framework/Headers/SDL_opengl.h +11126 -0
  37. data/ext/macosx/SDL2.framework/Headers/SDL_opengles.h +38 -0
  38. data/ext/macosx/SDL2.framework/Headers/SDL_opengles2.h +2790 -0
  39. data/ext/macosx/SDL2.framework/Headers/SDL_pixels.h +429 -0
  40. data/ext/macosx/SDL2.framework/Headers/SDL_platform.h +164 -0
  41. data/ext/macosx/SDL2.framework/Headers/SDL_power.h +75 -0
  42. data/ext/macosx/SDL2.framework/Headers/SDL_quit.h +58 -0
  43. data/ext/macosx/SDL2.framework/Headers/SDL_rect.h +138 -0
  44. data/ext/macosx/SDL2.framework/Headers/SDL_render.h +870 -0
  45. data/ext/macosx/SDL2.framework/Headers/SDL_revision.h +2 -0
  46. data/ext/macosx/SDL2.framework/Headers/SDL_rwops.h +232 -0
  47. data/ext/macosx/SDL2.framework/Headers/SDL_scancode.h +401 -0
  48. data/ext/macosx/SDL2.framework/Headers/SDL_shape.h +143 -0
  49. data/ext/macosx/SDL2.framework/Headers/SDL_stdinc.h +405 -0
  50. data/ext/macosx/SDL2.framework/Headers/SDL_surface.h +503 -0
  51. data/ext/macosx/SDL2.framework/Headers/SDL_system.h +191 -0
  52. data/ext/macosx/SDL2.framework/Headers/SDL_syswm.h +272 -0
  53. data/ext/macosx/SDL2.framework/Headers/SDL_thread.h +287 -0
  54. data/ext/macosx/SDL2.framework/Headers/SDL_timer.h +115 -0
  55. data/ext/macosx/SDL2.framework/Headers/SDL_touch.h +86 -0
  56. data/ext/macosx/SDL2.framework/Headers/SDL_types.h +29 -0
  57. data/ext/macosx/SDL2.framework/Headers/SDL_version.h +162 -0
  58. data/ext/macosx/SDL2.framework/Headers/SDL_video.h +979 -0
  59. data/ext/macosx/SDL2.framework/Headers/begin_code.h +140 -0
  60. data/ext/macosx/SDL2.framework/Headers/close_code.h +37 -0
  61. data/ext/macosx/SDL2.framework/Resources/Info.plist +42 -0
  62. data/ext/macosx/SDL2.framework/SDL2 +0 -0
  63. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL.h +163 -0
  64. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_assert.h +284 -0
  65. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_atomic.h +260 -0
  66. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_audio.h +506 -0
  67. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_bits.h +97 -0
  68. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_blendmode.h +63 -0
  69. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_clipboard.h +71 -0
  70. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_config.h +55 -0
  71. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_config_macosx.h +184 -0
  72. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_copying.h +20 -0
  73. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_cpuinfo.h +156 -0
  74. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_endian.h +239 -0
  75. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_error.h +76 -0
  76. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_events.h +723 -0
  77. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_filesystem.h +136 -0
  78. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_gamecontroller.h +316 -0
  79. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_gesture.h +87 -0
  80. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_haptic.h +1225 -0
  81. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_hints.h +517 -0
  82. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_joystick.h +253 -0
  83. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_keyboard.h +217 -0
  84. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_keycode.h +341 -0
  85. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_loadso.h +81 -0
  86. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_log.h +211 -0
  87. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_main.h +155 -0
  88. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_messagebox.h +144 -0
  89. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_mouse.h +224 -0
  90. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_mutex.h +251 -0
  91. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_name.h +33 -0
  92. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_opengl.h +11126 -0
  93. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_opengles.h +38 -0
  94. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_opengles2.h +2790 -0
  95. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_pixels.h +429 -0
  96. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_platform.h +164 -0
  97. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_power.h +75 -0
  98. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_quit.h +58 -0
  99. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_rect.h +138 -0
  100. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_render.h +870 -0
  101. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_revision.h +2 -0
  102. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_rwops.h +232 -0
  103. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_scancode.h +401 -0
  104. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_shape.h +143 -0
  105. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_stdinc.h +405 -0
  106. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_surface.h +503 -0
  107. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_system.h +191 -0
  108. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_syswm.h +272 -0
  109. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_thread.h +287 -0
  110. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_timer.h +115 -0
  111. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_touch.h +86 -0
  112. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_types.h +29 -0
  113. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_version.h +162 -0
  114. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_video.h +979 -0
  115. data/ext/macosx/SDL2.framework/Versions/A/Headers/begin_code.h +140 -0
  116. data/ext/macosx/SDL2.framework/Versions/A/Headers/close_code.h +37 -0
  117. data/ext/macosx/SDL2.framework/Versions/A/Resources/Info.plist +42 -0
  118. data/ext/macosx/SDL2.framework/Versions/A/SDL2 +0 -0
  119. data/ext/macosx/SDL2.framework/Versions/A/_CodeSignature/CodeResources +331 -0
  120. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL.h +163 -0
  121. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_assert.h +284 -0
  122. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_atomic.h +260 -0
  123. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_audio.h +506 -0
  124. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_bits.h +97 -0
  125. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_blendmode.h +63 -0
  126. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_clipboard.h +71 -0
  127. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_config.h +55 -0
  128. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_config_macosx.h +184 -0
  129. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_copying.h +20 -0
  130. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_cpuinfo.h +156 -0
  131. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_endian.h +239 -0
  132. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_error.h +76 -0
  133. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_events.h +723 -0
  134. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_filesystem.h +136 -0
  135. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_gamecontroller.h +316 -0
  136. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_gesture.h +87 -0
  137. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_haptic.h +1225 -0
  138. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_hints.h +517 -0
  139. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_joystick.h +253 -0
  140. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_keyboard.h +217 -0
  141. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_keycode.h +341 -0
  142. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_loadso.h +81 -0
  143. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_log.h +211 -0
  144. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_main.h +155 -0
  145. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_messagebox.h +144 -0
  146. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_mouse.h +224 -0
  147. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_mutex.h +251 -0
  148. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_name.h +33 -0
  149. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_opengl.h +11126 -0
  150. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_opengles.h +38 -0
  151. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_opengles2.h +2790 -0
  152. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_pixels.h +429 -0
  153. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_platform.h +164 -0
  154. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_power.h +75 -0
  155. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_quit.h +58 -0
  156. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_rect.h +138 -0
  157. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_render.h +870 -0
  158. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_revision.h +2 -0
  159. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_rwops.h +232 -0
  160. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_scancode.h +401 -0
  161. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_shape.h +143 -0
  162. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_stdinc.h +405 -0
  163. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_surface.h +503 -0
  164. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_system.h +191 -0
  165. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_syswm.h +272 -0
  166. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_thread.h +287 -0
  167. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_timer.h +115 -0
  168. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_touch.h +86 -0
  169. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_types.h +29 -0
  170. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_version.h +162 -0
  171. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_video.h +979 -0
  172. data/ext/macosx/SDL2.framework/Versions/Current/Headers/begin_code.h +140 -0
  173. data/ext/macosx/SDL2.framework/Versions/Current/Headers/close_code.h +37 -0
  174. data/ext/macosx/SDL2.framework/Versions/Current/Resources/Info.plist +42 -0
  175. data/ext/macosx/SDL2.framework/Versions/Current/SDL2 +0 -0
  176. data/ext/macosx/SDL2.framework/Versions/Current/_CodeSignature/CodeResources +331 -0
  177. data/ext/windows/RubyGL.so +0 -0
  178. data/lib/rubygl/native/opengl.rb +1052 -1044
  179. data/lib/rubygl/setup.rb +7 -4
  180. data/lib/rubygl.rb +12 -4
  181. data/rubygl.gemspec +3 -2
  182. metadata +174 -3
@@ -0,0 +1,429 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+ /**
23
+ * \file SDL_pixels.h
24
+ *
25
+ * Header for the enumerated pixel format definitions.
26
+ */
27
+
28
+ #ifndef _SDL_pixels_h
29
+ #define _SDL_pixels_h
30
+
31
+ #include "SDL_stdinc.h"
32
+
33
+ #include "begin_code.h"
34
+ /* Set up for C function definitions, even when using C++ */
35
+ #ifdef __cplusplus
36
+ extern "C" {
37
+ #endif
38
+
39
+ /**
40
+ * \name Transparency definitions
41
+ *
42
+ * These define alpha as the opacity of a surface.
43
+ */
44
+ /* @{ */
45
+ #define SDL_ALPHA_OPAQUE 255
46
+ #define SDL_ALPHA_TRANSPARENT 0
47
+ /* @} */
48
+
49
+ /** Pixel type. */
50
+ enum
51
+ {
52
+ SDL_PIXELTYPE_UNKNOWN,
53
+ SDL_PIXELTYPE_INDEX1,
54
+ SDL_PIXELTYPE_INDEX4,
55
+ SDL_PIXELTYPE_INDEX8,
56
+ SDL_PIXELTYPE_PACKED8,
57
+ SDL_PIXELTYPE_PACKED16,
58
+ SDL_PIXELTYPE_PACKED32,
59
+ SDL_PIXELTYPE_ARRAYU8,
60
+ SDL_PIXELTYPE_ARRAYU16,
61
+ SDL_PIXELTYPE_ARRAYU32,
62
+ SDL_PIXELTYPE_ARRAYF16,
63
+ SDL_PIXELTYPE_ARRAYF32
64
+ };
65
+
66
+ /** Bitmap pixel order, high bit -> low bit. */
67
+ enum
68
+ {
69
+ SDL_BITMAPORDER_NONE,
70
+ SDL_BITMAPORDER_4321,
71
+ SDL_BITMAPORDER_1234
72
+ };
73
+
74
+ /** Packed component order, high bit -> low bit. */
75
+ enum
76
+ {
77
+ SDL_PACKEDORDER_NONE,
78
+ SDL_PACKEDORDER_XRGB,
79
+ SDL_PACKEDORDER_RGBX,
80
+ SDL_PACKEDORDER_ARGB,
81
+ SDL_PACKEDORDER_RGBA,
82
+ SDL_PACKEDORDER_XBGR,
83
+ SDL_PACKEDORDER_BGRX,
84
+ SDL_PACKEDORDER_ABGR,
85
+ SDL_PACKEDORDER_BGRA
86
+ };
87
+
88
+ /** Array component order, low byte -> high byte. */
89
+ enum
90
+ {
91
+ SDL_ARRAYORDER_NONE,
92
+ SDL_ARRAYORDER_RGB,
93
+ SDL_ARRAYORDER_RGBA,
94
+ SDL_ARRAYORDER_ARGB,
95
+ SDL_ARRAYORDER_BGR,
96
+ SDL_ARRAYORDER_BGRA,
97
+ SDL_ARRAYORDER_ABGR
98
+ };
99
+
100
+ /** Packed component layout. */
101
+ enum
102
+ {
103
+ SDL_PACKEDLAYOUT_NONE,
104
+ SDL_PACKEDLAYOUT_332,
105
+ SDL_PACKEDLAYOUT_4444,
106
+ SDL_PACKEDLAYOUT_1555,
107
+ SDL_PACKEDLAYOUT_5551,
108
+ SDL_PACKEDLAYOUT_565,
109
+ SDL_PACKEDLAYOUT_8888,
110
+ SDL_PACKEDLAYOUT_2101010,
111
+ SDL_PACKEDLAYOUT_1010102
112
+ };
113
+
114
+ #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
115
+
116
+ #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
117
+ ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
118
+ ((bits) << 8) | ((bytes) << 0))
119
+
120
+ #define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
121
+ #define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
122
+ #define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
123
+ #define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
124
+ #define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
125
+ #define SDL_BYTESPERPIXEL(X) \
126
+ (SDL_ISPIXELFORMAT_FOURCC(X) ? \
127
+ ((((X) == SDL_PIXELFORMAT_YUY2) || \
128
+ ((X) == SDL_PIXELFORMAT_UYVY) || \
129
+ ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
130
+
131
+ #define SDL_ISPIXELFORMAT_INDEXED(format) \
132
+ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
133
+ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
134
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
135
+ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
136
+
137
+ #define SDL_ISPIXELFORMAT_ALPHA(format) \
138
+ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
139
+ ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
140
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
141
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
142
+ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))
143
+
144
+ /* The flag is set to 1 because 0x1? is not in the printable ASCII range */
145
+ #define SDL_ISPIXELFORMAT_FOURCC(format) \
146
+ ((format) && (SDL_PIXELFLAG(format) != 1))
147
+
148
+ /* Note: If you modify this list, update SDL_GetPixelFormatName() */
149
+ enum
150
+ {
151
+ SDL_PIXELFORMAT_UNKNOWN,
152
+ SDL_PIXELFORMAT_INDEX1LSB =
153
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0,
154
+ 1, 0),
155
+ SDL_PIXELFORMAT_INDEX1MSB =
156
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
157
+ 1, 0),
158
+ SDL_PIXELFORMAT_INDEX4LSB =
159
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
160
+ 4, 0),
161
+ SDL_PIXELFORMAT_INDEX4MSB =
162
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
163
+ 4, 0),
164
+ SDL_PIXELFORMAT_INDEX8 =
165
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1),
166
+ SDL_PIXELFORMAT_RGB332 =
167
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB,
168
+ SDL_PACKEDLAYOUT_332, 8, 1),
169
+ SDL_PIXELFORMAT_RGB444 =
170
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
171
+ SDL_PACKEDLAYOUT_4444, 12, 2),
172
+ SDL_PIXELFORMAT_RGB555 =
173
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
174
+ SDL_PACKEDLAYOUT_1555, 15, 2),
175
+ SDL_PIXELFORMAT_BGR555 =
176
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
177
+ SDL_PACKEDLAYOUT_1555, 15, 2),
178
+ SDL_PIXELFORMAT_ARGB4444 =
179
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
180
+ SDL_PACKEDLAYOUT_4444, 16, 2),
181
+ SDL_PIXELFORMAT_RGBA4444 =
182
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
183
+ SDL_PACKEDLAYOUT_4444, 16, 2),
184
+ SDL_PIXELFORMAT_ABGR4444 =
185
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
186
+ SDL_PACKEDLAYOUT_4444, 16, 2),
187
+ SDL_PIXELFORMAT_BGRA4444 =
188
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
189
+ SDL_PACKEDLAYOUT_4444, 16, 2),
190
+ SDL_PIXELFORMAT_ARGB1555 =
191
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB,
192
+ SDL_PACKEDLAYOUT_1555, 16, 2),
193
+ SDL_PIXELFORMAT_RGBA5551 =
194
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA,
195
+ SDL_PACKEDLAYOUT_5551, 16, 2),
196
+ SDL_PIXELFORMAT_ABGR1555 =
197
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR,
198
+ SDL_PACKEDLAYOUT_1555, 16, 2),
199
+ SDL_PIXELFORMAT_BGRA5551 =
200
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA,
201
+ SDL_PACKEDLAYOUT_5551, 16, 2),
202
+ SDL_PIXELFORMAT_RGB565 =
203
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB,
204
+ SDL_PACKEDLAYOUT_565, 16, 2),
205
+ SDL_PIXELFORMAT_BGR565 =
206
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR,
207
+ SDL_PACKEDLAYOUT_565, 16, 2),
208
+ SDL_PIXELFORMAT_RGB24 =
209
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0,
210
+ 24, 3),
211
+ SDL_PIXELFORMAT_BGR24 =
212
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0,
213
+ 24, 3),
214
+ SDL_PIXELFORMAT_RGB888 =
215
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
216
+ SDL_PACKEDLAYOUT_8888, 24, 4),
217
+ SDL_PIXELFORMAT_RGBX8888 =
218
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
219
+ SDL_PACKEDLAYOUT_8888, 24, 4),
220
+ SDL_PIXELFORMAT_BGR888 =
221
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
222
+ SDL_PACKEDLAYOUT_8888, 24, 4),
223
+ SDL_PIXELFORMAT_BGRX8888 =
224
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
225
+ SDL_PACKEDLAYOUT_8888, 24, 4),
226
+ SDL_PIXELFORMAT_ARGB8888 =
227
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
228
+ SDL_PACKEDLAYOUT_8888, 32, 4),
229
+ SDL_PIXELFORMAT_RGBA8888 =
230
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA,
231
+ SDL_PACKEDLAYOUT_8888, 32, 4),
232
+ SDL_PIXELFORMAT_ABGR8888 =
233
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR,
234
+ SDL_PACKEDLAYOUT_8888, 32, 4),
235
+ SDL_PIXELFORMAT_BGRA8888 =
236
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA,
237
+ SDL_PACKEDLAYOUT_8888, 32, 4),
238
+ SDL_PIXELFORMAT_ARGB2101010 =
239
+ SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
240
+ SDL_PACKEDLAYOUT_2101010, 32, 4),
241
+
242
+ SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
243
+ SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
244
+ SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
245
+ SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
246
+ SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
247
+ SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
248
+ SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
249
+ SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
250
+ SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
251
+ SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U')
252
+ };
253
+
254
+ typedef struct SDL_Color
255
+ {
256
+ Uint8 r;
257
+ Uint8 g;
258
+ Uint8 b;
259
+ Uint8 a;
260
+ } SDL_Color;
261
+ #define SDL_Colour SDL_Color
262
+
263
+ typedef struct SDL_Palette
264
+ {
265
+ int ncolors;
266
+ SDL_Color *colors;
267
+ Uint32 version;
268
+ int refcount;
269
+ } SDL_Palette;
270
+
271
+ /**
272
+ * \note Everything in the pixel format structure is read-only.
273
+ */
274
+ typedef struct SDL_PixelFormat
275
+ {
276
+ Uint32 format;
277
+ SDL_Palette *palette;
278
+ Uint8 BitsPerPixel;
279
+ Uint8 BytesPerPixel;
280
+ Uint8 padding[2];
281
+ Uint32 Rmask;
282
+ Uint32 Gmask;
283
+ Uint32 Bmask;
284
+ Uint32 Amask;
285
+ Uint8 Rloss;
286
+ Uint8 Gloss;
287
+ Uint8 Bloss;
288
+ Uint8 Aloss;
289
+ Uint8 Rshift;
290
+ Uint8 Gshift;
291
+ Uint8 Bshift;
292
+ Uint8 Ashift;
293
+ int refcount;
294
+ struct SDL_PixelFormat *next;
295
+ } SDL_PixelFormat;
296
+
297
+ /**
298
+ * \brief Get the human readable name of a pixel format
299
+ */
300
+ extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
301
+
302
+ /**
303
+ * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks.
304
+ *
305
+ * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
306
+ *
307
+ * \sa SDL_MasksToPixelFormatEnum()
308
+ */
309
+ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
310
+ int *bpp,
311
+ Uint32 * Rmask,
312
+ Uint32 * Gmask,
313
+ Uint32 * Bmask,
314
+ Uint32 * Amask);
315
+
316
+ /**
317
+ * \brief Convert a bpp and RGBA masks to an enumerated pixel format.
318
+ *
319
+ * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion
320
+ * wasn't possible.
321
+ *
322
+ * \sa SDL_PixelFormatEnumToMasks()
323
+ */
324
+ extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
325
+ Uint32 Rmask,
326
+ Uint32 Gmask,
327
+ Uint32 Bmask,
328
+ Uint32 Amask);
329
+
330
+ /**
331
+ * \brief Create an SDL_PixelFormat structure from a pixel format enum.
332
+ */
333
+ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
334
+
335
+ /**
336
+ * \brief Free an SDL_PixelFormat structure.
337
+ */
338
+ extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
339
+
340
+ /**
341
+ * \brief Create a palette structure with the specified number of color
342
+ * entries.
343
+ *
344
+ * \return A new palette, or NULL if there wasn't enough memory.
345
+ *
346
+ * \note The palette entries are initialized to white.
347
+ *
348
+ * \sa SDL_FreePalette()
349
+ */
350
+ extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
351
+
352
+ /**
353
+ * \brief Set the palette for a pixel format structure.
354
+ */
355
+ extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
356
+ SDL_Palette *palette);
357
+
358
+ /**
359
+ * \brief Set a range of colors in a palette.
360
+ *
361
+ * \param palette The palette to modify.
362
+ * \param colors An array of colors to copy into the palette.
363
+ * \param firstcolor The index of the first palette entry to modify.
364
+ * \param ncolors The number of entries to modify.
365
+ *
366
+ * \return 0 on success, or -1 if not all of the colors could be set.
367
+ */
368
+ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
369
+ const SDL_Color * colors,
370
+ int firstcolor, int ncolors);
371
+
372
+ /**
373
+ * \brief Free a palette created with SDL_AllocPalette().
374
+ *
375
+ * \sa SDL_AllocPalette()
376
+ */
377
+ extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
378
+
379
+ /**
380
+ * \brief Maps an RGB triple to an opaque pixel value for a given pixel format.
381
+ *
382
+ * \sa SDL_MapRGBA
383
+ */
384
+ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
385
+ Uint8 r, Uint8 g, Uint8 b);
386
+
387
+ /**
388
+ * \brief Maps an RGBA quadruple to a pixel value for a given pixel format.
389
+ *
390
+ * \sa SDL_MapRGB
391
+ */
392
+ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
393
+ Uint8 r, Uint8 g, Uint8 b,
394
+ Uint8 a);
395
+
396
+ /**
397
+ * \brief Get the RGB components from a pixel of the specified format.
398
+ *
399
+ * \sa SDL_GetRGBA
400
+ */
401
+ extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
402
+ const SDL_PixelFormat * format,
403
+ Uint8 * r, Uint8 * g, Uint8 * b);
404
+
405
+ /**
406
+ * \brief Get the RGBA components from a pixel of the specified format.
407
+ *
408
+ * \sa SDL_GetRGB
409
+ */
410
+ extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
411
+ const SDL_PixelFormat * format,
412
+ Uint8 * r, Uint8 * g, Uint8 * b,
413
+ Uint8 * a);
414
+
415
+ /**
416
+ * \brief Calculate a 256 entry gamma ramp for a gamma value.
417
+ */
418
+ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
419
+
420
+
421
+ /* Ends C function definitions when using C++ */
422
+ #ifdef __cplusplus
423
+ }
424
+ #endif
425
+ #include "close_code.h"
426
+
427
+ #endif /* _SDL_pixels_h */
428
+
429
+ /* vi: set ts=4 sw=4 expandtab: */
@@ -0,0 +1,164 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+ /**
23
+ * \file SDL_platform.h
24
+ *
25
+ * Try to get a standard set of platform defines.
26
+ */
27
+
28
+ #ifndef _SDL_platform_h
29
+ #define _SDL_platform_h
30
+
31
+ #if defined(_AIX)
32
+ #undef __AIX__
33
+ #define __AIX__ 1
34
+ #endif
35
+ #if defined(__HAIKU__)
36
+ #undef __HAIKU__
37
+ #define __HAIKU__ 1
38
+ #endif
39
+ #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
40
+ #undef __BSDI__
41
+ #define __BSDI__ 1
42
+ #endif
43
+ #if defined(_arch_dreamcast)
44
+ #undef __DREAMCAST__
45
+ #define __DREAMCAST__ 1
46
+ #endif
47
+ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
48
+ #undef __FREEBSD__
49
+ #define __FREEBSD__ 1
50
+ #endif
51
+ #if defined(hpux) || defined(__hpux) || defined(__hpux__)
52
+ #undef __HPUX__
53
+ #define __HPUX__ 1
54
+ #endif
55
+ #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
56
+ #undef __IRIX__
57
+ #define __IRIX__ 1
58
+ #endif
59
+ #if defined(linux) || defined(__linux) || defined(__linux__)
60
+ #undef __LINUX__
61
+ #define __LINUX__ 1
62
+ #endif
63
+ #if defined(ANDROID) || defined(__ANDROID__)
64
+ #undef __ANDROID__
65
+ #undef __LINUX__ /* do we need to do this? */
66
+ #define __ANDROID__ 1
67
+ #endif
68
+
69
+ #if defined(__APPLE__)
70
+ /* lets us know what version of Mac OS X we're compiling on */
71
+ #include "AvailabilityMacros.h"
72
+ #include "TargetConditionals.h"
73
+ #if TARGET_OS_IPHONE
74
+ /* if compiling for iPhone */
75
+ #undef __IPHONEOS__
76
+ #define __IPHONEOS__ 1
77
+ #undef __MACOSX__
78
+ #else
79
+ /* if not compiling for iPhone */
80
+ #undef __MACOSX__
81
+ #define __MACOSX__ 1
82
+ #if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
83
+ # error SDL for Mac OS X only supports deploying on 10.5 and above.
84
+ #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */
85
+ #endif /* TARGET_OS_IPHONE */
86
+ #endif /* defined(__APPLE__) */
87
+
88
+ #if defined(__NetBSD__)
89
+ #undef __NETBSD__
90
+ #define __NETBSD__ 1
91
+ #endif
92
+ #if defined(__OpenBSD__)
93
+ #undef __OPENBSD__
94
+ #define __OPENBSD__ 1
95
+ #endif
96
+ #if defined(__OS2__)
97
+ #undef __OS2__
98
+ #define __OS2__ 1
99
+ #endif
100
+ #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
101
+ #undef __OSF__
102
+ #define __OSF__ 1
103
+ #endif
104
+ #if defined(__QNXNTO__)
105
+ #undef __QNXNTO__
106
+ #define __QNXNTO__ 1
107
+ #endif
108
+ #if defined(riscos) || defined(__riscos) || defined(__riscos__)
109
+ #undef __RISCOS__
110
+ #define __RISCOS__ 1
111
+ #endif
112
+ #if defined(__SVR4)
113
+ #undef __SOLARIS__
114
+ #define __SOLARIS__ 1
115
+ #endif
116
+
117
+ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
118
+ /* Try to find out if we're compiling for WinRT or non-WinRT */
119
+ /* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
120
+ #if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */
121
+ #include <winapifamily.h>
122
+ #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
123
+ #undef __WINDOWS__
124
+ #define __WINDOWS__ 1
125
+ /* See if we're compiling for WinRT: */
126
+ #elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
127
+ #undef __WINRT__
128
+ #define __WINRT__ 1
129
+ #endif
130
+ #else
131
+ #undef __WINDOWS__
132
+ #define __WINDOWS__ 1
133
+ #endif /* _MSC_VER < 1700 */
134
+ #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
135
+
136
+ #if defined(__WINDOWS__)
137
+ #undef __WIN32__
138
+ #define __WIN32__ 1
139
+ #endif
140
+ #if defined(__PSP__)
141
+ #undef __PSP__
142
+ #define __PSP__ 1
143
+ #endif
144
+
145
+ #include "begin_code.h"
146
+ /* Set up for C function definitions, even when using C++ */
147
+ #ifdef __cplusplus
148
+ extern "C" {
149
+ #endif
150
+
151
+ /**
152
+ * \brief Gets the name of the platform.
153
+ */
154
+ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
155
+
156
+ /* Ends C function definitions when using C++ */
157
+ #ifdef __cplusplus
158
+ }
159
+ #endif
160
+ #include "close_code.h"
161
+
162
+ #endif /* _SDL_platform_h */
163
+
164
+ /* vi: set ts=4 sw=4 expandtab: */
@@ -0,0 +1,75 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+ #ifndef _SDL_power_h
23
+ #define _SDL_power_h
24
+
25
+ /**
26
+ * \file SDL_power.h
27
+ *
28
+ * Header for the SDL power management routines.
29
+ */
30
+
31
+ #include "SDL_stdinc.h"
32
+
33
+ #include "begin_code.h"
34
+ /* Set up for C function definitions, even when using C++ */
35
+ #ifdef __cplusplus
36
+ extern "C" {
37
+ #endif
38
+
39
+ /**
40
+ * \brief The basic state for the system's power supply.
41
+ */
42
+ typedef enum
43
+ {
44
+ SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
45
+ SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
46
+ SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
47
+ SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */
48
+ SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */
49
+ } SDL_PowerState;
50
+
51
+
52
+ /**
53
+ * \brief Get the current power supply details.
54
+ *
55
+ * \param secs Seconds of battery life left. You can pass a NULL here if
56
+ * you don't care. Will return -1 if we can't determine a
57
+ * value, or we're not running on a battery.
58
+ *
59
+ * \param pct Percentage of battery life left, between 0 and 100. You can
60
+ * pass a NULL here if you don't care. Will return -1 if we
61
+ * can't determine a value, or we're not running on a battery.
62
+ *
63
+ * \return The state of the battery (if any).
64
+ */
65
+ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
66
+
67
+ /* Ends C function definitions when using C++ */
68
+ #ifdef __cplusplus
69
+ }
70
+ #endif
71
+ #include "close_code.h"
72
+
73
+ #endif /* _SDL_power_h */
74
+
75
+ /* vi: set ts=4 sw=4 expandtab: */