ruby2d 0.9.3 → 0.11.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.
- checksums.yaml +4 -4
- data/assets/README.md +7 -9
- data/assets/Rakefile +85 -0
- data/assets/include/SDL2/SDL.h +4 -1
- data/assets/include/SDL2/SDL_assert.h +3 -1
- data/assets/include/SDL2/SDL_atomic.h +20 -2
- data/assets/include/SDL2/SDL_audio.h +47 -14
- data/assets/include/SDL2/SDL_bits.h +10 -1
- data/assets/include/SDL2/SDL_blendmode.h +10 -7
- data/assets/include/SDL2/SDL_clipboard.h +1 -1
- data/assets/include/SDL2/SDL_config.h +24 -390
- data/assets/include/SDL2/SDL_config_android.h +182 -0
- data/assets/include/SDL2/SDL_config_iphoneos.h +207 -0
- data/assets/include/SDL2/SDL_config_macosx.h +266 -0
- data/assets/include/SDL2/SDL_config_minimal.h +85 -0
- data/assets/include/SDL2/SDL_config_os2.h +188 -0
- data/assets/include/SDL2/SDL_config_pandora.h +135 -0
- data/assets/include/SDL2/SDL_config_psp.h +165 -0
- data/assets/include/SDL2/SDL_config_windows.h +288 -0
- data/assets/include/SDL2/SDL_config_winrt.h +243 -0
- data/assets/include/SDL2/SDL_config_wiz.h +149 -0
- data/assets/include/SDL2/SDL_copying.h +20 -0
- data/assets/include/SDL2/SDL_cpuinfo.h +119 -8
- data/assets/include/SDL2/SDL_egl.h +4 -1
- data/assets/include/SDL2/SDL_endian.h +6 -3
- data/assets/include/SDL2/SDL_error.h +38 -2
- data/assets/include/SDL2/SDL_events.h +67 -28
- data/assets/include/SDL2/SDL_filesystem.h +1 -1
- data/assets/include/SDL2/SDL_gamecontroller.h +160 -9
- data/assets/include/SDL2/SDL_gesture.h +1 -1
- data/assets/include/SDL2/SDL_haptic.h +10 -1
- data/assets/include/SDL2/SDL_hints.h +460 -17
- data/assets/include/SDL2/SDL_image.h +2 -2
- data/assets/include/SDL2/SDL_joystick.h +115 -24
- data/assets/include/SDL2/SDL_keyboard.h +1 -1
- data/assets/include/SDL2/SDL_keycode.h +11 -9
- data/assets/include/SDL2/SDL_loadso.h +1 -1
- data/assets/include/SDL2/SDL_locale.h +101 -0
- data/assets/include/SDL2/SDL_log.h +3 -3
- data/assets/include/SDL2/SDL_main.h +28 -16
- data/assets/include/SDL2/SDL_messagebox.h +6 -4
- data/assets/include/SDL2/SDL_metal.h +117 -0
- data/assets/include/SDL2/SDL_misc.h +75 -0
- data/assets/include/SDL2/SDL_mouse.h +1 -1
- data/assets/include/SDL2/SDL_mutex.h +1 -1
- data/assets/include/SDL2/SDL_name.h +1 -1
- data/assets/include/SDL2/SDL_opengl.h +1 -1
- data/assets/include/SDL2/SDL_opengl_glext.h +3 -0
- data/assets/include/SDL2/SDL_opengles.h +1 -1
- data/assets/include/SDL2/SDL_opengles2.h +1 -1
- data/assets/include/SDL2/SDL_pixels.h +27 -18
- data/assets/include/SDL2/SDL_platform.h +1 -1
- data/assets/include/SDL2/SDL_power.h +1 -1
- data/assets/include/SDL2/SDL_quit.h +1 -1
- data/assets/include/SDL2/SDL_rect.h +29 -3
- data/assets/include/SDL2/SDL_render.h +230 -3
- data/assets/include/SDL2/SDL_revision.h +2 -2
- data/assets/include/SDL2/SDL_rwops.h +51 -22
- data/assets/include/SDL2/SDL_scancode.h +2 -2
- data/assets/include/SDL2/SDL_sensor.h +28 -12
- data/assets/include/SDL2/SDL_shape.h +1 -1
- data/assets/include/SDL2/SDL_stdinc.h +44 -4
- data/assets/include/SDL2/SDL_surface.h +12 -2
- data/assets/include/SDL2/SDL_system.h +50 -4
- data/assets/include/SDL2/SDL_syswm.h +39 -9
- data/assets/include/SDL2/SDL_test.h +1 -1
- data/assets/include/SDL2/SDL_test_assert.h +1 -1
- data/assets/include/SDL2/SDL_test_common.h +32 -2
- data/assets/include/SDL2/SDL_test_compare.h +1 -1
- data/assets/include/SDL2/SDL_test_crc32.h +1 -1
- data/assets/include/SDL2/SDL_test_font.h +1 -1
- data/assets/include/SDL2/SDL_test_fuzzer.h +1 -1
- data/assets/include/SDL2/SDL_test_harness.h +1 -1
- data/assets/include/SDL2/SDL_test_images.h +1 -1
- data/assets/include/SDL2/SDL_test_log.h +1 -1
- data/assets/include/SDL2/SDL_test_md5.h +1 -1
- data/assets/include/SDL2/SDL_test_memory.h +3 -3
- data/assets/include/SDL2/SDL_test_random.h +1 -1
- data/assets/include/SDL2/SDL_thread.h +34 -11
- data/assets/include/SDL2/SDL_timer.h +1 -1
- data/assets/include/SDL2/SDL_touch.h +17 -1
- data/assets/include/SDL2/SDL_types.h +1 -1
- data/assets/include/SDL2/SDL_version.h +2 -2
- data/assets/include/SDL2/SDL_video.h +11 -5
- data/assets/include/SDL2/SDL_vulkan.h +9 -11
- data/assets/include/SDL2/begin_code.h +8 -9
- data/assets/include/SDL2/close_code.h +4 -1
- data/assets/macos/lib/libFLAC.a +0 -0
- data/assets/macos/lib/libSDL2.a +0 -0
- data/assets/macos/lib/libSDL2_image.a +0 -0
- data/assets/macos/lib/libSDL2_mixer.a +0 -0
- data/assets/macos/lib/libSDL2_ttf.a +0 -0
- data/assets/macos/lib/libfreetype.a +0 -0
- data/assets/macos/lib/libjpeg.a +0 -0
- data/assets/macos/lib/libmpg123.a +0 -0
- data/assets/macos/lib/libogg.a +0 -0
- data/assets/macos/lib/libpng16.a +0 -0
- data/assets/macos/lib/libtiff.a +0 -0
- data/assets/macos/lib/libvorbis.a +0 -0
- data/assets/macos/lib/libvorbisfile.a +0 -0
- data/assets/macos/lib/libwebp.a +0 -0
- data/assets/mingw/bin/SDL2.dll +0 -0
- data/assets/mingw/bin/SDL2_image.dll +0 -0
- data/assets/mingw/bin/libpng16-16.dll +0 -0
- data/assets/mingw/bin/libtiff-5.dll +0 -0
- data/assets/mingw/bin/libwebp-7.dll +0 -0
- data/assets/mingw/lib/libSDL2.a +0 -0
- data/assets/mingw/lib/libSDL2.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_image.a +0 -0
- data/assets/mingw/lib/libSDL2_image.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_test.a +0 -0
- data/assets/mingw/lib/libSDL2main.a +0 -0
- data/bin/ruby2d +1 -0
- data/{assets/linux/simple2d/src/simple2d.c → ext/ruby2d/common.c} +32 -32
- data/{assets/linux/simple2d/src → ext/ruby2d}/controllers.c +17 -17
- data/ext/ruby2d/extconf.rb +36 -58
- data/ext/ruby2d/font.c +35 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/gl.c +72 -100
- data/ext/ruby2d/gl2.c +86 -0
- data/ext/ruby2d/gl3.c +305 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/gles.c +22 -81
- data/ext/ruby2d/image.c +58 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/input.c +8 -8
- data/{assets/linux/simple2d/src → ext/ruby2d}/music.c +30 -17
- data/ext/ruby2d/ruby2d.c +449 -439
- data/ext/ruby2d/ruby2d.h +652 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/shapes.c +18 -18
- data/ext/ruby2d/sound.c +118 -0
- data/ext/ruby2d/text.c +22 -0
- data/{assets/linux/simple2d/src → ext/ruby2d}/window.c +73 -62
- data/lib/ruby2d/circle.rb +21 -3
- data/lib/ruby2d/cli/build.rb +4 -7
- data/lib/ruby2d/dsl.rb +16 -9
- data/lib/ruby2d/entity.rb +17 -0
- data/lib/ruby2d/font.rb +23 -3
- data/lib/ruby2d/image.rb +35 -7
- data/lib/ruby2d/line.rb +23 -1
- data/lib/ruby2d/music.rb +5 -0
- data/lib/ruby2d/pixel.rb +17 -0
- data/lib/ruby2d/quad.rb +21 -1
- data/lib/ruby2d/rectangle.rb +12 -3
- data/lib/ruby2d/renderable.rb +4 -20
- data/lib/ruby2d/sound.rb +30 -0
- data/lib/ruby2d/sprite.rb +57 -75
- data/lib/ruby2d/square.rb +10 -1
- data/lib/ruby2d/text.rb +55 -12
- data/lib/ruby2d/texture.rb +28 -0
- data/lib/ruby2d/tileset.rb +87 -0
- data/lib/ruby2d/triangle.rb +19 -1
- data/lib/ruby2d/version.rb +1 -1
- data/lib/ruby2d/vertices.rb +84 -0
- data/lib/ruby2d/window.rb +259 -22
- data/lib/ruby2d.rb +6 -1
- metadata +41 -26
- data/assets/include/simple2d.h +0 -735
- data/assets/linux/simple2d/Makefile +0 -257
- data/assets/linux/simple2d/bin/simple2d.sh +0 -1312
- data/assets/linux/simple2d/include/simple2d.h +0 -735
- data/assets/linux/simple2d/src/gl2.c +0 -146
- data/assets/linux/simple2d/src/gl3.c +0 -275
- data/assets/linux/simple2d/src/image.c +0 -138
- data/assets/linux/simple2d/src/sound.c +0 -56
- data/assets/linux/simple2d/src/sprite.c +0 -147
- data/assets/linux/simple2d/src/text.c +0 -129
- data/assets/macos/lib/libsimple2d.a +0 -0
- data/assets/mingw/lib/libsimple2d.a +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
SDL_image: An example image loading library for use with SDL
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -37,7 +37,7 @@ extern "C" {
|
|
37
37
|
*/
|
38
38
|
#define SDL_IMAGE_MAJOR_VERSION 2
|
39
39
|
#define SDL_IMAGE_MINOR_VERSION 0
|
40
|
-
#define SDL_IMAGE_PATCHLEVEL
|
40
|
+
#define SDL_IMAGE_PATCHLEVEL 5
|
41
41
|
|
42
42
|
/* This macro can be used to fill a version structure with the compile-time
|
43
43
|
* version of the SDL_image library.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -105,6 +105,12 @@ typedef enum
|
|
105
105
|
SDL_JOYSTICK_POWER_MAX
|
106
106
|
} SDL_JoystickPowerLevel;
|
107
107
|
|
108
|
+
/* Set max recognized G-force from accelerometer
|
109
|
+
See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
|
110
|
+
*/
|
111
|
+
#define SDL_IPHONE_MAX_GFORCE 5.0
|
112
|
+
|
113
|
+
|
108
114
|
/* Function prototypes */
|
109
115
|
|
110
116
|
/**
|
@@ -192,48 +198,99 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
|
|
192
198
|
/**
|
193
199
|
* Return the SDL_Joystick associated with an instance id.
|
194
200
|
*/
|
195
|
-
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID
|
201
|
+
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id);
|
202
|
+
|
203
|
+
/**
|
204
|
+
* Return the SDL_Joystick associated with a player index.
|
205
|
+
*/
|
206
|
+
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index);
|
207
|
+
|
208
|
+
/**
|
209
|
+
* Attaches a new virtual joystick.
|
210
|
+
* Returns the joystick's device index, or -1 if an error occurred.
|
211
|
+
*/
|
212
|
+
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
|
213
|
+
int naxes,
|
214
|
+
int nbuttons,
|
215
|
+
int nhats);
|
216
|
+
|
217
|
+
/**
|
218
|
+
* Detaches a virtual joystick
|
219
|
+
* Returns 0 on success, or -1 if an error occurred.
|
220
|
+
*/
|
221
|
+
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Indicates whether or not a virtual-joystick is at a given device index.
|
225
|
+
*/
|
226
|
+
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Set values on an opened, virtual-joystick's controls.
|
230
|
+
* Please note that values set here will not be applied until the next
|
231
|
+
* call to SDL_JoystickUpdate, which can either be called directly,
|
232
|
+
* or can be called indirectly through various other SDL APIS,
|
233
|
+
* including, but not limited to the following: SDL_PollEvent,
|
234
|
+
* SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.
|
235
|
+
*
|
236
|
+
* Returns 0 on success, -1 on error.
|
237
|
+
*/
|
238
|
+
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value);
|
239
|
+
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value);
|
240
|
+
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
|
196
241
|
|
197
242
|
/**
|
198
243
|
* Return the name for this currently opened joystick.
|
199
244
|
* If no name can be found, this function returns NULL.
|
200
245
|
*/
|
201
|
-
extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *
|
246
|
+
extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick);
|
202
247
|
|
203
248
|
/**
|
204
249
|
* Get the player index of an opened joystick, or -1 if it's not available
|
205
250
|
*
|
206
251
|
* For XInput controllers this returns the XInput user index.
|
207
252
|
*/
|
208
|
-
extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *
|
253
|
+
extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick);
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Set the player index of an opened joystick
|
257
|
+
*/
|
258
|
+
extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick, int player_index);
|
209
259
|
|
210
260
|
/**
|
211
261
|
* Return the GUID for this opened joystick
|
212
262
|
*/
|
213
|
-
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *
|
263
|
+
extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *joystick);
|
214
264
|
|
215
265
|
/**
|
216
266
|
* Get the USB vendor ID of an opened joystick, if available.
|
217
267
|
* If the vendor ID isn't available this function returns 0.
|
218
268
|
*/
|
219
|
-
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *
|
269
|
+
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick);
|
220
270
|
|
221
271
|
/**
|
222
272
|
* Get the USB product ID of an opened joystick, if available.
|
223
273
|
* If the product ID isn't available this function returns 0.
|
224
274
|
*/
|
225
|
-
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *
|
275
|
+
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick);
|
226
276
|
|
227
277
|
/**
|
228
278
|
* Get the product version of an opened joystick, if available.
|
229
279
|
* If the product version isn't available this function returns 0.
|
230
280
|
*/
|
231
|
-
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *
|
281
|
+
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick);
|
282
|
+
|
283
|
+
/**
|
284
|
+
* Get the serial number of an opened joystick, if available.
|
285
|
+
*
|
286
|
+
* Returns the serial number of the joystick, or NULL if it is not available.
|
287
|
+
*/
|
288
|
+
extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystick);
|
232
289
|
|
233
290
|
/**
|
234
291
|
* Get the type of an opened joystick.
|
235
292
|
*/
|
236
|
-
extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *
|
293
|
+
extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joystick);
|
237
294
|
|
238
295
|
/**
|
239
296
|
* Return a string representation for this guid. pszGUID must point to at least 33 bytes
|
@@ -249,17 +306,17 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha
|
|
249
306
|
/**
|
250
307
|
* Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not.
|
251
308
|
*/
|
252
|
-
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *
|
309
|
+
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *joystick);
|
253
310
|
|
254
311
|
/**
|
255
312
|
* Get the instance ID of an opened joystick or -1 if the joystick is invalid.
|
256
313
|
*/
|
257
|
-
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *
|
314
|
+
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joystick);
|
258
315
|
|
259
316
|
/**
|
260
317
|
* Get the number of general axis controls on a joystick.
|
261
318
|
*/
|
262
|
-
extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *
|
319
|
+
extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
|
263
320
|
|
264
321
|
/**
|
265
322
|
* Get the number of trackballs on a joystick.
|
@@ -267,17 +324,17 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick);
|
|
267
324
|
* Joystick trackballs have only relative motion events associated
|
268
325
|
* with them and their state cannot be polled.
|
269
326
|
*/
|
270
|
-
extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *
|
327
|
+
extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
|
271
328
|
|
272
329
|
/**
|
273
330
|
* Get the number of POV hats on a joystick.
|
274
331
|
*/
|
275
|
-
extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *
|
332
|
+
extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
|
276
333
|
|
277
334
|
/**
|
278
335
|
* Get the number of buttons on a joystick.
|
279
336
|
*/
|
280
|
-
extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *
|
337
|
+
extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
|
281
338
|
|
282
339
|
/**
|
283
340
|
* Update the current state of the open joysticks.
|
@@ -307,7 +364,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
|
|
307
364
|
*
|
308
365
|
* The axis indices start at index 0.
|
309
366
|
*/
|
310
|
-
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *
|
367
|
+
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick,
|
311
368
|
int axis);
|
312
369
|
|
313
370
|
/**
|
@@ -319,7 +376,7 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
|
|
319
376
|
*
|
320
377
|
* \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
|
321
378
|
*/
|
322
|
-
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *
|
379
|
+
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick,
|
323
380
|
int axis, Sint16 *state);
|
324
381
|
|
325
382
|
/**
|
@@ -353,7 +410,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *
|
|
353
410
|
* - ::SDL_HAT_LEFTUP
|
354
411
|
* - ::SDL_HAT_LEFTDOWN
|
355
412
|
*/
|
356
|
-
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *
|
413
|
+
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick,
|
357
414
|
int hat);
|
358
415
|
|
359
416
|
/**
|
@@ -363,7 +420,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick,
|
|
363
420
|
*
|
364
421
|
* The ball indices start at index 0.
|
365
422
|
*/
|
366
|
-
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *
|
423
|
+
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick,
|
367
424
|
int ball, int *dx, int *dy);
|
368
425
|
|
369
426
|
/**
|
@@ -371,11 +428,11 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick,
|
|
371
428
|
*
|
372
429
|
* The button indices start at index 0.
|
373
430
|
*/
|
374
|
-
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *
|
431
|
+
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick,
|
375
432
|
int button);
|
376
433
|
|
377
434
|
/**
|
378
|
-
*
|
435
|
+
* Start a rumble effect
|
379
436
|
* Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
|
380
437
|
*
|
381
438
|
* \param joystick The joystick to vibrate
|
@@ -385,17 +442,51 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
|
|
385
442
|
*
|
386
443
|
* \return 0, or -1 if rumble isn't supported on this joystick
|
387
444
|
*/
|
388
|
-
extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *
|
445
|
+
extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
|
446
|
+
|
447
|
+
/**
|
448
|
+
* Start a rumble effect in the joystick's triggers
|
449
|
+
* Each call to this function cancels any previous trigger rumble effect, and calling it with 0 intensity stops any rumbling.
|
450
|
+
*
|
451
|
+
* \param joystick The joystick to vibrate
|
452
|
+
* \param left_rumble The intensity of the left trigger rumble motor, from 0 to 0xFFFF
|
453
|
+
* \param right_rumble The intensity of the right trigger rumble motor, from 0 to 0xFFFF
|
454
|
+
* \param duration_ms The duration of the rumble effect, in milliseconds
|
455
|
+
*
|
456
|
+
* \return 0, or -1 if trigger rumble isn't supported on this joystick
|
457
|
+
*/
|
458
|
+
extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
|
459
|
+
|
460
|
+
/**
|
461
|
+
* Return whether a joystick has an LED
|
462
|
+
*
|
463
|
+
* \param joystick The joystick to query
|
464
|
+
*
|
465
|
+
* \return SDL_TRUE, or SDL_FALSE if this joystick does not have a modifiable LED
|
466
|
+
*/
|
467
|
+
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick);
|
468
|
+
|
469
|
+
/**
|
470
|
+
* Update a joystick's LED color.
|
471
|
+
*
|
472
|
+
* \param joystick The joystick to update
|
473
|
+
* \param red The intensity of the red LED
|
474
|
+
* \param green The intensity of the green LED
|
475
|
+
* \param blue The intensity of the blue LED
|
476
|
+
*
|
477
|
+
* \return 0, or -1 if this joystick does not have a modifiable LED
|
478
|
+
*/
|
479
|
+
extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
|
389
480
|
|
390
481
|
/**
|
391
482
|
* Close a joystick previously opened with SDL_JoystickOpen().
|
392
483
|
*/
|
393
|
-
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *
|
484
|
+
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
|
394
485
|
|
395
486
|
/**
|
396
487
|
* Return the battery level of this joystick
|
397
488
|
*/
|
398
|
-
extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick *
|
489
|
+
extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick *joystick);
|
399
490
|
|
400
491
|
/* Ends C function definitions when using C++ */
|
401
492
|
#ifdef __cplusplus
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -47,7 +47,7 @@ typedef Sint32 SDL_Keycode;
|
|
47
47
|
#define SDLK_SCANCODE_MASK (1<<30)
|
48
48
|
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
49
49
|
|
50
|
-
enum
|
50
|
+
typedef enum
|
51
51
|
{
|
52
52
|
SDLK_UNKNOWN = 0,
|
53
53
|
|
@@ -88,9 +88,11 @@ enum
|
|
88
88
|
SDLK_GREATER = '>',
|
89
89
|
SDLK_QUESTION = '?',
|
90
90
|
SDLK_AT = '@',
|
91
|
+
|
91
92
|
/*
|
92
93
|
Skip uppercase letters
|
93
94
|
*/
|
95
|
+
|
94
96
|
SDLK_LEFTBRACKET = '[',
|
95
97
|
SDLK_BACKSLASH = '\\',
|
96
98
|
SDLK_RIGHTBRACKET = ']',
|
@@ -317,7 +319,7 @@ enum
|
|
317
319
|
|
318
320
|
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
|
319
321
|
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
|
320
|
-
};
|
322
|
+
} SDL_KeyCode;
|
321
323
|
|
322
324
|
/**
|
323
325
|
* \brief Enumeration of valid key mods (possibly OR'd together).
|
@@ -336,13 +338,13 @@ typedef enum
|
|
336
338
|
KMOD_NUM = 0x1000,
|
337
339
|
KMOD_CAPS = 0x2000,
|
338
340
|
KMOD_MODE = 0x4000,
|
339
|
-
KMOD_RESERVED = 0x8000
|
340
|
-
} SDL_Keymod;
|
341
|
+
KMOD_RESERVED = 0x8000,
|
341
342
|
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
343
|
+
KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL,
|
344
|
+
KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT,
|
345
|
+
KMOD_ALT = KMOD_LALT | KMOD_RALT,
|
346
|
+
KMOD_GUI = KMOD_LGUI | KMOD_RGUI
|
347
|
+
} SDL_Keymod;
|
346
348
|
|
347
349
|
#endif /* SDL_keycode_h_ */
|
348
350
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -0,0 +1,101 @@
|
|
1
|
+
/*
|
2
|
+
Simple DirectMedia Layer
|
3
|
+
Copyright (C) 1997-2020 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_locale.h
|
24
|
+
*
|
25
|
+
* Include file for SDL locale services
|
26
|
+
*/
|
27
|
+
|
28
|
+
#ifndef _SDL_locale_h
|
29
|
+
#define _SDL_locale_h
|
30
|
+
|
31
|
+
#include "SDL_stdinc.h"
|
32
|
+
#include "SDL_error.h"
|
33
|
+
|
34
|
+
#include "begin_code.h"
|
35
|
+
/* Set up for C function definitions, even when using C++ */
|
36
|
+
#ifdef __cplusplus
|
37
|
+
/* *INDENT-OFF* */
|
38
|
+
extern "C" {
|
39
|
+
/* *INDENT-ON* */
|
40
|
+
#endif
|
41
|
+
|
42
|
+
|
43
|
+
typedef struct SDL_Locale
|
44
|
+
{
|
45
|
+
const char *language; /**< A language name, like "en" for English. */
|
46
|
+
const char *country; /**< A country, like "US" for America. Can be NULL. */
|
47
|
+
} SDL_Locale;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* \brief Report the user's preferred locale.
|
51
|
+
*
|
52
|
+
* This returns an array of SDL_Locale structs, the final item zeroed out.
|
53
|
+
* When the caller is done with this array, it should call SDL_free() on
|
54
|
+
* the returned value; all the memory involved is allocated in a single
|
55
|
+
* block, so a single SDL_free() will suffice.
|
56
|
+
*
|
57
|
+
* Returned language strings are in the format xx, where 'xx' is an ISO-639
|
58
|
+
* language specifier (such as "en" for English, "de" for German, etc).
|
59
|
+
* Country strings are in the format YY, where "YY" is an ISO-3166 country
|
60
|
+
* code (such as "US" for the United States, "CA" for Canada, etc). Country
|
61
|
+
* might be NULL if there's no specific guidance on them (so you might get
|
62
|
+
* { "en", "US" } for American English, but { "en", NULL } means "English
|
63
|
+
* language, generically"). Language strings are never NULL, except to
|
64
|
+
* terminate the array.
|
65
|
+
*
|
66
|
+
* Please note that not all of these strings are 2 characters; some are
|
67
|
+
* three or more.
|
68
|
+
*
|
69
|
+
* The returned list of locales are in the order of the user's preference.
|
70
|
+
* For example, a German citizen that is fluent in US English and knows
|
71
|
+
* enough Japanese to navigate around Tokyo might have a list like:
|
72
|
+
* { "de", "en_US", "jp", NULL }. Someone from England might prefer British
|
73
|
+
* English (where "color" is spelled "colour", etc), but will settle for
|
74
|
+
* anything like it: { "en_GB", "en", NULL }.
|
75
|
+
*
|
76
|
+
* This function returns NULL on error, including when the platform does not
|
77
|
+
* supply this information at all.
|
78
|
+
*
|
79
|
+
* This might be a "slow" call that has to query the operating system. It's
|
80
|
+
* best to ask for this once and save the results. However, this list can
|
81
|
+
* change, usually because the user has changed a system preference outside
|
82
|
+
* of your program; SDL will send an SDL_LOCALECHANGED event in this case,
|
83
|
+
* if possible, and you can call this function again to get an updated copy
|
84
|
+
* of preferred locales.
|
85
|
+
*
|
86
|
+
* \return array of locales, terminated with a locale with a NULL language
|
87
|
+
* field. Will return NULL on error.
|
88
|
+
*/
|
89
|
+
extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void);
|
90
|
+
|
91
|
+
/* Ends C function definitions when using C++ */
|
92
|
+
#ifdef __cplusplus
|
93
|
+
/* *INDENT-OFF* */
|
94
|
+
}
|
95
|
+
/* *INDENT-ON* */
|
96
|
+
#endif
|
97
|
+
#include "close_code.h"
|
98
|
+
|
99
|
+
#endif /* _SDL_locale_h */
|
100
|
+
|
101
|
+
/* vi: set ts=4 sw=4 expandtab: */
|