gosu 1.1.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/COPYING +1 -1
- data/dependencies/SDL/include/SDL.h +108 -14
- data/dependencies/SDL/include/SDL_assert.h +81 -50
- data/dependencies/SDL/include/SDL_atomic.h +135 -35
- data/dependencies/SDL/include/SDL_audio.h +960 -355
- data/dependencies/SDL/include/SDL_bits.h +11 -6
- data/dependencies/SDL/include/SDL_blendmode.h +91 -14
- data/dependencies/SDL/include/SDL_clipboard.h +30 -7
- data/dependencies/SDL/include/SDL_config.h +277 -27
- data/dependencies/SDL/include/SDL_config_android.h +13 -38
- data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
- data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
- data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
- data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
- data/dependencies/SDL/include/SDL_config_psp.h +16 -37
- data/dependencies/SDL/include/SDL_config_windows.h +28 -91
- data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
- data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
- data/dependencies/SDL/include/SDL_copying.h +1 -1
- data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
- data/dependencies/SDL/include/SDL_egl.h +906 -280
- data/dependencies/SDL/include/SDL_endian.h +101 -47
- data/dependencies/SDL/include/SDL_error.h +70 -19
- data/dependencies/SDL/include/SDL_events.h +387 -79
- data/dependencies/SDL/include/SDL_filesystem.h +73 -64
- data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
- data/dependencies/SDL/include/SDL_gesture.h +36 -6
- data/dependencies/SDL/include/SDL_haptic.h +304 -210
- data/dependencies/SDL/include/SDL_hidapi.h +451 -0
- data/dependencies/SDL/include/SDL_hints.h +1286 -897
- data/dependencies/SDL/include/SDL_joystick.h +577 -130
- data/dependencies/SDL/include/SDL_keyboard.h +162 -63
- data/dependencies/SDL/include/SDL_keycode.h +7 -5
- data/dependencies/SDL/include/SDL_loadso.h +42 -8
- data/dependencies/SDL/include/SDL_locale.h +34 -32
- data/dependencies/SDL/include/SDL_log.h +212 -19
- data/dependencies/SDL/include/SDL_main.h +72 -17
- data/dependencies/SDL/include/SDL_messagebox.h +70 -23
- data/dependencies/SDL/include/SDL_metal.h +27 -32
- data/dependencies/SDL/include/SDL_misc.h +19 -15
- data/dependencies/SDL/include/SDL_mouse.h +262 -110
- data/dependencies/SDL/include/SDL_mutex.h +286 -66
- data/dependencies/SDL/include/SDL_name.h +1 -1
- data/dependencies/SDL/include/SDL_opengl.h +1 -1
- data/dependencies/SDL/include/SDL_opengles.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2.h +2 -2
- data/dependencies/SDL/include/SDL_pixels.h +199 -34
- data/dependencies/SDL/include/SDL_platform.h +39 -2
- data/dependencies/SDL/include/SDL_power.h +23 -10
- data/dependencies/SDL/include/SDL_quit.h +1 -1
- data/dependencies/SDL/include/SDL_rect.h +78 -28
- data/dependencies/SDL/include/SDL_render.h +1204 -472
- data/dependencies/SDL/include/SDL_revision.h +2 -2
- data/dependencies/SDL/include/SDL_rwops.h +605 -33
- data/dependencies/SDL/include/SDL_scancode.h +1 -1
- data/dependencies/SDL/include/SDL_sensor.h +76 -42
- data/dependencies/SDL/include/SDL_shape.h +38 -27
- data/dependencies/SDL/include/SDL_stdinc.h +96 -24
- data/dependencies/SDL/include/SDL_surface.h +571 -139
- data/dependencies/SDL/include/SDL_system.h +339 -101
- data/dependencies/SDL/include/SDL_syswm.h +50 -20
- data/dependencies/SDL/include/SDL_test.h +1 -1
- data/dependencies/SDL/include/SDL_test_assert.h +2 -2
- data/dependencies/SDL/include/SDL_test_common.h +23 -6
- data/dependencies/SDL/include/SDL_test_compare.h +1 -1
- data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
- data/dependencies/SDL/include/SDL_test_font.h +3 -3
- data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
- data/dependencies/SDL/include/SDL_test_harness.h +6 -6
- data/dependencies/SDL/include/SDL_test_images.h +1 -1
- data/dependencies/SDL/include/SDL_test_log.h +1 -1
- data/dependencies/SDL/include/SDL_test_md5.h +1 -1
- data/dependencies/SDL/include/SDL_test_memory.h +1 -1
- data/dependencies/SDL/include/SDL_test_random.h +2 -2
- data/dependencies/SDL/include/SDL_thread.h +226 -128
- data/dependencies/SDL/include/SDL_timer.h +129 -22
- data/dependencies/SDL/include/SDL_touch.h +48 -8
- data/dependencies/SDL/include/SDL_types.h +1 -1
- data/dependencies/SDL/include/SDL_version.h +72 -46
- data/dependencies/SDL/include/SDL_video.h +1266 -460
- data/dependencies/SDL/include/SDL_vulkan.h +100 -161
- data/dependencies/SDL/include/begin_code.h +22 -1
- data/dependencies/SDL/include/close_code.h +1 -1
- data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
- data/dependencies/SDL_sound/SDL_sound.c +83 -7
- data/dependencies/SDL_sound/SDL_sound.h +4 -4
- data/dependencies/SDL_sound/SDL_sound_aiff.c +9 -12
- data/dependencies/SDL_sound/SDL_sound_au.c +7 -7
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +3 -3
- data/dependencies/SDL_sound/SDL_sound_flac.c +1 -1
- data/dependencies/SDL_sound/SDL_sound_internal.h +17 -10
- data/dependencies/SDL_sound/SDL_sound_modplug.c +25 -27
- data/dependencies/SDL_sound/SDL_sound_mp3.c +5 -17
- data/dependencies/SDL_sound/SDL_sound_raw.c +11 -11
- data/dependencies/SDL_sound/SDL_sound_shn.c +8 -7
- data/dependencies/SDL_sound/SDL_sound_voc.c +6 -4
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +6 -11
- data/dependencies/SDL_sound/SDL_sound_wav.c +35 -29
- data/dependencies/SDL_sound/dr_flac.h +618 -220
- data/dependencies/SDL_sound/dr_mp3.h +263 -94
- data/dependencies/SDL_sound/libmodplug/fastmix.c +58 -64
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
- data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
- data/dependencies/SDL_sound/libmodplug/load_amf.c +11 -7
- data/dependencies/SDL_sound/libmodplug/load_ams.c +65 -22
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
- data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
- data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +45 -49
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +80 -53
- data/dependencies/SDL_sound/libmodplug/load_med.c +20 -12
- data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +29 -17
- data/dependencies/SDL_sound/libmodplug/load_okt.c +12 -8
- data/dependencies/SDL_sound/libmodplug/load_psm.c +101 -78
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
- data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
- data/dependencies/SDL_sound/libmodplug/load_ult.c +2 -2
- data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
- data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
- data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
- data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +24 -18
- data/dependencies/SDL_sound/libmodplug/sndfile.c +55 -156
- data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
- data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
- data/dependencies/SDL_sound/stb_vorbis.h +508 -325
- data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
- data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
- data/dependencies/mojoAL/mojoal.c +4594 -0
- data/ext/gosu/extconf.rb +33 -30
- data/include/Gosu/Audio.hpp +70 -85
- data/include/Gosu/Color.hpp +63 -107
- data/include/Gosu/Font.hpp +44 -50
- data/include/Gosu/Fwd.hpp +1 -1
- data/include/Gosu/Graphics.hpp +64 -75
- data/include/Gosu/GraphicsBase.hpp +32 -39
- data/include/Gosu/Image.hpp +56 -62
- data/include/Gosu/ImageData.hpp +23 -27
- data/include/Gosu/Inspection.hpp +1 -4
- data/include/Gosu/Math.hpp +4 -16
- data/include/Gosu/Platform.hpp +1 -51
- data/include/Gosu/Text.hpp +37 -40
- data/include/Gosu/TextInput.hpp +34 -40
- data/include/Gosu/Utility.hpp +10 -8
- data/include/Gosu/Version.hpp +1 -1
- data/include/Gosu/Window.hpp +73 -70
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/compat.rb +28 -37
- data/lib/gosu/swig_patches.rb +31 -3
- data/lib/gosu.rb +2 -2
- data/lib64/SDL2.dll +0 -0
- data/rdoc/gosu.rb +9 -1
- data/src/Audio.cpp +86 -86
- data/src/AudioFile.hpp +6 -6
- data/src/AudioFileAudioToolbox.cpp +1 -1
- data/src/AudioFileSDLSound.cpp +1 -1
- data/src/AudioImpl.hpp +5 -5
- data/src/Bitmap.cpp +13 -13
- data/src/BitmapIO.cpp +0 -20
- data/src/BlockAllocator.cpp +2 -1
- data/src/Channel.cpp +22 -20
- data/src/Color.cpp +62 -55
- data/src/EmptyImageData.hpp +16 -18
- data/src/FileUnix.cpp +1 -1
- data/src/FileWin.cpp +1 -1
- data/src/Font.cpp +52 -57
- data/src/GosuViewController.cpp +2 -0
- data/src/Graphics.cpp +135 -143
- data/src/Image.cpp +42 -42
- data/src/Input.cpp +1 -1
- data/src/InputUIKit.cpp +1 -1
- data/src/LargeImageData.cpp +120 -113
- data/src/LargeImageData.hpp +18 -16
- data/src/Log.hpp +6 -6
- data/src/Macro.cpp +124 -169
- data/src/Macro.hpp +11 -11
- data/src/Math.cpp +8 -1
- data/src/RenderState.hpp +5 -5
- data/src/Resolution.cpp +114 -61
- data/src/RubyGosu.cxx +470 -501
- data/src/RubyGosu.h +3 -2
- data/src/TexChunk.cpp +50 -41
- data/src/TexChunk.hpp +22 -22
- data/src/Text.cpp +58 -59
- data/src/TextBuilder.cpp +60 -57
- data/src/TextBuilder.hpp +20 -20
- data/src/TextInput.cpp +127 -135
- data/src/TrueTypeFont.cpp +108 -108
- data/src/TrueTypeFont.hpp +39 -38
- data/src/TrueTypeFontApple.cpp +27 -23
- data/src/TrueTypeFontUnix.cpp +21 -26
- data/src/TrueTypeFontWin.cpp +30 -30
- data/src/Utility.cpp +82 -23
- data/src/WinUtility.hpp +2 -1
- data/src/Window.cpp +103 -86
- data/src/WindowUIKit.cpp +48 -51
- metadata +8 -20
- data/dependencies/SDL/include/SDL_config_os2.h +0 -188
- data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
- data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
- data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
- data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
- data/dependencies/al_soft/AL/alext.h +0 -585
- data/dependencies/al_soft/AL/efx-creative.h +0 -3
- data/dependencies/al_soft/AL/efx-presets.h +0 -402
- data/dependencies/al_soft/AL/efx.h +0 -762
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/lib/OpenAL32.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
- data/src/UtilityApple.cpp +0 -16
- data/src/UtilityWin.cpp +0 -17
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2022 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
|
@@ -301,6 +301,11 @@ typedef enum
|
|
301
301
|
SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
|
302
302
|
} SDL_PixelFormatEnum;
|
303
303
|
|
304
|
+
/**
|
305
|
+
* The bits of this structure can be directly reinterpreted as an integer-packed
|
306
|
+
* color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888
|
307
|
+
* on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
|
308
|
+
*/
|
304
309
|
typedef struct SDL_Color
|
305
310
|
{
|
306
311
|
Uint8 r;
|
@@ -345,16 +350,31 @@ typedef struct SDL_PixelFormat
|
|
345
350
|
} SDL_PixelFormat;
|
346
351
|
|
347
352
|
/**
|
348
|
-
*
|
353
|
+
* Get the human readable name of a pixel format.
|
354
|
+
*
|
355
|
+
* \param format the pixel format to query
|
356
|
+
* \returns the human readable name of the specified pixel format or
|
357
|
+
* `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized.
|
358
|
+
*
|
359
|
+
* \since This function is available since SDL 2.0.0.
|
349
360
|
*/
|
350
361
|
extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
|
351
362
|
|
352
363
|
/**
|
353
|
-
*
|
364
|
+
* Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
|
365
|
+
*
|
366
|
+
* \param format one of the SDL_PixelFormatEnum values
|
367
|
+
* \param bpp a bits per pixel value; usually 15, 16, or 32
|
368
|
+
* \param Rmask a pointer filled in with the red mask for the format
|
369
|
+
* \param Gmask a pointer filled in with the green mask for the format
|
370
|
+
* \param Bmask a pointer filled in with the blue mask for the format
|
371
|
+
* \param Amask a pointer filled in with the alpha mask for the format
|
372
|
+
* \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't
|
373
|
+
* possible; call SDL_GetError() for more information.
|
354
374
|
*
|
355
|
-
*
|
375
|
+
* \since This function is available since SDL 2.0.0.
|
356
376
|
*
|
357
|
-
*
|
377
|
+
* \sa SDL_MasksToPixelFormatEnum
|
358
378
|
*/
|
359
379
|
extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
|
360
380
|
int *bpp,
|
@@ -364,12 +384,21 @@ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
|
|
364
384
|
Uint32 * Amask);
|
365
385
|
|
366
386
|
/**
|
367
|
-
*
|
387
|
+
* Convert a bpp value and RGBA masks to an enumerated pixel format.
|
388
|
+
*
|
389
|
+
* This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't
|
390
|
+
* possible.
|
368
391
|
*
|
369
|
-
*
|
370
|
-
*
|
392
|
+
* \param bpp a bits per pixel value; usually 15, 16, or 32
|
393
|
+
* \param Rmask the red mask for the format
|
394
|
+
* \param Gmask the green mask for the format
|
395
|
+
* \param Bmask the blue mask for the format
|
396
|
+
* \param Amask the alpha mask for the format
|
397
|
+
* \returns one of the SDL_PixelFormatEnum values
|
371
398
|
*
|
372
|
-
*
|
399
|
+
* \since This function is available since SDL 2.0.0.
|
400
|
+
*
|
401
|
+
* \sa SDL_PixelFormatEnumToMasks
|
373
402
|
*/
|
374
403
|
extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
|
375
404
|
Uint32 Rmask,
|
@@ -378,84 +407,213 @@ extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
|
|
378
407
|
Uint32 Amask);
|
379
408
|
|
380
409
|
/**
|
381
|
-
*
|
410
|
+
* Create an SDL_PixelFormat structure corresponding to a pixel format.
|
411
|
+
*
|
412
|
+
* Returned structure may come from a shared global cache (i.e. not newly
|
413
|
+
* allocated), and hence should not be modified, especially the palette. Weird
|
414
|
+
* errors such as `Blit combination not supported` may occur.
|
415
|
+
*
|
416
|
+
* \param pixel_format one of the SDL_PixelFormatEnum values
|
417
|
+
* \returns the new SDL_PixelFormat structure or NULL on failure; call
|
418
|
+
* SDL_GetError() for more information.
|
419
|
+
*
|
420
|
+
* \since This function is available since SDL 2.0.0.
|
421
|
+
*
|
422
|
+
* \sa SDL_FreeFormat
|
382
423
|
*/
|
383
424
|
extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
|
384
425
|
|
385
426
|
/**
|
386
|
-
*
|
427
|
+
* Free an SDL_PixelFormat structure allocated by SDL_AllocFormat().
|
428
|
+
*
|
429
|
+
* \param format the SDL_PixelFormat structure to free
|
430
|
+
*
|
431
|
+
* \since This function is available since SDL 2.0.0.
|
432
|
+
*
|
433
|
+
* \sa SDL_AllocFormat
|
387
434
|
*/
|
388
435
|
extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
|
389
436
|
|
390
437
|
/**
|
391
|
-
*
|
392
|
-
* entries.
|
438
|
+
* Create a palette structure with the specified number of color entries.
|
393
439
|
*
|
394
|
-
*
|
440
|
+
* The palette entries are initialized to white.
|
395
441
|
*
|
396
|
-
*
|
442
|
+
* \param ncolors represents the number of color entries in the color palette
|
443
|
+
* \returns a new SDL_Palette structure on success or NULL on failure (e.g. if
|
444
|
+
* there wasn't enough memory); call SDL_GetError() for more
|
445
|
+
* information.
|
397
446
|
*
|
398
|
-
*
|
447
|
+
* \since This function is available since SDL 2.0.0.
|
448
|
+
*
|
449
|
+
* \sa SDL_FreePalette
|
399
450
|
*/
|
400
451
|
extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
|
401
452
|
|
402
453
|
/**
|
403
|
-
*
|
454
|
+
* Set the palette for a pixel format structure.
|
455
|
+
*
|
456
|
+
* \param format the SDL_PixelFormat structure that will use the palette
|
457
|
+
* \param palette the SDL_Palette structure that will be used
|
458
|
+
* \returns 0 on success or a negative error code on failure; call
|
459
|
+
* SDL_GetError() for more information.
|
460
|
+
*
|
461
|
+
* \since This function is available since SDL 2.0.0.
|
462
|
+
*
|
463
|
+
* \sa SDL_AllocPalette
|
464
|
+
* \sa SDL_FreePalette
|
404
465
|
*/
|
405
466
|
extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
|
406
467
|
SDL_Palette *palette);
|
407
468
|
|
408
469
|
/**
|
409
|
-
*
|
470
|
+
* Set a range of colors in a palette.
|
471
|
+
*
|
472
|
+
* \param palette the SDL_Palette structure to modify
|
473
|
+
* \param colors an array of SDL_Color structures to copy into the palette
|
474
|
+
* \param firstcolor the index of the first palette entry to modify
|
475
|
+
* \param ncolors the number of entries to modify
|
476
|
+
* \returns 0 on success or a negative error code if not all of the colors
|
477
|
+
* could be set; call SDL_GetError() for more information.
|
410
478
|
*
|
411
|
-
*
|
412
|
-
* \param colors An array of colors to copy into the palette.
|
413
|
-
* \param firstcolor The index of the first palette entry to modify.
|
414
|
-
* \param ncolors The number of entries to modify.
|
479
|
+
* \since This function is available since SDL 2.0.0.
|
415
480
|
*
|
416
|
-
*
|
481
|
+
* \sa SDL_AllocPalette
|
482
|
+
* \sa SDL_CreateRGBSurface
|
417
483
|
*/
|
418
484
|
extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
|
419
485
|
const SDL_Color * colors,
|
420
486
|
int firstcolor, int ncolors);
|
421
487
|
|
422
488
|
/**
|
423
|
-
*
|
489
|
+
* Free a palette created with SDL_AllocPalette().
|
490
|
+
*
|
491
|
+
* \param palette the SDL_Palette structure to be freed
|
424
492
|
*
|
425
|
-
*
|
493
|
+
* \since This function is available since SDL 2.0.0.
|
494
|
+
*
|
495
|
+
* \sa SDL_AllocPalette
|
426
496
|
*/
|
427
497
|
extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
|
428
498
|
|
429
499
|
/**
|
430
|
-
*
|
500
|
+
* Map an RGB triple to an opaque pixel value for a given pixel format.
|
501
|
+
*
|
502
|
+
* This function maps the RGB color value to the specified pixel format and
|
503
|
+
* returns the pixel value best approximating the given RGB color value for
|
504
|
+
* the given pixel format.
|
431
505
|
*
|
432
|
-
*
|
506
|
+
* If the format has a palette (8-bit) the index of the closest matching color
|
507
|
+
* in the palette will be returned.
|
508
|
+
*
|
509
|
+
* If the specified pixel format has an alpha component it will be returned as
|
510
|
+
* all 1 bits (fully opaque).
|
511
|
+
*
|
512
|
+
* If the pixel format bpp (color depth) is less than 32-bpp then the unused
|
513
|
+
* upper bits of the return value can safely be ignored (e.g., with a 16-bpp
|
514
|
+
* format the return value can be assigned to a Uint16, and similarly a Uint8
|
515
|
+
* for an 8-bpp format).
|
516
|
+
*
|
517
|
+
* \param format an SDL_PixelFormat structure describing the pixel format
|
518
|
+
* \param r the red component of the pixel in the range 0-255
|
519
|
+
* \param g the green component of the pixel in the range 0-255
|
520
|
+
* \param b the blue component of the pixel in the range 0-255
|
521
|
+
* \returns a pixel value
|
522
|
+
*
|
523
|
+
* \since This function is available since SDL 2.0.0.
|
524
|
+
*
|
525
|
+
* \sa SDL_GetRGB
|
526
|
+
* \sa SDL_GetRGBA
|
527
|
+
* \sa SDL_MapRGBA
|
433
528
|
*/
|
434
529
|
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
|
435
530
|
Uint8 r, Uint8 g, Uint8 b);
|
436
531
|
|
437
532
|
/**
|
438
|
-
*
|
533
|
+
* Map an RGBA quadruple to a pixel value for a given pixel format.
|
534
|
+
*
|
535
|
+
* This function maps the RGBA color value to the specified pixel format and
|
536
|
+
* returns the pixel value best approximating the given RGBA color value for
|
537
|
+
* the given pixel format.
|
538
|
+
*
|
539
|
+
* If the specified pixel format has no alpha component the alpha value will
|
540
|
+
* be ignored (as it will be in formats with a palette).
|
541
|
+
*
|
542
|
+
* If the format has a palette (8-bit) the index of the closest matching color
|
543
|
+
* in the palette will be returned.
|
544
|
+
*
|
545
|
+
* If the pixel format bpp (color depth) is less than 32-bpp then the unused
|
546
|
+
* upper bits of the return value can safely be ignored (e.g., with a 16-bpp
|
547
|
+
* format the return value can be assigned to a Uint16, and similarly a Uint8
|
548
|
+
* for an 8-bpp format).
|
549
|
+
*
|
550
|
+
* \param format an SDL_PixelFormat structure describing the format of the
|
551
|
+
* pixel
|
552
|
+
* \param r the red component of the pixel in the range 0-255
|
553
|
+
* \param g the green component of the pixel in the range 0-255
|
554
|
+
* \param b the blue component of the pixel in the range 0-255
|
555
|
+
* \param a the alpha component of the pixel in the range 0-255
|
556
|
+
* \returns a pixel value
|
557
|
+
*
|
558
|
+
* \since This function is available since SDL 2.0.0.
|
439
559
|
*
|
440
|
-
*
|
560
|
+
* \sa SDL_GetRGB
|
561
|
+
* \sa SDL_GetRGBA
|
562
|
+
* \sa SDL_MapRGB
|
441
563
|
*/
|
442
564
|
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
|
443
565
|
Uint8 r, Uint8 g, Uint8 b,
|
444
566
|
Uint8 a);
|
445
567
|
|
446
568
|
/**
|
447
|
-
*
|
569
|
+
* Get RGB values from a pixel in the specified format.
|
448
570
|
*
|
449
|
-
*
|
571
|
+
* This function uses the entire 8-bit [0..255] range when converting color
|
572
|
+
* components from pixel formats with less than 8-bits per RGB component
|
573
|
+
* (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
|
574
|
+
* 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
|
575
|
+
*
|
576
|
+
* \param pixel a pixel value
|
577
|
+
* \param format an SDL_PixelFormat structure describing the format of the
|
578
|
+
* pixel
|
579
|
+
* \param r a pointer filled in with the red component
|
580
|
+
* \param g a pointer filled in with the green component
|
581
|
+
* \param b a pointer filled in with the blue component
|
582
|
+
*
|
583
|
+
* \since This function is available since SDL 2.0.0.
|
584
|
+
*
|
585
|
+
* \sa SDL_GetRGBA
|
586
|
+
* \sa SDL_MapRGB
|
587
|
+
* \sa SDL_MapRGBA
|
450
588
|
*/
|
451
589
|
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
|
452
590
|
const SDL_PixelFormat * format,
|
453
591
|
Uint8 * r, Uint8 * g, Uint8 * b);
|
454
592
|
|
455
593
|
/**
|
456
|
-
*
|
594
|
+
* Get RGBA values from a pixel in the specified format.
|
595
|
+
*
|
596
|
+
* This function uses the entire 8-bit [0..255] range when converting color
|
597
|
+
* components from pixel formats with less than 8-bits per RGB component
|
598
|
+
* (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
|
599
|
+
* 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
|
600
|
+
*
|
601
|
+
* If the surface has no alpha component, the alpha will be returned as 0xff
|
602
|
+
* (100% opaque).
|
457
603
|
*
|
458
|
-
*
|
604
|
+
* \param pixel a pixel value
|
605
|
+
* \param format an SDL_PixelFormat structure describing the format of the
|
606
|
+
* pixel
|
607
|
+
* \param r a pointer filled in with the red component
|
608
|
+
* \param g a pointer filled in with the green component
|
609
|
+
* \param b a pointer filled in with the blue component
|
610
|
+
* \param a a pointer filled in with the alpha component
|
611
|
+
*
|
612
|
+
* \since This function is available since SDL 2.0.0.
|
613
|
+
*
|
614
|
+
* \sa SDL_GetRGB
|
615
|
+
* \sa SDL_MapRGB
|
616
|
+
* \sa SDL_MapRGBA
|
459
617
|
*/
|
460
618
|
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
|
461
619
|
const SDL_PixelFormat * format,
|
@@ -463,7 +621,14 @@ extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
|
|
463
621
|
Uint8 * a);
|
464
622
|
|
465
623
|
/**
|
466
|
-
*
|
624
|
+
* Calculate a 256 entry gamma ramp for a gamma value.
|
625
|
+
*
|
626
|
+
* \param gamma a gamma value where 0.0 is black and 1.0 is identity
|
627
|
+
* \param ramp an array of 256 values filled in with the gamma ramp
|
628
|
+
*
|
629
|
+
* \since This function is available since SDL 2.0.0.
|
630
|
+
*
|
631
|
+
* \sa SDL_SetWindowGammaRamp
|
467
632
|
*/
|
468
633
|
extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
|
469
634
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2022 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
|
@@ -70,6 +70,27 @@
|
|
70
70
|
/* lets us know what version of Mac OS X we're compiling on */
|
71
71
|
#include "AvailabilityMacros.h"
|
72
72
|
#include "TargetConditionals.h"
|
73
|
+
|
74
|
+
/* Fix building with older SDKs that don't define these
|
75
|
+
See this for more information:
|
76
|
+
https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets
|
77
|
+
*/
|
78
|
+
#ifndef TARGET_OS_MACCATALYST
|
79
|
+
#define TARGET_OS_MACCATALYST 0
|
80
|
+
#endif
|
81
|
+
#ifndef TARGET_OS_IOS
|
82
|
+
#define TARGET_OS_IOS 0
|
83
|
+
#endif
|
84
|
+
#ifndef TARGET_OS_IPHONE
|
85
|
+
#define TARGET_OS_IPHONE 0
|
86
|
+
#endif
|
87
|
+
#ifndef TARGET_OS_TV
|
88
|
+
#define TARGET_OS_TV 0
|
89
|
+
#endif
|
90
|
+
#ifndef TARGET_OS_SIMULATOR
|
91
|
+
#define TARGET_OS_SIMULATOR 0
|
92
|
+
#endif
|
93
|
+
|
73
94
|
#if TARGET_OS_TV
|
74
95
|
#undef __TVOS__
|
75
96
|
#define __TVOS__ 1
|
@@ -175,6 +196,9 @@
|
|
175
196
|
#define __SDL_NOGETPROCADDR__
|
176
197
|
#endif
|
177
198
|
|
199
|
+
#if defined(__vita__)
|
200
|
+
#define __VITA__ 1
|
201
|
+
#endif
|
178
202
|
|
179
203
|
#include "begin_code.h"
|
180
204
|
/* Set up for C function definitions, even when using C++ */
|
@@ -183,7 +207,20 @@ extern "C" {
|
|
183
207
|
#endif
|
184
208
|
|
185
209
|
/**
|
186
|
-
*
|
210
|
+
* Get the name of the platform.
|
211
|
+
*
|
212
|
+
* Here are the names returned for some (but not all) supported platforms:
|
213
|
+
*
|
214
|
+
* - "Windows"
|
215
|
+
* - "Mac OS X"
|
216
|
+
* - "Linux"
|
217
|
+
* - "iOS"
|
218
|
+
* - "Android"
|
219
|
+
*
|
220
|
+
* \returns the name of the platform. If the correct platform name is not
|
221
|
+
* available, returns a string beginning with the text "Unknown".
|
222
|
+
*
|
223
|
+
* \since This function is available since SDL 2.0.0.
|
187
224
|
*/
|
188
225
|
extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
|
189
226
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2022 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
|
#endif
|
38
38
|
|
39
39
|
/**
|
40
|
-
*
|
40
|
+
* The basic state for the system's power supply.
|
41
41
|
*/
|
42
42
|
typedef enum
|
43
43
|
{
|
@@ -50,17 +50,30 @@ typedef enum
|
|
50
50
|
|
51
51
|
|
52
52
|
/**
|
53
|
-
*
|
53
|
+
* Get the current power supply details.
|
54
54
|
*
|
55
|
-
*
|
56
|
-
*
|
57
|
-
*
|
55
|
+
* You should never take a battery status as absolute truth. Batteries
|
56
|
+
* (especially failing batteries) are delicate hardware, and the values
|
57
|
+
* reported here are best estimates based on what that hardware reports. It's
|
58
|
+
* not uncommon for older batteries to lose stored power much faster than it
|
59
|
+
* reports, or completely drain when reporting it has 20 percent left, etc.
|
58
60
|
*
|
59
|
-
*
|
60
|
-
*
|
61
|
-
*
|
61
|
+
* Battery status can change at any time; if you are concerned with power
|
62
|
+
* state, you should call this function frequently, and perhaps ignore changes
|
63
|
+
* until they seem to be stable for a few seconds.
|
62
64
|
*
|
63
|
-
*
|
65
|
+
* It's possible a platform can only report battery percentage or time left
|
66
|
+
* but not both.
|
67
|
+
*
|
68
|
+
* \param secs seconds of battery life left, you can pass a NULL here if you
|
69
|
+
* don't care, will return -1 if we can't determine a value, or
|
70
|
+
* we're not running on a battery
|
71
|
+
* \param pct percentage of battery life left, between 0 and 100, you can pass
|
72
|
+
* a NULL here if you don't care, will return -1 if we can't
|
73
|
+
* determine a value, or we're not running on a battery
|
74
|
+
* \returns an SDL_PowerState enum representing the current battery state.
|
75
|
+
*
|
76
|
+
* \since This function is available since SDL 2.0.0.
|
64
77
|
*/
|
65
78
|
extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
|
66
79
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2022 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-2022 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
|
@@ -40,10 +40,10 @@ extern "C" {
|
|
40
40
|
#endif
|
41
41
|
|
42
42
|
/**
|
43
|
-
*
|
43
|
+
* The structure that defines a point (integer)
|
44
44
|
*
|
45
|
-
*
|
46
|
-
*
|
45
|
+
* \sa SDL_EnclosePoints
|
46
|
+
* \sa SDL_PointInRect
|
47
47
|
*/
|
48
48
|
typedef struct SDL_Point
|
49
49
|
{
|
@@ -52,10 +52,10 @@ typedef struct SDL_Point
|
|
52
52
|
} SDL_Point;
|
53
53
|
|
54
54
|
/**
|
55
|
-
*
|
55
|
+
* The structure that defines a point (floating point)
|
56
56
|
*
|
57
|
-
*
|
58
|
-
*
|
57
|
+
* \sa SDL_EnclosePoints
|
58
|
+
* \sa SDL_PointInRect
|
59
59
|
*/
|
60
60
|
typedef struct SDL_FPoint
|
61
61
|
{
|
@@ -65,14 +65,14 @@ typedef struct SDL_FPoint
|
|
65
65
|
|
66
66
|
|
67
67
|
/**
|
68
|
-
*
|
69
|
-
*
|
70
|
-
*
|
71
|
-
*
|
72
|
-
*
|
73
|
-
*
|
74
|
-
*
|
75
|
-
*
|
68
|
+
* A rectangle, with the origin at the upper left (integer).
|
69
|
+
*
|
70
|
+
* \sa SDL_RectEmpty
|
71
|
+
* \sa SDL_RectEquals
|
72
|
+
* \sa SDL_HasIntersection
|
73
|
+
* \sa SDL_IntersectRect
|
74
|
+
* \sa SDL_UnionRect
|
75
|
+
* \sa SDL_EnclosePoints
|
76
76
|
*/
|
77
77
|
typedef struct SDL_Rect
|
78
78
|
{
|
@@ -82,7 +82,7 @@ typedef struct SDL_Rect
|
|
82
82
|
|
83
83
|
|
84
84
|
/**
|
85
|
-
*
|
85
|
+
* A rectangle, with the origin at the upper left (floating point).
|
86
86
|
*/
|
87
87
|
typedef struct SDL_FRect
|
88
88
|
{
|
@@ -94,7 +94,7 @@ typedef struct SDL_FRect
|
|
94
94
|
|
95
95
|
|
96
96
|
/**
|
97
|
-
*
|
97
|
+
* Returns true if point resides inside a rectangle.
|
98
98
|
*/
|
99
99
|
SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
|
100
100
|
{
|
@@ -103,7 +103,7 @@ SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
|
|
103
103
|
}
|
104
104
|
|
105
105
|
/**
|
106
|
-
*
|
106
|
+
* Returns true if the rectangle has no area.
|
107
107
|
*/
|
108
108
|
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
|
109
109
|
{
|
@@ -111,7 +111,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
|
|
111
111
|
}
|
112
112
|
|
113
113
|
/**
|
114
|
-
*
|
114
|
+
* Returns true if the two rectangles are equal.
|
115
115
|
*/
|
116
116
|
SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
|
117
117
|
{
|
@@ -120,33 +120,70 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
|
|
120
120
|
}
|
121
121
|
|
122
122
|
/**
|
123
|
-
*
|
123
|
+
* Determine whether two rectangles intersect.
|
124
|
+
*
|
125
|
+
* If either pointer is NULL the function will return SDL_FALSE.
|
126
|
+
*
|
127
|
+
* \param A an SDL_Rect structure representing the first rectangle
|
128
|
+
* \param B an SDL_Rect structure representing the second rectangle
|
129
|
+
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
130
|
+
*
|
131
|
+
* \since This function is available since SDL 2.0.0.
|
124
132
|
*
|
125
|
-
*
|
133
|
+
* \sa SDL_IntersectRect
|
126
134
|
*/
|
127
135
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
|
128
136
|
const SDL_Rect * B);
|
129
137
|
|
130
138
|
/**
|
131
|
-
*
|
139
|
+
* Calculate the intersection of two rectangles.
|
140
|
+
*
|
141
|
+
* If `result` is NULL then this function will return SDL_FALSE.
|
142
|
+
*
|
143
|
+
* \param A an SDL_Rect structure representing the first rectangle
|
144
|
+
* \param B an SDL_Rect structure representing the second rectangle
|
145
|
+
* \param result an SDL_Rect structure filled in with the intersection of
|
146
|
+
* rectangles `A` and `B`
|
147
|
+
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
148
|
+
*
|
149
|
+
* \since This function is available since SDL 2.0.0.
|
132
150
|
*
|
133
|
-
*
|
151
|
+
* \sa SDL_HasIntersection
|
134
152
|
*/
|
135
153
|
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
|
136
154
|
const SDL_Rect * B,
|
137
155
|
SDL_Rect * result);
|
138
156
|
|
139
157
|
/**
|
140
|
-
*
|
158
|
+
* Calculate the union of two rectangles.
|
159
|
+
*
|
160
|
+
* \param A an SDL_Rect structure representing the first rectangle
|
161
|
+
* \param B an SDL_Rect structure representing the second rectangle
|
162
|
+
* \param result an SDL_Rect structure filled in with the union of rectangles
|
163
|
+
* `A` and `B`
|
164
|
+
*
|
165
|
+
* \since This function is available since SDL 2.0.0.
|
141
166
|
*/
|
142
167
|
extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
|
143
168
|
const SDL_Rect * B,
|
144
169
|
SDL_Rect * result);
|
145
170
|
|
146
171
|
/**
|
147
|
-
*
|
172
|
+
* Calculate a minimal rectangle enclosing a set of points.
|
173
|
+
*
|
174
|
+
* If `clip` is not NULL then only points inside of the clipping rectangle are
|
175
|
+
* considered.
|
148
176
|
*
|
149
|
-
*
|
177
|
+
* \param points an array of SDL_Point structures representing points to be
|
178
|
+
* enclosed
|
179
|
+
* \param count the number of structures in the `points` array
|
180
|
+
* \param clip an SDL_Rect used for clipping or NULL to enclose all points
|
181
|
+
* \param result an SDL_Rect structure filled in with the minimal enclosing
|
182
|
+
* rectangle
|
183
|
+
* \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the
|
184
|
+
* points were outside of the clipping rectangle.
|
185
|
+
*
|
186
|
+
* \since This function is available since SDL 2.0.0.
|
150
187
|
*/
|
151
188
|
extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
|
152
189
|
int count,
|
@@ -154,9 +191,22 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
|
|
154
191
|
SDL_Rect * result);
|
155
192
|
|
156
193
|
/**
|
157
|
-
*
|
194
|
+
* Calculate the intersection of a rectangle and line segment.
|
195
|
+
*
|
196
|
+
* This function is used to clip a line segment to a rectangle. A line segment
|
197
|
+
* contained entirely within the rectangle or that does not intersect will
|
198
|
+
* remain unchanged. A line segment that crosses the rectangle at either or
|
199
|
+
* both ends will be clipped to the boundary of the rectangle and the new
|
200
|
+
* coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.
|
201
|
+
*
|
202
|
+
* \param rect an SDL_Rect structure representing the rectangle to intersect
|
203
|
+
* \param X1 a pointer to the starting X-coordinate of the line
|
204
|
+
* \param Y1 a pointer to the starting Y-coordinate of the line
|
205
|
+
* \param X2 a pointer to the ending X-coordinate of the line
|
206
|
+
* \param Y2 a pointer to the ending Y-coordinate of the line
|
207
|
+
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
|
158
208
|
*
|
159
|
-
*
|
209
|
+
* \since This function is available since SDL 2.0.0.
|
160
210
|
*/
|
161
211
|
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
|
162
212
|
rect, int *X1,
|