Windowsでもコンパイル出来る様に
守矢諏訪子 <suwako@076.moe>、2026-06-23 02:28
コミット f9c5aa8249fffd788674390dc856fe5e5aee317c
・親 c154d6c
・ファイルを見る
116個のファイル、+20056 -0
| @@ -1,1 +1,7 @@ | ||
| 1 | 1 | brickbreaker |
| 2 | +BrickBreaker | |
| 3 | +x64 | |
| 4 | +BrickBreaker.vcxproj.user | |
| 5 | +Debug | |
| 6 | +Release | |
| 7 | +.vs |
| @@ -0,0 +1,31 @@ | ||
| 1 | + | |
| 2 | +Microsoft Visual Studio Solution File, Format Version 12.00 | |
| 3 | +# Visual Studio Version 17 | |
| 4 | +VisualStudioVersion = 17.14.37314.3 d17.14 | |
| 5 | +MinimumVisualStudioVersion = 10.0.40219.1 | |
| 6 | +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BrickBreaker", "BrickBreaker.vcxproj", "{F8C5DD72-0A56-4D82-B32B-21C2B215766B}" | |
| 7 | +EndProject | |
| 8 | +Global | |
| 9 | + GlobalSection(SolutionConfigurationPlatforms) = preSolution | |
| 10 | + Debug|x64 = Debug|x64 | |
| 11 | + Debug|x86 = Debug|x86 | |
| 12 | + Release|x64 = Release|x64 | |
| 13 | + Release|x86 = Release|x86 | |
| 14 | + EndGlobalSection | |
| 15 | + GlobalSection(ProjectConfigurationPlatforms) = postSolution | |
| 16 | + {F8C5DD72-0A56-4D82-B32B-21C2B215766B}.Debug|x64.ActiveCfg = Debug|x64 | |
| 17 | + {F8C5DD72-0A56-4D82-B32B-21C2B215766B}.Debug|x64.Build.0 = Debug|x64 | |
| 18 | + {F8C5DD72-0A56-4D82-B32B-21C2B215766B}.Debug|x86.ActiveCfg = Debug|Win32 | |
| 19 | + {F8C5DD72-0A56-4D82-B32B-21C2B215766B}.Debug|x86.Build.0 = Debug|Win32 | |
| 20 | + {F8C5DD72-0A56-4D82-B32B-21C2B215766B}.Release|x64.ActiveCfg = Release|x64 | |
| 21 | + {F8C5DD72-0A56-4D82-B32B-21C2B215766B}.Release|x64.Build.0 = Release|x64 | |
| 22 | + {F8C5DD72-0A56-4D82-B32B-21C2B215766B}.Release|x86.ActiveCfg = Release|Win32 | |
| 23 | + {F8C5DD72-0A56-4D82-B32B-21C2B215766B}.Release|x86.Build.0 = Release|Win32 | |
| 24 | + EndGlobalSection | |
| 25 | + GlobalSection(SolutionProperties) = preSolution | |
| 26 | + HideSolutionNode = FALSE | |
| 27 | + EndGlobalSection | |
| 28 | + GlobalSection(ExtensibilityGlobals) = postSolution | |
| 29 | + SolutionGuid = {2A5A5785-A674-4234-A106-BCA707302F1F} | |
| 30 | + EndGlobalSection | |
| 31 | +EndGlobal |
| @@ -0,0 +1,158 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| 3 | + <ItemGroup Label="ProjectConfigurations"> | |
| 4 | + <ProjectConfiguration Include="Debug|Win32"> | |
| 5 | + <Configuration>Debug</Configuration> | |
| 6 | + <Platform>Win32</Platform> | |
| 7 | + </ProjectConfiguration> | |
| 8 | + <ProjectConfiguration Include="Release|Win32"> | |
| 9 | + <Configuration>Release</Configuration> | |
| 10 | + <Platform>Win32</Platform> | |
| 11 | + </ProjectConfiguration> | |
| 12 | + <ProjectConfiguration Include="Debug|x64"> | |
| 13 | + <Configuration>Debug</Configuration> | |
| 14 | + <Platform>x64</Platform> | |
| 15 | + </ProjectConfiguration> | |
| 16 | + <ProjectConfiguration Include="Release|x64"> | |
| 17 | + <Configuration>Release</Configuration> | |
| 18 | + <Platform>x64</Platform> | |
| 19 | + </ProjectConfiguration> | |
| 20 | + </ItemGroup> | |
| 21 | + <PropertyGroup Label="Globals"> | |
| 22 | + <VCProjectVersion>17.0</VCProjectVersion> | |
| 23 | + <Keyword>Win32Proj</Keyword> | |
| 24 | + <ProjectGuid>{f8c5dd72-0a56-4d82-b32b-21c2b215766b}</ProjectGuid> | |
| 25 | + <RootNamespace>BrickBreaker</RootNamespace> | |
| 26 | + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | |
| 27 | + </PropertyGroup> | |
| 28 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | |
| 29 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | |
| 30 | + <ConfigurationType>Application</ConfigurationType> | |
| 31 | + <UseDebugLibraries>true</UseDebugLibraries> | |
| 32 | + <PlatformToolset>v143</PlatformToolset> | |
| 33 | + <CharacterSet>Unicode</CharacterSet> | |
| 34 | + </PropertyGroup> | |
| 35 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | |
| 36 | + <ConfigurationType>Application</ConfigurationType> | |
| 37 | + <UseDebugLibraries>false</UseDebugLibraries> | |
| 38 | + <PlatformToolset>v143</PlatformToolset> | |
| 39 | + <WholeProgramOptimization>true</WholeProgramOptimization> | |
| 40 | + <CharacterSet>Unicode</CharacterSet> | |
| 41 | + </PropertyGroup> | |
| 42 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | |
| 43 | + <ConfigurationType>Application</ConfigurationType> | |
| 44 | + <UseDebugLibraries>true</UseDebugLibraries> | |
| 45 | + <PlatformToolset>v143</PlatformToolset> | |
| 46 | + <CharacterSet>Unicode</CharacterSet> | |
| 47 | + </PropertyGroup> | |
| 48 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | |
| 49 | + <ConfigurationType>Application</ConfigurationType> | |
| 50 | + <UseDebugLibraries>false</UseDebugLibraries> | |
| 51 | + <PlatformToolset>v143</PlatformToolset> | |
| 52 | + <WholeProgramOptimization>true</WholeProgramOptimization> | |
| 53 | + <CharacterSet>Unicode</CharacterSet> | |
| 54 | + </PropertyGroup> | |
| 55 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | |
| 56 | + <ImportGroup Label="ExtensionSettings"> | |
| 57 | + </ImportGroup> | |
| 58 | + <ImportGroup Label="Shared"> | |
| 59 | + </ImportGroup> | |
| 60 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
| 61 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
| 62 | + </ImportGroup> | |
| 63 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
| 64 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
| 65 | + </ImportGroup> | |
| 66 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | |
| 67 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
| 68 | + </ImportGroup> | |
| 69 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | |
| 70 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
| 71 | + </ImportGroup> | |
| 72 | + <PropertyGroup Label="UserMacros" /> | |
| 73 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
| 74 | + <ClCompile> | |
| 75 | + <WarningLevel>Level3</WarningLevel> | |
| 76 | + <SDLCheck>true</SDLCheck> | |
| 77 | + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
| 78 | + <ConformanceMode>true</ConformanceMode> | |
| 79 | + </ClCompile> | |
| 80 | + <Link> | |
| 81 | + <SubSystem>Console</SubSystem> | |
| 82 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
| 83 | + </Link> | |
| 84 | + </ItemDefinitionGroup> | |
| 85 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
| 86 | + <ClCompile> | |
| 87 | + <WarningLevel>Level3</WarningLevel> | |
| 88 | + <FunctionLevelLinking>true</FunctionLevelLinking> | |
| 89 | + <IntrinsicFunctions>true</IntrinsicFunctions> | |
| 90 | + <SDLCheck>true</SDLCheck> | |
| 91 | + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
| 92 | + <ConformanceMode>true</ConformanceMode> | |
| 93 | + </ClCompile> | |
| 94 | + <Link> | |
| 95 | + <SubSystem>Console</SubSystem> | |
| 96 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
| 97 | + </Link> | |
| 98 | + </ItemDefinitionGroup> | |
| 99 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | |
| 100 | + <ClCompile> | |
| 101 | + <WarningLevel>Level3</WarningLevel> | |
| 102 | + <SDLCheck>true</SDLCheck> | |
| 103 | + <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
| 104 | + <ConformanceMode>true</ConformanceMode> | |
| 105 | + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | |
| 106 | + <LanguageStandard>stdcpp17</LanguageStandard> | |
| 107 | + <AdditionalIncludeDirectories>$(ProjectDir)dep\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |
| 108 | + <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> | |
| 109 | + </ClCompile> | |
| 110 | + <Link> | |
| 111 | + <SubSystem>Console</SubSystem> | |
| 112 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
| 113 | + <AdditionalLibraryDirectories>$(ProjectDir)dep\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | |
| 114 | + <AdditionalDependencies>SDL2-static.lib;SDL2_ttf.lib;SDL2_mixer-static.lib;vorbisfile.lib; | |
| 115 | +vorbis.lib; | |
| 116 | +ogg.lib; | |
| 117 | +wavpack.lib;winmm.lib;setupapi.lib;imm32.lib;version.lib;hid.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
| 118 | + </Link> | |
| 119 | + </ItemDefinitionGroup> | |
| 120 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | |
| 121 | + <ClCompile> | |
| 122 | + <WarningLevel>Level3</WarningLevel> | |
| 123 | + <FunctionLevelLinking>true</FunctionLevelLinking> | |
| 124 | + <IntrinsicFunctions>true</IntrinsicFunctions> | |
| 125 | + <SDLCheck>true</SDLCheck> | |
| 126 | + <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
| 127 | + <ConformanceMode>true</ConformanceMode> | |
| 128 | + <AdditionalIncludeDirectories>$(ProjectDir)dep\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |
| 129 | + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | |
| 130 | + <LanguageStandard>stdcpp17</LanguageStandard> | |
| 131 | + <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> | |
| 132 | + </ClCompile> | |
| 133 | + <Link> | |
| 134 | + <SubSystem>Windows</SubSystem> | |
| 135 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
| 136 | + <AdditionalLibraryDirectories>$(ProjectDir)dep\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | |
| 137 | + <AdditionalDependencies>SDL2-static.lib;SDL2_ttf.lib;SDL2_mixer-static.lib;vorbisfile.lib; | |
| 138 | +vorbis.lib; | |
| 139 | +ogg.lib; | |
| 140 | +wavpack.lib;winmm.lib;setupapi.lib;imm32.lib;version.lib;hid.lib;%(AdditionalDependencies)</AdditionalDependencies> | |
| 141 | + </Link> | |
| 142 | + </ItemDefinitionGroup> | |
| 143 | + <ItemGroup> | |
| 144 | + <ClCompile Include="main.cc" /> | |
| 145 | + <ClCompile Include="src\ball.cc" /> | |
| 146 | + <ClCompile Include="src\brick.cc" /> | |
| 147 | + <ClCompile Include="src\render.cc" /> | |
| 148 | + </ItemGroup> | |
| 149 | + <ItemGroup> | |
| 150 | + <ClInclude Include="src\ball.hh" /> | |
| 151 | + <ClInclude Include="src\brick.hh" /> | |
| 152 | + <ClInclude Include="src\player.hh" /> | |
| 153 | + <ClInclude Include="src\render.hh" /> | |
| 154 | + </ItemGroup> | |
| 155 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |
| 156 | + <ImportGroup Label="ExtensionTargets"> | |
| 157 | + </ImportGroup> | |
| 158 | +</Project> |
| @@ -0,0 +1,45 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| 3 | + <ItemGroup> | |
| 4 | + <Filter Include="Source Files"> | |
| 5 | + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | |
| 6 | + <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | |
| 7 | + </Filter> | |
| 8 | + <Filter Include="Header Files"> | |
| 9 | + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | |
| 10 | + <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions> | |
| 11 | + </Filter> | |
| 12 | + <Filter Include="Resource Files"> | |
| 13 | + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | |
| 14 | + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | |
| 15 | + </Filter> | |
| 16 | + </ItemGroup> | |
| 17 | + <ItemGroup> | |
| 18 | + <ClCompile Include="main.cc"> | |
| 19 | + <Filter>Source Files</Filter> | |
| 20 | + </ClCompile> | |
| 21 | + <ClCompile Include="src\ball.cc"> | |
| 22 | + <Filter>Source Files</Filter> | |
| 23 | + </ClCompile> | |
| 24 | + <ClCompile Include="src\brick.cc"> | |
| 25 | + <Filter>Source Files</Filter> | |
| 26 | + </ClCompile> | |
| 27 | + <ClCompile Include="src\render.cc"> | |
| 28 | + <Filter>Source Files</Filter> | |
| 29 | + </ClCompile> | |
| 30 | + </ItemGroup> | |
| 31 | + <ItemGroup> | |
| 32 | + <ClInclude Include="src\ball.hh"> | |
| 33 | + <Filter>Header Files</Filter> | |
| 34 | + </ClInclude> | |
| 35 | + <ClInclude Include="src\brick.hh"> | |
| 36 | + <Filter>Header Files</Filter> | |
| 37 | + </ClInclude> | |
| 38 | + <ClInclude Include="src\player.hh"> | |
| 39 | + <Filter>Header Files</Filter> | |
| 40 | + </ClInclude> | |
| 41 | + <ClInclude Include="src\render.hh"> | |
| 42 | + <Filter>Header Files</Filter> | |
| 43 | + </ClInclude> | |
| 44 | + </ItemGroup> | |
| 45 | +</Project> |
大き過ぎるので表示しません
大き過ぎるので表示しません
大き過ぎるので表示しません
大き過ぎるので表示しません
大き過ぎるので表示しません
大き過ぎるので表示しません
大き過ぎるので表示しません
| @@ -0,0 +1,234 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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.h | |
| 24 | + * | |
| 25 | + * Main include header for the SDL library | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_h_ | |
| 29 | +#define SDL_h_ | |
| 30 | + | |
| 31 | +#include "SDL_main.h" | |
| 32 | +#include "SDL_stdinc.h" | |
| 33 | +#include "SDL_assert.h" | |
| 34 | +#include "SDL_atomic.h" | |
| 35 | +#include "SDL_audio.h" | |
| 36 | +#include "SDL_clipboard.h" | |
| 37 | +#include "SDL_cpuinfo.h" | |
| 38 | +#include "SDL_endian.h" | |
| 39 | +#include "SDL_error.h" | |
| 40 | +#include "SDL_events.h" | |
| 41 | +#include "SDL_filesystem.h" | |
| 42 | +#include "SDL_gamecontroller.h" | |
| 43 | +#include "SDL_guid.h" | |
| 44 | +#include "SDL_haptic.h" | |
| 45 | +#include "SDL_hidapi.h" | |
| 46 | +#include "SDL_hints.h" | |
| 47 | +#include "SDL_joystick.h" | |
| 48 | +#include "SDL_loadso.h" | |
| 49 | +#include "SDL_log.h" | |
| 50 | +#include "SDL_messagebox.h" | |
| 51 | +#include "SDL_metal.h" | |
| 52 | +#include "SDL_mutex.h" | |
| 53 | +#include "SDL_power.h" | |
| 54 | +#include "SDL_render.h" | |
| 55 | +#include "SDL_rwops.h" | |
| 56 | +#include "SDL_sensor.h" | |
| 57 | +#include "SDL_shape.h" | |
| 58 | +#include "SDL_system.h" | |
| 59 | +#include "SDL_thread.h" | |
| 60 | +#include "SDL_timer.h" | |
| 61 | +#include "SDL_version.h" | |
| 62 | +#include "SDL_video.h" | |
| 63 | +#include "SDL_locale.h" | |
| 64 | +#include "SDL_misc.h" | |
| 65 | + | |
| 66 | +#include "begin_code.h" | |
| 67 | +/* Set up for C function definitions, even when using C++ */ | |
| 68 | +#ifdef __cplusplus | |
| 69 | +extern "C" { | |
| 70 | +#endif | |
| 71 | + | |
| 72 | +/* WIKI CATEGORY: Init */ | |
| 73 | + | |
| 74 | +/* As of version 0.5, SDL is loaded dynamically into the application */ | |
| 75 | + | |
| 76 | +/** | |
| 77 | + * \name SDL_INIT_* | |
| 78 | + * | |
| 79 | + * These are the flags which may be passed to SDL_Init(). You should | |
| 80 | + * specify the subsystems which you will be using in your application. | |
| 81 | + */ | |
| 82 | +/* @{ */ | |
| 83 | +#define SDL_INIT_TIMER 0x00000001u | |
| 84 | +#define SDL_INIT_AUDIO 0x00000010u | |
| 85 | +#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ | |
| 86 | +#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ | |
| 87 | +#define SDL_INIT_HAPTIC 0x00001000u | |
| 88 | +#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ | |
| 89 | +#define SDL_INIT_EVENTS 0x00004000u | |
| 90 | +#define SDL_INIT_SENSOR 0x00008000u | |
| 91 | +#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */ | |
| 92 | +#define SDL_INIT_EVERYTHING ( \ | |
| 93 | + SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ | |
| 94 | + SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \ | |
| 95 | + ) | |
| 96 | +/* @} */ | |
| 97 | + | |
| 98 | +/** | |
| 99 | + * Initialize the SDL library. | |
| 100 | + * | |
| 101 | + * SDL_Init() simply forwards to calling SDL_InitSubSystem(). Therefore, the | |
| 102 | + * two may be used interchangeably. Though for readability of your code | |
| 103 | + * SDL_InitSubSystem() might be preferred. | |
| 104 | + * | |
| 105 | + * The file I/O (for example: SDL_RWFromFile) and threading (SDL_CreateThread) | |
| 106 | + * subsystems are initialized by default. Message boxes | |
| 107 | + * (SDL_ShowSimpleMessageBox) also attempt to work without initializing the | |
| 108 | + * video subsystem, in hopes of being useful in showing an error dialog when | |
| 109 | + * SDL_Init fails. You must specifically initialize other subsystems if you | |
| 110 | + * use them in your application. | |
| 111 | + * | |
| 112 | + * Logging (such as SDL_Log) works without initialization, too. | |
| 113 | + * | |
| 114 | + * `flags` may be any of the following OR'd together: | |
| 115 | + * | |
| 116 | + * - `SDL_INIT_TIMER`: timer subsystem | |
| 117 | + * - `SDL_INIT_AUDIO`: audio subsystem | |
| 118 | + * - `SDL_INIT_VIDEO`: video subsystem; automatically initializes the events | |
| 119 | + * subsystem | |
| 120 | + * - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the | |
| 121 | + * events subsystem | |
| 122 | + * - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem | |
| 123 | + * - `SDL_INIT_GAMECONTROLLER`: controller subsystem; automatically | |
| 124 | + * initializes the joystick subsystem | |
| 125 | + * - `SDL_INIT_EVENTS`: events subsystem | |
| 126 | + * - `SDL_INIT_EVERYTHING`: all of the above subsystems | |
| 127 | + * - `SDL_INIT_NOPARACHUTE`: compatibility; this flag is ignored | |
| 128 | + * | |
| 129 | + * Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem() | |
| 130 | + * for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or | |
| 131 | + * call SDL_Quit() to force shutdown). If a subsystem is already loaded then | |
| 132 | + * this call will increase the ref-count and return. | |
| 133 | + * | |
| 134 | + * \param flags subsystem initialization flags. | |
| 135 | + * \returns 0 on success or a negative error code on failure; call | |
| 136 | + * SDL_GetError() for more information. | |
| 137 | + * | |
| 138 | + * \since This function is available since SDL 2.0.0. | |
| 139 | + * | |
| 140 | + * \sa SDL_InitSubSystem | |
| 141 | + * \sa SDL_Quit | |
| 142 | + * \sa SDL_SetMainReady | |
| 143 | + * \sa SDL_WasInit | |
| 144 | + */ | |
| 145 | +extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); | |
| 146 | + | |
| 147 | +/** | |
| 148 | + * Compatibility function to initialize the SDL library. | |
| 149 | + * | |
| 150 | + * In SDL2, this function and SDL_Init() are interchangeable. | |
| 151 | + * | |
| 152 | + * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. | |
| 153 | + * \returns 0 on success or a negative error code on failure; call | |
| 154 | + * SDL_GetError() for more information. | |
| 155 | + * | |
| 156 | + * \since This function is available since SDL 2.0.0. | |
| 157 | + * | |
| 158 | + * \sa SDL_Init | |
| 159 | + * \sa SDL_Quit | |
| 160 | + * \sa SDL_QuitSubSystem | |
| 161 | + */ | |
| 162 | +extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); | |
| 163 | + | |
| 164 | +/** | |
| 165 | + * Shut down specific SDL subsystems. | |
| 166 | + * | |
| 167 | + * If you start a subsystem using a call to that subsystem's init function | |
| 168 | + * (for example SDL_VideoInit()) instead of SDL_Init() or SDL_InitSubSystem(), | |
| 169 | + * SDL_QuitSubSystem() and SDL_WasInit() will not work. You will need to use | |
| 170 | + * that subsystem's quit function (SDL_VideoQuit()) directly instead. But | |
| 171 | + * generally, you should not be using those functions directly anyhow; use | |
| 172 | + * SDL_Init() instead. | |
| 173 | + * | |
| 174 | + * You still need to call SDL_Quit() even if you close all open subsystems | |
| 175 | + * with SDL_QuitSubSystem(). | |
| 176 | + * | |
| 177 | + * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. | |
| 178 | + * | |
| 179 | + * \since This function is available since SDL 2.0.0. | |
| 180 | + * | |
| 181 | + * \sa SDL_InitSubSystem | |
| 182 | + * \sa SDL_Quit | |
| 183 | + */ | |
| 184 | +extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); | |
| 185 | + | |
| 186 | +/** | |
| 187 | + * Get a mask of the specified subsystems which are currently initialized. | |
| 188 | + * | |
| 189 | + * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. | |
| 190 | + * \returns a mask of all initialized subsystems if `flags` is 0, otherwise it | |
| 191 | + * returns the initialization status of the specified subsystems. | |
| 192 | + * | |
| 193 | + * The return value does not include SDL_INIT_NOPARACHUTE. | |
| 194 | + * | |
| 195 | + * \since This function is available since SDL 2.0.0. | |
| 196 | + * | |
| 197 | + * \sa SDL_Init | |
| 198 | + * \sa SDL_InitSubSystem | |
| 199 | + */ | |
| 200 | +extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); | |
| 201 | + | |
| 202 | +/** | |
| 203 | + * Clean up all initialized subsystems. | |
| 204 | + * | |
| 205 | + * You should call this function even if you have already shutdown each | |
| 206 | + * initialized subsystem with SDL_QuitSubSystem(). It is safe to call this | |
| 207 | + * function even in the case of errors in initialization. | |
| 208 | + * | |
| 209 | + * If you start a subsystem using a call to that subsystem's init function | |
| 210 | + * (for example SDL_VideoInit()) instead of SDL_Init() or SDL_InitSubSystem(), | |
| 211 | + * then you must use that subsystem's quit function (SDL_VideoQuit()) to shut | |
| 212 | + * it down before calling SDL_Quit(). But generally, you should not be using | |
| 213 | + * those functions directly anyhow; use SDL_Init() instead. | |
| 214 | + * | |
| 215 | + * You can use this function with atexit() to ensure that it is run when your | |
| 216 | + * application is shutdown, but it is not wise to do this from a library or | |
| 217 | + * other dynamically loaded code. | |
| 218 | + * | |
| 219 | + * \since This function is available since SDL 2.0.0. | |
| 220 | + * | |
| 221 | + * \sa SDL_Init | |
| 222 | + * \sa SDL_QuitSubSystem | |
| 223 | + */ | |
| 224 | +extern DECLSPEC void SDLCALL SDL_Quit(void); | |
| 225 | + | |
| 226 | +/* Ends C function definitions when using C++ */ | |
| 227 | +#ifdef __cplusplus | |
| 228 | +} | |
| 229 | +#endif | |
| 230 | +#include "close_code.h" | |
| 231 | + | |
| 232 | +#endif /* SDL_h_ */ | |
| 233 | + | |
| 234 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,324 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_assert_h_ | |
| 23 | +#define SDL_assert_h_ | |
| 24 | + | |
| 25 | +#include "SDL_stdinc.h" | |
| 26 | + | |
| 27 | +#include "begin_code.h" | |
| 28 | +/* Set up for C function definitions, even when using C++ */ | |
| 29 | +#ifdef __cplusplus | |
| 30 | +extern "C" { | |
| 31 | +#endif | |
| 32 | + | |
| 33 | +#ifndef SDL_ASSERT_LEVEL | |
| 34 | +#ifdef SDL_DEFAULT_ASSERT_LEVEL | |
| 35 | +#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL | |
| 36 | +#elif defined(_DEBUG) || defined(DEBUG) || \ | |
| 37 | + (defined(__GNUC__) && !defined(__OPTIMIZE__)) | |
| 38 | +#define SDL_ASSERT_LEVEL 2 | |
| 39 | +#else | |
| 40 | +#define SDL_ASSERT_LEVEL 1 | |
| 41 | +#endif | |
| 42 | +#endif /* SDL_ASSERT_LEVEL */ | |
| 43 | + | |
| 44 | +/* | |
| 45 | +These are macros and not first class functions so that the debugger breaks | |
| 46 | +on the assertion line and not in some random guts of SDL, and so each | |
| 47 | +assert can have unique static variables associated with it. | |
| 48 | +*/ | |
| 49 | + | |
| 50 | +#if defined(_MSC_VER) | |
| 51 | +/* Don't include intrin.h here because it contains C++ code */ | |
| 52 | + extern void __cdecl __debugbreak(void); | |
| 53 | + #define SDL_TriggerBreakpoint() __debugbreak() | |
| 54 | +#elif _SDL_HAS_BUILTIN(__builtin_debugtrap) | |
| 55 | + #define SDL_TriggerBreakpoint() __builtin_debugtrap() | |
| 56 | +#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) | |
| 57 | + #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) | |
| 58 | +#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv) | |
| 59 | + #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" ) | |
| 60 | +#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */ | |
| 61 | + #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" ) | |
| 62 | +#elif defined(__APPLE__) && defined(__arm__) | |
| 63 | + #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" ) | |
| 64 | +#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) ) | |
| 65 | + #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" ) | |
| 66 | +#elif defined(__386__) && defined(__WATCOMC__) | |
| 67 | + #define SDL_TriggerBreakpoint() { _asm { int 0x03 } } | |
| 68 | +#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__) | |
| 69 | + #include <signal.h> | |
| 70 | + #define SDL_TriggerBreakpoint() raise(SIGTRAP) | |
| 71 | +#else | |
| 72 | + /* How do we trigger breakpoints on this platform? */ | |
| 73 | + #define SDL_TriggerBreakpoint() | |
| 74 | +#endif | |
| 75 | + | |
| 76 | +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ | |
| 77 | +# define SDL_FUNCTION __func__ | |
| 78 | +#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__)) | |
| 79 | +# define SDL_FUNCTION __FUNCTION__ | |
| 80 | +#else | |
| 81 | +# define SDL_FUNCTION "???" | |
| 82 | +#endif | |
| 83 | +#define SDL_FILE __FILE__ | |
| 84 | +#define SDL_LINE __LINE__ | |
| 85 | + | |
| 86 | +/* | |
| 87 | +sizeof (x) makes the compiler still parse the expression even without | |
| 88 | +assertions enabled, so the code is always checked at compile time, but | |
| 89 | +doesn't actually generate code for it, so there are no side effects or | |
| 90 | +expensive checks at run time, just the constant size of what x WOULD be, | |
| 91 | +which presumably gets optimized out as unused. | |
| 92 | +This also solves the problem of... | |
| 93 | + | |
| 94 | + int somevalue = blah(); | |
| 95 | + SDL_assert(somevalue == 1); | |
| 96 | + | |
| 97 | +...which would cause compiles to complain that somevalue is unused if we | |
| 98 | +disable assertions. | |
| 99 | +*/ | |
| 100 | + | |
| 101 | +/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking | |
| 102 | + this condition isn't constant. And looks like an owl's face! */ | |
| 103 | +#ifdef _MSC_VER /* stupid /W4 warnings. */ | |
| 104 | +#define SDL_NULL_WHILE_LOOP_CONDITION (0,0) | |
| 105 | +#else | |
| 106 | +#define SDL_NULL_WHILE_LOOP_CONDITION (0) | |
| 107 | +#endif | |
| 108 | + | |
| 109 | +#define SDL_disabled_assert(condition) \ | |
| 110 | + do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION) | |
| 111 | + | |
| 112 | +typedef enum | |
| 113 | +{ | |
| 114 | + SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */ | |
| 115 | + SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */ | |
| 116 | + SDL_ASSERTION_ABORT, /**< Terminate the program. */ | |
| 117 | + SDL_ASSERTION_IGNORE, /**< Ignore the assert. */ | |
| 118 | + SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */ | |
| 119 | +} SDL_AssertState; | |
| 120 | + | |
| 121 | +typedef struct SDL_AssertData | |
| 122 | +{ | |
| 123 | + int always_ignore; | |
| 124 | + unsigned int trigger_count; | |
| 125 | + const char *condition; | |
| 126 | + const char *filename; | |
| 127 | + int linenum; | |
| 128 | + const char *function; | |
| 129 | + const struct SDL_AssertData *next; | |
| 130 | +} SDL_AssertData; | |
| 131 | + | |
| 132 | +/* Never call this directly. Use the SDL_assert* macros. */ | |
| 133 | +extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, | |
| 134 | + const char *, | |
| 135 | + const char *, int) | |
| 136 | +#if defined(__clang__) | |
| 137 | +#if __has_feature(attribute_analyzer_noreturn) | |
| 138 | +/* this tells Clang's static analysis that we're a custom assert function, | |
| 139 | + and that the analyzer should assume the condition was always true past this | |
| 140 | + SDL_assert test. */ | |
| 141 | + __attribute__((analyzer_noreturn)) | |
| 142 | +#endif | |
| 143 | +#endif | |
| 144 | +; | |
| 145 | + | |
| 146 | +/* the do {} while(0) avoids dangling else problems: | |
| 147 | + if (x) SDL_assert(y); else blah(); | |
| 148 | + ... without the do/while, the "else" could attach to this macro's "if". | |
| 149 | + We try to handle just the minimum we need here in a macro...the loop, | |
| 150 | + the static vars, and break points. The heavy lifting is handled in | |
| 151 | + SDL_ReportAssertion(), in SDL_assert.c. | |
| 152 | +*/ | |
| 153 | +#define SDL_enabled_assert(condition) \ | |
| 154 | + do { \ | |
| 155 | + while ( !(condition) ) { \ | |
| 156 | + static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, NULL, 0, NULL, NULL }; \ | |
| 157 | + const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \ | |
| 158 | + if (sdl_assert_state == SDL_ASSERTION_RETRY) { \ | |
| 159 | + continue; /* go again. */ \ | |
| 160 | + } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \ | |
| 161 | + SDL_TriggerBreakpoint(); \ | |
| 162 | + } \ | |
| 163 | + break; /* not retrying. */ \ | |
| 164 | + } \ | |
| 165 | + } while (SDL_NULL_WHILE_LOOP_CONDITION) | |
| 166 | + | |
| 167 | +/* Enable various levels of assertions. */ | |
| 168 | +#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */ | |
| 169 | +# define SDL_assert(condition) SDL_disabled_assert(condition) | |
| 170 | +# define SDL_assert_release(condition) SDL_disabled_assert(condition) | |
| 171 | +# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) | |
| 172 | +#elif SDL_ASSERT_LEVEL == 1 /* release settings. */ | |
| 173 | +# define SDL_assert(condition) SDL_disabled_assert(condition) | |
| 174 | +# define SDL_assert_release(condition) SDL_enabled_assert(condition) | |
| 175 | +# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) | |
| 176 | +#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */ | |
| 177 | +# define SDL_assert(condition) SDL_enabled_assert(condition) | |
| 178 | +# define SDL_assert_release(condition) SDL_enabled_assert(condition) | |
| 179 | +# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) | |
| 180 | +#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */ | |
| 181 | +# define SDL_assert(condition) SDL_enabled_assert(condition) | |
| 182 | +# define SDL_assert_release(condition) SDL_enabled_assert(condition) | |
| 183 | +# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition) | |
| 184 | +#else | |
| 185 | +# error Unknown assertion level. | |
| 186 | +#endif | |
| 187 | + | |
| 188 | +/* this assertion is never disabled at any level. */ | |
| 189 | +#define SDL_assert_always(condition) SDL_enabled_assert(condition) | |
| 190 | + | |
| 191 | + | |
| 192 | +/** | |
| 193 | + * A callback that fires when an SDL assertion fails. | |
| 194 | + * | |
| 195 | + * \param data a pointer to the SDL_AssertData structure corresponding to the | |
| 196 | + * current assertion. | |
| 197 | + * \param userdata what was passed as `userdata` to SDL_SetAssertionHandler(). | |
| 198 | + * \returns an SDL_AssertState value indicating how to handle the failure. | |
| 199 | + */ | |
| 200 | +typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( | |
| 201 | + const SDL_AssertData* data, void* userdata); | |
| 202 | + | |
| 203 | +/** | |
| 204 | + * Set an application-defined assertion handler. | |
| 205 | + * | |
| 206 | + * This function allows an application to show its own assertion UI and/or | |
| 207 | + * force the response to an assertion failure. If the application doesn't | |
| 208 | + * provide this, SDL will try to do the right thing, popping up a | |
| 209 | + * system-specific GUI dialog, and probably minimizing any fullscreen windows. | |
| 210 | + * | |
| 211 | + * This callback may fire from any thread, but it runs wrapped in a mutex, so | |
| 212 | + * it will only fire from one thread at a time. | |
| 213 | + * | |
| 214 | + * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! | |
| 215 | + * | |
| 216 | + * \param handler the SDL_AssertionHandler function to call when an assertion | |
| 217 | + * fails or NULL for the default handler. | |
| 218 | + * \param userdata a pointer that is passed to `handler`. | |
| 219 | + * | |
| 220 | + * \since This function is available since SDL 2.0.0. | |
| 221 | + * | |
| 222 | + * \sa SDL_GetAssertionHandler | |
| 223 | + */ | |
| 224 | +extern DECLSPEC void SDLCALL SDL_SetAssertionHandler( | |
| 225 | + SDL_AssertionHandler handler, | |
| 226 | + void *userdata); | |
| 227 | + | |
| 228 | +/** | |
| 229 | + * Get the default assertion handler. | |
| 230 | + * | |
| 231 | + * This returns the function pointer that is called by default when an | |
| 232 | + * assertion is triggered. This is an internal function provided by SDL, that | |
| 233 | + * is used for assertions when SDL_SetAssertionHandler() hasn't been used to | |
| 234 | + * provide a different function. | |
| 235 | + * | |
| 236 | + * \returns the default SDL_AssertionHandler that is called when an assert | |
| 237 | + * triggers. | |
| 238 | + * | |
| 239 | + * \since This function is available since SDL 2.0.2. | |
| 240 | + * | |
| 241 | + * \sa SDL_GetAssertionHandler | |
| 242 | + */ | |
| 243 | +extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void); | |
| 244 | + | |
| 245 | +/** | |
| 246 | + * Get the current assertion handler. | |
| 247 | + * | |
| 248 | + * This returns the function pointer that is called when an assertion is | |
| 249 | + * triggered. This is either the value last passed to | |
| 250 | + * SDL_SetAssertionHandler(), or if no application-specified function is set, | |
| 251 | + * is equivalent to calling SDL_GetDefaultAssertionHandler(). | |
| 252 | + * | |
| 253 | + * The parameter `puserdata` is a pointer to a void*, which will store the | |
| 254 | + * "userdata" pointer that was passed to SDL_SetAssertionHandler(). This value | |
| 255 | + * will always be NULL for the default handler. If you don't care about this | |
| 256 | + * data, it is safe to pass a NULL pointer to this function to ignore it. | |
| 257 | + * | |
| 258 | + * \param puserdata pointer which is filled with the "userdata" pointer that | |
| 259 | + * was passed to SDL_SetAssertionHandler(). | |
| 260 | + * \returns the SDL_AssertionHandler that is called when an assert triggers. | |
| 261 | + * | |
| 262 | + * \since This function is available since SDL 2.0.2. | |
| 263 | + * | |
| 264 | + * \sa SDL_SetAssertionHandler | |
| 265 | + */ | |
| 266 | +extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata); | |
| 267 | + | |
| 268 | +/** | |
| 269 | + * Get a list of all assertion failures. | |
| 270 | + * | |
| 271 | + * This function gets all assertions triggered since the last call to | |
| 272 | + * SDL_ResetAssertionReport(), or the start of the program. | |
| 273 | + * | |
| 274 | + * The proper way to examine this data looks something like this: | |
| 275 | + * | |
| 276 | + * ```c | |
| 277 | + * const SDL_AssertData *item = SDL_GetAssertionReport(); | |
| 278 | + * while (item) { | |
| 279 | + * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", | |
| 280 | + * item->condition, item->function, item->filename, | |
| 281 | + * item->linenum, item->trigger_count, | |
| 282 | + * item->always_ignore ? "yes" : "no"); | |
| 283 | + * item = item->next; | |
| 284 | + * } | |
| 285 | + * ``` | |
| 286 | + * | |
| 287 | + * \returns a list of all failed assertions or NULL if the list is empty. This | |
| 288 | + * memory should not be modified or freed by the application. | |
| 289 | + * | |
| 290 | + * \since This function is available since SDL 2.0.0. | |
| 291 | + * | |
| 292 | + * \sa SDL_ResetAssertionReport | |
| 293 | + */ | |
| 294 | +extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void); | |
| 295 | + | |
| 296 | +/** | |
| 297 | + * Clear the list of all assertion failures. | |
| 298 | + * | |
| 299 | + * This function will clear the list of all assertions triggered up to that | |
| 300 | + * point. Immediately following this call, SDL_GetAssertionReport will return | |
| 301 | + * no items. In addition, any previously-triggered assertions will be reset to | |
| 302 | + * a trigger_count of zero, and their always_ignore state will be false. | |
| 303 | + * | |
| 304 | + * \since This function is available since SDL 2.0.0. | |
| 305 | + * | |
| 306 | + * \sa SDL_GetAssertionReport | |
| 307 | + */ | |
| 308 | +extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); | |
| 309 | + | |
| 310 | + | |
| 311 | +/* these had wrong naming conventions until 2.0.4. Please update your app! */ | |
| 312 | +#define SDL_assert_state SDL_AssertState | |
| 313 | +#define SDL_assert_data SDL_AssertData | |
| 314 | + | |
| 315 | + | |
| 316 | +/* Ends C function definitions when using C++ */ | |
| 317 | +#ifdef __cplusplus | |
| 318 | +} | |
| 319 | +#endif | |
| 320 | +#include "close_code.h" | |
| 321 | + | |
| 322 | +#endif /* SDL_assert_h_ */ | |
| 323 | + | |
| 324 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,408 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryAtomic | |
| 24 | + * | |
| 25 | + * Atomic operations. | |
| 26 | + * | |
| 27 | + * IMPORTANT: If you are not an expert in concurrent lockless programming, you | |
| 28 | + * should not be using any functions in this file. You should be protecting | |
| 29 | + * your data structures with full mutexes instead. | |
| 30 | + * | |
| 31 | + * ***Seriously, here be dragons!*** | |
| 32 | + * | |
| 33 | + * You can find out a little more about lockless programming and the subtle | |
| 34 | + * issues that can arise here: | |
| 35 | + * https://learn.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming | |
| 36 | + * | |
| 37 | + * There's also lots of good information here: | |
| 38 | + * | |
| 39 | + * - https://www.1024cores.net/home/lock-free-algorithms | |
| 40 | + * - https://preshing.com/ | |
| 41 | + * | |
| 42 | + * These operations may or may not actually be implemented using processor | |
| 43 | + * specific atomic operations. When possible they are implemented as true | |
| 44 | + * processor specific atomic operations. When that is not possible the are | |
| 45 | + * implemented using locks that *do* use the available atomic operations. | |
| 46 | + * | |
| 47 | + * All of the atomic operations that modify memory are full memory barriers. | |
| 48 | + */ | |
| 49 | + | |
| 50 | +#ifndef SDL_atomic_h_ | |
| 51 | +#define SDL_atomic_h_ | |
| 52 | + | |
| 53 | +#include "SDL_stdinc.h" | |
| 54 | +#include "SDL_platform.h" | |
| 55 | + | |
| 56 | +#include "begin_code.h" | |
| 57 | + | |
| 58 | +/* Set up for C function definitions, even when using C++ */ | |
| 59 | +#ifdef __cplusplus | |
| 60 | +extern "C" { | |
| 61 | +#endif | |
| 62 | + | |
| 63 | +/** | |
| 64 | + * \name SDL AtomicLock | |
| 65 | + * | |
| 66 | + * The atomic locks are efficient spinlocks using CPU instructions, | |
| 67 | + * but are vulnerable to starvation and can spin forever if a thread | |
| 68 | + * holding a lock has been terminated. For this reason you should | |
| 69 | + * minimize the code executed inside an atomic lock and never do | |
| 70 | + * expensive things like API or system calls while holding them. | |
| 71 | + * | |
| 72 | + * The atomic locks are not safe to lock recursively. | |
| 73 | + * | |
| 74 | + * Porting Note: | |
| 75 | + * The spin lock functions and type are required and can not be | |
| 76 | + * emulated because they are used in the atomic emulation code. | |
| 77 | + */ | |
| 78 | +/* @{ */ | |
| 79 | + | |
| 80 | +typedef int SDL_SpinLock; | |
| 81 | + | |
| 82 | +/** | |
| 83 | + * Try to lock a spin lock by setting it to a non-zero value. | |
| 84 | + * | |
| 85 | + * ***Please note that spinlocks are dangerous if you don't know what you're | |
| 86 | + * doing. Please be careful using any sort of spinlock!*** | |
| 87 | + * | |
| 88 | + * \param lock a pointer to a lock variable. | |
| 89 | + * \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already | |
| 90 | + * held. | |
| 91 | + * | |
| 92 | + * \since This function is available since SDL 2.0.0. | |
| 93 | + * | |
| 94 | + * \sa SDL_AtomicLock | |
| 95 | + * \sa SDL_AtomicUnlock | |
| 96 | + */ | |
| 97 | +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock); | |
| 98 | + | |
| 99 | +/** | |
| 100 | + * Lock a spin lock by setting it to a non-zero value. | |
| 101 | + * | |
| 102 | + * ***Please note that spinlocks are dangerous if you don't know what you're | |
| 103 | + * doing. Please be careful using any sort of spinlock!*** | |
| 104 | + * | |
| 105 | + * \param lock a pointer to a lock variable. | |
| 106 | + * | |
| 107 | + * \since This function is available since SDL 2.0.0. | |
| 108 | + * | |
| 109 | + * \sa SDL_AtomicTryLock | |
| 110 | + * \sa SDL_AtomicUnlock | |
| 111 | + */ | |
| 112 | +extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock); | |
| 113 | + | |
| 114 | +/** | |
| 115 | + * Unlock a spin lock by setting it to 0. | |
| 116 | + * | |
| 117 | + * Always returns immediately. | |
| 118 | + * | |
| 119 | + * ***Please note that spinlocks are dangerous if you don't know what you're | |
| 120 | + * doing. Please be careful using any sort of spinlock!*** | |
| 121 | + * | |
| 122 | + * \param lock a pointer to a lock variable. | |
| 123 | + * | |
| 124 | + * \since This function is available since SDL 2.0.0. | |
| 125 | + * | |
| 126 | + * \sa SDL_AtomicLock | |
| 127 | + * \sa SDL_AtomicTryLock | |
| 128 | + */ | |
| 129 | +extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); | |
| 130 | + | |
| 131 | +/* @} *//* SDL AtomicLock */ | |
| 132 | + | |
| 133 | + | |
| 134 | +/** | |
| 135 | + * The compiler barrier prevents the compiler from reordering | |
| 136 | + * reads and writes to globally visible variables across the call. | |
| 137 | + */ | |
| 138 | +#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__) | |
| 139 | +void _ReadWriteBarrier(void); | |
| 140 | +#pragma intrinsic(_ReadWriteBarrier) | |
| 141 | +#define SDL_CompilerBarrier() _ReadWriteBarrier() | |
| 142 | +#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) | |
| 143 | +/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ | |
| 144 | +#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") | |
| 145 | +#elif defined(__WATCOMC__) | |
| 146 | +extern __inline void SDL_CompilerBarrier(void); | |
| 147 | +#pragma aux SDL_CompilerBarrier = "" parm [] modify exact []; | |
| 148 | +#else | |
| 149 | +#define SDL_CompilerBarrier() \ | |
| 150 | +{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } | |
| 151 | +#endif | |
| 152 | + | |
| 153 | +/** | |
| 154 | + * Memory barriers are designed to prevent reads and writes from being | |
| 155 | + * reordered by the compiler and being seen out of order on multi-core CPUs. | |
| 156 | + * | |
| 157 | + * A typical pattern would be for thread A to write some data and a flag, and | |
| 158 | + * for thread B to read the flag and get the data. In this case you would | |
| 159 | + * insert a release barrier between writing the data and the flag, | |
| 160 | + * guaranteeing that the data write completes no later than the flag is | |
| 161 | + * written, and you would insert an acquire barrier between reading the flag | |
| 162 | + * and reading the data, to ensure that all the reads associated with the flag | |
| 163 | + * have completed. | |
| 164 | + * | |
| 165 | + * In this pattern you should always see a release barrier paired with an | |
| 166 | + * acquire barrier and you should gate the data reads/writes with a single | |
| 167 | + * flag variable. | |
| 168 | + * | |
| 169 | + * For more information on these semantics, take a look at the blog post: | |
| 170 | + * http://preshing.com/20120913/acquire-and-release-semantics | |
| 171 | + * | |
| 172 | + * \since This function is available since SDL 2.0.6. | |
| 173 | + */ | |
| 174 | +extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); | |
| 175 | +extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); | |
| 176 | + | |
| 177 | +#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) | |
| 178 | +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") | |
| 179 | +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") | |
| 180 | +#elif defined(__GNUC__) && defined(__aarch64__) | |
| 181 | +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") | |
| 182 | +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") | |
| 183 | +#elif defined(__GNUC__) && defined(__arm__) | |
| 184 | +#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */ | |
| 185 | +/* Information from: | |
| 186 | + https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19 | |
| 187 | + | |
| 188 | + The Linux kernel provides a helper function which provides the right code for a memory barrier, | |
| 189 | + hard-coded at address 0xffff0fa0 | |
| 190 | +*/ | |
| 191 | +typedef void (*SDL_KernelMemoryBarrierFunc)(); | |
| 192 | +#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() | |
| 193 | +#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() | |
| 194 | +#elif 0 /* defined(__QNXNTO__) */ | |
| 195 | +#include <sys/cpuinline.h> | |
| 196 | + | |
| 197 | +#define SDL_MemoryBarrierRelease() __cpu_membarrier() | |
| 198 | +#define SDL_MemoryBarrierAcquire() __cpu_membarrier() | |
| 199 | +#else | |
| 200 | +#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__) | |
| 201 | +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") | |
| 202 | +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") | |
| 203 | +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) | |
| 204 | +#ifdef __thumb__ | |
| 205 | +/* The mcr instruction isn't available in thumb mode, use real functions */ | |
| 206 | +#define SDL_MEMORY_BARRIER_USES_FUNCTION | |
| 207 | +#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() | |
| 208 | +#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() | |
| 209 | +#else | |
| 210 | +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") | |
| 211 | +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") | |
| 212 | +#endif /* __thumb__ */ | |
| 213 | +#else | |
| 214 | +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory") | |
| 215 | +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory") | |
| 216 | +#endif /* __LINUX__ || __ANDROID__ */ | |
| 217 | +#endif /* __GNUC__ && __arm__ */ | |
| 218 | +#else | |
| 219 | +#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) | |
| 220 | +/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */ | |
| 221 | +#include <mbarrier.h> | |
| 222 | +#define SDL_MemoryBarrierRelease() __machine_rel_barrier() | |
| 223 | +#define SDL_MemoryBarrierAcquire() __machine_acq_barrier() | |
| 224 | +#else | |
| 225 | +/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */ | |
| 226 | +#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier() | |
| 227 | +#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier() | |
| 228 | +#endif | |
| 229 | +#endif | |
| 230 | + | |
| 231 | +/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */ | |
| 232 | +#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) | |
| 233 | + #define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */ | |
| 234 | +#elif (defined(__arm__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__aarch64__) | |
| 235 | + #define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory") | |
| 236 | +#elif (defined(__powerpc__) || defined(__powerpc64__)) | |
| 237 | + #define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27"); | |
| 238 | +#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) | |
| 239 | + #define SDL_CPUPauseInstruction() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */ | |
| 240 | +#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) | |
| 241 | + #define SDL_CPUPauseInstruction() __yield() | |
| 242 | +#elif defined(__WATCOMC__) && defined(__386__) | |
| 243 | + extern __inline void SDL_CPUPauseInstruction(void); | |
| 244 | + #pragma aux SDL_CPUPauseInstruction = ".686p" ".xmm2" "pause" | |
| 245 | +#else | |
| 246 | + #define SDL_CPUPauseInstruction() | |
| 247 | +#endif | |
| 248 | + | |
| 249 | + | |
| 250 | +/** | |
| 251 | + * A type representing an atomic integer value. | |
| 252 | + * | |
| 253 | + * It is a struct so people don't accidentally use numeric operations on it. | |
| 254 | + */ | |
| 255 | +typedef struct SDL_atomic_t { | |
| 256 | + int value; | |
| 257 | +} SDL_atomic_t; | |
| 258 | + | |
| 259 | +/** | |
| 260 | + * Set an atomic variable to a new value if it is currently an old value. | |
| 261 | + * | |
| 262 | + * ***Note: If you don't know what this function is for, you shouldn't use | |
| 263 | + * it!*** | |
| 264 | + * | |
| 265 | + * \param a a pointer to an SDL_atomic_t variable to be modified. | |
| 266 | + * \param oldval the old value. | |
| 267 | + * \param newval the new value. | |
| 268 | + * \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise. | |
| 269 | + * | |
| 270 | + * \since This function is available since SDL 2.0.0. | |
| 271 | + * | |
| 272 | + * \sa SDL_AtomicCASPtr | |
| 273 | + * \sa SDL_AtomicGet | |
| 274 | + * \sa SDL_AtomicSet | |
| 275 | + */ | |
| 276 | +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval); | |
| 277 | + | |
| 278 | +/** | |
| 279 | + * Set an atomic variable to a value. | |
| 280 | + * | |
| 281 | + * This function also acts as a full memory barrier. | |
| 282 | + * | |
| 283 | + * ***Note: If you don't know what this function is for, you shouldn't use | |
| 284 | + * it!*** | |
| 285 | + * | |
| 286 | + * \param a a pointer to an SDL_atomic_t variable to be modified. | |
| 287 | + * \param v the desired value. | |
| 288 | + * \returns the previous value of the atomic variable. | |
| 289 | + * | |
| 290 | + * \since This function is available since SDL 2.0.2. | |
| 291 | + * | |
| 292 | + * \sa SDL_AtomicGet | |
| 293 | + */ | |
| 294 | +extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v); | |
| 295 | + | |
| 296 | +/** | |
| 297 | + * Get the value of an atomic variable. | |
| 298 | + * | |
| 299 | + * ***Note: If you don't know what this function is for, you shouldn't use | |
| 300 | + * it!*** | |
| 301 | + * | |
| 302 | + * \param a a pointer to an SDL_atomic_t variable. | |
| 303 | + * \returns the current value of an atomic variable. | |
| 304 | + * | |
| 305 | + * \since This function is available since SDL 2.0.2. | |
| 306 | + * | |
| 307 | + * \sa SDL_AtomicSet | |
| 308 | + */ | |
| 309 | +extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a); | |
| 310 | + | |
| 311 | +/** | |
| 312 | + * Add to an atomic variable. | |
| 313 | + * | |
| 314 | + * This function also acts as a full memory barrier. | |
| 315 | + * | |
| 316 | + * ***Note: If you don't know what this function is for, you shouldn't use | |
| 317 | + * it!*** | |
| 318 | + * | |
| 319 | + * \param a a pointer to an SDL_atomic_t variable to be modified. | |
| 320 | + * \param v the desired value to add. | |
| 321 | + * \returns the previous value of the atomic variable. | |
| 322 | + * | |
| 323 | + * \since This function is available since SDL 2.0.2. | |
| 324 | + * | |
| 325 | + * \sa SDL_AtomicDecRef | |
| 326 | + * \sa SDL_AtomicIncRef | |
| 327 | + */ | |
| 328 | +extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v); | |
| 329 | + | |
| 330 | +/** | |
| 331 | + * \brief Increment an atomic variable used as a reference count. | |
| 332 | + */ | |
| 333 | +#ifndef SDL_AtomicIncRef | |
| 334 | +#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1) | |
| 335 | +#endif | |
| 336 | + | |
| 337 | +/** | |
| 338 | + * \brief Decrement an atomic variable used as a reference count. | |
| 339 | + * | |
| 340 | + * \return SDL_TRUE if the variable reached zero after decrementing, | |
| 341 | + * SDL_FALSE otherwise | |
| 342 | + */ | |
| 343 | +#ifndef SDL_AtomicDecRef | |
| 344 | +#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1) | |
| 345 | +#endif | |
| 346 | + | |
| 347 | +/** | |
| 348 | + * Set a pointer to a new value if it is currently an old value. | |
| 349 | + * | |
| 350 | + * ***Note: If you don't know what this function is for, you shouldn't use | |
| 351 | + * it!*** | |
| 352 | + * | |
| 353 | + * \param a a pointer to a pointer. | |
| 354 | + * \param oldval the old pointer value. | |
| 355 | + * \param newval the new pointer value. | |
| 356 | + * \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise. | |
| 357 | + * | |
| 358 | + * \since This function is available since SDL 2.0.0. | |
| 359 | + * | |
| 360 | + * \sa SDL_AtomicCAS | |
| 361 | + * \sa SDL_AtomicGetPtr | |
| 362 | + * \sa SDL_AtomicSetPtr | |
| 363 | + */ | |
| 364 | +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval); | |
| 365 | + | |
| 366 | +/** | |
| 367 | + * Set a pointer to a value atomically. | |
| 368 | + * | |
| 369 | + * ***Note: If you don't know what this function is for, you shouldn't use | |
| 370 | + * it!*** | |
| 371 | + * | |
| 372 | + * \param a a pointer to a pointer. | |
| 373 | + * \param v the desired pointer value. | |
| 374 | + * \returns the previous value of the pointer. | |
| 375 | + * | |
| 376 | + * \since This function is available since SDL 2.0.2. | |
| 377 | + * | |
| 378 | + * \sa SDL_AtomicCASPtr | |
| 379 | + * \sa SDL_AtomicGetPtr | |
| 380 | + */ | |
| 381 | +extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v); | |
| 382 | + | |
| 383 | +/** | |
| 384 | + * Get the value of a pointer atomically. | |
| 385 | + * | |
| 386 | + * ***Note: If you don't know what this function is for, you shouldn't use | |
| 387 | + * it!*** | |
| 388 | + * | |
| 389 | + * \param a a pointer to a pointer. | |
| 390 | + * \returns the current value of a pointer. | |
| 391 | + * | |
| 392 | + * \since This function is available since SDL 2.0.2. | |
| 393 | + * | |
| 394 | + * \sa SDL_AtomicCASPtr | |
| 395 | + * \sa SDL_AtomicSetPtr | |
| 396 | + */ | |
| 397 | +extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a); | |
| 398 | + | |
| 399 | +/* Ends C function definitions when using C++ */ | |
| 400 | +#ifdef __cplusplus | |
| 401 | +} | |
| 402 | +#endif | |
| 403 | + | |
| 404 | +#include "close_code.h" | |
| 405 | + | |
| 406 | +#endif /* SDL_atomic_h_ */ | |
| 407 | + | |
| 408 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,1502 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | +/* !!! FIXME: several functions in here need Doxygen comments. */ | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * # CategoryAudio | |
| 26 | + * | |
| 27 | + * Access to the raw audio mixing buffer for the SDL library. | |
| 28 | + */ | |
| 29 | + | |
| 30 | +#ifndef SDL_audio_h_ | |
| 31 | +#define SDL_audio_h_ | |
| 32 | + | |
| 33 | +#include "SDL_stdinc.h" | |
| 34 | +#include "SDL_error.h" | |
| 35 | +#include "SDL_endian.h" | |
| 36 | +#include "SDL_mutex.h" | |
| 37 | +#include "SDL_thread.h" | |
| 38 | +#include "SDL_rwops.h" | |
| 39 | + | |
| 40 | +#include "begin_code.h" | |
| 41 | +/* Set up for C function definitions, even when using C++ */ | |
| 42 | +#ifdef __cplusplus | |
| 43 | +extern "C" { | |
| 44 | +#endif | |
| 45 | + | |
| 46 | +/** | |
| 47 | + * Audio format flags. | |
| 48 | + * | |
| 49 | + * These are what the 16 bits in SDL_AudioFormat currently mean... | |
| 50 | + * (Unspecified bits are always zero). | |
| 51 | + * | |
| 52 | + * ``` | |
| 53 | + * ++-----------------------sample is signed if set | |
| 54 | + * || | |
| 55 | + * || ++-----------sample is bigendian if set | |
| 56 | + * || || | |
| 57 | + * || || ++---sample is float if set | |
| 58 | + * || || || | |
| 59 | + * || || || +---sample bit size---+ | |
| 60 | + * || || || | | | |
| 61 | + * 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 | |
| 62 | + * ``` | |
| 63 | + * | |
| 64 | + * There are macros in SDL 2.0 and later to query these bits. | |
| 65 | + */ | |
| 66 | +typedef Uint16 SDL_AudioFormat; | |
| 67 | + | |
| 68 | +/** | |
| 69 | + * \name Audio flags | |
| 70 | + */ | |
| 71 | +/* @{ */ | |
| 72 | + | |
| 73 | +#define SDL_AUDIO_MASK_BITSIZE (0xFF) | |
| 74 | +#define SDL_AUDIO_MASK_DATATYPE (1<<8) | |
| 75 | +#define SDL_AUDIO_MASK_ENDIAN (1<<12) | |
| 76 | +#define SDL_AUDIO_MASK_SIGNED (1<<15) | |
| 77 | +#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE) | |
| 78 | +#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE) | |
| 79 | +#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN) | |
| 80 | +#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED) | |
| 81 | +#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x)) | |
| 82 | +#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x)) | |
| 83 | +#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x)) | |
| 84 | + | |
| 85 | +/** | |
| 86 | + * \name Audio format flags | |
| 87 | + * | |
| 88 | + * Defaults to LSB byte order. | |
| 89 | + */ | |
| 90 | +/* @{ */ | |
| 91 | +#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ | |
| 92 | +#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ | |
| 93 | +#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ | |
| 94 | +#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ | |
| 95 | +#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ | |
| 96 | +#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ | |
| 97 | +#define AUDIO_U16 AUDIO_U16LSB | |
| 98 | +#define AUDIO_S16 AUDIO_S16LSB | |
| 99 | +/* @} */ | |
| 100 | + | |
| 101 | +/** | |
| 102 | + * \name int32 support | |
| 103 | + */ | |
| 104 | +/* @{ */ | |
| 105 | +#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ | |
| 106 | +#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ | |
| 107 | +#define AUDIO_S32 AUDIO_S32LSB | |
| 108 | +/* @} */ | |
| 109 | + | |
| 110 | +/** | |
| 111 | + * \name float32 support | |
| 112 | + */ | |
| 113 | +/* @{ */ | |
| 114 | +#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ | |
| 115 | +#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ | |
| 116 | +#define AUDIO_F32 AUDIO_F32LSB | |
| 117 | +/* @} */ | |
| 118 | + | |
| 119 | +/** | |
| 120 | + * \name Native audio byte ordering | |
| 121 | + */ | |
| 122 | +/* @{ */ | |
| 123 | +#if SDL_BYTEORDER == SDL_LIL_ENDIAN | |
| 124 | +#define AUDIO_U16SYS AUDIO_U16LSB | |
| 125 | +#define AUDIO_S16SYS AUDIO_S16LSB | |
| 126 | +#define AUDIO_S32SYS AUDIO_S32LSB | |
| 127 | +#define AUDIO_F32SYS AUDIO_F32LSB | |
| 128 | +#else | |
| 129 | +#define AUDIO_U16SYS AUDIO_U16MSB | |
| 130 | +#define AUDIO_S16SYS AUDIO_S16MSB | |
| 131 | +#define AUDIO_S32SYS AUDIO_S32MSB | |
| 132 | +#define AUDIO_F32SYS AUDIO_F32MSB | |
| 133 | +#endif | |
| 134 | +/* @} */ | |
| 135 | + | |
| 136 | +/** | |
| 137 | + * \name Allow change flags | |
| 138 | + * | |
| 139 | + * Which audio format changes are allowed when opening a device. | |
| 140 | + */ | |
| 141 | +/* @{ */ | |
| 142 | +#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 | |
| 143 | +#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 | |
| 144 | +#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 | |
| 145 | +#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008 | |
| 146 | +#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE) | |
| 147 | +/* @} */ | |
| 148 | + | |
| 149 | +/* @} *//* Audio flags */ | |
| 150 | + | |
| 151 | +/** | |
| 152 | + * This function is called when the audio device needs more data. | |
| 153 | + * | |
| 154 | + * \param userdata An application-specific parameter saved in the | |
| 155 | + * SDL_AudioSpec structure. | |
| 156 | + * \param stream A pointer to the audio data buffer. | |
| 157 | + * \param len Length of **stream** in bytes. | |
| 158 | + */ | |
| 159 | +typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, | |
| 160 | + int len); | |
| 161 | + | |
| 162 | +/** | |
| 163 | + * The calculated values in this structure are calculated by SDL_OpenAudio(). | |
| 164 | + * | |
| 165 | + * For multi-channel audio, the default SDL channel mapping is: | |
| 166 | + * | |
| 167 | + * ``` | |
| 168 | + * 2: FL FR (stereo) | |
| 169 | + * 3: FL FR LFE (2.1 surround) | |
| 170 | + * 4: FL FR BL BR (quad) | |
| 171 | + * 5: FL FR LFE BL BR (4.1 surround) | |
| 172 | + * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) | |
| 173 | + * 7: FL FR FC LFE BC SL SR (6.1 surround) | |
| 174 | + * 8: FL FR FC LFE BL BR SL SR (7.1 surround) | |
| 175 | + * ``` | |
| 176 | + */ | |
| 177 | +typedef struct SDL_AudioSpec | |
| 178 | +{ | |
| 179 | + int freq; /**< DSP frequency -- samples per second */ | |
| 180 | + SDL_AudioFormat format; /**< Audio data format */ | |
| 181 | + Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ | |
| 182 | + Uint8 silence; /**< Audio buffer silence value (calculated) */ | |
| 183 | + Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */ | |
| 184 | + Uint16 padding; /**< Necessary for some compile environments */ | |
| 185 | + Uint32 size; /**< Audio buffer size in bytes (calculated) */ | |
| 186 | + SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */ | |
| 187 | + void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */ | |
| 188 | +} SDL_AudioSpec; | |
| 189 | + | |
| 190 | + | |
| 191 | +struct SDL_AudioCVT; | |
| 192 | +typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, | |
| 193 | + SDL_AudioFormat format); | |
| 194 | + | |
| 195 | +/** | |
| 196 | + * Upper limit of filters in SDL_AudioCVT | |
| 197 | + * | |
| 198 | + * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is | |
| 199 | + * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, one | |
| 200 | + * of which is the terminating NULL pointer. | |
| 201 | + */ | |
| 202 | +#define SDL_AUDIOCVT_MAX_FILTERS 9 | |
| 203 | + | |
| 204 | +/** | |
| 205 | + * \struct SDL_AudioCVT | |
| 206 | + * \brief A structure to hold a set of audio conversion filters and buffers. | |
| 207 | + * | |
| 208 | + * Note that various parts of the conversion pipeline can take advantage | |
| 209 | + * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require | |
| 210 | + * you to pass it aligned data, but can possibly run much faster if you | |
| 211 | + * set both its (buf) field to a pointer that is aligned to 16 bytes, and its | |
| 212 | + * (len) field to something that's a multiple of 16, if possible. | |
| 213 | + */ | |
| 214 | +#if defined(__GNUC__) && !defined(__CHERI_PURE_CAPABILITY__) | |
| 215 | +/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't | |
| 216 | + pad it out to 88 bytes to guarantee ABI compatibility between compilers. | |
| 217 | + This is not a concern on CHERI architectures, where pointers must be stored | |
| 218 | + at aligned locations otherwise they will become invalid, and thus structs | |
| 219 | + containing pointers cannot be packed without giving a warning or error. | |
| 220 | + vvv | |
| 221 | + The next time we rev the ABI, make sure to size the ints and add padding. | |
| 222 | +*/ | |
| 223 | +#define SDL_AUDIOCVT_PACKED __attribute__((packed)) | |
| 224 | +#else | |
| 225 | +#define SDL_AUDIOCVT_PACKED | |
| 226 | +#endif | |
| 227 | +/* */ | |
| 228 | +typedef struct SDL_AudioCVT | |
| 229 | +{ | |
| 230 | + int needed; /**< Set to 1 if conversion possible */ | |
| 231 | + SDL_AudioFormat src_format; /**< Source audio format */ | |
| 232 | + SDL_AudioFormat dst_format; /**< Target audio format */ | |
| 233 | + double rate_incr; /**< Rate conversion increment */ | |
| 234 | + Uint8 *buf; /**< Buffer to hold entire audio data */ | |
| 235 | + int len; /**< Length of original audio buffer */ | |
| 236 | + int len_cvt; /**< Length of converted audio buffer */ | |
| 237 | + int len_mult; /**< buffer must be len*len_mult big */ | |
| 238 | + double len_ratio; /**< Given len, final size is len*len_ratio */ | |
| 239 | + SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */ | |
| 240 | + int filter_index; /**< Current audio conversion function */ | |
| 241 | +} SDL_AUDIOCVT_PACKED SDL_AudioCVT; | |
| 242 | + | |
| 243 | + | |
| 244 | +/* Function prototypes */ | |
| 245 | + | |
| 246 | +/** | |
| 247 | + * \name Driver discovery functions | |
| 248 | + * | |
| 249 | + * These functions return the list of built in audio drivers, in the | |
| 250 | + * order that they are normally initialized by default. | |
| 251 | + */ | |
| 252 | +/* @{ */ | |
| 253 | + | |
| 254 | +/** | |
| 255 | + * Use this function to get the number of built-in audio drivers. | |
| 256 | + * | |
| 257 | + * This function returns a hardcoded number. This never returns a negative | |
| 258 | + * value; if there are no drivers compiled into this build of SDL, this | |
| 259 | + * function returns zero. The presence of a driver in this list does not mean | |
| 260 | + * it will function, it just means SDL is capable of interacting with that | |
| 261 | + * interface. For example, a build of SDL might have esound support, but if | |
| 262 | + * there's no esound server available, SDL's esound driver would fail if used. | |
| 263 | + * | |
| 264 | + * By default, SDL tries all drivers, in its preferred order, until one is | |
| 265 | + * found to be usable. | |
| 266 | + * | |
| 267 | + * \returns the number of built-in audio drivers. | |
| 268 | + * | |
| 269 | + * \since This function is available since SDL 2.0.0. | |
| 270 | + * | |
| 271 | + * \sa SDL_GetAudioDriver | |
| 272 | + */ | |
| 273 | +extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); | |
| 274 | + | |
| 275 | +/** | |
| 276 | + * Use this function to get the name of a built in audio driver. | |
| 277 | + * | |
| 278 | + * The list of audio drivers is given in the order that they are normally | |
| 279 | + * initialized by default; the drivers that seem more reasonable to choose | |
| 280 | + * first (as far as the SDL developers believe) are earlier in the list. | |
| 281 | + * | |
| 282 | + * The names of drivers are all simple, low-ASCII identifiers, like "alsa", | |
| 283 | + * "coreaudio" or "xaudio2". These never have Unicode characters, and are not | |
| 284 | + * meant to be proper names. | |
| 285 | + * | |
| 286 | + * \param index the index of the audio driver; the value ranges from 0 to | |
| 287 | + * SDL_GetNumAudioDrivers() - 1. | |
| 288 | + * \returns the name of the audio driver at the requested index, or NULL if an | |
| 289 | + * invalid index was specified. | |
| 290 | + * | |
| 291 | + * \since This function is available since SDL 2.0.0. | |
| 292 | + * | |
| 293 | + * \sa SDL_GetNumAudioDrivers | |
| 294 | + */ | |
| 295 | +extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); | |
| 296 | +/* @} */ | |
| 297 | + | |
| 298 | +/** | |
| 299 | + * \name Initialization and cleanup | |
| 300 | + * | |
| 301 | + * \internal These functions are used internally, and should not be used unless | |
| 302 | + * you have a specific need to specify the audio driver you want to | |
| 303 | + * use. You should normally use SDL_Init() or SDL_InitSubSystem(). | |
| 304 | + */ | |
| 305 | +/* @{ */ | |
| 306 | + | |
| 307 | +/** | |
| 308 | + * Use this function to initialize a particular audio driver. | |
| 309 | + * | |
| 310 | + * This function is used internally, and should not be used unless you have a | |
| 311 | + * specific need to designate the audio driver you want to use. You should | |
| 312 | + * normally use SDL_Init() or SDL_InitSubSystem(). | |
| 313 | + * | |
| 314 | + * \param driver_name the name of the desired audio driver. | |
| 315 | + * \returns 0 on success or a negative error code on failure; call | |
| 316 | + * SDL_GetError() for more information. | |
| 317 | + * | |
| 318 | + * \since This function is available since SDL 2.0.0. | |
| 319 | + * | |
| 320 | + * \sa SDL_AudioQuit | |
| 321 | + */ | |
| 322 | +extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); | |
| 323 | + | |
| 324 | +/** | |
| 325 | + * Use this function to shut down audio if you initialized it with | |
| 326 | + * SDL_AudioInit(). | |
| 327 | + * | |
| 328 | + * This function is used internally, and should not be used unless you have a | |
| 329 | + * specific need to specify the audio driver you want to use. You should | |
| 330 | + * normally use SDL_Quit() or SDL_QuitSubSystem(). | |
| 331 | + * | |
| 332 | + * \since This function is available since SDL 2.0.0. | |
| 333 | + * | |
| 334 | + * \sa SDL_AudioInit | |
| 335 | + */ | |
| 336 | +extern DECLSPEC void SDLCALL SDL_AudioQuit(void); | |
| 337 | +/* @} */ | |
| 338 | + | |
| 339 | +/** | |
| 340 | + * Get the name of the current audio driver. | |
| 341 | + * | |
| 342 | + * The returned string points to internal static memory and thus never becomes | |
| 343 | + * invalid, even if you quit the audio subsystem and initialize a new driver | |
| 344 | + * (although such a case would return a different static string from another | |
| 345 | + * call to this function, of course). As such, you should not modify or free | |
| 346 | + * the returned string. | |
| 347 | + * | |
| 348 | + * \returns the name of the current audio driver or NULL if no driver has been | |
| 349 | + * initialized. | |
| 350 | + * | |
| 351 | + * \since This function is available since SDL 2.0.0. | |
| 352 | + * | |
| 353 | + * \sa SDL_AudioInit | |
| 354 | + */ | |
| 355 | +extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); | |
| 356 | + | |
| 357 | +/** | |
| 358 | + * This function is a legacy means of opening the audio device. | |
| 359 | + * | |
| 360 | + * This function remains for compatibility with SDL 1.2, but also because it's | |
| 361 | + * slightly easier to use than the new functions in SDL 2.0. The new, more | |
| 362 | + * powerful, and preferred way to do this is SDL_OpenAudioDevice(). | |
| 363 | + * | |
| 364 | + * This function is roughly equivalent to: | |
| 365 | + * | |
| 366 | + * ```c | |
| 367 | + * SDL_OpenAudioDevice(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); | |
| 368 | + * ``` | |
| 369 | + * | |
| 370 | + * With two notable exceptions: | |
| 371 | + * | |
| 372 | + * - If `obtained` is NULL, we use `desired` (and allow no changes), which | |
| 373 | + * means desired will be modified to have the correct values for silence, | |
| 374 | + * etc, and SDL will convert any differences between your app's specific | |
| 375 | + * request and the hardware behind the scenes. | |
| 376 | + * - The return value is always success or failure, and not a device ID, which | |
| 377 | + * means you can only have one device open at a time with this function. | |
| 378 | + * | |
| 379 | + * \param desired an SDL_AudioSpec structure representing the desired output | |
| 380 | + * format. Please refer to the SDL_OpenAudioDevice | |
| 381 | + * documentation for details on how to prepare this structure. | |
| 382 | + * \param obtained an SDL_AudioSpec structure filled in with the actual | |
| 383 | + * parameters, or NULL. | |
| 384 | + * \returns 0 if successful, placing the actual hardware parameters in the | |
| 385 | + * structure pointed to by `obtained`. | |
| 386 | + * | |
| 387 | + * If `obtained` is NULL, the audio data passed to the callback | |
| 388 | + * function will be guaranteed to be in the requested format, and | |
| 389 | + * will be automatically converted to the actual hardware audio | |
| 390 | + * format if necessary. If `obtained` is NULL, `desired` will have | |
| 391 | + * fields modified. | |
| 392 | + * | |
| 393 | + * This function returns a negative error code on failure to open the | |
| 394 | + * audio device or failure to set up the audio thread; call | |
| 395 | + * SDL_GetError() for more information. | |
| 396 | + * | |
| 397 | + * \since This function is available since SDL 2.0.0. | |
| 398 | + * | |
| 399 | + * \sa SDL_CloseAudio | |
| 400 | + * \sa SDL_LockAudio | |
| 401 | + * \sa SDL_PauseAudio | |
| 402 | + * \sa SDL_UnlockAudio | |
| 403 | + */ | |
| 404 | +extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired, | |
| 405 | + SDL_AudioSpec * obtained); | |
| 406 | + | |
| 407 | +/** | |
| 408 | + * SDL Audio Device IDs. | |
| 409 | + * | |
| 410 | + * A successful call to SDL_OpenAudio() is always device id 1, and legacy SDL | |
| 411 | + * audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls | |
| 412 | + * always returns devices >= 2 on success. The legacy calls are good both for | |
| 413 | + * backwards compatibility and when you don't care about multiple, specific, | |
| 414 | + * or capture devices. | |
| 415 | + */ | |
| 416 | +typedef Uint32 SDL_AudioDeviceID; | |
| 417 | + | |
| 418 | +/** | |
| 419 | + * Get the number of built-in audio devices. | |
| 420 | + * | |
| 421 | + * This function is only valid after successfully initializing the audio | |
| 422 | + * subsystem. | |
| 423 | + * | |
| 424 | + * Note that audio capture support is not implemented as of SDL 2.0.4, so the | |
| 425 | + * `iscapture` parameter is for future expansion and should always be zero for | |
| 426 | + * now. | |
| 427 | + * | |
| 428 | + * This function will return -1 if an explicit list of devices can't be | |
| 429 | + * determined. Returning -1 is not an error. For example, if SDL is set up to | |
| 430 | + * talk to a remote audio server, it can't list every one available on the | |
| 431 | + * Internet, but it will still allow a specific host to be specified in | |
| 432 | + * SDL_OpenAudioDevice(). | |
| 433 | + * | |
| 434 | + * In many common cases, when this function returns a value <= 0, it can still | |
| 435 | + * successfully open the default device (NULL for first argument of | |
| 436 | + * SDL_OpenAudioDevice()). | |
| 437 | + * | |
| 438 | + * This function may trigger a complete redetect of available hardware. It | |
| 439 | + * should not be called for each iteration of a loop, but rather once at the | |
| 440 | + * start of a loop: | |
| 441 | + * | |
| 442 | + * ```c | |
| 443 | + * // Don't do this: | |
| 444 | + * for (int i = 0; i < SDL_GetNumAudioDevices(0); i++) | |
| 445 | + * | |
| 446 | + * // do this instead: | |
| 447 | + * const int count = SDL_GetNumAudioDevices(0); | |
| 448 | + * for (int i = 0; i < count; ++i) { do_something_here(); } | |
| 449 | + * ``` | |
| 450 | + * | |
| 451 | + * \param iscapture zero to request playback devices, non-zero to request | |
| 452 | + * recording devices. | |
| 453 | + * \returns the number of available devices exposed by the current driver or | |
| 454 | + * -1 if an explicit list of devices can't be determined. A return | |
| 455 | + * value of -1 does not necessarily mean an error condition. | |
| 456 | + * | |
| 457 | + * \since This function is available since SDL 2.0.0. | |
| 458 | + * | |
| 459 | + * \sa SDL_GetAudioDeviceName | |
| 460 | + * \sa SDL_OpenAudioDevice | |
| 461 | + */ | |
| 462 | +extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); | |
| 463 | + | |
| 464 | +/** | |
| 465 | + * Get the human-readable name of a specific audio device. | |
| 466 | + * | |
| 467 | + * This function is only valid after successfully initializing the audio | |
| 468 | + * subsystem. The values returned by this function reflect the latest call to | |
| 469 | + * SDL_GetNumAudioDevices(); re-call that function to redetect available | |
| 470 | + * hardware. | |
| 471 | + * | |
| 472 | + * The string returned by this function is UTF-8 encoded, read-only, and | |
| 473 | + * managed internally. You are not to free it. If you need to keep the string | |
| 474 | + * for any length of time, you should make your own copy of it, as it will be | |
| 475 | + * invalid next time any of several other SDL functions are called. | |
| 476 | + * | |
| 477 | + * \param index the index of the audio device; valid values range from 0 to | |
| 478 | + * SDL_GetNumAudioDevices() - 1. | |
| 479 | + * \param iscapture non-zero to query the list of recording devices, zero to | |
| 480 | + * query the list of output devices. | |
| 481 | + * \returns the name of the audio device at the requested index, or NULL on | |
| 482 | + * error. | |
| 483 | + * | |
| 484 | + * \since This function is available since SDL 2.0.0. | |
| 485 | + * | |
| 486 | + * \sa SDL_GetNumAudioDevices | |
| 487 | + * \sa SDL_GetDefaultAudioInfo | |
| 488 | + */ | |
| 489 | +extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, | |
| 490 | + int iscapture); | |
| 491 | + | |
| 492 | +/** | |
| 493 | + * Get the preferred audio format of a specific audio device. | |
| 494 | + * | |
| 495 | + * This function is only valid after a successfully initializing the audio | |
| 496 | + * subsystem. The values returned by this function reflect the latest call to | |
| 497 | + * SDL_GetNumAudioDevices(); re-call that function to redetect available | |
| 498 | + * hardware. | |
| 499 | + * | |
| 500 | + * `spec` will be filled with the sample rate, sample format, and channel | |
| 501 | + * count. | |
| 502 | + * | |
| 503 | + * \param index the index of the audio device; valid values range from 0 to | |
| 504 | + * SDL_GetNumAudioDevices() - 1. | |
| 505 | + * \param iscapture non-zero to query the list of recording devices, zero to | |
| 506 | + * query the list of output devices. | |
| 507 | + * \param spec The SDL_AudioSpec to be initialized by this function. | |
| 508 | + * \returns 0 on success, nonzero on error. | |
| 509 | + * | |
| 510 | + * \since This function is available since SDL 2.0.16. | |
| 511 | + * | |
| 512 | + * \sa SDL_GetNumAudioDevices | |
| 513 | + * \sa SDL_GetDefaultAudioInfo | |
| 514 | + */ | |
| 515 | +extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index, | |
| 516 | + int iscapture, | |
| 517 | + SDL_AudioSpec *spec); | |
| 518 | + | |
| 519 | + | |
| 520 | +/** | |
| 521 | + * Get the name and preferred format of the default audio device. | |
| 522 | + * | |
| 523 | + * Some (but not all!) platforms have an isolated mechanism to get information | |
| 524 | + * about the "default" device. This can actually be a completely different | |
| 525 | + * device that's not in the list you get from SDL_GetAudioDeviceSpec(). It can | |
| 526 | + * even be a network address! (This is discussed in SDL_OpenAudioDevice().) | |
| 527 | + * | |
| 528 | + * As a result, this call is not guaranteed to be performant, as it can query | |
| 529 | + * the sound server directly every time, unlike the other query functions. You | |
| 530 | + * should call this function sparingly! | |
| 531 | + * | |
| 532 | + * `spec` will be filled with the sample rate, sample format, and channel | |
| 533 | + * count, if a default device exists on the system. If `name` is provided, | |
| 534 | + * will be filled with either a dynamically-allocated UTF-8 string or NULL. | |
| 535 | + * | |
| 536 | + * \param name A pointer to be filled with the name of the default device (can | |
| 537 | + * be NULL). Please call SDL_free() when you are done with this | |
| 538 | + * pointer! | |
| 539 | + * \param spec The SDL_AudioSpec to be initialized by this function. | |
| 540 | + * \param iscapture non-zero to query the default recording device, zero to | |
| 541 | + * query the default output device. | |
| 542 | + * \returns 0 on success, nonzero on error. | |
| 543 | + * | |
| 544 | + * \since This function is available since SDL 2.24.0. | |
| 545 | + * | |
| 546 | + * \sa SDL_GetAudioDeviceName | |
| 547 | + * \sa SDL_GetAudioDeviceSpec | |
| 548 | + * \sa SDL_OpenAudioDevice | |
| 549 | + */ | |
| 550 | +extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name, | |
| 551 | + SDL_AudioSpec *spec, | |
| 552 | + int iscapture); | |
| 553 | + | |
| 554 | + | |
| 555 | +/** | |
| 556 | + * Open a specific audio device. | |
| 557 | + * | |
| 558 | + * SDL_OpenAudio(), unlike this function, always acts on device ID 1. As such, | |
| 559 | + * this function will never return a 1 so as not to conflict with the legacy | |
| 560 | + * function. | |
| 561 | + * | |
| 562 | + * Please note that SDL 2.0 before 2.0.5 did not support recording; as such, | |
| 563 | + * this function would fail if `iscapture` was not zero. Starting with SDL | |
| 564 | + * 2.0.5, recording is implemented and this value can be non-zero. | |
| 565 | + * | |
| 566 | + * Passing in a `device` name of NULL requests the most reasonable default | |
| 567 | + * (and is equivalent to what SDL_OpenAudio() does to choose a device). The | |
| 568 | + * `device` name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but | |
| 569 | + * some drivers allow arbitrary and driver-specific strings, such as a | |
| 570 | + * hostname/IP address for a remote audio server, or a filename in the | |
| 571 | + * diskaudio driver. | |
| 572 | + * | |
| 573 | + * An opened audio device starts out paused, and should be enabled for playing | |
| 574 | + * by calling SDL_PauseAudioDevice(devid, 0) when you are ready for your audio | |
| 575 | + * callback function to be called. Since the audio driver may modify the | |
| 576 | + * requested size of the audio buffer, you should allocate any local mixing | |
| 577 | + * buffers after you open the audio device. | |
| 578 | + * | |
| 579 | + * The audio callback runs in a separate thread in most cases; you can prevent | |
| 580 | + * race conditions between your callback and other threads without fully | |
| 581 | + * pausing playback with SDL_LockAudioDevice(). For more information about the | |
| 582 | + * callback, see SDL_AudioSpec. | |
| 583 | + * | |
| 584 | + * Managing the audio spec via 'desired' and 'obtained': | |
| 585 | + * | |
| 586 | + * When filling in the desired audio spec structure: | |
| 587 | + * | |
| 588 | + * - `desired->freq` should be the frequency in sample-frames-per-second (Hz). | |
| 589 | + * - `desired->format` should be the audio format (`AUDIO_S16SYS`, etc). | |
| 590 | + * - `desired->samples` is the desired size of the audio buffer, in _sample | |
| 591 | + * frames_ (with stereo output, two samples--left and right--would make a | |
| 592 | + * single sample frame). This number should be a power of two, and may be | |
| 593 | + * adjusted by the audio driver to a value more suitable for the hardware. | |
| 594 | + * Good values seem to range between 512 and 4096 inclusive, depending on | |
| 595 | + * the application and CPU speed. Smaller values reduce latency, but can | |
| 596 | + * lead to underflow if the application is doing heavy processing and cannot | |
| 597 | + * fill the audio buffer in time. Note that the number of sample frames is | |
| 598 | + * directly related to time by the following formula: `ms = | |
| 599 | + * (sampleframes*1000)/freq` | |
| 600 | + * - `desired->size` is the size in _bytes_ of the audio buffer, and is | |
| 601 | + * calculated by SDL_OpenAudioDevice(). You don't initialize this. | |
| 602 | + * - `desired->silence` is the value used to set the buffer to silence, and is | |
| 603 | + * calculated by SDL_OpenAudioDevice(). You don't initialize this. | |
| 604 | + * - `desired->callback` should be set to a function that will be called when | |
| 605 | + * the audio device is ready for more data. It is passed a pointer to the | |
| 606 | + * audio buffer, and the length in bytes of the audio buffer. This function | |
| 607 | + * usually runs in a separate thread, and so you should protect data | |
| 608 | + * structures that it accesses by calling SDL_LockAudioDevice() and | |
| 609 | + * SDL_UnlockAudioDevice() in your code. Alternately, you may pass a NULL | |
| 610 | + * pointer here, and call SDL_QueueAudio() with some frequency, to queue | |
| 611 | + * more audio samples to be played (or for capture devices, call | |
| 612 | + * SDL_DequeueAudio() with some frequency, to obtain audio samples). | |
| 613 | + * - `desired->userdata` is passed as the first parameter to your callback | |
| 614 | + * function. If you passed a NULL callback, this value is ignored. | |
| 615 | + * | |
| 616 | + * `allowed_changes` can have the following flags OR'd together: | |
| 617 | + * | |
| 618 | + * - `SDL_AUDIO_ALLOW_FREQUENCY_CHANGE` | |
| 619 | + * - `SDL_AUDIO_ALLOW_FORMAT_CHANGE` | |
| 620 | + * - `SDL_AUDIO_ALLOW_CHANNELS_CHANGE` | |
| 621 | + * - `SDL_AUDIO_ALLOW_SAMPLES_CHANGE` | |
| 622 | + * - `SDL_AUDIO_ALLOW_ANY_CHANGE` | |
| 623 | + * | |
| 624 | + * These flags specify how SDL should behave when a device cannot offer a | |
| 625 | + * specific feature. If the application requests a feature that the hardware | |
| 626 | + * doesn't offer, SDL will always try to get the closest equivalent. | |
| 627 | + * | |
| 628 | + * For example, if you ask for float32 audio format, but the sound card only | |
| 629 | + * supports int16, SDL will set the hardware to int16. If you had set | |
| 630 | + * SDL_AUDIO_ALLOW_FORMAT_CHANGE, SDL will change the format in the `obtained` | |
| 631 | + * structure. If that flag was *not* set, SDL will prepare to convert your | |
| 632 | + * callback's float32 audio to int16 before feeding it to the hardware and | |
| 633 | + * will keep the originally requested format in the `obtained` structure. | |
| 634 | + * | |
| 635 | + * The resulting audio specs, varying depending on hardware and on what | |
| 636 | + * changes were allowed, will then be written back to `obtained`. | |
| 637 | + * | |
| 638 | + * If your application can only handle one specific data format, pass a zero | |
| 639 | + * for `allowed_changes` and let SDL transparently handle any differences. | |
| 640 | + * | |
| 641 | + * \param device a UTF-8 string reported by SDL_GetAudioDeviceName() or a | |
| 642 | + * driver-specific name as appropriate. NULL requests the most | |
| 643 | + * reasonable default device. | |
| 644 | + * \param iscapture non-zero to specify a device should be opened for | |
| 645 | + * recording, not playback. | |
| 646 | + * \param desired an SDL_AudioSpec structure representing the desired output | |
| 647 | + * format; see SDL_OpenAudio() for more information. | |
| 648 | + * \param obtained an SDL_AudioSpec structure filled in with the actual output | |
| 649 | + * format; see SDL_OpenAudio() for more information. | |
| 650 | + * \param allowed_changes 0, or one or more flags OR'd together. | |
| 651 | + * \returns a valid device ID that is > 0 on success or 0 on failure; call | |
| 652 | + * SDL_GetError() for more information. | |
| 653 | + * | |
| 654 | + * For compatibility with SDL 1.2, this will never return 1, since | |
| 655 | + * SDL reserves that ID for the legacy SDL_OpenAudio() function. | |
| 656 | + * | |
| 657 | + * \since This function is available since SDL 2.0.0. | |
| 658 | + * | |
| 659 | + * \sa SDL_CloseAudioDevice | |
| 660 | + * \sa SDL_GetAudioDeviceName | |
| 661 | + * \sa SDL_LockAudioDevice | |
| 662 | + * \sa SDL_OpenAudio | |
| 663 | + * \sa SDL_PauseAudioDevice | |
| 664 | + * \sa SDL_UnlockAudioDevice | |
| 665 | + */ | |
| 666 | +extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice( | |
| 667 | + const char *device, | |
| 668 | + int iscapture, | |
| 669 | + const SDL_AudioSpec *desired, | |
| 670 | + SDL_AudioSpec *obtained, | |
| 671 | + int allowed_changes); | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | +/** | |
| 676 | + * \name Audio state | |
| 677 | + * | |
| 678 | + * Get the current audio state. | |
| 679 | + */ | |
| 680 | +/* @{ */ | |
| 681 | +typedef enum | |
| 682 | +{ | |
| 683 | + SDL_AUDIO_STOPPED = 0, | |
| 684 | + SDL_AUDIO_PLAYING, | |
| 685 | + SDL_AUDIO_PAUSED | |
| 686 | +} SDL_AudioStatus; | |
| 687 | + | |
| 688 | +/** | |
| 689 | + * This function is a legacy means of querying the audio device. | |
| 690 | + * | |
| 691 | + * New programs might want to use SDL_GetAudioDeviceStatus() instead. This | |
| 692 | + * function is equivalent to calling... | |
| 693 | + * | |
| 694 | + * ```c | |
| 695 | + * SDL_GetAudioDeviceStatus(1); | |
| 696 | + * ``` | |
| 697 | + * | |
| 698 | + * ...and is only useful if you used the legacy SDL_OpenAudio() function. | |
| 699 | + * | |
| 700 | + * \returns the SDL_AudioStatus of the audio device opened by SDL_OpenAudio(). | |
| 701 | + * | |
| 702 | + * \since This function is available since SDL 2.0.0. | |
| 703 | + * | |
| 704 | + * \sa SDL_GetAudioDeviceStatus | |
| 705 | + */ | |
| 706 | +extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void); | |
| 707 | + | |
| 708 | +/** | |
| 709 | + * Use this function to get the current audio state of an audio device. | |
| 710 | + * | |
| 711 | + * \param dev the ID of an audio device previously opened with | |
| 712 | + * SDL_OpenAudioDevice(). | |
| 713 | + * \returns the SDL_AudioStatus of the specified audio device. | |
| 714 | + * | |
| 715 | + * \since This function is available since SDL 2.0.0. | |
| 716 | + * | |
| 717 | + * \sa SDL_PauseAudioDevice | |
| 718 | + */ | |
| 719 | +extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); | |
| 720 | +/* @} *//* Audio State */ | |
| 721 | + | |
| 722 | +/** | |
| 723 | + * \name Pause audio functions | |
| 724 | + * | |
| 725 | + * These functions pause and unpause the audio callback processing. | |
| 726 | + * They should be called with a parameter of 0 after opening the audio | |
| 727 | + * device to start playing sound. This is so you can safely initialize | |
| 728 | + * data for your callback function after opening the audio device. | |
| 729 | + * Silence will be written to the audio device during the pause. | |
| 730 | + */ | |
| 731 | +/* @{ */ | |
| 732 | + | |
| 733 | +/** | |
| 734 | + * This function is a legacy means of pausing the audio device. | |
| 735 | + * | |
| 736 | + * New programs might want to use SDL_PauseAudioDevice() instead. This | |
| 737 | + * function is equivalent to calling... | |
| 738 | + * | |
| 739 | + * ```c | |
| 740 | + * SDL_PauseAudioDevice(1, pause_on); | |
| 741 | + * ``` | |
| 742 | + * | |
| 743 | + * ...and is only useful if you used the legacy SDL_OpenAudio() function. | |
| 744 | + * | |
| 745 | + * \param pause_on non-zero to pause, 0 to unpause. | |
| 746 | + * | |
| 747 | + * \since This function is available since SDL 2.0.0. | |
| 748 | + * | |
| 749 | + * \sa SDL_GetAudioStatus | |
| 750 | + * \sa SDL_PauseAudioDevice | |
| 751 | + */ | |
| 752 | +extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); | |
| 753 | + | |
| 754 | +/** | |
| 755 | + * Use this function to pause and unpause audio playback on a specified | |
| 756 | + * device. | |
| 757 | + * | |
| 758 | + * This function pauses and unpauses the audio callback processing for a given | |
| 759 | + * device. Newly-opened audio devices start in the paused state, so you must | |
| 760 | + * call this function with **pause_on**=0 after opening the specified audio | |
| 761 | + * device to start playing sound. This allows you to safely initialize data | |
| 762 | + * for your callback function after opening the audio device. Silence will be | |
| 763 | + * written to the audio device while paused, and the audio callback is | |
| 764 | + * guaranteed to not be called. Pausing one device does not prevent other | |
| 765 | + * unpaused devices from running their callbacks. | |
| 766 | + * | |
| 767 | + * Pausing state does not stack; even if you pause a device several times, a | |
| 768 | + * single unpause will start the device playing again, and vice versa. This is | |
| 769 | + * different from how SDL_LockAudioDevice() works. | |
| 770 | + * | |
| 771 | + * If you just need to protect a few variables from race conditions vs your | |
| 772 | + * callback, you shouldn't pause the audio device, as it will lead to dropouts | |
| 773 | + * in the audio playback. Instead, you should use SDL_LockAudioDevice(). | |
| 774 | + * | |
| 775 | + * \param dev a device opened by SDL_OpenAudioDevice(). | |
| 776 | + * \param pause_on non-zero to pause, 0 to unpause. | |
| 777 | + * | |
| 778 | + * \since This function is available since SDL 2.0.0. | |
| 779 | + * | |
| 780 | + * \sa SDL_LockAudioDevice | |
| 781 | + */ | |
| 782 | +extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, | |
| 783 | + int pause_on); | |
| 784 | +/* @} *//* Pause audio functions */ | |
| 785 | + | |
| 786 | +/** | |
| 787 | + * Load the audio data of a WAVE file into memory. | |
| 788 | + * | |
| 789 | + * Loading a WAVE file requires `src`, `spec`, `audio_buf` and `audio_len` to | |
| 790 | + * be valid pointers. The entire data portion of the file is then loaded into | |
| 791 | + * memory and decoded if necessary. | |
| 792 | + * | |
| 793 | + * If `freesrc` is non-zero, the data source gets automatically closed and | |
| 794 | + * freed before the function returns. | |
| 795 | + * | |
| 796 | + * Supported formats are RIFF WAVE files with the formats PCM (8, 16, 24, and | |
| 797 | + * 32 bits), IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and | |
| 798 | + * A-law and mu-law (8 bits). Other formats are currently unsupported and | |
| 799 | + * cause an error. | |
| 800 | + * | |
| 801 | + * If this function succeeds, the pointer returned by it is equal to `spec` | |
| 802 | + * and the pointer to the audio data allocated by the function is written to | |
| 803 | + * `audio_buf` and its length in bytes to `audio_len`. The SDL_AudioSpec | |
| 804 | + * members `freq`, `channels`, and `format` are set to the values of the audio | |
| 805 | + * data in the buffer. The `samples` member is set to a sane default and all | |
| 806 | + * others are set to zero. | |
| 807 | + * | |
| 808 | + * It's necessary to use SDL_FreeWAV() to free the audio data returned in | |
| 809 | + * `audio_buf` when it is no longer used. | |
| 810 | + * | |
| 811 | + * Because of the underspecification of the .WAV format, there are many | |
| 812 | + * problematic files in the wild that cause issues with strict decoders. To | |
| 813 | + * provide compatibility with these files, this decoder is lenient in regards | |
| 814 | + * to the truncation of the file, the fact chunk, and the size of the RIFF | |
| 815 | + * chunk. The hints `SDL_HINT_WAVE_RIFF_CHUNK_SIZE`, | |
| 816 | + * `SDL_HINT_WAVE_TRUNCATION`, and `SDL_HINT_WAVE_FACT_CHUNK` can be used to | |
| 817 | + * tune the behavior of the loading process. | |
| 818 | + * | |
| 819 | + * Any file that is invalid (due to truncation, corruption, or wrong values in | |
| 820 | + * the headers), too big, or unsupported causes an error. Additionally, any | |
| 821 | + * critical I/O error from the data source will terminate the loading process | |
| 822 | + * with an error. The function returns NULL on error and in all cases (with | |
| 823 | + * the exception of `src` being NULL), an appropriate error message will be | |
| 824 | + * set. | |
| 825 | + * | |
| 826 | + * It is required that the data source supports seeking. | |
| 827 | + * | |
| 828 | + * Example: | |
| 829 | + * | |
| 830 | + * ```c | |
| 831 | + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, &spec, &buf, &len); | |
| 832 | + * ``` | |
| 833 | + * | |
| 834 | + * Note that the SDL_LoadWAV macro does this same thing for you, but in a less | |
| 835 | + * messy way: | |
| 836 | + * | |
| 837 | + * ```c | |
| 838 | + * SDL_LoadWAV("sample.wav", &spec, &buf, &len); | |
| 839 | + * ``` | |
| 840 | + * | |
| 841 | + * \param src The data source for the WAVE data. | |
| 842 | + * \param freesrc If non-zero, SDL will _always_ free the data source. | |
| 843 | + * \param spec An SDL_AudioSpec that will be filled in with the wave file's | |
| 844 | + * format details. | |
| 845 | + * \param audio_buf A pointer filled with the audio data, allocated by the | |
| 846 | + * function. | |
| 847 | + * \param audio_len A pointer filled with the length of the audio data buffer | |
| 848 | + * in bytes. | |
| 849 | + * \returns This function, if successfully called, returns `spec`, which will | |
| 850 | + * be filled with the audio data format of the wave source data. | |
| 851 | + * `audio_buf` will be filled with a pointer to an allocated buffer | |
| 852 | + * containing the audio data, and `audio_len` is filled with the | |
| 853 | + * length of that audio buffer in bytes. | |
| 854 | + * | |
| 855 | + * This function returns NULL if the .WAV file cannot be opened, uses | |
| 856 | + * an unknown data format, or is corrupt; call SDL_GetError() for | |
| 857 | + * more information. | |
| 858 | + * | |
| 859 | + * When the application is done with the data returned in | |
| 860 | + * `audio_buf`, it should call SDL_FreeWAV() to dispose of it. | |
| 861 | + * | |
| 862 | + * \since This function is available since SDL 2.0.0. | |
| 863 | + * | |
| 864 | + * \sa SDL_FreeWAV | |
| 865 | + * \sa SDL_LoadWAV | |
| 866 | + */ | |
| 867 | +extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, | |
| 868 | + int freesrc, | |
| 869 | + SDL_AudioSpec * spec, | |
| 870 | + Uint8 ** audio_buf, | |
| 871 | + Uint32 * audio_len); | |
| 872 | + | |
| 873 | +/** | |
| 874 | + * Loads a WAV from a file. | |
| 875 | + * | |
| 876 | + * Compatibility convenience function. | |
| 877 | + */ | |
| 878 | +#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ | |
| 879 | + SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) | |
| 880 | + | |
| 881 | +/** | |
| 882 | + * Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW(). | |
| 883 | + * | |
| 884 | + * After a WAVE file has been opened with SDL_LoadWAV() or SDL_LoadWAV_RW() | |
| 885 | + * its data can eventually be freed with SDL_FreeWAV(). It is safe to call | |
| 886 | + * this function with a NULL pointer. | |
| 887 | + * | |
| 888 | + * \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or | |
| 889 | + * SDL_LoadWAV_RW(). | |
| 890 | + * | |
| 891 | + * \since This function is available since SDL 2.0.0. | |
| 892 | + * | |
| 893 | + * \sa SDL_LoadWAV | |
| 894 | + * \sa SDL_LoadWAV_RW | |
| 895 | + */ | |
| 896 | +extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); | |
| 897 | + | |
| 898 | +/** | |
| 899 | + * Initialize an SDL_AudioCVT structure for conversion. | |
| 900 | + * | |
| 901 | + * Before an SDL_AudioCVT structure can be used to convert audio data it must | |
| 902 | + * be initialized with source and destination information. | |
| 903 | + * | |
| 904 | + * This function will zero out every field of the SDL_AudioCVT, so it must be | |
| 905 | + * called before the application fills in the final buffer information. | |
| 906 | + * | |
| 907 | + * Once this function has returned successfully, and reported that a | |
| 908 | + * conversion is necessary, the application fills in the rest of the fields in | |
| 909 | + * SDL_AudioCVT, now that it knows how large a buffer it needs to allocate, | |
| 910 | + * and then can call SDL_ConvertAudio() to complete the conversion. | |
| 911 | + * | |
| 912 | + * \param cvt an SDL_AudioCVT structure filled in with audio conversion | |
| 913 | + * information. | |
| 914 | + * \param src_format the source format of the audio data; for more info see | |
| 915 | + * SDL_AudioFormat. | |
| 916 | + * \param src_channels the number of channels in the source. | |
| 917 | + * \param src_rate the frequency (sample-frames-per-second) of the source. | |
| 918 | + * \param dst_format the destination format of the audio data; for more info | |
| 919 | + * see SDL_AudioFormat. | |
| 920 | + * \param dst_channels the number of channels in the destination. | |
| 921 | + * \param dst_rate the frequency (sample-frames-per-second) of the | |
| 922 | + * destination. | |
| 923 | + * \returns 1 if the audio filter is prepared, 0 if no conversion is needed, | |
| 924 | + * or a negative error code on failure; call SDL_GetError() for more | |
| 925 | + * information. | |
| 926 | + * | |
| 927 | + * \since This function is available since SDL 2.0.0. | |
| 928 | + * | |
| 929 | + * \sa SDL_ConvertAudio | |
| 930 | + */ | |
| 931 | +extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, | |
| 932 | + SDL_AudioFormat src_format, | |
| 933 | + Uint8 src_channels, | |
| 934 | + int src_rate, | |
| 935 | + SDL_AudioFormat dst_format, | |
| 936 | + Uint8 dst_channels, | |
| 937 | + int dst_rate); | |
| 938 | + | |
| 939 | +/** | |
| 940 | + * Convert audio data to a desired audio format. | |
| 941 | + * | |
| 942 | + * This function does the actual audio data conversion, after the application | |
| 943 | + * has called SDL_BuildAudioCVT() to prepare the conversion information and | |
| 944 | + * then filled in the buffer details. | |
| 945 | + * | |
| 946 | + * Once the application has initialized the `cvt` structure using | |
| 947 | + * SDL_BuildAudioCVT(), allocated an audio buffer and filled it with audio | |
| 948 | + * data in the source format, this function will convert the buffer, in-place, | |
| 949 | + * to the desired format. | |
| 950 | + * | |
| 951 | + * The data conversion may go through several passes; any given pass may | |
| 952 | + * possibly temporarily increase the size of the data. For example, SDL might | |
| 953 | + * expand 16-bit data to 32 bits before resampling to a lower frequency, | |
| 954 | + * shrinking the data size after having grown it briefly. Since the supplied | |
| 955 | + * buffer will be both the source and destination, converting as necessary | |
| 956 | + * in-place, the application must allocate a buffer that will fully contain | |
| 957 | + * the data during its largest conversion pass. After SDL_BuildAudioCVT() | |
| 958 | + * returns, the application should set the `cvt->len` field to the size, in | |
| 959 | + * bytes, of the source data, and allocate a buffer that is `cvt->len * | |
| 960 | + * cvt->len_mult` bytes long for the `buf` field. | |
| 961 | + * | |
| 962 | + * The source data should be copied into this buffer before the call to | |
| 963 | + * SDL_ConvertAudio(). Upon successful return, this buffer will contain the | |
| 964 | + * converted audio, and `cvt->len_cvt` will be the size of the converted data, | |
| 965 | + * in bytes. Any bytes in the buffer past `cvt->len_cvt` are undefined once | |
| 966 | + * this function returns. | |
| 967 | + * | |
| 968 | + * \param cvt an SDL_AudioCVT structure that was previously set up by | |
| 969 | + * SDL_BuildAudioCVT(). | |
| 970 | + * \returns 0 if the conversion was completed successfully or a negative error | |
| 971 | + * code on failure; call SDL_GetError() for more information. | |
| 972 | + * | |
| 973 | + * \since This function is available since SDL 2.0.0. | |
| 974 | + * | |
| 975 | + * \sa SDL_BuildAudioCVT | |
| 976 | + */ | |
| 977 | +extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt); | |
| 978 | + | |
| 979 | +/* SDL_AudioStream is a new audio conversion interface. | |
| 980 | + The benefits vs SDL_AudioCVT: | |
| 981 | + - it can handle resampling data in chunks without generating | |
| 982 | + artifacts, when it doesn't have the complete buffer available. | |
| 983 | + - it can handle incoming data in any variable size. | |
| 984 | + - You push data as you have it, and pull it when you need it | |
| 985 | + */ | |
| 986 | +/* this is opaque to the outside world. */ | |
| 987 | +struct _SDL_AudioStream; | |
| 988 | +typedef struct _SDL_AudioStream SDL_AudioStream; | |
| 989 | + | |
| 990 | +/** | |
| 991 | + * Create a new audio stream. | |
| 992 | + * | |
| 993 | + * \param src_format The format of the source audio. | |
| 994 | + * \param src_channels The number of channels of the source audio. | |
| 995 | + * \param src_rate The sampling rate of the source audio. | |
| 996 | + * \param dst_format The format of the desired audio output. | |
| 997 | + * \param dst_channels The number of channels of the desired audio output. | |
| 998 | + * \param dst_rate The sampling rate of the desired audio output. | |
| 999 | + * \returns 0 on success, or -1 on error. | |
| 1000 | + * | |
| 1001 | + * \since This function is available since SDL 2.0.7. | |
| 1002 | + * | |
| 1003 | + * \sa SDL_AudioStreamPut | |
| 1004 | + * \sa SDL_AudioStreamGet | |
| 1005 | + * \sa SDL_AudioStreamAvailable | |
| 1006 | + * \sa SDL_AudioStreamFlush | |
| 1007 | + * \sa SDL_AudioStreamClear | |
| 1008 | + * \sa SDL_FreeAudioStream | |
| 1009 | + */ | |
| 1010 | +extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format, | |
| 1011 | + const Uint8 src_channels, | |
| 1012 | + const int src_rate, | |
| 1013 | + const SDL_AudioFormat dst_format, | |
| 1014 | + const Uint8 dst_channels, | |
| 1015 | + const int dst_rate); | |
| 1016 | + | |
| 1017 | +/** | |
| 1018 | + * Add data to be converted/resampled to the stream. | |
| 1019 | + * | |
| 1020 | + * \param stream The stream the audio data is being added to. | |
| 1021 | + * \param buf A pointer to the audio data to add. | |
| 1022 | + * \param len The number of bytes to write to the stream. | |
| 1023 | + * \returns 0 on success, or -1 on error. | |
| 1024 | + * | |
| 1025 | + * \since This function is available since SDL 2.0.7. | |
| 1026 | + * | |
| 1027 | + * \sa SDL_NewAudioStream | |
| 1028 | + * \sa SDL_AudioStreamGet | |
| 1029 | + * \sa SDL_AudioStreamAvailable | |
| 1030 | + * \sa SDL_AudioStreamFlush | |
| 1031 | + * \sa SDL_AudioStreamClear | |
| 1032 | + * \sa SDL_FreeAudioStream | |
| 1033 | + */ | |
| 1034 | +extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len); | |
| 1035 | + | |
| 1036 | +/** | |
| 1037 | + * Get converted/resampled data from the stream | |
| 1038 | + * | |
| 1039 | + * \param stream The stream the audio is being requested from. | |
| 1040 | + * \param buf A buffer to fill with audio data. | |
| 1041 | + * \param len The maximum number of bytes to fill. | |
| 1042 | + * \returns the number of bytes read from the stream, or -1 on error. | |
| 1043 | + * | |
| 1044 | + * \since This function is available since SDL 2.0.7. | |
| 1045 | + * | |
| 1046 | + * \sa SDL_NewAudioStream | |
| 1047 | + * \sa SDL_AudioStreamPut | |
| 1048 | + * \sa SDL_AudioStreamAvailable | |
| 1049 | + * \sa SDL_AudioStreamFlush | |
| 1050 | + * \sa SDL_AudioStreamClear | |
| 1051 | + * \sa SDL_FreeAudioStream | |
| 1052 | + */ | |
| 1053 | +extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len); | |
| 1054 | + | |
| 1055 | +/** | |
| 1056 | + * Get the number of converted/resampled bytes available. | |
| 1057 | + * | |
| 1058 | + * The stream may be buffering data behind the scenes until it has enough to | |
| 1059 | + * resample correctly, so this number might be lower than what you expect, or | |
| 1060 | + * even be zero. Add more data or flush the stream if you need the data now. | |
| 1061 | + * | |
| 1062 | + * \since This function is available since SDL 2.0.7. | |
| 1063 | + * | |
| 1064 | + * \sa SDL_NewAudioStream | |
| 1065 | + * \sa SDL_AudioStreamPut | |
| 1066 | + * \sa SDL_AudioStreamGet | |
| 1067 | + * \sa SDL_AudioStreamFlush | |
| 1068 | + * \sa SDL_AudioStreamClear | |
| 1069 | + * \sa SDL_FreeAudioStream | |
| 1070 | + */ | |
| 1071 | +extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream); | |
| 1072 | + | |
| 1073 | +/** | |
| 1074 | + * Tell the stream that you're done sending data, and anything being buffered | |
| 1075 | + * should be converted/resampled and made available immediately. | |
| 1076 | + * | |
| 1077 | + * It is legal to add more data to a stream after flushing, but there will be | |
| 1078 | + * audio gaps in the output. Generally this is intended to signal the end of | |
| 1079 | + * input, so the complete output becomes available. | |
| 1080 | + * | |
| 1081 | + * \since This function is available since SDL 2.0.7. | |
| 1082 | + * | |
| 1083 | + * \sa SDL_NewAudioStream | |
| 1084 | + * \sa SDL_AudioStreamPut | |
| 1085 | + * \sa SDL_AudioStreamGet | |
| 1086 | + * \sa SDL_AudioStreamAvailable | |
| 1087 | + * \sa SDL_AudioStreamClear | |
| 1088 | + * \sa SDL_FreeAudioStream | |
| 1089 | + */ | |
| 1090 | +extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream); | |
| 1091 | + | |
| 1092 | +/** | |
| 1093 | + * Clear any pending data in the stream without converting it | |
| 1094 | + * | |
| 1095 | + * \since This function is available since SDL 2.0.7. | |
| 1096 | + * | |
| 1097 | + * \sa SDL_NewAudioStream | |
| 1098 | + * \sa SDL_AudioStreamPut | |
| 1099 | + * \sa SDL_AudioStreamGet | |
| 1100 | + * \sa SDL_AudioStreamAvailable | |
| 1101 | + * \sa SDL_AudioStreamFlush | |
| 1102 | + * \sa SDL_FreeAudioStream | |
| 1103 | + */ | |
| 1104 | +extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream); | |
| 1105 | + | |
| 1106 | +/** | |
| 1107 | + * Free an audio stream | |
| 1108 | + * | |
| 1109 | + * \since This function is available since SDL 2.0.7. | |
| 1110 | + * | |
| 1111 | + * \sa SDL_NewAudioStream | |
| 1112 | + * \sa SDL_AudioStreamPut | |
| 1113 | + * \sa SDL_AudioStreamGet | |
| 1114 | + * \sa SDL_AudioStreamAvailable | |
| 1115 | + * \sa SDL_AudioStreamFlush | |
| 1116 | + * \sa SDL_AudioStreamClear | |
| 1117 | + */ | |
| 1118 | +extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); | |
| 1119 | + | |
| 1120 | +/** | |
| 1121 | + * Maximum volume allowed in calls to SDL_MixAudio and SDL_MixAudioFormat. | |
| 1122 | + */ | |
| 1123 | +#define SDL_MIX_MAXVOLUME 128 | |
| 1124 | + | |
| 1125 | +/** | |
| 1126 | + * This function is a legacy means of mixing audio. | |
| 1127 | + * | |
| 1128 | + * This function is equivalent to calling... | |
| 1129 | + * | |
| 1130 | + * ```c | |
| 1131 | + * SDL_MixAudioFormat(dst, src, format, len, volume); | |
| 1132 | + * ``` | |
| 1133 | + * | |
| 1134 | + * ...where `format` is the obtained format of the audio device from the | |
| 1135 | + * legacy SDL_OpenAudio() function. | |
| 1136 | + * | |
| 1137 | + * \param dst the destination for the mixed audio. | |
| 1138 | + * \param src the source audio buffer to be mixed. | |
| 1139 | + * \param len the length of the audio buffer in bytes. | |
| 1140 | + * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME | |
| 1141 | + * for full audio volume. | |
| 1142 | + * | |
| 1143 | + * \since This function is available since SDL 2.0.0. | |
| 1144 | + * | |
| 1145 | + * \sa SDL_MixAudioFormat | |
| 1146 | + */ | |
| 1147 | +extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src, | |
| 1148 | + Uint32 len, int volume); | |
| 1149 | + | |
| 1150 | +/** | |
| 1151 | + * Mix audio data in a specified format. | |
| 1152 | + * | |
| 1153 | + * This takes an audio buffer `src` of `len` bytes of `format` data and mixes | |
| 1154 | + * it into `dst`, performing addition, volume adjustment, and overflow | |
| 1155 | + * clipping. The buffer pointed to by `dst` must also be `len` bytes of | |
| 1156 | + * `format` data. | |
| 1157 | + * | |
| 1158 | + * This is provided for convenience -- you can mix your own audio data. | |
| 1159 | + * | |
| 1160 | + * Do not use this function for mixing together more than two streams of | |
| 1161 | + * sample data. The output from repeated application of this function may be | |
| 1162 | + * distorted by clipping, because there is no accumulator with greater range | |
| 1163 | + * than the input (not to mention this being an inefficient way of doing it). | |
| 1164 | + * | |
| 1165 | + * It is a common misconception that this function is required to write audio | |
| 1166 | + * data to an output stream in an audio callback. While you can do that, | |
| 1167 | + * SDL_MixAudioFormat() is really only needed when you're mixing a single | |
| 1168 | + * audio stream with a volume adjustment. | |
| 1169 | + * | |
| 1170 | + * \param dst the destination for the mixed audio. | |
| 1171 | + * \param src the source audio buffer to be mixed. | |
| 1172 | + * \param format the SDL_AudioFormat structure representing the desired audio | |
| 1173 | + * format. | |
| 1174 | + * \param len the length of the audio buffer in bytes. | |
| 1175 | + * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME | |
| 1176 | + * for full audio volume. | |
| 1177 | + * | |
| 1178 | + * \since This function is available since SDL 2.0.0. | |
| 1179 | + */ | |
| 1180 | +extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, | |
| 1181 | + const Uint8 * src, | |
| 1182 | + SDL_AudioFormat format, | |
| 1183 | + Uint32 len, int volume); | |
| 1184 | + | |
| 1185 | +/** | |
| 1186 | + * Queue more audio on non-callback devices. | |
| 1187 | + * | |
| 1188 | + * If you are looking to retrieve queued audio from a non-callback capture | |
| 1189 | + * device, you want SDL_DequeueAudio() instead. SDL_QueueAudio() will return | |
| 1190 | + * -1 to signify an error if you use it with capture devices. | |
| 1191 | + * | |
| 1192 | + * SDL offers two ways to feed audio to the device: you can either supply a | |
| 1193 | + * callback that SDL triggers with some frequency to obtain more audio (pull | |
| 1194 | + * method), or you can supply no callback, and then SDL will expect you to | |
| 1195 | + * supply data at regular intervals (push method) with this function. | |
| 1196 | + * | |
| 1197 | + * There are no limits on the amount of data you can queue, short of | |
| 1198 | + * exhaustion of address space. Queued data will drain to the device as | |
| 1199 | + * necessary without further intervention from you. If the device needs audio | |
| 1200 | + * but there is not enough queued, it will play silence to make up the | |
| 1201 | + * difference. This means you will have skips in your audio playback if you | |
| 1202 | + * aren't routinely queueing sufficient data. | |
| 1203 | + * | |
| 1204 | + * This function copies the supplied data, so you are safe to free it when the | |
| 1205 | + * function returns. This function is thread-safe, but queueing to the same | |
| 1206 | + * device from two threads at once does not promise which buffer will be | |
| 1207 | + * queued first. | |
| 1208 | + * | |
| 1209 | + * You may not queue audio on a device that is using an application-supplied | |
| 1210 | + * callback; doing so returns an error. You have to use the audio callback or | |
| 1211 | + * queue audio with this function, but not both. | |
| 1212 | + * | |
| 1213 | + * You should not call SDL_LockAudio() on the device before queueing; SDL | |
| 1214 | + * handles locking internally for this function. | |
| 1215 | + * | |
| 1216 | + * Note that SDL2 does not support planar audio. You will need to resample | |
| 1217 | + * from planar audio formats into a non-planar one (see SDL_AudioFormat) | |
| 1218 | + * before queuing audio. | |
| 1219 | + * | |
| 1220 | + * \param dev the device ID to which we will queue audio. | |
| 1221 | + * \param data the data to queue to the device for later playback. | |
| 1222 | + * \param len the number of bytes (not samples!) to which `data` points. | |
| 1223 | + * \returns 0 on success or a negative error code on failure; call | |
| 1224 | + * SDL_GetError() for more information. | |
| 1225 | + * | |
| 1226 | + * \since This function is available since SDL 2.0.4. | |
| 1227 | + * | |
| 1228 | + * \sa SDL_ClearQueuedAudio | |
| 1229 | + * \sa SDL_GetQueuedAudioSize | |
| 1230 | + */ | |
| 1231 | +extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len); | |
| 1232 | + | |
| 1233 | +/** | |
| 1234 | + * Dequeue more audio on non-callback devices. | |
| 1235 | + * | |
| 1236 | + * If you are looking to queue audio for output on a non-callback playback | |
| 1237 | + * device, you want SDL_QueueAudio() instead. SDL_DequeueAudio() will always | |
| 1238 | + * return 0 if you use it with playback devices. | |
| 1239 | + * | |
| 1240 | + * SDL offers two ways to retrieve audio from a capture device: you can either | |
| 1241 | + * supply a callback that SDL triggers with some frequency as the device | |
| 1242 | + * records more audio data, (push method), or you can supply no callback, and | |
| 1243 | + * then SDL will expect you to retrieve data at regular intervals (pull | |
| 1244 | + * method) with this function. | |
| 1245 | + * | |
| 1246 | + * There are no limits on the amount of data you can queue, short of | |
| 1247 | + * exhaustion of address space. Data from the device will keep queuing as | |
| 1248 | + * necessary without further intervention from you. This means you will | |
| 1249 | + * eventually run out of memory if you aren't routinely dequeueing data. | |
| 1250 | + * | |
| 1251 | + * Capture devices will not queue data when paused; if you are expecting to | |
| 1252 | + * not need captured audio for some length of time, use SDL_PauseAudioDevice() | |
| 1253 | + * to stop the capture device from queueing more data. This can be useful | |
| 1254 | + * during, say, level loading times. When unpaused, capture devices will start | |
| 1255 | + * queueing data from that point, having flushed any capturable data available | |
| 1256 | + * while paused. | |
| 1257 | + * | |
| 1258 | + * This function is thread-safe, but dequeueing from the same device from two | |
| 1259 | + * threads at once does not promise which thread will dequeue data first. | |
| 1260 | + * | |
| 1261 | + * You may not dequeue audio from a device that is using an | |
| 1262 | + * application-supplied callback; doing so returns an error. You have to use | |
| 1263 | + * the audio callback, or dequeue audio with this function, but not both. | |
| 1264 | + * | |
| 1265 | + * You should not call SDL_LockAudio() on the device before dequeueing; SDL | |
| 1266 | + * handles locking internally for this function. | |
| 1267 | + * | |
| 1268 | + * \param dev the device ID from which we will dequeue audio. | |
| 1269 | + * \param data a pointer into where audio data should be copied. | |
| 1270 | + * \param len the number of bytes (not samples!) to which (data) points. | |
| 1271 | + * \returns the number of bytes dequeued, which could be less than requested; | |
| 1272 | + * call SDL_GetError() for more information. | |
| 1273 | + * | |
| 1274 | + * \since This function is available since SDL 2.0.5. | |
| 1275 | + * | |
| 1276 | + * \sa SDL_ClearQueuedAudio | |
| 1277 | + * \sa SDL_GetQueuedAudioSize | |
| 1278 | + */ | |
| 1279 | +extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len); | |
| 1280 | + | |
| 1281 | +/** | |
| 1282 | + * Get the number of bytes of still-queued audio. | |
| 1283 | + * | |
| 1284 | + * For playback devices: this is the number of bytes that have been queued for | |
| 1285 | + * playback with SDL_QueueAudio(), but have not yet been sent to the hardware. | |
| 1286 | + * | |
| 1287 | + * Once we've sent it to the hardware, this function can not decide the exact | |
| 1288 | + * byte boundary of what has been played. It's possible that we just gave the | |
| 1289 | + * hardware several kilobytes right before you called this function, but it | |
| 1290 | + * hasn't played any of it yet, or maybe half of it, etc. | |
| 1291 | + * | |
| 1292 | + * For capture devices, this is the number of bytes that have been captured by | |
| 1293 | + * the device and are waiting for you to dequeue. This number may grow at any | |
| 1294 | + * time, so this only informs of the lower-bound of available data. | |
| 1295 | + * | |
| 1296 | + * You may not queue or dequeue audio on a device that is using an | |
| 1297 | + * application-supplied callback; calling this function on such a device | |
| 1298 | + * always returns 0. You have to use the audio callback or queue audio, but | |
| 1299 | + * not both. | |
| 1300 | + * | |
| 1301 | + * You should not call SDL_LockAudio() on the device before querying; SDL | |
| 1302 | + * handles locking internally for this function. | |
| 1303 | + * | |
| 1304 | + * \param dev the device ID of which we will query queued audio size. | |
| 1305 | + * \returns the number of bytes (not samples!) of queued audio. | |
| 1306 | + * | |
| 1307 | + * \since This function is available since SDL 2.0.4. | |
| 1308 | + * | |
| 1309 | + * \sa SDL_ClearQueuedAudio | |
| 1310 | + * \sa SDL_QueueAudio | |
| 1311 | + * \sa SDL_DequeueAudio | |
| 1312 | + */ | |
| 1313 | +extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev); | |
| 1314 | + | |
| 1315 | +/** | |
| 1316 | + * Drop any queued audio data waiting to be sent to the hardware. | |
| 1317 | + * | |
| 1318 | + * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For | |
| 1319 | + * output devices, the hardware will start playing silence if more audio isn't | |
| 1320 | + * queued. For capture devices, the hardware will start filling the empty | |
| 1321 | + * queue with new data if the capture device isn't paused. | |
| 1322 | + * | |
| 1323 | + * This will not prevent playback of queued audio that's already been sent to | |
| 1324 | + * the hardware, as we can not undo that, so expect there to be some fraction | |
| 1325 | + * of a second of audio that might still be heard. This can be useful if you | |
| 1326 | + * want to, say, drop any pending music or any unprocessed microphone input | |
| 1327 | + * during a level change in your game. | |
| 1328 | + * | |
| 1329 | + * You may not queue or dequeue audio on a device that is using an | |
| 1330 | + * application-supplied callback; calling this function on such a device | |
| 1331 | + * always returns 0. You have to use the audio callback or queue audio, but | |
| 1332 | + * not both. | |
| 1333 | + * | |
| 1334 | + * You should not call SDL_LockAudio() on the device before clearing the | |
| 1335 | + * queue; SDL handles locking internally for this function. | |
| 1336 | + * | |
| 1337 | + * This function always succeeds and thus returns void. | |
| 1338 | + * | |
| 1339 | + * \param dev the device ID of which to clear the audio queue. | |
| 1340 | + * | |
| 1341 | + * \since This function is available since SDL 2.0.4. | |
| 1342 | + * | |
| 1343 | + * \sa SDL_GetQueuedAudioSize | |
| 1344 | + * \sa SDL_QueueAudio | |
| 1345 | + * \sa SDL_DequeueAudio | |
| 1346 | + */ | |
| 1347 | +extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev); | |
| 1348 | + | |
| 1349 | + | |
| 1350 | +/** | |
| 1351 | + * \name Audio lock functions | |
| 1352 | + * | |
| 1353 | + * The lock manipulated by these functions protects the callback function. | |
| 1354 | + * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that | |
| 1355 | + * the callback function is not running. Do not call these from the callback | |
| 1356 | + * function or you will cause deadlock. | |
| 1357 | + */ | |
| 1358 | +/* @{ */ | |
| 1359 | + | |
| 1360 | +/** | |
| 1361 | + * This function is a legacy means of locking the audio device. | |
| 1362 | + * | |
| 1363 | + * New programs might want to use SDL_LockAudioDevice() instead. This function | |
| 1364 | + * is equivalent to calling... | |
| 1365 | + * | |
| 1366 | + * ```c | |
| 1367 | + * SDL_LockAudioDevice(1); | |
| 1368 | + * ``` | |
| 1369 | + * | |
| 1370 | + * ...and is only useful if you used the legacy SDL_OpenAudio() function. | |
| 1371 | + * | |
| 1372 | + * \since This function is available since SDL 2.0.0. | |
| 1373 | + * | |
| 1374 | + * \sa SDL_LockAudioDevice | |
| 1375 | + * \sa SDL_UnlockAudio | |
| 1376 | + * \sa SDL_UnlockAudioDevice | |
| 1377 | + */ | |
| 1378 | +extern DECLSPEC void SDLCALL SDL_LockAudio(void); | |
| 1379 | + | |
| 1380 | +/** | |
| 1381 | + * Use this function to lock out the audio callback function for a specified | |
| 1382 | + * device. | |
| 1383 | + * | |
| 1384 | + * The lock manipulated by these functions protects the audio callback | |
| 1385 | + * function specified in SDL_OpenAudioDevice(). During a | |
| 1386 | + * SDL_LockAudioDevice()/SDL_UnlockAudioDevice() pair, you can be guaranteed | |
| 1387 | + * that the callback function for that device is not running, even if the | |
| 1388 | + * device is not paused. While a device is locked, any other unpaused, | |
| 1389 | + * unlocked devices may still run their callbacks. | |
| 1390 | + * | |
| 1391 | + * Calling this function from inside your audio callback is unnecessary. SDL | |
| 1392 | + * obtains this lock before calling your function, and releases it when the | |
| 1393 | + * function returns. | |
| 1394 | + * | |
| 1395 | + * You should not hold the lock longer than absolutely necessary. If you hold | |
| 1396 | + * it too long, you'll experience dropouts in your audio playback. Ideally, | |
| 1397 | + * your application locks the device, sets a few variables and unlocks again. | |
| 1398 | + * Do not do heavy work while holding the lock for a device. | |
| 1399 | + * | |
| 1400 | + * It is safe to lock the audio device multiple times, as long as you unlock | |
| 1401 | + * it an equivalent number of times. The callback will not run until the | |
| 1402 | + * device has been unlocked completely in this way. If your application fails | |
| 1403 | + * to unlock the device appropriately, your callback will never run, you might | |
| 1404 | + * hear repeating bursts of audio, and SDL_CloseAudioDevice() will probably | |
| 1405 | + * deadlock. | |
| 1406 | + * | |
| 1407 | + * Internally, the audio device lock is a mutex; if you lock from two threads | |
| 1408 | + * at once, not only will you block the audio callback, you'll block the other | |
| 1409 | + * thread. | |
| 1410 | + * | |
| 1411 | + * \param dev the ID of the device to be locked. | |
| 1412 | + * | |
| 1413 | + * \since This function is available since SDL 2.0.0. | |
| 1414 | + * | |
| 1415 | + * \sa SDL_UnlockAudioDevice | |
| 1416 | + */ | |
| 1417 | +extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev); | |
| 1418 | + | |
| 1419 | +/** | |
| 1420 | + * This function is a legacy means of unlocking the audio device. | |
| 1421 | + * | |
| 1422 | + * New programs might want to use SDL_UnlockAudioDevice() instead. This | |
| 1423 | + * function is equivalent to calling... | |
| 1424 | + * | |
| 1425 | + * ```c | |
| 1426 | + * SDL_UnlockAudioDevice(1); | |
| 1427 | + * ``` | |
| 1428 | + * | |
| 1429 | + * ...and is only useful if you used the legacy SDL_OpenAudio() function. | |
| 1430 | + * | |
| 1431 | + * \since This function is available since SDL 2.0.0. | |
| 1432 | + * | |
| 1433 | + * \sa SDL_LockAudio | |
| 1434 | + * \sa SDL_UnlockAudioDevice | |
| 1435 | + */ | |
| 1436 | +extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); | |
| 1437 | + | |
| 1438 | +/** | |
| 1439 | + * Use this function to unlock the audio callback function for a specified | |
| 1440 | + * device. | |
| 1441 | + * | |
| 1442 | + * This function should be paired with a previous SDL_LockAudioDevice() call. | |
| 1443 | + * | |
| 1444 | + * \param dev the ID of the device to be unlocked. | |
| 1445 | + * | |
| 1446 | + * \since This function is available since SDL 2.0.0. | |
| 1447 | + * | |
| 1448 | + * \sa SDL_LockAudioDevice | |
| 1449 | + */ | |
| 1450 | +extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); | |
| 1451 | +/* @} *//* Audio lock functions */ | |
| 1452 | + | |
| 1453 | +/** | |
| 1454 | + * This function is a legacy means of closing the audio device. | |
| 1455 | + * | |
| 1456 | + * This function is equivalent to calling... | |
| 1457 | + * | |
| 1458 | + * ```c | |
| 1459 | + * SDL_CloseAudioDevice(1); | |
| 1460 | + * ``` | |
| 1461 | + * | |
| 1462 | + * ...and is only useful if you used the legacy SDL_OpenAudio() function. | |
| 1463 | + * | |
| 1464 | + * \since This function is available since SDL 2.0.0. | |
| 1465 | + * | |
| 1466 | + * \sa SDL_OpenAudio | |
| 1467 | + */ | |
| 1468 | +extern DECLSPEC void SDLCALL SDL_CloseAudio(void); | |
| 1469 | + | |
| 1470 | +/** | |
| 1471 | + * Use this function to shut down audio processing and close the audio device. | |
| 1472 | + * | |
| 1473 | + * The application should close open audio devices once they are no longer | |
| 1474 | + * needed. Calling this function will wait until the device's audio callback | |
| 1475 | + * is not running, release the audio hardware and then clean up internal | |
| 1476 | + * state. No further audio will play from this device once this function | |
| 1477 | + * returns. | |
| 1478 | + * | |
| 1479 | + * This function may block briefly while pending audio data is played by the | |
| 1480 | + * hardware, so that applications don't drop the last buffer of data they | |
| 1481 | + * supplied. | |
| 1482 | + * | |
| 1483 | + * The device ID is invalid as soon as the device is closed, and is eligible | |
| 1484 | + * for reuse in a new SDL_OpenAudioDevice() call immediately. | |
| 1485 | + * | |
| 1486 | + * \param dev an audio device previously opened with SDL_OpenAudioDevice(). | |
| 1487 | + * | |
| 1488 | + * \since This function is available since SDL 2.0.0. | |
| 1489 | + * | |
| 1490 | + * \sa SDL_OpenAudioDevice | |
| 1491 | + */ | |
| 1492 | +extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); | |
| 1493 | + | |
| 1494 | +/* Ends C function definitions when using C++ */ | |
| 1495 | +#ifdef __cplusplus | |
| 1496 | +} | |
| 1497 | +#endif | |
| 1498 | +#include "close_code.h" | |
| 1499 | + | |
| 1500 | +#endif /* SDL_audio_h_ */ | |
| 1501 | + | |
| 1502 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,132 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryBits | |
| 24 | + * | |
| 25 | + * Functions for fiddling with bits and bitmasks. | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_bits_h_ | |
| 29 | +#define SDL_bits_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 | + * \file SDL_bits.h | |
| 41 | + */ | |
| 42 | + | |
| 43 | +/** | |
| 44 | + * Get the index of the most significant bit. Result is undefined when called | |
| 45 | + * with 0. This operation can also be stated as "count leading zeroes" and | |
| 46 | + * "log base 2". | |
| 47 | + * | |
| 48 | + * \return the index of the most significant bit, or -1 if the value is 0. | |
| 49 | + */ | |
| 50 | +#if defined(__WATCOMC__) && defined(__386__) | |
| 51 | +extern __inline int _SDL_bsr_watcom(Uint32); | |
| 52 | +#pragma aux _SDL_bsr_watcom = \ | |
| 53 | + "bsr eax, eax" \ | |
| 54 | + parm [eax] nomemory \ | |
| 55 | + value [eax] \ | |
| 56 | + modify exact [eax] nomemory; | |
| 57 | +#endif | |
| 58 | + | |
| 59 | +/** | |
| 60 | + * Use this function to get the index of the most significant (set) bit in a | |
| 61 | + * | |
| 62 | + * \param x the number to find the MSB of. | |
| 63 | + * \returns the index of the most significant bit of x, or -1 if x is 0. | |
| 64 | + */ | |
| 65 | +SDL_FORCE_INLINE int | |
| 66 | +SDL_MostSignificantBitIndex32(Uint32 x) | |
| 67 | +{ | |
| 68 | +#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
| 69 | + /* Count Leading Zeroes builtin in GCC. | |
| 70 | + * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html | |
| 71 | + */ | |
| 72 | + if (x == 0) { | |
| 73 | + return -1; | |
| 74 | + } | |
| 75 | + return 31 - __builtin_clz(x); | |
| 76 | +#elif defined(__WATCOMC__) && defined(__386__) | |
| 77 | + if (x == 0) { | |
| 78 | + return -1; | |
| 79 | + } | |
| 80 | + return _SDL_bsr_watcom(x); | |
| 81 | +#elif defined(_MSC_VER) | |
| 82 | + unsigned long index; | |
| 83 | + if (_BitScanReverse(&index, x)) { | |
| 84 | + return index; | |
| 85 | + } | |
| 86 | + return -1; | |
| 87 | +#else | |
| 88 | + /* Based off of Bit Twiddling Hacks by Sean Eron Anderson | |
| 89 | + * <seander@cs.stanford.edu>, released in the public domain. | |
| 90 | + * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog | |
| 91 | + */ | |
| 92 | + const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; | |
| 93 | + const int S[] = {1, 2, 4, 8, 16}; | |
| 94 | + | |
| 95 | + int msbIndex = 0; | |
| 96 | + int i; | |
| 97 | + | |
| 98 | + if (x == 0) { | |
| 99 | + return -1; | |
| 100 | + } | |
| 101 | + | |
| 102 | + for (i = 4; i >= 0; i--) | |
| 103 | + { | |
| 104 | + if (x & b[i]) | |
| 105 | + { | |
| 106 | + x >>= S[i]; | |
| 107 | + msbIndex |= S[i]; | |
| 108 | + } | |
| 109 | + } | |
| 110 | + | |
| 111 | + return msbIndex; | |
| 112 | +#endif | |
| 113 | +} | |
| 114 | + | |
| 115 | +SDL_FORCE_INLINE SDL_bool | |
| 116 | +SDL_HasExactlyOneBitSet32(Uint32 x) | |
| 117 | +{ | |
| 118 | + if (x && !(x & (x - 1))) { | |
| 119 | + return SDL_TRUE; | |
| 120 | + } | |
| 121 | + return SDL_FALSE; | |
| 122 | +} | |
| 123 | + | |
| 124 | +/* Ends C function definitions when using C++ */ | |
| 125 | +#ifdef __cplusplus | |
| 126 | +} | |
| 127 | +#endif | |
| 128 | +#include "close_code.h" | |
| 129 | + | |
| 130 | +#endif /* SDL_bits_h_ */ | |
| 131 | + | |
| 132 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,199 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryBlendmode | |
| 24 | + * | |
| 25 | + * Header file declaring the SDL_BlendMode enumeration | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_blendmode_h_ | |
| 29 | +#define SDL_blendmode_h_ | |
| 30 | + | |
| 31 | +#include "begin_code.h" | |
| 32 | +/* Set up for C function definitions, even when using C++ */ | |
| 33 | +#ifdef __cplusplus | |
| 34 | +extern "C" { | |
| 35 | +#endif | |
| 36 | + | |
| 37 | +/** | |
| 38 | + * The blend mode used in SDL_RenderCopy() and drawing operations. | |
| 39 | + */ | |
| 40 | +typedef enum SDL_BlendMode | |
| 41 | +{ | |
| 42 | + SDL_BLENDMODE_NONE = 0x00000000, /**< no blending | |
| 43 | + dstRGBA = srcRGBA */ | |
| 44 | + SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending | |
| 45 | + dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) | |
| 46 | + dstA = srcA + (dstA * (1-srcA)) */ | |
| 47 | + SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending | |
| 48 | + dstRGB = (srcRGB * srcA) + dstRGB | |
| 49 | + dstA = dstA */ | |
| 50 | + SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate | |
| 51 | + dstRGB = srcRGB * dstRGB | |
| 52 | + dstA = dstA */ | |
| 53 | + SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply | |
| 54 | + dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) | |
| 55 | + dstA = dstA */ | |
| 56 | + SDL_BLENDMODE_INVALID = 0x7FFFFFFF | |
| 57 | + | |
| 58 | + /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ | |
| 59 | + | |
| 60 | +} SDL_BlendMode; | |
| 61 | + | |
| 62 | +/** | |
| 63 | + * The blend operation used when combining source and destination pixel | |
| 64 | + * components | |
| 65 | + */ | |
| 66 | +typedef enum SDL_BlendOperation | |
| 67 | +{ | |
| 68 | + SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ | |
| 69 | + SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ | |
| 70 | + SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ | |
| 71 | + SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */ | |
| 72 | + SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */ | |
| 73 | +} SDL_BlendOperation; | |
| 74 | + | |
| 75 | +/** | |
| 76 | + * The normalized factor used to multiply pixel components | |
| 77 | + */ | |
| 78 | +typedef enum SDL_BlendFactor | |
| 79 | +{ | |
| 80 | + SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */ | |
| 81 | + SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */ | |
| 82 | + SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */ | |
| 83 | + SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */ | |
| 84 | + SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */ | |
| 85 | + SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */ | |
| 86 | + SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */ | |
| 87 | + SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */ | |
| 88 | + SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */ | |
| 89 | + SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */ | |
| 90 | +} SDL_BlendFactor; | |
| 91 | + | |
| 92 | +/** | |
| 93 | + * Compose a custom blend mode for renderers. | |
| 94 | + * | |
| 95 | + * The functions SDL_SetRenderDrawBlendMode and SDL_SetTextureBlendMode accept | |
| 96 | + * the SDL_BlendMode returned by this function if the renderer supports it. | |
| 97 | + * | |
| 98 | + * A blend mode controls how the pixels from a drawing operation (source) get | |
| 99 | + * combined with the pixels from the render target (destination). First, the | |
| 100 | + * components of the source and destination pixels get multiplied with their | |
| 101 | + * blend factors. Then, the blend operation takes the two products and | |
| 102 | + * calculates the result that will get stored in the render target. | |
| 103 | + * | |
| 104 | + * Expressed in pseudocode, it would look like this: | |
| 105 | + * | |
| 106 | + * ```c | |
| 107 | + * dstRGB = colorOperation(srcRGB * srcColorFactor, dstRGB * dstColorFactor); | |
| 108 | + * dstA = alphaOperation(srcA * srcAlphaFactor, dstA * dstAlphaFactor); | |
| 109 | + * ``` | |
| 110 | + * | |
| 111 | + * Where the functions `colorOperation(src, dst)` and `alphaOperation(src, | |
| 112 | + * dst)` can return one of the following: | |
| 113 | + * | |
| 114 | + * - `src + dst` | |
| 115 | + * - `src - dst` | |
| 116 | + * - `dst - src` | |
| 117 | + * - `min(src, dst)` | |
| 118 | + * - `max(src, dst)` | |
| 119 | + * | |
| 120 | + * The red, green, and blue components are always multiplied with the first, | |
| 121 | + * second, and third components of the SDL_BlendFactor, respectively. The | |
| 122 | + * fourth component is not used. | |
| 123 | + * | |
| 124 | + * The alpha component is always multiplied with the fourth component of the | |
| 125 | + * SDL_BlendFactor. The other components are not used in the alpha | |
| 126 | + * calculation. | |
| 127 | + * | |
| 128 | + * Support for these blend modes varies for each renderer. To check if a | |
| 129 | + * specific SDL_BlendMode is supported, create a renderer and pass it to | |
| 130 | + * either SDL_SetRenderDrawBlendMode or SDL_SetTextureBlendMode. They will | |
| 131 | + * return with an error if the blend mode is not supported. | |
| 132 | + * | |
| 133 | + * This list describes the support of custom blend modes for each renderer in | |
| 134 | + * SDL 2.0.6. All renderers support the four blend modes listed in the | |
| 135 | + * SDL_BlendMode enumeration. | |
| 136 | + * | |
| 137 | + * - **direct3d**: Supports all operations with all factors. However, some | |
| 138 | + * factors produce unexpected results with `SDL_BLENDOPERATION_MINIMUM` and | |
| 139 | + * `SDL_BLENDOPERATION_MAXIMUM`. | |
| 140 | + * - **direct3d11**: Same as Direct3D 9. | |
| 141 | + * - **opengl**: Supports the `SDL_BLENDOPERATION_ADD` operation with all | |
| 142 | + * factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly with SDL | |
| 143 | + * 2.0.6. | |
| 144 | + * - **opengles**: Supports the `SDL_BLENDOPERATION_ADD` operation with all | |
| 145 | + * factors. Color and alpha factors need to be the same. OpenGL ES 1 | |
| 146 | + * implementation specific: May also support `SDL_BLENDOPERATION_SUBTRACT` | |
| 147 | + * and `SDL_BLENDOPERATION_REV_SUBTRACT`. May support color and alpha | |
| 148 | + * operations being different from each other. May support color and alpha | |
| 149 | + * factors being different from each other. | |
| 150 | + * - **opengles2**: Supports the `SDL_BLENDOPERATION_ADD`, | |
| 151 | + * `SDL_BLENDOPERATION_SUBTRACT`, `SDL_BLENDOPERATION_REV_SUBTRACT` | |
| 152 | + * operations with all factors. | |
| 153 | + * - **psp**: No custom blend mode support. | |
| 154 | + * - **software**: No custom blend mode support. | |
| 155 | + * | |
| 156 | + * Some renderers do not provide an alpha component for the default render | |
| 157 | + * target. The `SDL_BLENDFACTOR_DST_ALPHA` and | |
| 158 | + * `SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA` factors do not have an effect in this | |
| 159 | + * case. | |
| 160 | + * | |
| 161 | + * \param srcColorFactor the SDL_BlendFactor applied to the red, green, and | |
| 162 | + * blue components of the source pixels. | |
| 163 | + * \param dstColorFactor the SDL_BlendFactor applied to the red, green, and | |
| 164 | + * blue components of the destination pixels. | |
| 165 | + * \param colorOperation the SDL_BlendOperation used to combine the red, | |
| 166 | + * green, and blue components of the source and | |
| 167 | + * destination pixels. | |
| 168 | + * \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of | |
| 169 | + * the source pixels. | |
| 170 | + * \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of | |
| 171 | + * the destination pixels. | |
| 172 | + * \param alphaOperation the SDL_BlendOperation used to combine the alpha | |
| 173 | + * component of the source and destination pixels. | |
| 174 | + * \returns an SDL_BlendMode that represents the chosen factors and | |
| 175 | + * operations. | |
| 176 | + * | |
| 177 | + * \since This function is available since SDL 2.0.6. | |
| 178 | + * | |
| 179 | + * \sa SDL_SetRenderDrawBlendMode | |
| 180 | + * \sa SDL_GetRenderDrawBlendMode | |
| 181 | + * \sa SDL_SetTextureBlendMode | |
| 182 | + * \sa SDL_GetTextureBlendMode | |
| 183 | + */ | |
| 184 | +extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, | |
| 185 | + SDL_BlendFactor dstColorFactor, | |
| 186 | + SDL_BlendOperation colorOperation, | |
| 187 | + SDL_BlendFactor srcAlphaFactor, | |
| 188 | + SDL_BlendFactor dstAlphaFactor, | |
| 189 | + SDL_BlendOperation alphaOperation); | |
| 190 | + | |
| 191 | +/* Ends C function definitions when using C++ */ | |
| 192 | +#ifdef __cplusplus | |
| 193 | +} | |
| 194 | +#endif | |
| 195 | +#include "close_code.h" | |
| 196 | + | |
| 197 | +#endif /* SDL_blendmode_h_ */ | |
| 198 | + | |
| 199 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,141 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryClipboard | |
| 24 | + * | |
| 25 | + * Include file for SDL clipboard handling | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_clipboard_h_ | |
| 29 | +#define SDL_clipboard_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 | +/* Function prototypes */ | |
| 40 | + | |
| 41 | +/** | |
| 42 | + * Put UTF-8 text into the clipboard. | |
| 43 | + * | |
| 44 | + * \param text the text to store in the clipboard. | |
| 45 | + * \returns 0 on success or a negative error code on failure; call | |
| 46 | + * SDL_GetError() for more information. | |
| 47 | + * | |
| 48 | + * \since This function is available since SDL 2.0.0. | |
| 49 | + * | |
| 50 | + * \sa SDL_GetClipboardText | |
| 51 | + * \sa SDL_HasClipboardText | |
| 52 | + */ | |
| 53 | +extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); | |
| 54 | + | |
| 55 | +/** | |
| 56 | + * Get UTF-8 text from the clipboard, which must be freed with SDL_free(). | |
| 57 | + * | |
| 58 | + * This functions returns empty string if there was not enough memory left for | |
| 59 | + * a copy of the clipboard's content. | |
| 60 | + * | |
| 61 | + * \returns the clipboard text on success or an empty string on failure; call | |
| 62 | + * SDL_GetError() for more information. Caller must call SDL_free() | |
| 63 | + * on the returned pointer when done with it (even if there was an | |
| 64 | + * error). | |
| 65 | + * | |
| 66 | + * \since This function is available since SDL 2.0.0. | |
| 67 | + * | |
| 68 | + * \sa SDL_HasClipboardText | |
| 69 | + * \sa SDL_SetClipboardText | |
| 70 | + */ | |
| 71 | +extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); | |
| 72 | + | |
| 73 | +/** | |
| 74 | + * Query whether the clipboard exists and contains a non-empty text string. | |
| 75 | + * | |
| 76 | + * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not. | |
| 77 | + * | |
| 78 | + * \since This function is available since SDL 2.0.0. | |
| 79 | + * | |
| 80 | + * \sa SDL_GetClipboardText | |
| 81 | + * \sa SDL_SetClipboardText | |
| 82 | + */ | |
| 83 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); | |
| 84 | + | |
| 85 | +/** | |
| 86 | + * Put UTF-8 text into the primary selection. | |
| 87 | + * | |
| 88 | + * \param text the text to store in the primary selection. | |
| 89 | + * \returns 0 on success or a negative error code on failure; call | |
| 90 | + * SDL_GetError() for more information. | |
| 91 | + * | |
| 92 | + * \since This function is available since SDL 2.26.0. | |
| 93 | + * | |
| 94 | + * \sa SDL_GetPrimarySelectionText | |
| 95 | + * \sa SDL_HasPrimarySelectionText | |
| 96 | + */ | |
| 97 | +extern DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); | |
| 98 | + | |
| 99 | +/** | |
| 100 | + * Get UTF-8 text from the primary selection, which must be freed with | |
| 101 | + * SDL_free(). | |
| 102 | + * | |
| 103 | + * This functions returns empty string if there was not enough memory left for | |
| 104 | + * a copy of the primary selection's content. | |
| 105 | + * | |
| 106 | + * \returns the primary selection text on success or an empty string on | |
| 107 | + * failure; call SDL_GetError() for more information. Caller must | |
| 108 | + * call SDL_free() on the returned pointer when done with it (even if | |
| 109 | + * there was an error). | |
| 110 | + * | |
| 111 | + * \since This function is available since SDL 2.26.0. | |
| 112 | + * | |
| 113 | + * \sa SDL_HasPrimarySelectionText | |
| 114 | + * \sa SDL_SetPrimarySelectionText | |
| 115 | + */ | |
| 116 | +extern DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); | |
| 117 | + | |
| 118 | +/** | |
| 119 | + * Query whether the primary selection exists and contains a non-empty text | |
| 120 | + * string. | |
| 121 | + * | |
| 122 | + * \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it | |
| 123 | + * does not. | |
| 124 | + * | |
| 125 | + * \since This function is available since SDL 2.26.0. | |
| 126 | + * | |
| 127 | + * \sa SDL_GetPrimarySelectionText | |
| 128 | + * \sa SDL_SetPrimarySelectionText | |
| 129 | + */ | |
| 130 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasPrimarySelectionText(void); | |
| 131 | + | |
| 132 | + | |
| 133 | +/* Ends C function definitions when using C++ */ | |
| 134 | +#ifdef __cplusplus | |
| 135 | +} | |
| 136 | +#endif | |
| 137 | +#include "close_code.h" | |
| 138 | + | |
| 139 | +#endif /* SDL_clipboard_h_ */ | |
| 140 | + | |
| 141 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,59 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_h_ | |
| 23 | +#define SDL_config_h_ | |
| 24 | + | |
| 25 | +#include "SDL_platform.h" | |
| 26 | + | |
| 27 | +/* WIKI CATEGORY: - */ | |
| 28 | + | |
| 29 | +/* Add any platform that doesn't build using the configure system. */ | |
| 30 | +#if defined(__WIN32__) | |
| 31 | +#include "SDL_config_windows.h" | |
| 32 | +#elif defined(__WINRT__) | |
| 33 | +#include "SDL_config_winrt.h" | |
| 34 | +#elif defined(__WINGDK__) | |
| 35 | +#include "SDL_config_wingdk.h" | |
| 36 | +#elif defined(__XBOXONE__) || defined(__XBOXSERIES__) | |
| 37 | +#include "SDL_config_xbox.h" | |
| 38 | +#elif defined(__MACOSX__) | |
| 39 | +#include "SDL_config_macosx.h" | |
| 40 | +#elif defined(__IPHONEOS__) | |
| 41 | +#include "SDL_config_iphoneos.h" | |
| 42 | +#elif defined(__ANDROID__) | |
| 43 | +#include "SDL_config_android.h" | |
| 44 | +#elif defined(__OS2__) | |
| 45 | +#include "SDL_config_os2.h" | |
| 46 | +#elif defined(__EMSCRIPTEN__) | |
| 47 | +#include "SDL_config_emscripten.h" | |
| 48 | +#elif defined(__NGAGE__) | |
| 49 | +#include "SDL_config_ngage.h" | |
| 50 | +#else | |
| 51 | +/* This is a minimal configuration just to get SDL running on new platforms. */ | |
| 52 | +#include "SDL_config_minimal.h" | |
| 53 | +#endif /* platform config */ | |
| 54 | + | |
| 55 | +#ifdef USING_GENERATED_CONFIG_H | |
| 56 | +#error Wrong SDL_config.h, check your include path? | |
| 57 | +#endif | |
| 58 | + | |
| 59 | +#endif /* SDL_config_h_ */ |
| @@ -0,0 +1,194 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_android_h_ | |
| 23 | +#define SDL_config_android_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +#include "SDL_platform.h" | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * \file SDL_config_android.h | |
| 30 | + * | |
| 31 | + * This is a configuration that can be used to build SDL for Android | |
| 32 | + */ | |
| 33 | + | |
| 34 | +#include <stdarg.h> | |
| 35 | + | |
| 36 | +#define HAVE_GCC_ATOMICS 1 | |
| 37 | + | |
| 38 | +#define STDC_HEADERS 1 | |
| 39 | +#define HAVE_ALLOCA_H 1 | |
| 40 | +#define HAVE_CTYPE_H 1 | |
| 41 | +#define HAVE_INTTYPES_H 1 | |
| 42 | +#define HAVE_LIMITS_H 1 | |
| 43 | +#define HAVE_MATH_H 1 | |
| 44 | +#define HAVE_SIGNAL_H 1 | |
| 45 | +#define HAVE_STDINT_H 1 | |
| 46 | +#define HAVE_STDIO_H 1 | |
| 47 | +#define HAVE_STRING_H 1 | |
| 48 | +#define HAVE_SYS_TYPES_H 1 | |
| 49 | + | |
| 50 | +/* C library functions */ | |
| 51 | +#define HAVE_DLOPEN 1 | |
| 52 | +#define HAVE_MALLOC 1 | |
| 53 | +#define HAVE_CALLOC 1 | |
| 54 | +#define HAVE_REALLOC 1 | |
| 55 | +#define HAVE_FREE 1 | |
| 56 | +#define HAVE_ALLOCA 1 | |
| 57 | +#define HAVE_GETENV 1 | |
| 58 | +#define HAVE_SETENV 1 | |
| 59 | +#define HAVE_PUTENV 1 | |
| 60 | +#define HAVE_SETENV 1 | |
| 61 | +#define HAVE_UNSETENV 1 | |
| 62 | +#define HAVE_QSORT 1 | |
| 63 | +#define HAVE_BSEARCH 1 | |
| 64 | +#define HAVE_ABS 1 | |
| 65 | +#define HAVE_BCOPY 1 | |
| 66 | +#define HAVE_MEMSET 1 | |
| 67 | +#define HAVE_MEMCPY 1 | |
| 68 | +#define HAVE_MEMMOVE 1 | |
| 69 | +#define HAVE_MEMCMP 1 | |
| 70 | +#define HAVE_STRLEN 1 | |
| 71 | +#define HAVE_STRLCPY 1 | |
| 72 | +#define HAVE_STRLCAT 1 | |
| 73 | +#define HAVE_STRCHR 1 | |
| 74 | +#define HAVE_STRRCHR 1 | |
| 75 | +#define HAVE_STRSTR 1 | |
| 76 | +#define HAVE_STRTOK_R 1 | |
| 77 | +#define HAVE_STRTOL 1 | |
| 78 | +#define HAVE_STRTOUL 1 | |
| 79 | +#define HAVE_STRTOLL 1 | |
| 80 | +#define HAVE_STRTOULL 1 | |
| 81 | +#define HAVE_STRTOD 1 | |
| 82 | +#define HAVE_ATOI 1 | |
| 83 | +#define HAVE_ATOF 1 | |
| 84 | +#define HAVE_STRCMP 1 | |
| 85 | +#define HAVE_STRNCMP 1 | |
| 86 | +#define HAVE_STRCASECMP 1 | |
| 87 | +#define HAVE_STRNCASECMP 1 | |
| 88 | +#define HAVE_STRCASESTR 1 | |
| 89 | +#define HAVE_VSSCANF 1 | |
| 90 | +#define HAVE_VSNPRINTF 1 | |
| 91 | +#define HAVE_ACOS 1 | |
| 92 | +#define HAVE_ACOSF 1 | |
| 93 | +#define HAVE_ASIN 1 | |
| 94 | +#define HAVE_ASINF 1 | |
| 95 | +#define HAVE_ATAN 1 | |
| 96 | +#define HAVE_ATANF 1 | |
| 97 | +#define HAVE_ATAN2 1 | |
| 98 | +#define HAVE_ATAN2F 1 | |
| 99 | +#define HAVE_CEIL 1 | |
| 100 | +#define HAVE_CEILF 1 | |
| 101 | +#define HAVE_COPYSIGN 1 | |
| 102 | +#define HAVE_COPYSIGNF 1 | |
| 103 | +#define HAVE_COS 1 | |
| 104 | +#define HAVE_COSF 1 | |
| 105 | +#define HAVE_EXP 1 | |
| 106 | +#define HAVE_EXPF 1 | |
| 107 | +#define HAVE_FABS 1 | |
| 108 | +#define HAVE_FABSF 1 | |
| 109 | +#define HAVE_FLOOR 1 | |
| 110 | +#define HAVE_FLOORF 1 | |
| 111 | +#define HAVE_FMOD 1 | |
| 112 | +#define HAVE_FMODF 1 | |
| 113 | +#define HAVE_LOG 1 | |
| 114 | +#define HAVE_LOGF 1 | |
| 115 | +#define HAVE_LOG10 1 | |
| 116 | +#define HAVE_LOG10F 1 | |
| 117 | +#define HAVE_LROUND 1 | |
| 118 | +#define HAVE_LROUNDF 1 | |
| 119 | +#define HAVE_POW 1 | |
| 120 | +#define HAVE_POWF 1 | |
| 121 | +#define HAVE_ROUND 1 | |
| 122 | +#define HAVE_ROUNDF 1 | |
| 123 | +#define HAVE_SCALBN 1 | |
| 124 | +#define HAVE_SCALBNF 1 | |
| 125 | +#define HAVE_SIN 1 | |
| 126 | +#define HAVE_SINF 1 | |
| 127 | +#define HAVE_SQRT 1 | |
| 128 | +#define HAVE_SQRTF 1 | |
| 129 | +#define HAVE_TAN 1 | |
| 130 | +#define HAVE_TANF 1 | |
| 131 | +#define HAVE_TRUNC 1 | |
| 132 | +#define HAVE_TRUNCF 1 | |
| 133 | +#define HAVE_SIGACTION 1 | |
| 134 | +#define HAVE_SETJMP 1 | |
| 135 | +#define HAVE_NANOSLEEP 1 | |
| 136 | +#define HAVE_SYSCONF 1 | |
| 137 | +#define HAVE_CLOCK_GETTIME 1 | |
| 138 | + | |
| 139 | +#ifdef __LP64__ | |
| 140 | +#define SIZEOF_VOIDP 8 | |
| 141 | +#else | |
| 142 | +#define SIZEOF_VOIDP 4 | |
| 143 | +#endif | |
| 144 | + | |
| 145 | +/* Enable various audio drivers */ | |
| 146 | +#define SDL_AUDIO_DRIVER_ANDROID 1 | |
| 147 | +#define SDL_AUDIO_DRIVER_OPENSLES 1 | |
| 148 | +#define SDL_AUDIO_DRIVER_AAUDIO 1 | |
| 149 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 150 | + | |
| 151 | +/* Enable various input drivers */ | |
| 152 | +#define SDL_JOYSTICK_ANDROID 1 | |
| 153 | +#define SDL_JOYSTICK_HIDAPI 1 | |
| 154 | +#define SDL_JOYSTICK_VIRTUAL 1 | |
| 155 | +#define SDL_HAPTIC_ANDROID 1 | |
| 156 | + | |
| 157 | +/* Enable sensor driver */ | |
| 158 | +#define SDL_SENSOR_ANDROID 1 | |
| 159 | + | |
| 160 | +/* Enable various shared object loading systems */ | |
| 161 | +#define SDL_LOADSO_DLOPEN 1 | |
| 162 | + | |
| 163 | +/* Enable various threading systems */ | |
| 164 | +#define SDL_THREAD_PTHREAD 1 | |
| 165 | +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 | |
| 166 | + | |
| 167 | +/* Enable various timer systems */ | |
| 168 | +#define SDL_TIMER_UNIX 1 | |
| 169 | + | |
| 170 | +/* Enable various video drivers */ | |
| 171 | +#define SDL_VIDEO_DRIVER_ANDROID 1 | |
| 172 | + | |
| 173 | +/* Enable OpenGL ES */ | |
| 174 | +#define SDL_VIDEO_OPENGL_ES 1 | |
| 175 | +#define SDL_VIDEO_OPENGL_ES2 1 | |
| 176 | +#define SDL_VIDEO_OPENGL_EGL 1 | |
| 177 | +#define SDL_VIDEO_RENDER_OGL_ES 1 | |
| 178 | +#define SDL_VIDEO_RENDER_OGL_ES2 1 | |
| 179 | + | |
| 180 | +/* Enable Vulkan support */ | |
| 181 | +/* Android does not support Vulkan in native code using the "armeabi" ABI. */ | |
| 182 | +#if defined(__ARM_ARCH) && __ARM_ARCH < 7 | |
| 183 | +#define SDL_VIDEO_VULKAN 0 | |
| 184 | +#else | |
| 185 | +#define SDL_VIDEO_VULKAN 1 | |
| 186 | +#endif | |
| 187 | + | |
| 188 | +/* Enable system power support */ | |
| 189 | +#define SDL_POWER_ANDROID 1 | |
| 190 | + | |
| 191 | +/* Enable the filesystem driver */ | |
| 192 | +#define SDL_FILESYSTEM_ANDROID 1 | |
| 193 | + | |
| 194 | +#endif /* SDL_config_android_h_ */ |
| @@ -0,0 +1,218 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_emscripten_h_ | |
| 23 | +#define _SDL_config_emscripten_h_ | |
| 24 | + | |
| 25 | +#include "SDL_platform.h" | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * \file SDL_config_emscripten.h | |
| 29 | + * | |
| 30 | + * This is a configuration that can be used to build SDL for Emscripten. | |
| 31 | + */ | |
| 32 | + | |
| 33 | +#ifdef __LP64__ | |
| 34 | +#define SIZEOF_VOIDP 8 | |
| 35 | +#else | |
| 36 | +#define SIZEOF_VOIDP 4 | |
| 37 | +#endif | |
| 38 | +#define HAVE_GCC_ATOMICS 1 | |
| 39 | + | |
| 40 | +/* Useful headers */ | |
| 41 | +#define STDC_HEADERS 1 | |
| 42 | +#define HAVE_ALLOCA_H 1 | |
| 43 | +#define HAVE_CTYPE_H 1 | |
| 44 | +#define HAVE_ICONV_H 1 | |
| 45 | +#define HAVE_INTTYPES_H 1 | |
| 46 | +#define HAVE_LIMITS_H 1 | |
| 47 | +#define HAVE_MALLOC_H 1 | |
| 48 | +#define HAVE_MATH_H 1 | |
| 49 | +#define HAVE_MEMORY_H 1 | |
| 50 | +#define HAVE_SIGNAL_H 1 | |
| 51 | +#define HAVE_STDARG_H 1 | |
| 52 | +#define HAVE_STDINT_H 1 | |
| 53 | +#define HAVE_STDIO_H 1 | |
| 54 | +#define HAVE_STDLIB_H 1 | |
| 55 | +#define HAVE_STRINGS_H 1 | |
| 56 | +#define HAVE_STRING_H 1 | |
| 57 | +#define HAVE_SYS_TYPES_H 1 | |
| 58 | +#define HAVE_WCHAR_H 1 | |
| 59 | + | |
| 60 | +/* C library functions */ | |
| 61 | +#define HAVE_DLOPEN 1 | |
| 62 | +#define HAVE_MALLOC 1 | |
| 63 | +#define HAVE_CALLOC 1 | |
| 64 | +#define HAVE_REALLOC 1 | |
| 65 | +#define HAVE_FREE 1 | |
| 66 | +#define HAVE_ALLOCA 1 | |
| 67 | +#define HAVE_GETENV 1 | |
| 68 | +#define HAVE_SETENV 1 | |
| 69 | +#define HAVE_PUTENV 1 | |
| 70 | +#define HAVE_UNSETENV 1 | |
| 71 | +#define HAVE_QSORT 1 | |
| 72 | +#define HAVE_BSEARCH 1 | |
| 73 | +#define HAVE_ABS 1 | |
| 74 | +#define HAVE_BCOPY 1 | |
| 75 | +#define HAVE_MEMSET 1 | |
| 76 | +#define HAVE_MEMCPY 1 | |
| 77 | +#define HAVE_MEMMOVE 1 | |
| 78 | +#define HAVE_MEMCMP 1 | |
| 79 | +#define HAVE_WCSLEN 1 | |
| 80 | +#define HAVE_WCSDUP 1 | |
| 81 | +#define HAVE_WCSSTR 1 | |
| 82 | +#define HAVE_WCSCMP 1 | |
| 83 | +#define HAVE_WCSNCMP 1 | |
| 84 | +#define HAVE_WCSCASECMP 1 | |
| 85 | +#define HAVE_WCSNCASECMP 1 | |
| 86 | +#define HAVE_STRLEN 1 | |
| 87 | +#define HAVE_STRLCPY 1 | |
| 88 | +#define HAVE_STRLCAT 1 | |
| 89 | +#define HAVE_STRCHR 1 | |
| 90 | +#define HAVE_STRRCHR 1 | |
| 91 | +#define HAVE_STRSTR 1 | |
| 92 | +#define HAVE_STRTOK_R 1 | |
| 93 | +#define HAVE_STRTOL 1 | |
| 94 | +#define HAVE_STRTOUL 1 | |
| 95 | +#define HAVE_STRTOLL 1 | |
| 96 | +#define HAVE_STRTOULL 1 | |
| 97 | +#define HAVE_STRTOD 1 | |
| 98 | +#define HAVE_ATOI 1 | |
| 99 | +#define HAVE_ATOF 1 | |
| 100 | +#define HAVE_STRCMP 1 | |
| 101 | +#define HAVE_STRNCMP 1 | |
| 102 | +#define HAVE_STRCASECMP 1 | |
| 103 | +#define HAVE_STRNCASECMP 1 | |
| 104 | +#define HAVE_SSCANF 1 | |
| 105 | +#define HAVE_VSSCANF 1 | |
| 106 | +#define HAVE_VSNPRINTF 1 | |
| 107 | +#define HAVE_M_PI 1 | |
| 108 | +#define HAVE_ACOS 1 | |
| 109 | +#define HAVE_ACOSF 1 | |
| 110 | +#define HAVE_ASIN 1 | |
| 111 | +#define HAVE_ASINF 1 | |
| 112 | +#define HAVE_ATAN 1 | |
| 113 | +#define HAVE_ATANF 1 | |
| 114 | +#define HAVE_ATAN2 1 | |
| 115 | +#define HAVE_ATAN2F 1 | |
| 116 | +#define HAVE_CEIL 1 | |
| 117 | +#define HAVE_CEILF 1 | |
| 118 | +#define HAVE_COPYSIGN 1 | |
| 119 | +#define HAVE_COPYSIGNF 1 | |
| 120 | +#define HAVE_COS 1 | |
| 121 | +#define HAVE_COSF 1 | |
| 122 | +#define HAVE_EXP 1 | |
| 123 | +#define HAVE_EXPF 1 | |
| 124 | +#define HAVE_FABS 1 | |
| 125 | +#define HAVE_FABSF 1 | |
| 126 | +#define HAVE_FLOOR 1 | |
| 127 | +#define HAVE_FLOORF 1 | |
| 128 | +#define HAVE_FMOD 1 | |
| 129 | +#define HAVE_FMODF 1 | |
| 130 | +#define HAVE_LOG 1 | |
| 131 | +#define HAVE_LOGF 1 | |
| 132 | +#define HAVE_LOG10 1 | |
| 133 | +#define HAVE_LOG10F 1 | |
| 134 | +#define HAVE_LROUND 1 | |
| 135 | +#define HAVE_LROUNDF 1 | |
| 136 | +#define HAVE_POW 1 | |
| 137 | +#define HAVE_POWF 1 | |
| 138 | +#define HAVE_ROUND 1 | |
| 139 | +#define HAVE_ROUNDF 1 | |
| 140 | +#define HAVE_SCALBN 1 | |
| 141 | +#define HAVE_SCALBNF 1 | |
| 142 | +#define HAVE_SIN 1 | |
| 143 | +#define HAVE_SINF 1 | |
| 144 | +#define HAVE_SQRT 1 | |
| 145 | +#define HAVE_SQRTF 1 | |
| 146 | +#define HAVE_TAN 1 | |
| 147 | +#define HAVE_TANF 1 | |
| 148 | +#define HAVE_TRUNC 1 | |
| 149 | +#define HAVE_TRUNCF 1 | |
| 150 | +#define HAVE_FSEEKO 1 | |
| 151 | +#define HAVE_FSEEKO64 1 | |
| 152 | +#define HAVE_SIGACTION 1 | |
| 153 | +#define HAVE_SA_SIGACTION 1 | |
| 154 | +#define HAVE_SETJMP 1 | |
| 155 | +#define HAVE_NANOSLEEP 1 | |
| 156 | +#define HAVE_SYSCONF 1 | |
| 157 | +#define HAVE_CLOCK_GETTIME 1 | |
| 158 | +/* #undef HAVE_GETPAGESIZE */ | |
| 159 | +#define HAVE_MPROTECT 1 | |
| 160 | +#define HAVE_ICONV 1 | |
| 161 | + | |
| 162 | +/* SDL internal assertion support */ | |
| 163 | +/* #undef SDL_DEFAULT_ASSERT_LEVEL */ | |
| 164 | + | |
| 165 | +#define SDL_CPUINFO_DISABLED 1 | |
| 166 | +#define SDL_HAPTIC_DISABLED 1 | |
| 167 | +#define SDL_HIDAPI_DISABLED 1 | |
| 168 | +#ifndef __EMSCRIPTEN_PTHREADS__ | |
| 169 | +#define SDL_THREADS_DISABLED 1 | |
| 170 | +#endif | |
| 171 | + | |
| 172 | +/* Enable various audio drivers */ | |
| 173 | +#define SDL_AUDIO_DRIVER_DISK 1 | |
| 174 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 175 | +#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1 | |
| 176 | + | |
| 177 | +/* Enable various input drivers */ | |
| 178 | +#define SDL_JOYSTICK_EMSCRIPTEN 1 | |
| 179 | + | |
| 180 | +/* Enable various sensor drivers */ | |
| 181 | +#define SDL_SENSOR_DUMMY 1 | |
| 182 | + | |
| 183 | +/* Enable various shared object loading systems */ | |
| 184 | +#define SDL_LOADSO_DLOPEN 1 | |
| 185 | + | |
| 186 | +/* Enable various threading systems */ | |
| 187 | +#ifdef __EMSCRIPTEN_PTHREADS__ | |
| 188 | +#define SDL_THREAD_PTHREAD 1 | |
| 189 | +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 | |
| 190 | +#endif | |
| 191 | + | |
| 192 | +/* Enable various timer systems */ | |
| 193 | +#define SDL_TIMER_UNIX 1 | |
| 194 | + | |
| 195 | +/* Enable various video drivers */ | |
| 196 | +#define SDL_VIDEO_DRIVER_EMSCRIPTEN 1 | |
| 197 | + | |
| 198 | +#define SDL_VIDEO_RENDER_OGL_ES2 1 | |
| 199 | + | |
| 200 | +/* Enable OpenGL support */ | |
| 201 | +/* #undef SDL_VIDEO_OPENGL */ | |
| 202 | +/* #undef SDL_VIDEO_OPENGL_ES */ | |
| 203 | +#define SDL_VIDEO_OPENGL_ES2 1 | |
| 204 | +/* #undef SDL_VIDEO_OPENGL_BGL */ | |
| 205 | +/* #undef SDL_VIDEO_OPENGL_CGL */ | |
| 206 | +/* #undef SDL_VIDEO_OPENGL_GLX */ | |
| 207 | +/* #undef SDL_VIDEO_OPENGL_WGL */ | |
| 208 | +#define SDL_VIDEO_OPENGL_EGL 1 | |
| 209 | +/* #undef SDL_VIDEO_OPENGL_OSMESA */ | |
| 210 | +/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ | |
| 211 | + | |
| 212 | +/* Enable system power support */ | |
| 213 | +#define SDL_POWER_EMSCRIPTEN 1 | |
| 214 | + | |
| 215 | +/* Enable system filesystem support */ | |
| 216 | +#define SDL_FILESYSTEM_EMSCRIPTEN 1 | |
| 217 | + | |
| 218 | +#endif /* _SDL_config_emscripten_h_ */ |
| @@ -0,0 +1,217 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_iphoneos_h_ | |
| 23 | +#define SDL_config_iphoneos_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +#include "SDL_platform.h" | |
| 27 | + | |
| 28 | +#ifdef __LP64__ | |
| 29 | +#define SIZEOF_VOIDP 8 | |
| 30 | +#else | |
| 31 | +#define SIZEOF_VOIDP 4 | |
| 32 | +#endif | |
| 33 | + | |
| 34 | +#define HAVE_GCC_ATOMICS 1 | |
| 35 | + | |
| 36 | +#define STDC_HEADERS 1 | |
| 37 | +#define HAVE_ALLOCA_H 1 | |
| 38 | +#define HAVE_CTYPE_H 1 | |
| 39 | +#define HAVE_INTTYPES_H 1 | |
| 40 | +#define HAVE_LIMITS_H 1 | |
| 41 | +#define HAVE_MATH_H 1 | |
| 42 | +#define HAVE_SIGNAL_H 1 | |
| 43 | +#define HAVE_STDINT_H 1 | |
| 44 | +#define HAVE_STDIO_H 1 | |
| 45 | +#define HAVE_STRING_H 1 | |
| 46 | +#define HAVE_SYS_TYPES_H 1 | |
| 47 | +/* The libunwind functions are only available on x86 */ | |
| 48 | +/* #undef HAVE_LIBUNWIND_H */ | |
| 49 | + | |
| 50 | +/* C library functions */ | |
| 51 | +#define HAVE_DLOPEN 1 | |
| 52 | +#define HAVE_MALLOC 1 | |
| 53 | +#define HAVE_CALLOC 1 | |
| 54 | +#define HAVE_REALLOC 1 | |
| 55 | +#define HAVE_FREE 1 | |
| 56 | +#define HAVE_ALLOCA 1 | |
| 57 | +#define HAVE_GETENV 1 | |
| 58 | +#define HAVE_SETENV 1 | |
| 59 | +#define HAVE_PUTENV 1 | |
| 60 | +#define HAVE_SETENV 1 | |
| 61 | +#define HAVE_UNSETENV 1 | |
| 62 | +#define HAVE_QSORT 1 | |
| 63 | +#define HAVE_BSEARCH 1 | |
| 64 | +#define HAVE_ABS 1 | |
| 65 | +#define HAVE_BCOPY 1 | |
| 66 | +#define HAVE_MEMSET 1 | |
| 67 | +#define HAVE_MEMCPY 1 | |
| 68 | +#define HAVE_MEMMOVE 1 | |
| 69 | +#define HAVE_MEMCMP 1 | |
| 70 | +#define HAVE_STRLEN 1 | |
| 71 | +#define HAVE_STRLCPY 1 | |
| 72 | +#define HAVE_STRLCAT 1 | |
| 73 | +#define HAVE_STRCHR 1 | |
| 74 | +#define HAVE_STRRCHR 1 | |
| 75 | +#define HAVE_STRSTR 1 | |
| 76 | +#define HAVE_STRTOK_R 1 | |
| 77 | +#define HAVE_STRTOL 1 | |
| 78 | +#define HAVE_STRTOUL 1 | |
| 79 | +#define HAVE_STRTOLL 1 | |
| 80 | +#define HAVE_STRTOULL 1 | |
| 81 | +#define HAVE_STRTOD 1 | |
| 82 | +#define HAVE_ATOI 1 | |
| 83 | +#define HAVE_ATOF 1 | |
| 84 | +#define HAVE_STRCMP 1 | |
| 85 | +#define HAVE_STRNCMP 1 | |
| 86 | +#define HAVE_STRCASECMP 1 | |
| 87 | +#define HAVE_STRNCASECMP 1 | |
| 88 | +#define HAVE_STRCASESTR 1 | |
| 89 | +#define HAVE_VSSCANF 1 | |
| 90 | +#define HAVE_VSNPRINTF 1 | |
| 91 | +#define HAVE_M_PI 1 | |
| 92 | +#define HAVE_ACOS 1 | |
| 93 | +#define HAVE_ACOSF 1 | |
| 94 | +#define HAVE_ASIN 1 | |
| 95 | +#define HAVE_ASINF 1 | |
| 96 | +#define HAVE_ATAN 1 | |
| 97 | +#define HAVE_ATANF 1 | |
| 98 | +#define HAVE_ATAN2 1 | |
| 99 | +#define HAVE_ATAN2F 1 | |
| 100 | +#define HAVE_CEIL 1 | |
| 101 | +#define HAVE_CEILF 1 | |
| 102 | +#define HAVE_COPYSIGN 1 | |
| 103 | +#define HAVE_COPYSIGNF 1 | |
| 104 | +#define HAVE_COS 1 | |
| 105 | +#define HAVE_COSF 1 | |
| 106 | +#define HAVE_EXP 1 | |
| 107 | +#define HAVE_EXPF 1 | |
| 108 | +#define HAVE_FABS 1 | |
| 109 | +#define HAVE_FABSF 1 | |
| 110 | +#define HAVE_FLOOR 1 | |
| 111 | +#define HAVE_FLOORF 1 | |
| 112 | +#define HAVE_FMOD 1 | |
| 113 | +#define HAVE_FMODF 1 | |
| 114 | +#define HAVE_LOG 1 | |
| 115 | +#define HAVE_LOGF 1 | |
| 116 | +#define HAVE_LOG10 1 | |
| 117 | +#define HAVE_LOG10F 1 | |
| 118 | +#define HAVE_LROUND 1 | |
| 119 | +#define HAVE_LROUNDF 1 | |
| 120 | +#define HAVE_POW 1 | |
| 121 | +#define HAVE_POWF 1 | |
| 122 | +#define HAVE_ROUND 1 | |
| 123 | +#define HAVE_ROUNDF 1 | |
| 124 | +#define HAVE_SCALBN 1 | |
| 125 | +#define HAVE_SCALBNF 1 | |
| 126 | +#define HAVE_SIN 1 | |
| 127 | +#define HAVE_SINF 1 | |
| 128 | +#define HAVE_SQRT 1 | |
| 129 | +#define HAVE_SQRTF 1 | |
| 130 | +#define HAVE_TAN 1 | |
| 131 | +#define HAVE_TANF 1 | |
| 132 | +#define HAVE_TRUNC 1 | |
| 133 | +#define HAVE_TRUNCF 1 | |
| 134 | +#define HAVE_SIGACTION 1 | |
| 135 | +#define HAVE_SETJMP 1 | |
| 136 | +#define HAVE_NANOSLEEP 1 | |
| 137 | +#define HAVE_SYSCONF 1 | |
| 138 | +#define HAVE_SYSCTLBYNAME 1 | |
| 139 | +#define HAVE_O_CLOEXEC 1 | |
| 140 | + | |
| 141 | +/* enable iPhone version of Core Audio driver */ | |
| 142 | +#define SDL_AUDIO_DRIVER_COREAUDIO 1 | |
| 143 | +/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ | |
| 144 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 145 | + | |
| 146 | +/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ | |
| 147 | +#define SDL_HAPTIC_DUMMY 1 | |
| 148 | + | |
| 149 | +/* Enable joystick support */ | |
| 150 | +/* Only enable HIDAPI support if you want to support Steam Controllers on iOS and tvOS */ | |
| 151 | +/*#define SDL_JOYSTICK_HIDAPI 1*/ | |
| 152 | +#define SDL_JOYSTICK_MFI 1 | |
| 153 | +#define SDL_JOYSTICK_VIRTUAL 1 | |
| 154 | + | |
| 155 | +#ifdef __TVOS__ | |
| 156 | +#define SDL_SENSOR_DUMMY 1 | |
| 157 | +#else | |
| 158 | +/* Enable the CoreMotion sensor driver */ | |
| 159 | +#define SDL_SENSOR_COREMOTION 1 | |
| 160 | +#endif | |
| 161 | + | |
| 162 | +/* Enable Unix style SO loading */ | |
| 163 | +#define SDL_LOADSO_DLOPEN 1 | |
| 164 | + | |
| 165 | +/* Enable various threading systems */ | |
| 166 | +#define SDL_THREAD_PTHREAD 1 | |
| 167 | +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 | |
| 168 | + | |
| 169 | +/* Enable various timer systems */ | |
| 170 | +#define SDL_TIMER_UNIX 1 | |
| 171 | + | |
| 172 | +/* Supported video drivers */ | |
| 173 | +#define SDL_VIDEO_DRIVER_UIKIT 1 | |
| 174 | +#define SDL_VIDEO_DRIVER_DUMMY 1 | |
| 175 | + | |
| 176 | +/* Enable OpenGL ES */ | |
| 177 | +#if !TARGET_OS_MACCATALYST | |
| 178 | +#define SDL_VIDEO_OPENGL_ES2 1 | |
| 179 | +#define SDL_VIDEO_OPENGL_ES 1 | |
| 180 | +#define SDL_VIDEO_RENDER_OGL_ES 1 | |
| 181 | +#define SDL_VIDEO_RENDER_OGL_ES2 1 | |
| 182 | +#endif | |
| 183 | + | |
| 184 | +/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer | |
| 185 | + Also supported in simulator from iOS 13.0 and tvOS 13.0 | |
| 186 | + */ | |
| 187 | +#if (TARGET_OS_SIMULATOR && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) || (__TV_OS_VERSION_MIN_REQUIRED >= 130000))) || (!TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000))) | |
| 188 | +#define SDL_PLATFORM_SUPPORTS_METAL 1 | |
| 189 | +#else | |
| 190 | +#define SDL_PLATFORM_SUPPORTS_METAL 0 | |
| 191 | +#endif | |
| 192 | + | |
| 193 | +#if SDL_PLATFORM_SUPPORTS_METAL | |
| 194 | +#define SDL_VIDEO_RENDER_METAL 1 | |
| 195 | +#endif | |
| 196 | + | |
| 197 | +#if SDL_PLATFORM_SUPPORTS_METAL | |
| 198 | +#define SDL_VIDEO_VULKAN 1 | |
| 199 | +#endif | |
| 200 | + | |
| 201 | +#if SDL_PLATFORM_SUPPORTS_METAL | |
| 202 | +#define SDL_VIDEO_METAL 1 | |
| 203 | +#endif | |
| 204 | + | |
| 205 | +/* Enable system power support */ | |
| 206 | +#define SDL_POWER_UIKIT 1 | |
| 207 | + | |
| 208 | +/* enable iPhone keyboard support */ | |
| 209 | +#define SDL_IPHONE_KEYBOARD 1 | |
| 210 | + | |
| 211 | +/* enable iOS extended launch screen */ | |
| 212 | +#define SDL_IPHONE_LAUNCHSCREEN 1 | |
| 213 | + | |
| 214 | +/* enable filesystem support */ | |
| 215 | +#define SDL_FILESYSTEM_COCOA 1 | |
| 216 | + | |
| 217 | +#endif /* SDL_config_iphoneos_h_ */ |
| @@ -0,0 +1,277 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_macosx_h_ | |
| 23 | +#define SDL_config_macosx_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +#include "SDL_platform.h" | |
| 27 | + | |
| 28 | +/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ | |
| 29 | +#include <AvailabilityMacros.h> | |
| 30 | + | |
| 31 | +/* This is a set of defines to configure the SDL features */ | |
| 32 | + | |
| 33 | +#ifdef __LP64__ | |
| 34 | + #define SIZEOF_VOIDP 8 | |
| 35 | +#else | |
| 36 | + #define SIZEOF_VOIDP 4 | |
| 37 | +#endif | |
| 38 | + | |
| 39 | +/* Useful headers */ | |
| 40 | +#define STDC_HEADERS 1 | |
| 41 | +#define HAVE_ALLOCA_H 1 | |
| 42 | +#define HAVE_CTYPE_H 1 | |
| 43 | +#define HAVE_FLOAT_H 1 | |
| 44 | +#define HAVE_INTTYPES_H 1 | |
| 45 | +#define HAVE_LIMITS_H 1 | |
| 46 | +#define HAVE_MATH_H 1 | |
| 47 | +#define HAVE_SIGNAL_H 1 | |
| 48 | +#define HAVE_STDINT_H 1 | |
| 49 | +#define HAVE_STDIO_H 1 | |
| 50 | +#define HAVE_STRING_H 1 | |
| 51 | +#define HAVE_SYS_TYPES_H 1 | |
| 52 | +#define HAVE_LIBUNWIND_H 1 | |
| 53 | + | |
| 54 | +/* C library functions */ | |
| 55 | +#define HAVE_DLOPEN 1 | |
| 56 | +#define HAVE_MALLOC 1 | |
| 57 | +#define HAVE_CALLOC 1 | |
| 58 | +#define HAVE_REALLOC 1 | |
| 59 | +#define HAVE_FREE 1 | |
| 60 | +#define HAVE_ALLOCA 1 | |
| 61 | +#define HAVE_GETENV 1 | |
| 62 | +#define HAVE_SETENV 1 | |
| 63 | +#define HAVE_PUTENV 1 | |
| 64 | +#define HAVE_UNSETENV 1 | |
| 65 | +#define HAVE_QSORT 1 | |
| 66 | +#define HAVE_BSEARCH 1 | |
| 67 | +#define HAVE_ABS 1 | |
| 68 | +#define HAVE_BCOPY 1 | |
| 69 | +#define HAVE_MEMSET 1 | |
| 70 | +#define HAVE_MEMCPY 1 | |
| 71 | +#define HAVE_MEMMOVE 1 | |
| 72 | +#define HAVE_MEMCMP 1 | |
| 73 | +#define HAVE_STRLEN 1 | |
| 74 | +#define HAVE_STRLCPY 1 | |
| 75 | +#define HAVE_STRLCAT 1 | |
| 76 | +#define HAVE_STRCHR 1 | |
| 77 | +#define HAVE_STRRCHR 1 | |
| 78 | +#define HAVE_STRSTR 1 | |
| 79 | +#define HAVE_STRTOK_R 1 | |
| 80 | +#define HAVE_STRTOL 1 | |
| 81 | +#define HAVE_STRTOUL 1 | |
| 82 | +#define HAVE_STRTOLL 1 | |
| 83 | +#define HAVE_STRTOULL 1 | |
| 84 | +#define HAVE_STRTOD 1 | |
| 85 | +#define HAVE_ATOI 1 | |
| 86 | +#define HAVE_ATOF 1 | |
| 87 | +#define HAVE_STRCMP 1 | |
| 88 | +#define HAVE_STRNCMP 1 | |
| 89 | +#define HAVE_STRCASECMP 1 | |
| 90 | +#define HAVE_STRNCASECMP 1 | |
| 91 | +#define HAVE_STRCASESTR 1 | |
| 92 | +#define HAVE_VSSCANF 1 | |
| 93 | +#define HAVE_VSNPRINTF 1 | |
| 94 | +#define HAVE_M_PI 1 | |
| 95 | +#define HAVE_ACOS 1 | |
| 96 | +#define HAVE_ACOSF 1 | |
| 97 | +#define HAVE_ASIN 1 | |
| 98 | +#define HAVE_ASINF 1 | |
| 99 | +#define HAVE_ATAN 1 | |
| 100 | +#define HAVE_ATANF 1 | |
| 101 | +#define HAVE_ATAN2 1 | |
| 102 | +#define HAVE_ATAN2F 1 | |
| 103 | +#define HAVE_CEIL 1 | |
| 104 | +#define HAVE_CEILF 1 | |
| 105 | +#define HAVE_COPYSIGN 1 | |
| 106 | +#define HAVE_COPYSIGNF 1 | |
| 107 | +#define HAVE_COS 1 | |
| 108 | +#define HAVE_COSF 1 | |
| 109 | +#define HAVE_EXP 1 | |
| 110 | +#define HAVE_EXPF 1 | |
| 111 | +#define HAVE_FABS 1 | |
| 112 | +#define HAVE_FABSF 1 | |
| 113 | +#define HAVE_FLOOR 1 | |
| 114 | +#define HAVE_FLOORF 1 | |
| 115 | +#define HAVE_FMOD 1 | |
| 116 | +#define HAVE_FMODF 1 | |
| 117 | +#define HAVE_LOG 1 | |
| 118 | +#define HAVE_LOGF 1 | |
| 119 | +#define HAVE_LOG10 1 | |
| 120 | +#define HAVE_LOG10F 1 | |
| 121 | +#define HAVE_LROUND 1 | |
| 122 | +#define HAVE_LROUNDF 1 | |
| 123 | +#define HAVE_POW 1 | |
| 124 | +#define HAVE_POWF 1 | |
| 125 | +#define HAVE_ROUND 1 | |
| 126 | +#define HAVE_ROUNDF 1 | |
| 127 | +#define HAVE_SCALBN 1 | |
| 128 | +#define HAVE_SCALBNF 1 | |
| 129 | +#define HAVE_SIN 1 | |
| 130 | +#define HAVE_SINF 1 | |
| 131 | +#define HAVE_SQRT 1 | |
| 132 | +#define HAVE_SQRTF 1 | |
| 133 | +#define HAVE_TAN 1 | |
| 134 | +#define HAVE_TANF 1 | |
| 135 | +#define HAVE_TRUNC 1 | |
| 136 | +#define HAVE_TRUNCF 1 | |
| 137 | +#define HAVE_SIGACTION 1 | |
| 138 | +#define HAVE_SETJMP 1 | |
| 139 | +#define HAVE_NANOSLEEP 1 | |
| 140 | +#define HAVE_SYSCONF 1 | |
| 141 | +#define HAVE_SYSCTLBYNAME 1 | |
| 142 | + | |
| 143 | +#if defined(__has_include) && (defined(__i386__) || defined(__x86_64)) | |
| 144 | +# if __has_include(<immintrin.h>) | |
| 145 | +# define HAVE_IMMINTRIN_H 1 | |
| 146 | +# endif | |
| 147 | +#endif | |
| 148 | + | |
| 149 | +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070) | |
| 150 | +#define HAVE_O_CLOEXEC 1 | |
| 151 | +#endif | |
| 152 | + | |
| 153 | +#define HAVE_GCC_ATOMICS 1 | |
| 154 | + | |
| 155 | +/* Enable various audio drivers */ | |
| 156 | +#define SDL_AUDIO_DRIVER_COREAUDIO 1 | |
| 157 | +#define SDL_AUDIO_DRIVER_DISK 1 | |
| 158 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 159 | + | |
| 160 | +/* Enable various input drivers */ | |
| 161 | +#define SDL_JOYSTICK_HIDAPI 1 | |
| 162 | +#define SDL_JOYSTICK_IOKIT 1 | |
| 163 | +#define SDL_JOYSTICK_VIRTUAL 1 | |
| 164 | +#define SDL_HAPTIC_IOKIT 1 | |
| 165 | + | |
| 166 | +/* The MFI controller support requires ARC Objective C runtime */ | |
| 167 | +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !defined(__i386__) | |
| 168 | +#define SDL_JOYSTICK_MFI 1 | |
| 169 | +#endif | |
| 170 | + | |
| 171 | +/* Enable the dummy sensor driver */ | |
| 172 | +#define SDL_SENSOR_DUMMY 1 | |
| 173 | + | |
| 174 | +/* Enable various shared object loading systems */ | |
| 175 | +#define SDL_LOADSO_DLOPEN 1 | |
| 176 | + | |
| 177 | +/* Enable various threading systems */ | |
| 178 | +#define SDL_THREAD_PTHREAD 1 | |
| 179 | +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 | |
| 180 | + | |
| 181 | +/* Enable various timer systems */ | |
| 182 | +#define SDL_TIMER_UNIX 1 | |
| 183 | + | |
| 184 | +/* Enable various video drivers */ | |
| 185 | +#define SDL_VIDEO_DRIVER_COCOA 1 | |
| 186 | +#define SDL_VIDEO_DRIVER_DUMMY 1 | |
| 187 | +#undef SDL_VIDEO_DRIVER_X11 | |
| 188 | +#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib" | |
| 189 | +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib" | |
| 190 | +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib" | |
| 191 | +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib" | |
| 192 | +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib" | |
| 193 | +#define SDL_VIDEO_DRIVER_X11_XDBE 1 | |
| 194 | +#define SDL_VIDEO_DRIVER_X11_XRANDR 1 | |
| 195 | +#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 | |
| 196 | +#define SDL_VIDEO_DRIVER_X11_XSHAPE 1 | |
| 197 | +#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 | |
| 198 | + | |
| 199 | +#ifdef MAC_OS_X_VERSION_10_8 | |
| 200 | +/* | |
| 201 | + * No matter the versions targeted, this is the 10.8 or later SDK, so you have | |
| 202 | + * to use the external Xquartz, which is a more modern Xlib. Previous SDKs | |
| 203 | + * used an older Xlib. | |
| 204 | + */ | |
| 205 | +#define SDL_VIDEO_DRIVER_X11_XINPUT2 1 | |
| 206 | +#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 | |
| 207 | +#endif | |
| 208 | + | |
| 209 | +#ifndef SDL_VIDEO_RENDER_OGL | |
| 210 | +#define SDL_VIDEO_RENDER_OGL 1 | |
| 211 | +#endif | |
| 212 | + | |
| 213 | +#ifndef SDL_VIDEO_RENDER_OGL_ES2 | |
| 214 | +#define SDL_VIDEO_RENDER_OGL_ES2 1 | |
| 215 | +#endif | |
| 216 | + | |
| 217 | +/* Metal only supported on 64-bit architectures with 10.11+ */ | |
| 218 | +#if TARGET_RT_64_BIT && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) | |
| 219 | +#define SDL_PLATFORM_SUPPORTS_METAL 1 | |
| 220 | +#else | |
| 221 | +#define SDL_PLATFORM_SUPPORTS_METAL 0 | |
| 222 | +#endif | |
| 223 | + | |
| 224 | +#ifndef SDL_VIDEO_RENDER_METAL | |
| 225 | +#if SDL_PLATFORM_SUPPORTS_METAL | |
| 226 | +#define SDL_VIDEO_RENDER_METAL 1 | |
| 227 | +#else | |
| 228 | +#define SDL_VIDEO_RENDER_METAL 0 | |
| 229 | +#endif | |
| 230 | +#endif | |
| 231 | + | |
| 232 | +/* Enable OpenGL support */ | |
| 233 | +#ifndef SDL_VIDEO_OPENGL | |
| 234 | +#define SDL_VIDEO_OPENGL 1 | |
| 235 | +#endif | |
| 236 | +#ifndef SDL_VIDEO_OPENGL_ES2 | |
| 237 | +#define SDL_VIDEO_OPENGL_ES2 1 | |
| 238 | +#endif | |
| 239 | +#ifndef SDL_VIDEO_OPENGL_EGL | |
| 240 | +#define SDL_VIDEO_OPENGL_EGL 1 | |
| 241 | +#endif | |
| 242 | +#ifndef SDL_VIDEO_OPENGL_CGL | |
| 243 | +#define SDL_VIDEO_OPENGL_CGL 1 | |
| 244 | +#endif | |
| 245 | +#ifndef SDL_VIDEO_OPENGL_GLX | |
| 246 | +#define SDL_VIDEO_OPENGL_GLX 1 | |
| 247 | +#endif | |
| 248 | + | |
| 249 | +/* Enable Vulkan and Metal support */ | |
| 250 | +#ifndef SDL_VIDEO_VULKAN | |
| 251 | +#if SDL_PLATFORM_SUPPORTS_METAL | |
| 252 | +#define SDL_VIDEO_VULKAN 1 | |
| 253 | +#else | |
| 254 | +#define SDL_VIDEO_VULKAN 0 | |
| 255 | +#endif | |
| 256 | +#endif | |
| 257 | + | |
| 258 | +#ifndef SDL_VIDEO_METAL | |
| 259 | +#if SDL_PLATFORM_SUPPORTS_METAL | |
| 260 | +#define SDL_VIDEO_METAL 1 | |
| 261 | +#else | |
| 262 | +#define SDL_VIDEO_METAL 0 | |
| 263 | +#endif | |
| 264 | +#endif | |
| 265 | + | |
| 266 | +/* Enable system power support */ | |
| 267 | +#define SDL_POWER_MACOSX 1 | |
| 268 | + | |
| 269 | +/* enable filesystem support */ | |
| 270 | +#define SDL_FILESYSTEM_COCOA 1 | |
| 271 | + | |
| 272 | +/* Enable assembly routines */ | |
| 273 | +#ifdef __ppc__ | |
| 274 | +#define SDL_ALTIVEC_BLITTERS 1 | |
| 275 | +#endif | |
| 276 | + | |
| 277 | +#endif /* SDL_config_macosx_h_ */ |
| @@ -0,0 +1,95 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_minimal_h_ | |
| 23 | +#define SDL_config_minimal_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +#include "SDL_platform.h" | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * \file SDL_config_minimal.h | |
| 30 | + * | |
| 31 | + * This is the minimal configuration that can be used to build SDL. | |
| 32 | + */ | |
| 33 | + | |
| 34 | +#define HAVE_STDARG_H 1 | |
| 35 | +#define HAVE_STDDEF_H 1 | |
| 36 | + | |
| 37 | +#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_) | |
| 38 | +/* Most everything except Visual Studio 2008 and earlier has stdint.h now */ | |
| 39 | +#if defined(_MSC_VER) && (_MSC_VER < 1600) | |
| 40 | +typedef signed __int8 int8_t; | |
| 41 | +typedef unsigned __int8 uint8_t; | |
| 42 | +typedef signed __int16 int16_t; | |
| 43 | +typedef unsigned __int16 uint16_t; | |
| 44 | +typedef signed __int32 int32_t; | |
| 45 | +typedef unsigned __int32 uint32_t; | |
| 46 | +typedef signed __int64 int64_t; | |
| 47 | +typedef unsigned __int64 uint64_t; | |
| 48 | +#ifndef _UINTPTR_T_DEFINED | |
| 49 | +#ifdef _WIN64 | |
| 50 | +typedef unsigned __int64 uintptr_t; | |
| 51 | +#else | |
| 52 | +typedef unsigned int uintptr_t; | |
| 53 | +#endif | |
| 54 | +#define _UINTPTR_T_DEFINED | |
| 55 | +#endif | |
| 56 | +#else | |
| 57 | +#define HAVE_STDINT_H 1 | |
| 58 | +#endif /* Visual Studio 2008 */ | |
| 59 | +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ | |
| 60 | + | |
| 61 | +#ifdef __GNUC__ | |
| 62 | +#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 | |
| 63 | +#endif | |
| 64 | + | |
| 65 | +/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ | |
| 66 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 67 | + | |
| 68 | +/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ | |
| 69 | +#define SDL_JOYSTICK_DISABLED 1 | |
| 70 | + | |
| 71 | +/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ | |
| 72 | +#define SDL_HAPTIC_DISABLED 1 | |
| 73 | + | |
| 74 | +/* Enable the stub HIDAPI */ | |
| 75 | +#define SDL_HIDAPI_DISABLED 1 | |
| 76 | + | |
| 77 | +/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */ | |
| 78 | +#define SDL_SENSOR_DISABLED 1 | |
| 79 | + | |
| 80 | +/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ | |
| 81 | +#define SDL_LOADSO_DISABLED 1 | |
| 82 | + | |
| 83 | +/* Enable the stub thread support (src/thread/generic/\*.c) */ | |
| 84 | +#define SDL_THREADS_DISABLED 1 | |
| 85 | + | |
| 86 | +/* Enable the stub timer support (src/timer/dummy/\*.c) */ | |
| 87 | +#define SDL_TIMERS_DISABLED 1 | |
| 88 | + | |
| 89 | +/* Enable the dummy video driver (src/video/dummy/\*.c) */ | |
| 90 | +#define SDL_VIDEO_DRIVER_DUMMY 1 | |
| 91 | + | |
| 92 | +/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ | |
| 93 | +#define SDL_FILESYSTEM_DUMMY 1 | |
| 94 | + | |
| 95 | +#endif /* SDL_config_minimal_h_ */ |
| @@ -0,0 +1,89 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_ngage_h_ | |
| 23 | +#define SDL_config_ngage_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +#include "SDL_platform.h" | |
| 27 | + | |
| 28 | +typedef signed char int8_t; | |
| 29 | +typedef unsigned char uint8_t; | |
| 30 | +typedef signed short int16_t; | |
| 31 | +typedef unsigned short uint16_t; | |
| 32 | +typedef signed int int32_t; | |
| 33 | +typedef unsigned int uint32_t; | |
| 34 | +typedef signed long long int64_t; | |
| 35 | +typedef unsigned long long uint64_t; | |
| 36 | +typedef unsigned long uintptr_t; | |
| 37 | + | |
| 38 | +#define HAVE_STDARG_H 1 | |
| 39 | +#define HAVE_STDDEF_H 1 | |
| 40 | +#define HAVE_STDIO_H 1 | |
| 41 | +#define HAVE_STDLIB_H 1 | |
| 42 | +#define HAVE_MATH_H 1 | |
| 43 | +#define HAVE_CEIL 1 | |
| 44 | +#define HAVE_COPYSIGN 1 | |
| 45 | +#define HAVE_COS 1 | |
| 46 | +#define HAVE_EXP 1 | |
| 47 | +#define HAVE_FABS 1 | |
| 48 | +#define HAVE_FLOOR 1 | |
| 49 | +#define HAVE_LOG 1 | |
| 50 | +#define HAVE_LOG10 1 | |
| 51 | +#define HAVE_SCALBN 1 | |
| 52 | +#define HAVE_SIN 1 | |
| 53 | +#define HAVE_SQRT 1 | |
| 54 | +#define HAVE_TAN 1 | |
| 55 | +#define HAVE_MALLOC 1 | |
| 56 | +#define SDL_MAIN_NEEDED 1 | |
| 57 | +#define LACKS_SYS_MMAN_H 1 | |
| 58 | + | |
| 59 | +/* Enable the N-Gage thread support (src/thread/ngage/\*.c) */ | |
| 60 | +#define SDL_THREAD_NGAGE 1 | |
| 61 | + | |
| 62 | +/* Enable the N-Gage timer support (src/timer/ngage/\*.c) */ | |
| 63 | +#define SDL_TIMER_NGAGE 1 | |
| 64 | + | |
| 65 | +/* Enable the N-Gage video driver (src/video/ngage/\*.c) */ | |
| 66 | +#define SDL_VIDEO_DRIVER_NGAGE 1 | |
| 67 | + | |
| 68 | +/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ | |
| 69 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 70 | + | |
| 71 | +/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ | |
| 72 | +#define SDL_JOYSTICK_DISABLED 1 | |
| 73 | + | |
| 74 | +/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ | |
| 75 | +#define SDL_HAPTIC_DISABLED 1 | |
| 76 | + | |
| 77 | +/* Enable the stub HIDAPI */ | |
| 78 | +#define SDL_HIDAPI_DISABLED 1 | |
| 79 | + | |
| 80 | +/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */ | |
| 81 | +#define SDL_SENSOR_DISABLED 1 | |
| 82 | + | |
| 83 | +/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ | |
| 84 | +#define SDL_LOADSO_DISABLED 1 | |
| 85 | + | |
| 86 | +/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ | |
| 87 | +#define SDL_FILESYSTEM_DUMMY 1 | |
| 88 | + | |
| 89 | +#endif /* SDL_config_ngage_h_ */ |
| @@ -0,0 +1,204 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_os2_h_ | |
| 23 | +#define SDL_config_os2_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +#include "SDL_platform.h" | |
| 27 | + | |
| 28 | +#define SIZEOF_VOIDP 4 | |
| 29 | + | |
| 30 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 31 | +#define SDL_AUDIO_DRIVER_DISK 1 | |
| 32 | +#define SDL_AUDIO_DRIVER_OS2 1 | |
| 33 | + | |
| 34 | +#define SDL_POWER_DISABLED 1 | |
| 35 | +#define SDL_HAPTIC_DISABLED 1 | |
| 36 | + | |
| 37 | +#define SDL_SENSOR_DUMMY 1 | |
| 38 | +#define SDL_VIDEO_DRIVER_DUMMY 1 | |
| 39 | +#define SDL_VIDEO_DRIVER_OS2 1 | |
| 40 | +#define SDL_JOYSTICK_OS2 1 | |
| 41 | +#ifndef HAVE_LIBUSB_H /* see Makefile */ | |
| 42 | +#define SDL_HIDAPI_DISABLED 1 | |
| 43 | +/*#undef SDL_JOYSTICK_HIDAPI */ | |
| 44 | +#else | |
| 45 | +#define SDL_JOYSTICK_HIDAPI 1 | |
| 46 | +#define HAVE_LIBUSB 1 | |
| 47 | +/* dynamically loaded libusb-1.0 dll: */ | |
| 48 | +#define SDL_LIBUSB_DYNAMIC "usb100.dll" | |
| 49 | +#endif | |
| 50 | +#define SDL_JOYSTICK_VIRTUAL 1 | |
| 51 | + | |
| 52 | +/* Enable OpenGL support */ | |
| 53 | +/* #undef SDL_VIDEO_OPENGL */ | |
| 54 | + | |
| 55 | +#define SDL_THREAD_OS2 1 | |
| 56 | +#define SDL_LOADSO_OS2 1 | |
| 57 | +#define SDL_TIMER_OS2 1 | |
| 58 | +#define SDL_FILESYSTEM_OS2 1 | |
| 59 | + | |
| 60 | +/* use libsamplerate for audio rate conversion. */ | |
| 61 | +/*#define HAVE_LIBSAMPLERATE_H 1 */ | |
| 62 | + | |
| 63 | +/* Enable dynamic libsamplerate support */ | |
| 64 | +#define SDL_LIBSAMPLERATE_DYNAMIC "SAMPRATE.DLL" | |
| 65 | + | |
| 66 | +#define HAVE_LIBC 1 | |
| 67 | + | |
| 68 | +#define HAVE_STDARG_H 1 | |
| 69 | +#define HAVE_STDDEF_H 1 | |
| 70 | +#define HAVE_STDINT_H 1 | |
| 71 | + | |
| 72 | +#define HAVE_SYS_TYPES_H 1 | |
| 73 | +#define HAVE_STDIO_H 1 | |
| 74 | +#define STDC_HEADERS 1 | |
| 75 | +#define HAVE_STDLIB_H 1 | |
| 76 | +#define HAVE_MALLOC_H 1 | |
| 77 | +#define HAVE_MEMORY_H 1 | |
| 78 | +#define HAVE_STRING_H 1 | |
| 79 | +#define HAVE_STRINGS_H 1 | |
| 80 | +#define HAVE_WCHAR_H 1 | |
| 81 | +#define HAVE_INTTYPES_H 1 | |
| 82 | +#define HAVE_LIMITS_H 1 | |
| 83 | +#define HAVE_CTYPE_H 1 | |
| 84 | +#define HAVE_MATH_H 1 | |
| 85 | +#define HAVE_FLOAT_H 1 | |
| 86 | +#define HAVE_SIGNAL_H 1 | |
| 87 | + | |
| 88 | +#if 0 /* see Makefile */ | |
| 89 | +#define HAVE_ICONV 1 | |
| 90 | +#define HAVE_ICONV_H 1 | |
| 91 | +#endif | |
| 92 | + | |
| 93 | +/* #undef HAVE_DLOPEN */ | |
| 94 | +#define HAVE_MALLOC 1 | |
| 95 | +#define HAVE_CALLOC 1 | |
| 96 | +#define HAVE_REALLOC 1 | |
| 97 | +#define HAVE_FREE 1 | |
| 98 | +#if defined(__WATCOMC__) | |
| 99 | +#define HAVE__FSEEKI64 1 | |
| 100 | +#define HAVE__FTELLI64 1 | |
| 101 | +#endif | |
| 102 | +#define HAVE_ALLOCA 1 | |
| 103 | +#define HAVE_GETENV 1 | |
| 104 | +#define HAVE_SETENV 1 | |
| 105 | +#define HAVE_PUTENV 1 | |
| 106 | +/* OpenWatcom requires specific calling conventions for qsort and bsearch */ | |
| 107 | +#ifndef __WATCOMC__ | |
| 108 | +#define HAVE_QSORT 1 | |
| 109 | +#define HAVE_BSEARCH 1 | |
| 110 | +#endif | |
| 111 | +#define HAVE_ABS 1 | |
| 112 | +#define HAVE_BCOPY 1 | |
| 113 | +#define HAVE_MEMSET 1 | |
| 114 | +#define HAVE_MEMCPY 1 | |
| 115 | +#define HAVE_MEMMOVE 1 | |
| 116 | +#define HAVE_MEMCMP 1 | |
| 117 | +#define HAVE_WCSCMP 1 | |
| 118 | +#define HAVE__WCSICMP 1 | |
| 119 | +#define HAVE__WCSNICMP 1 | |
| 120 | +#define HAVE_WCSLEN 1 | |
| 121 | +#define HAVE_WCSLCPY 1 | |
| 122 | +#define HAVE_WCSLCAT 1 | |
| 123 | +/* #undef HAVE_WCSDUP */ | |
| 124 | +#define HAVE__WCSDUP 1 | |
| 125 | +#define HAVE_WCSSTR 1 | |
| 126 | +#define HAVE_WCSCMP 1 | |
| 127 | +#define HAVE_WCSNCMP 1 | |
| 128 | +#define HAVE_STRLEN 1 | |
| 129 | +#define HAVE_STRLCPY 1 | |
| 130 | +#define HAVE_STRLCAT 1 | |
| 131 | +#define HAVE__STRREV 1 | |
| 132 | +#define HAVE__STRUPR 1 | |
| 133 | +#define HAVE__STRLWR 1 | |
| 134 | +/* #undef HAVE_INDEX */ | |
| 135 | +/* #undef HAVE_RINDEX */ | |
| 136 | +#define HAVE_STRCHR 1 | |
| 137 | +#define HAVE_STRRCHR 1 | |
| 138 | +#define HAVE_STRSTR 1 | |
| 139 | +/* #undef HAVE_STRTOK_R */ | |
| 140 | +#define HAVE_ITOA 1 | |
| 141 | +#define HAVE__LTOA 1 | |
| 142 | +#define HAVE__ULTOA 1 | |
| 143 | +#define HAVE_STRTOL 1 | |
| 144 | +#define HAVE_STRTOUL 1 | |
| 145 | +#define HAVE__I64TOA 1 | |
| 146 | +#define HAVE__UI64TOA 1 | |
| 147 | +#define HAVE_STRTOLL 1 | |
| 148 | +#define HAVE_STRTOULL 1 | |
| 149 | +#define HAVE_STRTOD 1 | |
| 150 | +#define HAVE_ATOI 1 | |
| 151 | +#define HAVE_ATOF 1 | |
| 152 | +#define HAVE_STRCMP 1 | |
| 153 | +#define HAVE_STRNCMP 1 | |
| 154 | +#define HAVE_STRICMP 1 | |
| 155 | +#define HAVE_STRCASECMP 1 | |
| 156 | +#define HAVE_STRNCASECMP 1 | |
| 157 | +#define HAVE_SSCANF 1 | |
| 158 | +#define HAVE_VSSCANF 1 | |
| 159 | +#define HAVE_SNPRINTF 1 | |
| 160 | +#define HAVE_VSNPRINTF 1 | |
| 161 | +#define HAVE_SETJMP 1 | |
| 162 | +#define HAVE_ACOS 1 | |
| 163 | +/* #undef HAVE_ACOSF */ | |
| 164 | +#define HAVE_ASIN 1 | |
| 165 | +/* #undef HAVE_ASINF */ | |
| 166 | +#define HAVE_ATAN 1 | |
| 167 | +#define HAVE_ATAN2 1 | |
| 168 | +/* #undef HAVE_ATAN2F */ | |
| 169 | +#define HAVE_CEIL 1 | |
| 170 | +/* #undef HAVE_CEILF */ | |
| 171 | +/* #undef HAVE_COPYSIGN */ | |
| 172 | +/* #undef HAVE_COPYSIGNF */ | |
| 173 | +#define HAVE_COS 1 | |
| 174 | +/* #undef HAVE_COSF */ | |
| 175 | +#define HAVE_EXP 1 | |
| 176 | +/* #undef HAVE_EXPF */ | |
| 177 | +#define HAVE_FABS 1 | |
| 178 | +/* #undef HAVE_FABSF */ | |
| 179 | +#define HAVE_FLOOR 1 | |
| 180 | +/* #undef HAVE_FLOORF */ | |
| 181 | +#define HAVE_FMOD 1 | |
| 182 | +/* #undef HAVE_FMODF */ | |
| 183 | +#define HAVE_LOG 1 | |
| 184 | +/* #undef HAVE_LOGF */ | |
| 185 | +#define HAVE_LOG10 1 | |
| 186 | +/* #undef HAVE_LOG10F */ | |
| 187 | +#define HAVE_POW 1 | |
| 188 | +/* #undef HAVE_POWF */ | |
| 189 | +#define HAVE_SIN 1 | |
| 190 | +/* #undef HAVE_SINF */ | |
| 191 | +/* #undef HAVE_SCALBN */ | |
| 192 | +/* #undef HAVE_SCALBNF */ | |
| 193 | +#define HAVE_SQRT 1 | |
| 194 | +/* #undef HAVE_SQRTF */ | |
| 195 | +#define HAVE_TAN 1 | |
| 196 | +/* #undef HAVE_TANF */ | |
| 197 | +/* #undef HAVE_TRUNC */ | |
| 198 | +/* #undef HAVE_TRUNCF */ | |
| 199 | +/* #undef HAVE_LROUND */ | |
| 200 | +/* #undef HAVE_LROUNDF */ | |
| 201 | +/* #undef HAVE_ROUND */ | |
| 202 | +/* #undef HAVE_ROUNDF */ | |
| 203 | + | |
| 204 | +#endif /* SDL_config_os2_h_ */ |
| @@ -0,0 +1,141 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_pandora_h_ | |
| 23 | +#define SDL_config_pandora_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +/* This is a set of defines to configure the SDL features */ | |
| 27 | + | |
| 28 | +/* General platform specific identifiers */ | |
| 29 | +#include "SDL_platform.h" | |
| 30 | + | |
| 31 | +#ifdef __LP64__ | |
| 32 | +#define SIZEOF_VOIDP 8 | |
| 33 | +#else | |
| 34 | +#define SIZEOF_VOIDP 4 | |
| 35 | +#endif | |
| 36 | + | |
| 37 | +#define SDL_BYTEORDER 1234 | |
| 38 | + | |
| 39 | +#define STDC_HEADERS 1 | |
| 40 | +#define HAVE_ALLOCA_H 1 | |
| 41 | +#define HAVE_CTYPE_H 1 | |
| 42 | +#define HAVE_ICONV_H 1 | |
| 43 | +#define HAVE_INTTYPES_H 1 | |
| 44 | +#define HAVE_LIMITS_H 1 | |
| 45 | +#define HAVE_MALLOC_H 1 | |
| 46 | +#define HAVE_MATH_H 1 | |
| 47 | +#define HAVE_MEMORY_H 1 | |
| 48 | +#define HAVE_SIGNAL_H 1 | |
| 49 | +#define HAVE_STDARG_H 1 | |
| 50 | +#define HAVE_STDINT_H 1 | |
| 51 | +#define HAVE_STDIO_H 1 | |
| 52 | +#define HAVE_STDLIB_H 1 | |
| 53 | +#define HAVE_STRINGS_H 1 | |
| 54 | +#define HAVE_STRING_H 1 | |
| 55 | +#define HAVE_SYS_TYPES_H 1 | |
| 56 | + | |
| 57 | +#define HAVE_DLOPEN 1 | |
| 58 | +#define HAVE_MALLOC 1 | |
| 59 | +#define HAVE_CALLOC 1 | |
| 60 | +#define HAVE_REALLOC 1 | |
| 61 | +#define HAVE_FREE 1 | |
| 62 | +#define HAVE_ALLOCA 1 | |
| 63 | +#define HAVE_GETENV 1 | |
| 64 | +#define HAVE_SETENV 1 | |
| 65 | +#define HAVE_PUTENV 1 | |
| 66 | +#define HAVE_UNSETENV 1 | |
| 67 | +#define HAVE_QSORT 1 | |
| 68 | +#define HAVE_BSEARCH 1 | |
| 69 | +#define HAVE_ABS 1 | |
| 70 | +#define HAVE_BCOPY 1 | |
| 71 | +#define HAVE_MEMSET 1 | |
| 72 | +#define HAVE_MEMCPY 1 | |
| 73 | +#define HAVE_MEMMOVE 1 | |
| 74 | +#define HAVE_STRLEN 1 | |
| 75 | +#define HAVE_STRCHR 1 | |
| 76 | +#define HAVE_STRRCHR 1 | |
| 77 | +#define HAVE_STRSTR 1 | |
| 78 | +#define HAVE_STRTOL 1 | |
| 79 | +#define HAVE_STRTOUL 1 | |
| 80 | +#define HAVE_STRTOLL 1 | |
| 81 | +#define HAVE_STRTOULL 1 | |
| 82 | +#define HAVE_ATOI 1 | |
| 83 | +#define HAVE_ATOF 1 | |
| 84 | +#define HAVE_STRCMP 1 | |
| 85 | +#define HAVE_STRNCMP 1 | |
| 86 | +#define HAVE_STRCASECMP 1 | |
| 87 | +#define HAVE_STRNCASECMP 1 | |
| 88 | +#define HAVE_VSSCANF 1 | |
| 89 | +#define HAVE_VSNPRINTF 1 | |
| 90 | +#define HAVE_M_PI 1 | |
| 91 | +#define HAVE_CEIL 1 | |
| 92 | +#define HAVE_COPYSIGN 1 | |
| 93 | +#define HAVE_COS 1 | |
| 94 | +#define HAVE_COSF 1 | |
| 95 | +#define HAVE_EXP 1 | |
| 96 | +#define HAVE_FABS 1 | |
| 97 | +#define HAVE_FLOOR 1 | |
| 98 | +#define HAVE_LOG 1 | |
| 99 | +#define HAVE_LOG10 1 | |
| 100 | +#define HAVE_LROUND 1 | |
| 101 | +#define HAVE_LROUNDF 1 | |
| 102 | +#define HAVE_ROUND 1 | |
| 103 | +#define HAVE_ROUNDF 1 | |
| 104 | +#define HAVE_SCALBN 1 | |
| 105 | +#define HAVE_SIN 1 | |
| 106 | +#define HAVE_SINF 1 | |
| 107 | +#define HAVE_SQRT 1 | |
| 108 | +#define HAVE_SQRTF 1 | |
| 109 | +#define HAVE_TAN 1 | |
| 110 | +#define HAVE_TANF 1 | |
| 111 | +#define HAVE_TRUNC 1 | |
| 112 | +#define HAVE_TRUNCF 1 | |
| 113 | +#define HAVE_SIGACTION 1 | |
| 114 | +#define HAVE_SETJMP 1 | |
| 115 | +#define HAVE_NANOSLEEP 1 | |
| 116 | + | |
| 117 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 118 | +#define SDL_AUDIO_DRIVER_OSS 1 | |
| 119 | + | |
| 120 | +#define SDL_INPUT_LINUXEV 1 | |
| 121 | +#define SDL_JOYSTICK_LINUX 1 | |
| 122 | +#define SDL_JOYSTICK_VIRTUAL 1 | |
| 123 | +#define SDL_HAPTIC_LINUX 1 | |
| 124 | + | |
| 125 | +#define SDL_SENSOR_DUMMY 1 | |
| 126 | + | |
| 127 | +#define SDL_LOADSO_DLOPEN 1 | |
| 128 | + | |
| 129 | +#define SDL_THREAD_PTHREAD 1 | |
| 130 | +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 | |
| 131 | + | |
| 132 | +#define SDL_TIMER_UNIX 1 | |
| 133 | +#define SDL_FILESYSTEM_UNIX 1 | |
| 134 | + | |
| 135 | +#define SDL_VIDEO_DRIVER_DUMMY 1 | |
| 136 | +#define SDL_VIDEO_DRIVER_X11 1 | |
| 137 | +#define SDL_VIDEO_DRIVER_PANDORA 1 | |
| 138 | +#define SDL_VIDEO_RENDER_OGL_ES 1 | |
| 139 | +#define SDL_VIDEO_OPENGL_ES 1 | |
| 140 | + | |
| 141 | +#endif /* SDL_config_pandora_h_ */ |
| @@ -0,0 +1,333 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_windows_h_ | |
| 23 | +#define SDL_config_windows_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +#include "SDL_platform.h" | |
| 27 | + | |
| 28 | +/* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK, | |
| 29 | + * but out of caution we'll only use it if the compiler supports __has_include() to confirm its presence. | |
| 30 | + * If your compiler doesn't support __has_include() but you have winsdkver.h, define HAVE_WINSDKVER_H. */ | |
| 31 | +#if !defined(HAVE_WINSDKVER_H) && defined(__has_include) | |
| 32 | +#if __has_include(<winsdkver.h>) | |
| 33 | +#define HAVE_WINSDKVER_H 1 | |
| 34 | +#endif | |
| 35 | +#endif | |
| 36 | + | |
| 37 | +#ifdef HAVE_WINSDKVER_H | |
| 38 | +#include <winsdkver.h> | |
| 39 | +#endif | |
| 40 | + | |
| 41 | +/* sdkddkver.h defines more specific SDK version numbers. This is needed because older versions of the | |
| 42 | + * Windows 10 SDK have broken declarations for the C API for DirectX 12. */ | |
| 43 | +#if !defined(HAVE_SDKDDKVER_H) && defined(__has_include) | |
| 44 | +#if __has_include(<sdkddkver.h>) | |
| 45 | +#define HAVE_SDKDDKVER_H 1 | |
| 46 | +#endif | |
| 47 | +#endif | |
| 48 | + | |
| 49 | +#ifdef HAVE_SDKDDKVER_H | |
| 50 | +#include <sdkddkver.h> | |
| 51 | +#endif | |
| 52 | + | |
| 53 | +/* This is a set of defines to configure the SDL features */ | |
| 54 | + | |
| 55 | +#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_) | |
| 56 | +/* Most everything except Visual Studio 2008 and earlier has stdint.h now */ | |
| 57 | +#if defined(_MSC_VER) && (_MSC_VER < 1600) | |
| 58 | +typedef signed __int8 int8_t; | |
| 59 | +typedef unsigned __int8 uint8_t; | |
| 60 | +typedef signed __int16 int16_t; | |
| 61 | +typedef unsigned __int16 uint16_t; | |
| 62 | +typedef signed __int32 int32_t; | |
| 63 | +typedef unsigned __int32 uint32_t; | |
| 64 | +typedef signed __int64 int64_t; | |
| 65 | +typedef unsigned __int64 uint64_t; | |
| 66 | +#ifndef _UINTPTR_T_DEFINED | |
| 67 | +#ifdef _WIN64 | |
| 68 | +typedef unsigned __int64 uintptr_t; | |
| 69 | +#else | |
| 70 | +typedef unsigned int uintptr_t; | |
| 71 | +#endif | |
| 72 | +#define _UINTPTR_T_DEFINED | |
| 73 | +#endif | |
| 74 | +#else | |
| 75 | +#define HAVE_STDINT_H 1 | |
| 76 | +#endif /* Visual Studio 2008 */ | |
| 77 | +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ | |
| 78 | + | |
| 79 | +#ifdef _WIN64 | |
| 80 | +# define SIZEOF_VOIDP 8 | |
| 81 | +#else | |
| 82 | +# define SIZEOF_VOIDP 4 | |
| 83 | +#endif | |
| 84 | + | |
| 85 | +#ifdef __clang__ | |
| 86 | +# define HAVE_GCC_ATOMICS 1 | |
| 87 | +#endif | |
| 88 | + | |
| 89 | +#define HAVE_DDRAW_H 1 | |
| 90 | +#define HAVE_DINPUT_H 1 | |
| 91 | +#define HAVE_DSOUND_H 1 | |
| 92 | +#ifndef __WATCOMC__ | |
| 93 | +#define HAVE_DXGI_H 1 | |
| 94 | +#define HAVE_XINPUT_H 1 | |
| 95 | +#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */ | |
| 96 | +#define HAVE_WINDOWS_GAMING_INPUT_H 1 | |
| 97 | +#endif | |
| 98 | +#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */ | |
| 99 | +#define HAVE_D3D11_H 1 | |
| 100 | +#define HAVE_ROAPI_H 1 | |
| 101 | +#endif | |
| 102 | +#if defined(__has_include) | |
| 103 | +#if __has_include(<d3d12.h>) && __has_include(<d3d12sdklayers.h>) | |
| 104 | +#define HAVE_D3D12_H 1 | |
| 105 | +#endif | |
| 106 | +#endif | |
| 107 | +#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */ | |
| 108 | +#define HAVE_SHELLSCALINGAPI_H 1 | |
| 109 | +#endif | |
| 110 | +#define HAVE_MMDEVICEAPI_H 1 | |
| 111 | +#define HAVE_AUDIOCLIENT_H 1 | |
| 112 | +#define HAVE_TPCSHRD_H 1 | |
| 113 | +#define HAVE_SENSORSAPI_H 1 | |
| 114 | +#endif | |
| 115 | +#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) | |
| 116 | +#define HAVE_IMMINTRIN_H 1 | |
| 117 | +#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) | |
| 118 | +# if __has_include(<immintrin.h>) | |
| 119 | +# define HAVE_IMMINTRIN_H 1 | |
| 120 | +# endif | |
| 121 | +#endif | |
| 122 | + | |
| 123 | +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ | |
| 124 | +#ifdef HAVE_LIBC | |
| 125 | +/* Useful headers */ | |
| 126 | +#define STDC_HEADERS 1 | |
| 127 | +#define HAVE_CTYPE_H 1 | |
| 128 | +#define HAVE_FLOAT_H 1 | |
| 129 | +#define HAVE_LIMITS_H 1 | |
| 130 | +#define HAVE_MATH_H 1 | |
| 131 | +#define HAVE_SIGNAL_H 1 | |
| 132 | +#define HAVE_STDIO_H 1 | |
| 133 | +#define HAVE_STRING_H 1 | |
| 134 | + | |
| 135 | +/* C library functions */ | |
| 136 | +#define HAVE_MALLOC 1 | |
| 137 | +#define HAVE_CALLOC 1 | |
| 138 | +#define HAVE_REALLOC 1 | |
| 139 | +#define HAVE_FREE 1 | |
| 140 | +#define HAVE_ALLOCA 1 | |
| 141 | +/* OpenWatcom requires specific calling conventions for qsort and bsearch */ | |
| 142 | +#ifndef __WATCOMC__ | |
| 143 | +#define HAVE_QSORT 1 | |
| 144 | +#define HAVE_BSEARCH 1 | |
| 145 | +#endif | |
| 146 | +#define HAVE_ABS 1 | |
| 147 | +#define HAVE_MEMSET 1 | |
| 148 | +#define HAVE_MEMCPY 1 | |
| 149 | +#define HAVE_MEMMOVE 1 | |
| 150 | +#define HAVE_MEMCMP 1 | |
| 151 | +#define HAVE_STRLEN 1 | |
| 152 | +#define HAVE__STRREV 1 | |
| 153 | +/* These functions have security warnings, so we won't use them */ | |
| 154 | +/* #undef HAVE__STRUPR */ | |
| 155 | +/* #undef HAVE__STRLWR */ | |
| 156 | +#define HAVE_STRCHR 1 | |
| 157 | +#define HAVE_STRRCHR 1 | |
| 158 | +#define HAVE_STRSTR 1 | |
| 159 | +/* #undef HAVE_STRTOK_R */ | |
| 160 | +/* These functions have security warnings, so we won't use them */ | |
| 161 | +/* #undef HAVE__LTOA */ | |
| 162 | +/* #undef HAVE__ULTOA */ | |
| 163 | +#define HAVE_STRTOL 1 | |
| 164 | +#define HAVE_STRTOUL 1 | |
| 165 | +#define HAVE_STRTOD 1 | |
| 166 | +#define HAVE_ATOI 1 | |
| 167 | +#define HAVE_ATOF 1 | |
| 168 | +#define HAVE_STRCMP 1 | |
| 169 | +#define HAVE_STRNCMP 1 | |
| 170 | +#define HAVE__STRICMP 1 | |
| 171 | +#define HAVE__STRNICMP 1 | |
| 172 | +#define HAVE__WCSICMP 1 | |
| 173 | +#define HAVE__WCSNICMP 1 | |
| 174 | +#define HAVE__WCSDUP 1 | |
| 175 | +#define HAVE_ACOS 1 | |
| 176 | +#define HAVE_ASIN 1 | |
| 177 | +#define HAVE_ATAN 1 | |
| 178 | +#define HAVE_ATAN2 1 | |
| 179 | +#define HAVE_CEIL 1 | |
| 180 | +#define HAVE_COS 1 | |
| 181 | +#define HAVE_EXP 1 | |
| 182 | +#define HAVE_FABS 1 | |
| 183 | +#define HAVE_FLOOR 1 | |
| 184 | +#define HAVE_FMOD 1 | |
| 185 | +#define HAVE_LOG 1 | |
| 186 | +#define HAVE_LOG10 1 | |
| 187 | +#define HAVE_POW 1 | |
| 188 | +#define HAVE_SIN 1 | |
| 189 | +#define HAVE_SQRT 1 | |
| 190 | +#define HAVE_TAN 1 | |
| 191 | +#ifndef __WATCOMC__ | |
| 192 | +#define HAVE_ACOSF 1 | |
| 193 | +#define HAVE_ASINF 1 | |
| 194 | +#define HAVE_ATANF 1 | |
| 195 | +#define HAVE_ATAN2F 1 | |
| 196 | +#define HAVE_CEILF 1 | |
| 197 | +#define HAVE__COPYSIGN 1 | |
| 198 | +#define HAVE_COSF 1 | |
| 199 | +#define HAVE_EXPF 1 | |
| 200 | +#define HAVE_FABSF 1 | |
| 201 | +#define HAVE_FLOORF 1 | |
| 202 | +#define HAVE_FMODF 1 | |
| 203 | +#define HAVE_LOGF 1 | |
| 204 | +#define HAVE_LOG10F 1 | |
| 205 | +#define HAVE_POWF 1 | |
| 206 | +#define HAVE_SINF 1 | |
| 207 | +#define HAVE_SQRTF 1 | |
| 208 | +#define HAVE_TANF 1 | |
| 209 | +#endif | |
| 210 | +#if defined(_MSC_VER) | |
| 211 | +/* These functions were added with the VC++ 2013 C runtime library */ | |
| 212 | +#if _MSC_VER >= 1800 | |
| 213 | +#define HAVE_STRTOLL 1 | |
| 214 | +#define HAVE_STRTOULL 1 | |
| 215 | +#define HAVE_VSSCANF 1 | |
| 216 | +#define HAVE_LROUND 1 | |
| 217 | +#define HAVE_LROUNDF 1 | |
| 218 | +#define HAVE_ROUND 1 | |
| 219 | +#define HAVE_ROUNDF 1 | |
| 220 | +#define HAVE_SCALBN 1 | |
| 221 | +#define HAVE_SCALBNF 1 | |
| 222 | +#define HAVE_TRUNC 1 | |
| 223 | +#define HAVE_TRUNCF 1 | |
| 224 | +#endif | |
| 225 | +/* This function is available with at least the VC++ 2008 C runtime library */ | |
| 226 | +#if _MSC_VER >= 1400 | |
| 227 | +#define HAVE__FSEEKI64 1 | |
| 228 | +#endif | |
| 229 | +#ifdef _USE_MATH_DEFINES | |
| 230 | +#define HAVE_M_PI 1 | |
| 231 | +#endif | |
| 232 | +#elif defined(__WATCOMC__) | |
| 233 | +#define HAVE__FSEEKI64 1 | |
| 234 | +#define HAVE_STRTOLL 1 | |
| 235 | +#define HAVE_STRTOULL 1 | |
| 236 | +#define HAVE_VSSCANF 1 | |
| 237 | +#define HAVE_ROUND 1 | |
| 238 | +#define HAVE_SCALBN 1 | |
| 239 | +#define HAVE_TRUNC 1 | |
| 240 | +#else | |
| 241 | +#define HAVE_M_PI 1 | |
| 242 | +#endif | |
| 243 | +#else | |
| 244 | +#define HAVE_STDARG_H 1 | |
| 245 | +#define HAVE_STDDEF_H 1 | |
| 246 | +#endif | |
| 247 | + | |
| 248 | +/* Enable various audio drivers */ | |
| 249 | +#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) | |
| 250 | +#define SDL_AUDIO_DRIVER_WASAPI 1 | |
| 251 | +#endif | |
| 252 | +#define SDL_AUDIO_DRIVER_DSOUND 1 | |
| 253 | +#define SDL_AUDIO_DRIVER_WINMM 1 | |
| 254 | +#define SDL_AUDIO_DRIVER_DISK 1 | |
| 255 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 256 | + | |
| 257 | +/* Enable various input drivers */ | |
| 258 | +#define SDL_JOYSTICK_DINPUT 1 | |
| 259 | +#define SDL_JOYSTICK_HIDAPI 1 | |
| 260 | +#ifndef __WINRT__ | |
| 261 | +#define SDL_JOYSTICK_RAWINPUT 1 | |
| 262 | +#endif | |
| 263 | +#define SDL_JOYSTICK_VIRTUAL 1 | |
| 264 | +#ifdef HAVE_WINDOWS_GAMING_INPUT_H | |
| 265 | +#define SDL_JOYSTICK_WGI 1 | |
| 266 | +#endif | |
| 267 | +#define SDL_JOYSTICK_XINPUT 1 | |
| 268 | +#define SDL_HAPTIC_DINPUT 1 | |
| 269 | +#define SDL_HAPTIC_XINPUT 1 | |
| 270 | + | |
| 271 | +/* Enable the sensor driver */ | |
| 272 | +#ifdef HAVE_SENSORSAPI_H | |
| 273 | +#define SDL_SENSOR_WINDOWS 1 | |
| 274 | +#else | |
| 275 | +#define SDL_SENSOR_DUMMY 1 | |
| 276 | +#endif | |
| 277 | + | |
| 278 | +/* Enable various shared object loading systems */ | |
| 279 | +#define SDL_LOADSO_WINDOWS 1 | |
| 280 | + | |
| 281 | +/* Enable various threading systems */ | |
| 282 | +#define SDL_THREAD_GENERIC_COND_SUFFIX 1 | |
| 283 | +#define SDL_THREAD_WINDOWS 1 | |
| 284 | + | |
| 285 | +/* Enable various timer systems */ | |
| 286 | +#define SDL_TIMER_WINDOWS 1 | |
| 287 | + | |
| 288 | +/* Enable various video drivers */ | |
| 289 | +#define SDL_VIDEO_DRIVER_DUMMY 1 | |
| 290 | +#define SDL_VIDEO_DRIVER_WINDOWS 1 | |
| 291 | + | |
| 292 | +#ifndef SDL_VIDEO_RENDER_D3D | |
| 293 | +#define SDL_VIDEO_RENDER_D3D 1 | |
| 294 | +#endif | |
| 295 | +#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) | |
| 296 | +#define SDL_VIDEO_RENDER_D3D11 1 | |
| 297 | +#endif | |
| 298 | +#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) | |
| 299 | +#define SDL_VIDEO_RENDER_D3D12 1 | |
| 300 | +#endif | |
| 301 | + | |
| 302 | +/* Enable OpenGL support */ | |
| 303 | +#ifndef SDL_VIDEO_OPENGL | |
| 304 | +#define SDL_VIDEO_OPENGL 1 | |
| 305 | +#endif | |
| 306 | +#ifndef SDL_VIDEO_OPENGL_WGL | |
| 307 | +#define SDL_VIDEO_OPENGL_WGL 1 | |
| 308 | +#endif | |
| 309 | +#ifndef SDL_VIDEO_RENDER_OGL | |
| 310 | +#define SDL_VIDEO_RENDER_OGL 1 | |
| 311 | +#endif | |
| 312 | +#ifndef SDL_VIDEO_RENDER_OGL_ES2 | |
| 313 | +#define SDL_VIDEO_RENDER_OGL_ES2 1 | |
| 314 | +#endif | |
| 315 | +#ifndef SDL_VIDEO_OPENGL_ES2 | |
| 316 | +#define SDL_VIDEO_OPENGL_ES2 1 | |
| 317 | +#endif | |
| 318 | +#ifndef SDL_VIDEO_OPENGL_EGL | |
| 319 | +#define SDL_VIDEO_OPENGL_EGL 1 | |
| 320 | +#endif | |
| 321 | + | |
| 322 | +/* Enable Vulkan support */ | |
| 323 | +#define SDL_VIDEO_VULKAN 1 | |
| 324 | + | |
| 325 | +/* Enable system power support */ | |
| 326 | +#define SDL_POWER_WINDOWS 1 | |
| 327 | + | |
| 328 | +/* Enable filesystem support */ | |
| 329 | +#define SDL_FILESYSTEM_WINDOWS 1 | |
| 330 | + | |
| 331 | +#endif /* SDL_config_windows_h_ */ | |
| 332 | + | |
| 333 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,253 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_wingdk_h_ | |
| 23 | +#define SDL_config_wingdk_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +#include "SDL_platform.h" | |
| 27 | + | |
| 28 | +/* Windows GDK does not need Windows SDK version checks because it requires | |
| 29 | + * a recent version of the Windows 10 SDK. */ | |
| 30 | + | |
| 31 | +/* GDK only supports 64-bit */ | |
| 32 | +# define SIZEOF_VOIDP 8 | |
| 33 | + | |
| 34 | +#ifdef __clang__ | |
| 35 | +# define HAVE_GCC_ATOMICS 1 | |
| 36 | +#endif | |
| 37 | + | |
| 38 | +#define HAVE_DDRAW_H 1 | |
| 39 | +#define HAVE_DINPUT_H 1 | |
| 40 | +#define HAVE_DSOUND_H 1 | |
| 41 | +/* No SDK version checks needed for these because the SDK has to be new. */ | |
| 42 | +#define HAVE_DXGI_H 1 | |
| 43 | +#define HAVE_XINPUT_H 1 | |
| 44 | +#define HAVE_WINDOWS_GAMING_INPUT_H 1 | |
| 45 | +#define HAVE_D3D11_H 1 | |
| 46 | +#define HAVE_ROAPI_H 1 | |
| 47 | +#define HAVE_D3D12_H 1 | |
| 48 | +#define HAVE_SHELLSCALINGAPI_H 1 | |
| 49 | +#define HAVE_MMDEVICEAPI_H 1 | |
| 50 | +#define HAVE_AUDIOCLIENT_H 1 | |
| 51 | +#define HAVE_TPCSHRD_H 1 | |
| 52 | +#define HAVE_SENSORSAPI_H 1 | |
| 53 | +#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) | |
| 54 | +#define HAVE_IMMINTRIN_H 1 | |
| 55 | +#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) | |
| 56 | +# if __has_include(<immintrin.h>) | |
| 57 | +# define HAVE_IMMINTRIN_H 1 | |
| 58 | +# endif | |
| 59 | +#endif | |
| 60 | + | |
| 61 | +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ | |
| 62 | +#ifdef HAVE_LIBC | |
| 63 | +/* Useful headers */ | |
| 64 | +#define STDC_HEADERS 1 | |
| 65 | +#define HAVE_CTYPE_H 1 | |
| 66 | +#define HAVE_FLOAT_H 1 | |
| 67 | +#define HAVE_LIMITS_H 1 | |
| 68 | +#define HAVE_MATH_H 1 | |
| 69 | +#define HAVE_SIGNAL_H 1 | |
| 70 | +#define HAVE_STDINT_H 1 | |
| 71 | +#define HAVE_STDIO_H 1 | |
| 72 | +#define HAVE_STRING_H 1 | |
| 73 | + | |
| 74 | +/* C library functions */ | |
| 75 | +#define HAVE_MALLOC 1 | |
| 76 | +#define HAVE_CALLOC 1 | |
| 77 | +#define HAVE_REALLOC 1 | |
| 78 | +#define HAVE_FREE 1 | |
| 79 | +#define HAVE_ALLOCA 1 | |
| 80 | +#define HAVE_QSORT 1 | |
| 81 | +#define HAVE_BSEARCH 1 | |
| 82 | +#define HAVE_ABS 1 | |
| 83 | +#define HAVE_MEMSET 1 | |
| 84 | +#define HAVE_MEMCPY 1 | |
| 85 | +#define HAVE_MEMMOVE 1 | |
| 86 | +#define HAVE_MEMCMP 1 | |
| 87 | +#define HAVE_STRLEN 1 | |
| 88 | +#define HAVE__STRREV 1 | |
| 89 | +/* These functions have security warnings, so we won't use them */ | |
| 90 | +/* #undef HAVE__STRUPR */ | |
| 91 | +/* #undef HAVE__STRLWR */ | |
| 92 | +#define HAVE_STRCHR 1 | |
| 93 | +#define HAVE_STRRCHR 1 | |
| 94 | +#define HAVE_STRSTR 1 | |
| 95 | +/* #undef HAVE_STRTOK_R */ | |
| 96 | +/* These functions have security warnings, so we won't use them */ | |
| 97 | +/* #undef HAVE__LTOA */ | |
| 98 | +/* #undef HAVE__ULTOA */ | |
| 99 | +#define HAVE_STRTOL 1 | |
| 100 | +#define HAVE_STRTOUL 1 | |
| 101 | +#define HAVE_STRTOD 1 | |
| 102 | +#define HAVE_ATOI 1 | |
| 103 | +#define HAVE_ATOF 1 | |
| 104 | +#define HAVE_STRCMP 1 | |
| 105 | +#define HAVE_STRNCMP 1 | |
| 106 | +#define HAVE__STRICMP 1 | |
| 107 | +#define HAVE__STRNICMP 1 | |
| 108 | +#define HAVE__WCSICMP 1 | |
| 109 | +#define HAVE__WCSNICMP 1 | |
| 110 | +#define HAVE__WCSDUP 1 | |
| 111 | +#define HAVE_ACOS 1 | |
| 112 | +#define HAVE_ASIN 1 | |
| 113 | +#define HAVE_ATAN 1 | |
| 114 | +#define HAVE_ATAN2 1 | |
| 115 | +#define HAVE_CEIL 1 | |
| 116 | +#define HAVE_COS 1 | |
| 117 | +#define HAVE_EXP 1 | |
| 118 | +#define HAVE_FABS 1 | |
| 119 | +#define HAVE_FLOOR 1 | |
| 120 | +#define HAVE_FMOD 1 | |
| 121 | +#define HAVE_LOG 1 | |
| 122 | +#define HAVE_LOG10 1 | |
| 123 | +#define HAVE_POW 1 | |
| 124 | +#define HAVE_SIN 1 | |
| 125 | +#define HAVE_SQRT 1 | |
| 126 | +#define HAVE_TAN 1 | |
| 127 | +#define HAVE_ACOSF 1 | |
| 128 | +#define HAVE_ASINF 1 | |
| 129 | +#define HAVE_ATANF 1 | |
| 130 | +#define HAVE_ATAN2F 1 | |
| 131 | +#define HAVE_CEILF 1 | |
| 132 | +#define HAVE__COPYSIGN 1 | |
| 133 | +#define HAVE_COSF 1 | |
| 134 | +#define HAVE_EXPF 1 | |
| 135 | +#define HAVE_FABSF 1 | |
| 136 | +#define HAVE_FLOORF 1 | |
| 137 | +#define HAVE_FMODF 1 | |
| 138 | +#define HAVE_LOGF 1 | |
| 139 | +#define HAVE_LOG10F 1 | |
| 140 | +#define HAVE_POWF 1 | |
| 141 | +#define HAVE_SINF 1 | |
| 142 | +#define HAVE_SQRTF 1 | |
| 143 | +#define HAVE_TANF 1 | |
| 144 | +#if defined(_MSC_VER) | |
| 145 | +/* These functions were added with the VC++ 2013 C runtime library */ | |
| 146 | +#define HAVE_STRTOLL 1 | |
| 147 | +#define HAVE_STRTOULL 1 | |
| 148 | +#define HAVE_VSSCANF 1 | |
| 149 | +#define HAVE_LROUND 1 | |
| 150 | +#define HAVE_LROUNDF 1 | |
| 151 | +#define HAVE_ROUND 1 | |
| 152 | +#define HAVE_ROUNDF 1 | |
| 153 | +#define HAVE_SCALBN 1 | |
| 154 | +#define HAVE_SCALBNF 1 | |
| 155 | +#define HAVE_TRUNC 1 | |
| 156 | +#define HAVE_TRUNCF 1 | |
| 157 | +#define HAVE__FSEEKI64 1 | |
| 158 | +#ifdef _USE_MATH_DEFINES | |
| 159 | +#define HAVE_M_PI 1 | |
| 160 | +#endif | |
| 161 | +#else | |
| 162 | +#define HAVE_M_PI 1 | |
| 163 | +#endif | |
| 164 | +#else | |
| 165 | +#define HAVE_STDARG_H 1 | |
| 166 | +#define HAVE_STDDEF_H 1 | |
| 167 | +#define HAVE_STDINT_H 1 | |
| 168 | +#endif | |
| 169 | + | |
| 170 | +/* Enable various audio drivers */ | |
| 171 | +#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) | |
| 172 | +#define SDL_AUDIO_DRIVER_WASAPI 1 | |
| 173 | +#endif | |
| 174 | +#define SDL_AUDIO_DRIVER_DSOUND 1 | |
| 175 | +#define SDL_AUDIO_DRIVER_WINMM 1 | |
| 176 | +#define SDL_AUDIO_DRIVER_DISK 1 | |
| 177 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 178 | + | |
| 179 | +/* Enable various input drivers */ | |
| 180 | +#define SDL_JOYSTICK_DINPUT 1 | |
| 181 | +#define SDL_JOYSTICK_HIDAPI 1 | |
| 182 | +#define SDL_JOYSTICK_RAWINPUT 1 | |
| 183 | +#define SDL_JOYSTICK_VIRTUAL 1 | |
| 184 | +#ifdef HAVE_WINDOWS_GAMING_INPUT_H | |
| 185 | +#define SDL_JOYSTICK_WGI 1 | |
| 186 | +#endif | |
| 187 | +#define SDL_JOYSTICK_XINPUT 1 | |
| 188 | +#define SDL_HAPTIC_DINPUT 1 | |
| 189 | +#define SDL_HAPTIC_XINPUT 1 | |
| 190 | + | |
| 191 | +/* Enable the sensor driver */ | |
| 192 | +#ifdef HAVE_SENSORSAPI_H | |
| 193 | +#define SDL_SENSOR_WINDOWS 1 | |
| 194 | +#else | |
| 195 | +#define SDL_SENSOR_DUMMY 1 | |
| 196 | +#endif | |
| 197 | + | |
| 198 | +/* Enable various shared object loading systems */ | |
| 199 | +#define SDL_LOADSO_WINDOWS 1 | |
| 200 | + | |
| 201 | +/* Enable various threading systems */ | |
| 202 | +#define SDL_THREAD_GENERIC_COND_SUFFIX 1 | |
| 203 | +#define SDL_THREAD_WINDOWS 1 | |
| 204 | + | |
| 205 | +/* Enable various timer systems */ | |
| 206 | +#define SDL_TIMER_WINDOWS 1 | |
| 207 | + | |
| 208 | +/* Enable various video drivers */ | |
| 209 | +#define SDL_VIDEO_DRIVER_DUMMY 1 | |
| 210 | +#define SDL_VIDEO_DRIVER_WINDOWS 1 | |
| 211 | + | |
| 212 | +#ifndef SDL_VIDEO_RENDER_D3D | |
| 213 | +#define SDL_VIDEO_RENDER_D3D 1 | |
| 214 | +#endif | |
| 215 | +#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) | |
| 216 | +#define SDL_VIDEO_RENDER_D3D11 1 | |
| 217 | +#endif | |
| 218 | +#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) | |
| 219 | +#define SDL_VIDEO_RENDER_D3D12 1 | |
| 220 | +#endif | |
| 221 | + | |
| 222 | +/* Enable OpenGL support */ | |
| 223 | +#ifndef SDL_VIDEO_OPENGL | |
| 224 | +#define SDL_VIDEO_OPENGL 1 | |
| 225 | +#endif | |
| 226 | +#ifndef SDL_VIDEO_OPENGL_WGL | |
| 227 | +#define SDL_VIDEO_OPENGL_WGL 1 | |
| 228 | +#endif | |
| 229 | +#ifndef SDL_VIDEO_RENDER_OGL | |
| 230 | +#define SDL_VIDEO_RENDER_OGL 1 | |
| 231 | +#endif | |
| 232 | +#ifndef SDL_VIDEO_RENDER_OGL_ES2 | |
| 233 | +#define SDL_VIDEO_RENDER_OGL_ES2 1 | |
| 234 | +#endif | |
| 235 | +#ifndef SDL_VIDEO_OPENGL_ES2 | |
| 236 | +#define SDL_VIDEO_OPENGL_ES2 1 | |
| 237 | +#endif | |
| 238 | +#ifndef SDL_VIDEO_OPENGL_EGL | |
| 239 | +#define SDL_VIDEO_OPENGL_EGL 1 | |
| 240 | +#endif | |
| 241 | + | |
| 242 | +/* Enable Vulkan support */ | |
| 243 | +#define SDL_VIDEO_VULKAN 1 | |
| 244 | + | |
| 245 | +/* Enable system power support */ | |
| 246 | +#define SDL_POWER_WINDOWS 1 | |
| 247 | + | |
| 248 | +/* Enable filesystem support */ | |
| 249 | +#define SDL_FILESYSTEM_WINDOWS 1 | |
| 250 | + | |
| 251 | +#endif /* SDL_config_wingdk_h_ */ | |
| 252 | + | |
| 253 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,220 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_winrt_h_ | |
| 23 | +#define SDL_config_winrt_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +#include "SDL_platform.h" | |
| 27 | + | |
| 28 | +/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used | |
| 29 | + by SDL to determine which version of the Windows SDK is being used. | |
| 30 | +*/ | |
| 31 | +#include <sdkddkver.h> | |
| 32 | + | |
| 33 | +/* Define possibly-undefined NTDDI values (used when compiling SDL against | |
| 34 | + older versions of the Windows SDK. | |
| 35 | +*/ | |
| 36 | +#ifndef NTDDI_WINBLUE | |
| 37 | +#define NTDDI_WINBLUE 0x06030000 | |
| 38 | +#endif | |
| 39 | +#ifndef NTDDI_WIN10 | |
| 40 | +#define NTDDI_WIN10 0x0A000000 | |
| 41 | +#endif | |
| 42 | + | |
| 43 | +/* This is a set of defines to configure the SDL features */ | |
| 44 | + | |
| 45 | +#ifdef _WIN64 | |
| 46 | +# define SIZEOF_VOIDP 8 | |
| 47 | +#else | |
| 48 | +# define SIZEOF_VOIDP 4 | |
| 49 | +#endif | |
| 50 | + | |
| 51 | +#ifdef __clang__ | |
| 52 | +# define HAVE_GCC_ATOMICS 1 | |
| 53 | +#endif | |
| 54 | + | |
| 55 | +/* Useful headers */ | |
| 56 | +#define HAVE_DXGI_H 1 | |
| 57 | +#if !SDL_WINAPI_FAMILY_PHONE | |
| 58 | +#define HAVE_XINPUT_H 1 | |
| 59 | +#endif | |
| 60 | + | |
| 61 | +#define HAVE_MMDEVICEAPI_H 1 | |
| 62 | +#define HAVE_AUDIOCLIENT_H 1 | |
| 63 | +#define HAVE_TPCSHRD_H 1 | |
| 64 | + | |
| 65 | +#define HAVE_LIBC 1 | |
| 66 | +#define STDC_HEADERS 1 | |
| 67 | +#define HAVE_CTYPE_H 1 | |
| 68 | +#define HAVE_FLOAT_H 1 | |
| 69 | +#define HAVE_LIMITS_H 1 | |
| 70 | +#define HAVE_MATH_H 1 | |
| 71 | +#define HAVE_SIGNAL_H 1 | |
| 72 | +#define HAVE_STDINT_H 1 | |
| 73 | +#define HAVE_STDIO_H 1 | |
| 74 | +#define HAVE_STRING_H 1 | |
| 75 | + | |
| 76 | +/* C library functions */ | |
| 77 | +#define HAVE_MALLOC 1 | |
| 78 | +#define HAVE_CALLOC 1 | |
| 79 | +#define HAVE_REALLOC 1 | |
| 80 | +#define HAVE_FREE 1 | |
| 81 | +#define HAVE_ALLOCA 1 | |
| 82 | +#define HAVE_QSORT 1 | |
| 83 | +#define HAVE_BSEARCH 1 | |
| 84 | +#define HAVE_ABS 1 | |
| 85 | +#define HAVE_MEMSET 1 | |
| 86 | +#define HAVE_MEMCPY 1 | |
| 87 | +#define HAVE_MEMMOVE 1 | |
| 88 | +#define HAVE_MEMCMP 1 | |
| 89 | +#define HAVE_STRLEN 1 | |
| 90 | +#define HAVE__STRREV 1 | |
| 91 | +#define HAVE__STRUPR 1 | |
| 92 | +#define HAVE_STRCHR 1 | |
| 93 | +#define HAVE_STRRCHR 1 | |
| 94 | +#define HAVE_STRSTR 1 | |
| 95 | +#define HAVE_STRTOL 1 | |
| 96 | +#define HAVE_STRTOUL 1 | |
| 97 | +/* #undef HAVE_STRTOLL */ | |
| 98 | +/* #undef HAVE_STRTOULL */ | |
| 99 | +#define HAVE_STRTOD 1 | |
| 100 | +#define HAVE_ATOI 1 | |
| 101 | +#define HAVE_ATOF 1 | |
| 102 | +#define HAVE_STRCMP 1 | |
| 103 | +#define HAVE_STRNCMP 1 | |
| 104 | +#define HAVE__STRICMP 1 | |
| 105 | +#define HAVE__STRNICMP 1 | |
| 106 | +#define HAVE_VSNPRINTF 1 | |
| 107 | +/* TODO, WinRT: consider using ??_s versions of the following */ | |
| 108 | +/* #undef HAVE__STRLWR */ | |
| 109 | +/* #undef HAVE_ITOA */ | |
| 110 | +/* #undef HAVE__LTOA */ | |
| 111 | +/* #undef HAVE__ULTOA */ | |
| 112 | +/* #undef HAVE_SSCANF */ | |
| 113 | +#define HAVE_M_PI 1 | |
| 114 | +#define HAVE_ACOS 1 | |
| 115 | +#define HAVE_ACOSF 1 | |
| 116 | +#define HAVE_ASIN 1 | |
| 117 | +#define HAVE_ASINF 1 | |
| 118 | +#define HAVE_ATAN 1 | |
| 119 | +#define HAVE_ATANF 1 | |
| 120 | +#define HAVE_ATAN2 1 | |
| 121 | +#define HAVE_ATAN2F 1 | |
| 122 | +#define HAVE_CEIL 1 | |
| 123 | +#define HAVE_CEILF 1 | |
| 124 | +#define HAVE__COPYSIGN 1 | |
| 125 | +#define HAVE_COS 1 | |
| 126 | +#define HAVE_COSF 1 | |
| 127 | +#define HAVE_EXP 1 | |
| 128 | +#define HAVE_EXPF 1 | |
| 129 | +#define HAVE_FABS 1 | |
| 130 | +#define HAVE_FABSF 1 | |
| 131 | +#define HAVE_FLOOR 1 | |
| 132 | +#define HAVE_FLOORF 1 | |
| 133 | +#define HAVE_FMOD 1 | |
| 134 | +#define HAVE_FMODF 1 | |
| 135 | +#define HAVE_LOG 1 | |
| 136 | +#define HAVE_LOGF 1 | |
| 137 | +#define HAVE_LOG10 1 | |
| 138 | +#define HAVE_LOG10F 1 | |
| 139 | +#define HAVE_LROUND 1 | |
| 140 | +#define HAVE_LROUNDF 1 | |
| 141 | +#define HAVE_POW 1 | |
| 142 | +#define HAVE_POWF 1 | |
| 143 | +#define HAVE_ROUND 1 | |
| 144 | +#define HAVE_ROUNDF 1 | |
| 145 | +#define HAVE__SCALB 1 | |
| 146 | +#define HAVE_SIN 1 | |
| 147 | +#define HAVE_SINF 1 | |
| 148 | +#define HAVE_SQRT 1 | |
| 149 | +#define HAVE_SQRTF 1 | |
| 150 | +#define HAVE_TAN 1 | |
| 151 | +#define HAVE_TANF 1 | |
| 152 | +#define HAVE_TRUNC 1 | |
| 153 | +#define HAVE_TRUNCF 1 | |
| 154 | +#define HAVE__FSEEKI64 1 | |
| 155 | + | |
| 156 | +#define HAVE_ROAPI_H 1 | |
| 157 | + | |
| 158 | +/* Enable various audio drivers */ | |
| 159 | +#define SDL_AUDIO_DRIVER_WASAPI 1 | |
| 160 | +#define SDL_AUDIO_DRIVER_DISK 1 | |
| 161 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 162 | + | |
| 163 | +/* Enable various input drivers */ | |
| 164 | +#if SDL_WINAPI_FAMILY_PHONE | |
| 165 | +#define SDL_JOYSTICK_DISABLED 1 | |
| 166 | +#define SDL_HAPTIC_DISABLED 1 | |
| 167 | +#else | |
| 168 | +#define SDL_JOYSTICK_VIRTUAL 1 | |
| 169 | +#if (NTDDI_VERSION >= NTDDI_WIN10) | |
| 170 | +#define SDL_JOYSTICK_WGI 1 | |
| 171 | +#define SDL_HAPTIC_DISABLED 1 | |
| 172 | +#else | |
| 173 | +#define SDL_JOYSTICK_XINPUT 1 | |
| 174 | +#define SDL_HAPTIC_XINPUT 1 | |
| 175 | +#endif /* WIN10 */ | |
| 176 | +#endif | |
| 177 | + | |
| 178 | +/* WinRT doesn't have HIDAPI available */ | |
| 179 | +#define SDL_HIDAPI_DISABLED 1 | |
| 180 | + | |
| 181 | +/* Enable the dummy sensor driver */ | |
| 182 | +#define SDL_SENSOR_DUMMY 1 | |
| 183 | + | |
| 184 | +/* Enable various shared object loading systems */ | |
| 185 | +#define SDL_LOADSO_WINDOWS 1 | |
| 186 | + | |
| 187 | +/* Enable various threading systems */ | |
| 188 | +#if (NTDDI_VERSION >= NTDDI_WINBLUE) | |
| 189 | +#define SDL_THREAD_GENERIC_COND_SUFFIX 1 | |
| 190 | +#define SDL_THREAD_WINDOWS 1 | |
| 191 | +#else | |
| 192 | +/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */ | |
| 193 | +#define SDL_THREAD_STDCPP 1 | |
| 194 | +#endif | |
| 195 | + | |
| 196 | +/* Enable various timer systems */ | |
| 197 | +#define SDL_TIMER_WINDOWS 1 | |
| 198 | + | |
| 199 | +/* Enable various video drivers */ | |
| 200 | +#define SDL_VIDEO_DRIVER_WINRT 1 | |
| 201 | +#define SDL_VIDEO_DRIVER_DUMMY 1 | |
| 202 | + | |
| 203 | +/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */ | |
| 204 | +#define SDL_VIDEO_OPENGL_ES2 1 | |
| 205 | +#define SDL_VIDEO_OPENGL_EGL 1 | |
| 206 | + | |
| 207 | +/* Enable appropriate renderer(s) */ | |
| 208 | +#define SDL_VIDEO_RENDER_D3D11 1 | |
| 209 | + | |
| 210 | +/* Disable D3D12 as it's not implemented for WinRT */ | |
| 211 | +/* #undef SDL_VIDEO_RENDER_D3D12 */ | |
| 212 | + | |
| 213 | +#ifdef SDL_VIDEO_OPENGL_ES2 | |
| 214 | +#define SDL_VIDEO_RENDER_OGL_ES2 1 | |
| 215 | +#endif | |
| 216 | + | |
| 217 | +/* Enable system power support */ | |
| 218 | +#define SDL_POWER_WINRT 1 | |
| 219 | + | |
| 220 | +#endif /* SDL_config_winrt_h_ */ |
| @@ -0,0 +1,240 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_config_wingdk_h_ | |
| 23 | +#define SDL_config_wingdk_h_ | |
| 24 | +#define SDL_config_h_ | |
| 25 | + | |
| 26 | +#include "SDL_platform.h" | |
| 27 | + | |
| 28 | +/* Windows GDK does not need Windows SDK version checks because it requires | |
| 29 | + * a recent version of the Windows 10 SDK. */ | |
| 30 | + | |
| 31 | +/* GDK only supports 64-bit */ | |
| 32 | +# define SIZEOF_VOIDP 8 | |
| 33 | + | |
| 34 | +#ifdef __clang__ | |
| 35 | +# define HAVE_GCC_ATOMICS 1 | |
| 36 | +#endif | |
| 37 | + | |
| 38 | +/*#define HAVE_DDRAW_H 1*/ | |
| 39 | +/*#define HAVE_DINPUT_H 1*/ | |
| 40 | +/*#define HAVE_DSOUND_H 1*/ | |
| 41 | +/* No SDK version checks needed for these because the SDK has to be new. */ | |
| 42 | +/* #define HAVE_DXGI_H 1 */ | |
| 43 | +#define HAVE_XINPUT_H 1 | |
| 44 | +/*#define HAVE_WINDOWS_GAMING_INPUT_H 1*/ | |
| 45 | +/*#define HAVE_D3D11_H 1*/ | |
| 46 | +/*#define HAVE_ROAPI_H 1*/ | |
| 47 | +#define HAVE_D3D12_H 1 | |
| 48 | +/*#define HAVE_SHELLSCALINGAPI_H 1*/ | |
| 49 | +#define HAVE_MMDEVICEAPI_H 1 | |
| 50 | +#define HAVE_AUDIOCLIENT_H 1 | |
| 51 | +/*#define HAVE_TPCSHRD_H 1*/ | |
| 52 | +/*#define HAVE_SENSORSAPI_H 1*/ | |
| 53 | +#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) | |
| 54 | +#define HAVE_IMMINTRIN_H 1 | |
| 55 | +#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) | |
| 56 | +# if __has_include(<immintrin.h>) | |
| 57 | +# define HAVE_IMMINTRIN_H 1 | |
| 58 | +# endif | |
| 59 | +#endif | |
| 60 | + | |
| 61 | +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ | |
| 62 | +#ifdef HAVE_LIBC | |
| 63 | +/* Useful headers */ | |
| 64 | +#define STDC_HEADERS 1 | |
| 65 | +#define HAVE_CTYPE_H 1 | |
| 66 | +#define HAVE_FLOAT_H 1 | |
| 67 | +#define HAVE_LIMITS_H 1 | |
| 68 | +#define HAVE_MATH_H 1 | |
| 69 | +#define HAVE_SIGNAL_H 1 | |
| 70 | +#define HAVE_STDINT_H 1 | |
| 71 | +#define HAVE_STDIO_H 1 | |
| 72 | +#define HAVE_STRING_H 1 | |
| 73 | + | |
| 74 | +/* C library functions */ | |
| 75 | +#define HAVE_MALLOC 1 | |
| 76 | +#define HAVE_CALLOC 1 | |
| 77 | +#define HAVE_REALLOC 1 | |
| 78 | +#define HAVE_FREE 1 | |
| 79 | +#define HAVE_ALLOCA 1 | |
| 80 | +#define HAVE_QSORT 1 | |
| 81 | +#define HAVE_BSEARCH 1 | |
| 82 | +#define HAVE_ABS 1 | |
| 83 | +#define HAVE_MEMSET 1 | |
| 84 | +#define HAVE_MEMCPY 1 | |
| 85 | +#define HAVE_MEMMOVE 1 | |
| 86 | +#define HAVE_MEMCMP 1 | |
| 87 | +#define HAVE_STRLEN 1 | |
| 88 | +#define HAVE__STRREV 1 | |
| 89 | +/* These functions have security warnings, so we won't use them */ | |
| 90 | +/* #undef HAVE__STRUPR */ | |
| 91 | +/* #undef HAVE__STRLWR */ | |
| 92 | +#define HAVE_STRCHR 1 | |
| 93 | +#define HAVE_STRRCHR 1 | |
| 94 | +#define HAVE_STRSTR 1 | |
| 95 | +/* #undef HAVE_STRTOK_R */ | |
| 96 | +/* These functions have security warnings, so we won't use them */ | |
| 97 | +/* #undef HAVE__LTOA */ | |
| 98 | +/* #undef HAVE__ULTOA */ | |
| 99 | +#define HAVE_STRTOL 1 | |
| 100 | +#define HAVE_STRTOUL 1 | |
| 101 | +#define HAVE_STRTOD 1 | |
| 102 | +#define HAVE_ATOI 1 | |
| 103 | +#define HAVE_ATOF 1 | |
| 104 | +#define HAVE_STRCMP 1 | |
| 105 | +#define HAVE_STRNCMP 1 | |
| 106 | +#define HAVE__STRICMP 1 | |
| 107 | +#define HAVE__STRNICMP 1 | |
| 108 | +#define HAVE__WCSICMP 1 | |
| 109 | +#define HAVE__WCSNICMP 1 | |
| 110 | +#define HAVE__WCSDUP 1 | |
| 111 | +#define HAVE_ACOS 1 | |
| 112 | +#define HAVE_ASIN 1 | |
| 113 | +#define HAVE_ATAN 1 | |
| 114 | +#define HAVE_ATAN2 1 | |
| 115 | +#define HAVE_CEIL 1 | |
| 116 | +#define HAVE_COS 1 | |
| 117 | +#define HAVE_EXP 1 | |
| 118 | +#define HAVE_FABS 1 | |
| 119 | +#define HAVE_FLOOR 1 | |
| 120 | +#define HAVE_FMOD 1 | |
| 121 | +#define HAVE_LOG 1 | |
| 122 | +#define HAVE_LOG10 1 | |
| 123 | +#define HAVE_POW 1 | |
| 124 | +#define HAVE_SIN 1 | |
| 125 | +#define HAVE_SQRT 1 | |
| 126 | +#define HAVE_TAN 1 | |
| 127 | +#define HAVE_ACOSF 1 | |
| 128 | +#define HAVE_ASINF 1 | |
| 129 | +#define HAVE_ATANF 1 | |
| 130 | +#define HAVE_ATAN2F 1 | |
| 131 | +#define HAVE_CEILF 1 | |
| 132 | +#define HAVE__COPYSIGN 1 | |
| 133 | +#define HAVE_COSF 1 | |
| 134 | +#define HAVE_EXPF 1 | |
| 135 | +#define HAVE_FABSF 1 | |
| 136 | +#define HAVE_FLOORF 1 | |
| 137 | +#define HAVE_FMODF 1 | |
| 138 | +#define HAVE_LOGF 1 | |
| 139 | +#define HAVE_LOG10F 1 | |
| 140 | +#define HAVE_POWF 1 | |
| 141 | +#define HAVE_SINF 1 | |
| 142 | +#define HAVE_SQRTF 1 | |
| 143 | +#define HAVE_TANF 1 | |
| 144 | +#if defined(_MSC_VER) | |
| 145 | +/* These functions were added with the VC++ 2013 C runtime library */ | |
| 146 | +#define HAVE_STRTOLL 1 | |
| 147 | +#define HAVE_STRTOULL 1 | |
| 148 | +#define HAVE_VSSCANF 1 | |
| 149 | +#define HAVE_LROUND 1 | |
| 150 | +#define HAVE_LROUNDF 1 | |
| 151 | +#define HAVE_ROUND 1 | |
| 152 | +#define HAVE_ROUNDF 1 | |
| 153 | +#define HAVE_SCALBN 1 | |
| 154 | +#define HAVE_SCALBNF 1 | |
| 155 | +#define HAVE_TRUNC 1 | |
| 156 | +#define HAVE_TRUNCF 1 | |
| 157 | +#define HAVE__FSEEKI64 1 | |
| 158 | +#ifdef _USE_MATH_DEFINES | |
| 159 | +#define HAVE_M_PI 1 | |
| 160 | +#endif | |
| 161 | +#else | |
| 162 | +#define HAVE_M_PI 1 | |
| 163 | +#endif | |
| 164 | +#else | |
| 165 | +#define HAVE_STDARG_H 1 | |
| 166 | +#define HAVE_STDDEF_H 1 | |
| 167 | +#define HAVE_STDINT_H 1 | |
| 168 | +#endif | |
| 169 | + | |
| 170 | +/* Enable various audio drivers */ | |
| 171 | +#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) | |
| 172 | +#define SDL_AUDIO_DRIVER_WASAPI 1 | |
| 173 | +#endif | |
| 174 | +/*#define SDL_AUDIO_DRIVER_DSOUND 1*/ | |
| 175 | +/*#define SDL_AUDIO_DRIVER_WINMM 1*/ | |
| 176 | +#define SDL_AUDIO_DRIVER_DISK 1 | |
| 177 | +#define SDL_AUDIO_DRIVER_DUMMY 1 | |
| 178 | + | |
| 179 | +/* Enable various input drivers */ | |
| 180 | +/*#define SDL_JOYSTICK_DINPUT 1*/ | |
| 181 | +/*#define SDL_JOYSTICK_HIDAPI 1*/ | |
| 182 | +/*#define SDL_JOYSTICK_RAWINPUT 1*/ | |
| 183 | +#define SDL_JOYSTICK_VIRTUAL 1 | |
| 184 | +#ifdef HAVE_WINDOWS_GAMING_INPUT_H | |
| 185 | +#define SDL_JOYSTICK_WGI 1 | |
| 186 | +#endif | |
| 187 | +#define SDL_JOYSTICK_XINPUT 1 | |
| 188 | +/*#define SDL_HAPTIC_DINPUT 1*/ | |
| 189 | +#define SDL_HAPTIC_XINPUT 1 | |
| 190 | + | |
| 191 | +/* Enable the sensor driver */ | |
| 192 | +#ifdef HAVE_SENSORSAPI_H | |
| 193 | +#define SDL_SENSOR_WINDOWS 1 | |
| 194 | +#else | |
| 195 | +#define SDL_SENSOR_DUMMY 1 | |
| 196 | +#endif | |
| 197 | + | |
| 198 | +/* Enable various shared object loading systems */ | |
| 199 | +#define SDL_LOADSO_WINDOWS 1 | |
| 200 | + | |
| 201 | +/* Enable various threading systems */ | |
| 202 | +#define SDL_THREAD_GENERIC_COND_SUFFIX 1 | |
| 203 | +#define SDL_THREAD_WINDOWS 1 | |
| 204 | + | |
| 205 | +/* Enable various timer systems */ | |
| 206 | +#define SDL_TIMER_WINDOWS 1 | |
| 207 | + | |
| 208 | +/* Enable various video drivers */ | |
| 209 | +#define SDL_VIDEO_DRIVER_DUMMY 1 | |
| 210 | +#define SDL_VIDEO_DRIVER_WINDOWS 1 | |
| 211 | + | |
| 212 | +#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) | |
| 213 | +#define SDL_VIDEO_RENDER_D3D12 1 | |
| 214 | +#endif | |
| 215 | + | |
| 216 | +/* Enable OpenGL support */ | |
| 217 | +#ifndef SDL_VIDEO_OPENGL | |
| 218 | +#define SDL_VIDEO_OPENGL 1 | |
| 219 | +#endif | |
| 220 | +#ifndef SDL_VIDEO_OPENGL_WGL | |
| 221 | +#define SDL_VIDEO_OPENGL_WGL 1 | |
| 222 | +#endif | |
| 223 | +#ifndef SDL_VIDEO_RENDER_OGL | |
| 224 | +#define SDL_VIDEO_RENDER_OGL 1 | |
| 225 | +#endif | |
| 226 | + | |
| 227 | +/* Enable system power support */ | |
| 228 | +/*#define SDL_POWER_WINDOWS 1*/ | |
| 229 | +#define SDL_POWER_HARDWIRED 1 | |
| 230 | + | |
| 231 | +/* Enable filesystem support */ | |
| 232 | +/* #define SDL_FILESYSTEM_WINDOWS 1*/ | |
| 233 | +#define SDL_FILESYSTEM_XBOX 1 | |
| 234 | + | |
| 235 | +/* Disable IME as not supported yet (TODO: Xbox IME?) */ | |
| 236 | +#define SDL_DISABLE_WINDOWS_IME 1 | |
| 237 | + | |
| 238 | +#endif /* SDL_config_wingdk_h_ */ | |
| 239 | + | |
| 240 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,20 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | +*/ |
| @@ -0,0 +1,603 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | +/* WIKI CATEGORY: CPUInfo */ | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * # CategoryCPUInfo | |
| 26 | + * | |
| 27 | + * CPU feature detection for SDL. | |
| 28 | + * | |
| 29 | + * These functions are largely concerned with reporting if the system has | |
| 30 | + * access to various SIMD instruction sets, but also has other important info | |
| 31 | + * to share, such as number of logical CPU cores. | |
| 32 | + */ | |
| 33 | + | |
| 34 | +#ifndef SDL_cpuinfo_h_ | |
| 35 | +#define SDL_cpuinfo_h_ | |
| 36 | + | |
| 37 | +#include "SDL_stdinc.h" | |
| 38 | + | |
| 39 | +/* Need to do this here because intrin.h has C++ code in it */ | |
| 40 | +/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ | |
| 41 | +#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) | |
| 42 | +#ifdef __clang__ | |
| 43 | +/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version, | |
| 44 | + so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */ | |
| 45 | + | |
| 46 | +#ifndef __PRFCHWINTRIN_H | |
| 47 | +#define __PRFCHWINTRIN_H | |
| 48 | + | |
| 49 | +static __inline__ void __attribute__((__always_inline__, __nodebug__)) | |
| 50 | +_m_prefetch(void *__P) | |
| 51 | +{ | |
| 52 | + __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */); | |
| 53 | +} | |
| 54 | + | |
| 55 | +#endif /* __PRFCHWINTRIN_H */ | |
| 56 | +#endif /* __clang__ */ | |
| 57 | +#include <intrin.h> | |
| 58 | +#ifndef _WIN64 | |
| 59 | +#ifndef __MMX__ | |
| 60 | +#define __MMX__ | |
| 61 | +#endif | |
| 62 | +/* | |
| 63 | +#ifndef __3dNOW__ | |
| 64 | +#define __3dNOW__ | |
| 65 | +#endif | |
| 66 | +*/ | |
| 67 | +#endif | |
| 68 | +#ifndef __SSE__ | |
| 69 | +#define __SSE__ | |
| 70 | +#endif | |
| 71 | +#ifndef __SSE2__ | |
| 72 | +#define __SSE2__ | |
| 73 | +#endif | |
| 74 | +#ifndef __SSE3__ | |
| 75 | +#define __SSE3__ | |
| 76 | +#endif | |
| 77 | +#elif defined(__MINGW64_VERSION_MAJOR) | |
| 78 | +#include <intrin.h> | |
| 79 | +#if !defined(SDL_DISABLE_ARM_NEON_H) && defined(__ARM_NEON) | |
| 80 | +# include <arm_neon.h> | |
| 81 | +#endif | |
| 82 | +#else | |
| 83 | +/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */ | |
| 84 | +#if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H) | |
| 85 | +#include <altivec.h> | |
| 86 | +#endif | |
| 87 | +#if !defined(SDL_DISABLE_ARM_NEON_H) | |
| 88 | +# if defined(__ARM_NEON) | |
| 89 | +# include <arm_neon.h> | |
| 90 | +# elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__) | |
| 91 | +/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */ | |
| 92 | +# if defined(_M_ARM) | |
| 93 | +# include <armintr.h> | |
| 94 | +# include <arm_neon.h> | |
| 95 | +# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ | |
| 96 | +# endif | |
| 97 | +# if defined (_M_ARM64) | |
| 98 | +# include <arm64intr.h> | |
| 99 | +# include <arm64_neon.h> | |
| 100 | +# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ | |
| 101 | +# define __ARM_ARCH 8 | |
| 102 | +# endif | |
| 103 | +# endif | |
| 104 | +#endif | |
| 105 | +#endif /* compiler version */ | |
| 106 | + | |
| 107 | +#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) | |
| 108 | +#include <mm3dnow.h> | |
| 109 | +#endif | |
| 110 | +#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H) | |
| 111 | +#include <lsxintrin.h> | |
| 112 | +#define __LSX__ | |
| 113 | +#endif | |
| 114 | +#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX_H) | |
| 115 | +#include <lasxintrin.h> | |
| 116 | +#define __LASX__ | |
| 117 | +#endif | |
| 118 | +#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) && \ | |
| 119 | + (defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)) | |
| 120 | +#include <immintrin.h> | |
| 121 | +#else | |
| 122 | +#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) | |
| 123 | +#include <mmintrin.h> | |
| 124 | +#endif | |
| 125 | +#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) | |
| 126 | +#include <xmmintrin.h> | |
| 127 | +#endif | |
| 128 | +#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) | |
| 129 | +#include <emmintrin.h> | |
| 130 | +#endif | |
| 131 | +#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) | |
| 132 | +#include <pmmintrin.h> | |
| 133 | +#endif | |
| 134 | +#endif /* HAVE_IMMINTRIN_H */ | |
| 135 | + | |
| 136 | +#include "begin_code.h" | |
| 137 | +/* Set up for C function definitions, even when using C++ */ | |
| 138 | +#ifdef __cplusplus | |
| 139 | +extern "C" { | |
| 140 | +#endif | |
| 141 | + | |
| 142 | +/* This is a guess for the cacheline size used for padding. | |
| 143 | + * Most x86 processors have a 64 byte cache line. | |
| 144 | + * The 64-bit PowerPC processors have a 128 byte cache line. | |
| 145 | + * We'll use the larger value to be generally safe. | |
| 146 | + */ | |
| 147 | +#define SDL_CACHELINE_SIZE 128 | |
| 148 | + | |
| 149 | +/** | |
| 150 | + * Get the number of CPU cores available. | |
| 151 | + * | |
| 152 | + * \returns the total number of logical CPU cores. On CPUs that include | |
| 153 | + * technologies such as hyperthreading, the number of logical cores | |
| 154 | + * may be more than the number of physical cores. | |
| 155 | + * | |
| 156 | + * \since This function is available since SDL 2.0.0. | |
| 157 | + */ | |
| 158 | +extern DECLSPEC int SDLCALL SDL_GetCPUCount(void); | |
| 159 | + | |
| 160 | +/** | |
| 161 | + * Determine the L1 cache line size of the CPU. | |
| 162 | + * | |
| 163 | + * This is useful for determining multi-threaded structure padding or SIMD | |
| 164 | + * prefetch sizes. | |
| 165 | + * | |
| 166 | + * \returns the L1 cache line size of the CPU, in bytes. | |
| 167 | + * | |
| 168 | + * \since This function is available since SDL 2.0.0. | |
| 169 | + */ | |
| 170 | +extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); | |
| 171 | + | |
| 172 | +/** | |
| 173 | + * Determine whether the CPU has the RDTSC instruction. | |
| 174 | + * | |
| 175 | + * This always returns false on CPUs that aren't using Intel instruction sets. | |
| 176 | + * | |
| 177 | + * \returns SDL_TRUE if the CPU has the RDTSC instruction or SDL_FALSE if not. | |
| 178 | + * | |
| 179 | + * \since This function is available since SDL 2.0.0. | |
| 180 | + * | |
| 181 | + * \sa SDL_Has3DNow | |
| 182 | + * \sa SDL_HasAltiVec | |
| 183 | + * \sa SDL_HasAVX | |
| 184 | + * \sa SDL_HasAVX2 | |
| 185 | + * \sa SDL_HasMMX | |
| 186 | + * \sa SDL_HasSSE | |
| 187 | + * \sa SDL_HasSSE2 | |
| 188 | + * \sa SDL_HasSSE3 | |
| 189 | + * \sa SDL_HasSSE41 | |
| 190 | + * \sa SDL_HasSSE42 | |
| 191 | + */ | |
| 192 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); | |
| 193 | + | |
| 194 | +/** | |
| 195 | + * Determine whether the CPU has AltiVec features. | |
| 196 | + * | |
| 197 | + * This always returns false on CPUs that aren't using PowerPC instruction | |
| 198 | + * sets. | |
| 199 | + * | |
| 200 | + * \returns SDL_TRUE if the CPU has AltiVec features or SDL_FALSE if not. | |
| 201 | + * | |
| 202 | + * \since This function is available since SDL 2.0.0. | |
| 203 | + * | |
| 204 | + * \sa SDL_Has3DNow | |
| 205 | + * \sa SDL_HasAVX | |
| 206 | + * \sa SDL_HasAVX2 | |
| 207 | + * \sa SDL_HasMMX | |
| 208 | + * \sa SDL_HasRDTSC | |
| 209 | + * \sa SDL_HasSSE | |
| 210 | + * \sa SDL_HasSSE2 | |
| 211 | + * \sa SDL_HasSSE3 | |
| 212 | + * \sa SDL_HasSSE41 | |
| 213 | + * \sa SDL_HasSSE42 | |
| 214 | + */ | |
| 215 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); | |
| 216 | + | |
| 217 | +/** | |
| 218 | + * Determine whether the CPU has MMX features. | |
| 219 | + * | |
| 220 | + * This always returns false on CPUs that aren't using Intel instruction sets. | |
| 221 | + * | |
| 222 | + * \returns SDL_TRUE if the CPU has MMX features or SDL_FALSE if not. | |
| 223 | + * | |
| 224 | + * \since This function is available since SDL 2.0.0. | |
| 225 | + * | |
| 226 | + * \sa SDL_Has3DNow | |
| 227 | + * \sa SDL_HasAltiVec | |
| 228 | + * \sa SDL_HasAVX | |
| 229 | + * \sa SDL_HasAVX2 | |
| 230 | + * \sa SDL_HasRDTSC | |
| 231 | + * \sa SDL_HasSSE | |
| 232 | + * \sa SDL_HasSSE2 | |
| 233 | + * \sa SDL_HasSSE3 | |
| 234 | + * \sa SDL_HasSSE41 | |
| 235 | + * \sa SDL_HasSSE42 | |
| 236 | + */ | |
| 237 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); | |
| 238 | + | |
| 239 | +/** | |
| 240 | + * Determine whether the CPU has 3DNow! features. | |
| 241 | + * | |
| 242 | + * This always returns false on CPUs that aren't using AMD instruction sets. | |
| 243 | + * | |
| 244 | + * \returns SDL_TRUE if the CPU has 3DNow! features or SDL_FALSE if not. | |
| 245 | + * | |
| 246 | + * \since This function is available since SDL 2.0.0. | |
| 247 | + * | |
| 248 | + * \sa SDL_HasAltiVec | |
| 249 | + * \sa SDL_HasAVX | |
| 250 | + * \sa SDL_HasAVX2 | |
| 251 | + * \sa SDL_HasMMX | |
| 252 | + * \sa SDL_HasRDTSC | |
| 253 | + * \sa SDL_HasSSE | |
| 254 | + * \sa SDL_HasSSE2 | |
| 255 | + * \sa SDL_HasSSE3 | |
| 256 | + * \sa SDL_HasSSE41 | |
| 257 | + * \sa SDL_HasSSE42 | |
| 258 | + */ | |
| 259 | +extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); | |
| 260 | + | |
| 261 | +/** | |
| 262 | + * Determine whether the CPU has SSE features. | |
| 263 | + * | |
| 264 | + * This always returns false on CPUs that aren't using Intel instruction sets. | |
| 265 | + * | |
| 266 | + * \returns SDL_TRUE if the CPU has SSE features or SDL_FALSE if not. | |
| 267 | + * | |
| 268 | + * \since This function is available since SDL 2.0.0. | |
| 269 | + * | |
| 270 | + * \sa SDL_Has3DNow | |
| 271 | + * \sa SDL_HasAltiVec | |
| 272 | + * \sa SDL_HasAVX | |
| 273 | + * \sa SDL_HasAVX2 | |
| 274 | + * \sa SDL_HasMMX | |
| 275 | + * \sa SDL_HasRDTSC | |
| 276 | + * \sa SDL_HasSSE2 | |
| 277 | + * \sa SDL_HasSSE3 | |
| 278 | + * \sa SDL_HasSSE41 | |
| 279 | + * \sa SDL_HasSSE42 | |
| 280 | + */ | |
| 281 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); | |
| 282 | + | |
| 283 | +/** | |
| 284 | + * Determine whether the CPU has SSE2 features. | |
| 285 | + * | |
| 286 | + * This always returns false on CPUs that aren't using Intel instruction sets. | |
| 287 | + * | |
| 288 | + * \returns SDL_TRUE if the CPU has SSE2 features or SDL_FALSE if not. | |
| 289 | + * | |
| 290 | + * \since This function is available since SDL 2.0.0. | |
| 291 | + * | |
| 292 | + * \sa SDL_Has3DNow | |
| 293 | + * \sa SDL_HasAltiVec | |
| 294 | + * \sa SDL_HasAVX | |
| 295 | + * \sa SDL_HasAVX2 | |
| 296 | + * \sa SDL_HasMMX | |
| 297 | + * \sa SDL_HasRDTSC | |
| 298 | + * \sa SDL_HasSSE | |
| 299 | + * \sa SDL_HasSSE3 | |
| 300 | + * \sa SDL_HasSSE41 | |
| 301 | + * \sa SDL_HasSSE42 | |
| 302 | + */ | |
| 303 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); | |
| 304 | + | |
| 305 | +/** | |
| 306 | + * Determine whether the CPU has SSE3 features. | |
| 307 | + * | |
| 308 | + * This always returns false on CPUs that aren't using Intel instruction sets. | |
| 309 | + * | |
| 310 | + * \returns SDL_TRUE if the CPU has SSE3 features or SDL_FALSE if not. | |
| 311 | + * | |
| 312 | + * \since This function is available since SDL 2.0.0. | |
| 313 | + * | |
| 314 | + * \sa SDL_Has3DNow | |
| 315 | + * \sa SDL_HasAltiVec | |
| 316 | + * \sa SDL_HasAVX | |
| 317 | + * \sa SDL_HasAVX2 | |
| 318 | + * \sa SDL_HasMMX | |
| 319 | + * \sa SDL_HasRDTSC | |
| 320 | + * \sa SDL_HasSSE | |
| 321 | + * \sa SDL_HasSSE2 | |
| 322 | + * \sa SDL_HasSSE41 | |
| 323 | + * \sa SDL_HasSSE42 | |
| 324 | + */ | |
| 325 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void); | |
| 326 | + | |
| 327 | +/** | |
| 328 | + * Determine whether the CPU has SSE4.1 features. | |
| 329 | + * | |
| 330 | + * This always returns false on CPUs that aren't using Intel instruction sets. | |
| 331 | + * | |
| 332 | + * \returns SDL_TRUE if the CPU has SSE4.1 features or SDL_FALSE if not. | |
| 333 | + * | |
| 334 | + * \since This function is available since SDL 2.0.0. | |
| 335 | + * | |
| 336 | + * \sa SDL_Has3DNow | |
| 337 | + * \sa SDL_HasAltiVec | |
| 338 | + * \sa SDL_HasAVX | |
| 339 | + * \sa SDL_HasAVX2 | |
| 340 | + * \sa SDL_HasMMX | |
| 341 | + * \sa SDL_HasRDTSC | |
| 342 | + * \sa SDL_HasSSE | |
| 343 | + * \sa SDL_HasSSE2 | |
| 344 | + * \sa SDL_HasSSE3 | |
| 345 | + * \sa SDL_HasSSE42 | |
| 346 | + */ | |
| 347 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void); | |
| 348 | + | |
| 349 | +/** | |
| 350 | + * Determine whether the CPU has SSE4.2 features. | |
| 351 | + * | |
| 352 | + * This always returns false on CPUs that aren't using Intel instruction sets. | |
| 353 | + * | |
| 354 | + * \returns SDL_TRUE if the CPU has SSE4.2 features or SDL_FALSE if not. | |
| 355 | + * | |
| 356 | + * \since This function is available since SDL 2.0.0. | |
| 357 | + * | |
| 358 | + * \sa SDL_Has3DNow | |
| 359 | + * \sa SDL_HasAltiVec | |
| 360 | + * \sa SDL_HasAVX | |
| 361 | + * \sa SDL_HasAVX2 | |
| 362 | + * \sa SDL_HasMMX | |
| 363 | + * \sa SDL_HasRDTSC | |
| 364 | + * \sa SDL_HasSSE | |
| 365 | + * \sa SDL_HasSSE2 | |
| 366 | + * \sa SDL_HasSSE3 | |
| 367 | + * \sa SDL_HasSSE41 | |
| 368 | + */ | |
| 369 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); | |
| 370 | + | |
| 371 | +/** | |
| 372 | + * Determine whether the CPU has AVX features. | |
| 373 | + * | |
| 374 | + * This always returns false on CPUs that aren't using Intel instruction sets. | |
| 375 | + * | |
| 376 | + * \returns SDL_TRUE if the CPU has AVX features or SDL_FALSE if not. | |
| 377 | + * | |
| 378 | + * \since This function is available since SDL 2.0.2. | |
| 379 | + * | |
| 380 | + * \sa SDL_Has3DNow | |
| 381 | + * \sa SDL_HasAltiVec | |
| 382 | + * \sa SDL_HasAVX2 | |
| 383 | + * \sa SDL_HasMMX | |
| 384 | + * \sa SDL_HasRDTSC | |
| 385 | + * \sa SDL_HasSSE | |
| 386 | + * \sa SDL_HasSSE2 | |
| 387 | + * \sa SDL_HasSSE3 | |
| 388 | + * \sa SDL_HasSSE41 | |
| 389 | + * \sa SDL_HasSSE42 | |
| 390 | + */ | |
| 391 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); | |
| 392 | + | |
| 393 | +/** | |
| 394 | + * Determine whether the CPU has AVX2 features. | |
| 395 | + * | |
| 396 | + * This always returns false on CPUs that aren't using Intel instruction sets. | |
| 397 | + * | |
| 398 | + * \returns SDL_TRUE if the CPU has AVX2 features or SDL_FALSE if not. | |
| 399 | + * | |
| 400 | + * \since This function is available since SDL 2.0.4. | |
| 401 | + * | |
| 402 | + * \sa SDL_Has3DNow | |
| 403 | + * \sa SDL_HasAltiVec | |
| 404 | + * \sa SDL_HasAVX | |
| 405 | + * \sa SDL_HasMMX | |
| 406 | + * \sa SDL_HasRDTSC | |
| 407 | + * \sa SDL_HasSSE | |
| 408 | + * \sa SDL_HasSSE2 | |
| 409 | + * \sa SDL_HasSSE3 | |
| 410 | + * \sa SDL_HasSSE41 | |
| 411 | + * \sa SDL_HasSSE42 | |
| 412 | + */ | |
| 413 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); | |
| 414 | + | |
| 415 | +/** | |
| 416 | + * Determine whether the CPU has AVX-512F (foundation) features. | |
| 417 | + * | |
| 418 | + * This always returns false on CPUs that aren't using Intel instruction sets. | |
| 419 | + * | |
| 420 | + * \returns SDL_TRUE if the CPU has AVX-512F features or SDL_FALSE if not. | |
| 421 | + * | |
| 422 | + * \since This function is available since SDL 2.0.9. | |
| 423 | + * | |
| 424 | + * \sa SDL_HasAVX | |
| 425 | + */ | |
| 426 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); | |
| 427 | + | |
| 428 | +/** | |
| 429 | + * Determine whether the CPU has ARM SIMD (ARMv6) features. | |
| 430 | + * | |
| 431 | + * This is different from ARM NEON, which is a different instruction set. | |
| 432 | + * | |
| 433 | + * This always returns false on CPUs that aren't using ARM instruction sets. | |
| 434 | + * | |
| 435 | + * \returns SDL_TRUE if the CPU has ARM SIMD features or SDL_FALSE if not. | |
| 436 | + * | |
| 437 | + * \since This function is available since SDL 2.0.12. | |
| 438 | + * | |
| 439 | + * \sa SDL_HasNEON | |
| 440 | + */ | |
| 441 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void); | |
| 442 | + | |
| 443 | +/** | |
| 444 | + * Determine whether the CPU has NEON (ARM SIMD) features. | |
| 445 | + * | |
| 446 | + * This always returns false on CPUs that aren't using ARM instruction sets. | |
| 447 | + * | |
| 448 | + * \returns SDL_TRUE if the CPU has ARM NEON features or SDL_FALSE if not. | |
| 449 | + * | |
| 450 | + * \since This function is available since SDL 2.0.6. | |
| 451 | + */ | |
| 452 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); | |
| 453 | + | |
| 454 | +/** | |
| 455 | + * Determine whether the CPU has LSX (LOONGARCH SIMD) features. | |
| 456 | + * | |
| 457 | + * This always returns false on CPUs that aren't using LOONGARCH instruction | |
| 458 | + * sets. | |
| 459 | + * | |
| 460 | + * \returns SDL_TRUE if the CPU has LOONGARCH LSX features or SDL_FALSE if | |
| 461 | + * not. | |
| 462 | + * | |
| 463 | + * \since This function is available since SDL 2.24.0. | |
| 464 | + */ | |
| 465 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasLSX(void); | |
| 466 | + | |
| 467 | +/** | |
| 468 | + * Determine whether the CPU has LASX (LOONGARCH SIMD) features. | |
| 469 | + * | |
| 470 | + * This always returns false on CPUs that aren't using LOONGARCH instruction | |
| 471 | + * sets. | |
| 472 | + * | |
| 473 | + * \returns SDL_TRUE if the CPU has LOONGARCH LASX features or SDL_FALSE if | |
| 474 | + * not. | |
| 475 | + * | |
| 476 | + * \since This function is available since SDL 2.24.0. | |
| 477 | + */ | |
| 478 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasLASX(void); | |
| 479 | + | |
| 480 | +/** | |
| 481 | + * Get the amount of RAM configured in the system. | |
| 482 | + * | |
| 483 | + * \returns the amount of RAM configured in the system in MiB. | |
| 484 | + * | |
| 485 | + * \since This function is available since SDL 2.0.1. | |
| 486 | + */ | |
| 487 | +extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); | |
| 488 | + | |
| 489 | +/** | |
| 490 | + * Report the alignment this system needs for SIMD allocations. | |
| 491 | + * | |
| 492 | + * This will return the minimum number of bytes to which a pointer must be | |
| 493 | + * aligned to be compatible with SIMD instructions on the current machine. For | |
| 494 | + * example, if the machine supports SSE only, it will return 16, but if it | |
| 495 | + * supports AVX-512F, it'll return 64 (etc). This only reports values for | |
| 496 | + * instruction sets SDL knows about, so if your SDL build doesn't have | |
| 497 | + * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and | |
| 498 | + * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. | |
| 499 | + * Plan accordingly. | |
| 500 | + * | |
| 501 | + * \returns the alignment in bytes needed for available, known SIMD | |
| 502 | + * instructions. | |
| 503 | + * | |
| 504 | + * \since This function is available since SDL 2.0.10. | |
| 505 | + */ | |
| 506 | +extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void); | |
| 507 | + | |
| 508 | +/** | |
| 509 | + * Allocate memory in a SIMD-friendly way. | |
| 510 | + * | |
| 511 | + * This will allocate a block of memory that is suitable for use with SIMD | |
| 512 | + * instructions. Specifically, it will be properly aligned and padded for the | |
| 513 | + * system's supported vector instructions. | |
| 514 | + * | |
| 515 | + * The memory returned will be padded such that it is safe to read or write an | |
| 516 | + * incomplete vector at the end of the memory block. This can be useful so you | |
| 517 | + * don't have to drop back to a scalar fallback at the end of your SIMD | |
| 518 | + * processing loop to deal with the final elements without overflowing the | |
| 519 | + * allocated buffer. | |
| 520 | + * | |
| 521 | + * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() or | |
| 522 | + * delete[], etc. | |
| 523 | + * | |
| 524 | + * Note that SDL will only deal with SIMD instruction sets it is aware of; for | |
| 525 | + * example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and | |
| 526 | + * AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants | |
| 527 | + * 64. To be clear: if you can't decide to use an instruction set with an | |
| 528 | + * SDL_Has*() function, don't use that instruction set with memory allocated | |
| 529 | + * through here. | |
| 530 | + * | |
| 531 | + * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't | |
| 532 | + * out of memory, but you are not allowed to dereference it (because you only | |
| 533 | + * own zero bytes of that buffer). | |
| 534 | + * | |
| 535 | + * \param len The length, in bytes, of the block to allocate. The actual | |
| 536 | + * allocated block might be larger due to padding, etc. | |
| 537 | + * \returns a pointer to the newly-allocated block, NULL if out of memory. | |
| 538 | + * | |
| 539 | + * \since This function is available since SDL 2.0.10. | |
| 540 | + * | |
| 541 | + * \sa SDL_SIMDGetAlignment | |
| 542 | + * \sa SDL_SIMDRealloc | |
| 543 | + * \sa SDL_SIMDFree | |
| 544 | + */ | |
| 545 | +extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len); | |
| 546 | + | |
| 547 | +/** | |
| 548 | + * Reallocate memory obtained from SDL_SIMDAlloc | |
| 549 | + * | |
| 550 | + * It is not valid to use this function on a pointer from anything but | |
| 551 | + * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc, | |
| 552 | + * SDL_malloc, memalign, new[], etc. | |
| 553 | + * | |
| 554 | + * \param mem The pointer obtained from SDL_SIMDAlloc. This function also | |
| 555 | + * accepts NULL, at which point this function is the same as | |
| 556 | + * calling SDL_SIMDAlloc with a NULL pointer. | |
| 557 | + * \param len The length, in bytes, of the block to allocated. The actual | |
| 558 | + * allocated block might be larger due to padding, etc. Passing 0 | |
| 559 | + * will return a non-NULL pointer, assuming the system isn't out of | |
| 560 | + * memory. | |
| 561 | + * \returns a pointer to the newly-reallocated block, NULL if out of memory. | |
| 562 | + * | |
| 563 | + * \since This function is available since SDL 2.0.14. | |
| 564 | + * | |
| 565 | + * \sa SDL_SIMDGetAlignment | |
| 566 | + * \sa SDL_SIMDAlloc | |
| 567 | + * \sa SDL_SIMDFree | |
| 568 | + */ | |
| 569 | +extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, const size_t len); | |
| 570 | + | |
| 571 | +/** | |
| 572 | + * Deallocate memory obtained from SDL_SIMDAlloc | |
| 573 | + * | |
| 574 | + * It is not valid to use this function on a pointer from anything but | |
| 575 | + * SDL_SIMDAlloc() or SDL_SIMDRealloc(). It can't be used on pointers from | |
| 576 | + * malloc, realloc, SDL_malloc, memalign, new[], etc. | |
| 577 | + * | |
| 578 | + * However, SDL_SIMDFree(NULL) is a legal no-op. | |
| 579 | + * | |
| 580 | + * The memory pointed to by `ptr` is no longer valid for access upon return, | |
| 581 | + * and may be returned to the system or reused by a future allocation. The | |
| 582 | + * pointer passed to this function is no longer safe to dereference once this | |
| 583 | + * function returns, and should be discarded. | |
| 584 | + * | |
| 585 | + * \param ptr The pointer, returned from SDL_SIMDAlloc or SDL_SIMDRealloc, to | |
| 586 | + * deallocate. NULL is a legal no-op. | |
| 587 | + * | |
| 588 | + * \since This function is available since SDL 2.0.10. | |
| 589 | + * | |
| 590 | + * \sa SDL_SIMDAlloc | |
| 591 | + * \sa SDL_SIMDRealloc | |
| 592 | + */ | |
| 593 | +extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr); | |
| 594 | + | |
| 595 | +/* Ends C function definitions when using C++ */ | |
| 596 | +#ifdef __cplusplus | |
| 597 | +} | |
| 598 | +#endif | |
| 599 | +#include "close_code.h" | |
| 600 | + | |
| 601 | +#endif /* SDL_cpuinfo_h_ */ | |
| 602 | + | |
| 603 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,2351 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * This is a simple file to encapsulate the EGL API headers. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) | |
| 27 | + | |
| 28 | +#if defined(__vita__) || defined(__psp2__) | |
| 29 | +#include <psp2/types.h> | |
| 30 | +#endif | |
| 31 | + | |
| 32 | +#include <EGL/egl.h> | |
| 33 | +#include <EGL/eglext.h> | |
| 34 | + | |
| 35 | +#else /* _MSC_VER */ | |
| 36 | + | |
| 37 | +/* EGL headers for Visual Studio */ | |
| 38 | + | |
| 39 | +#ifndef __khrplatform_h_ | |
| 40 | +#define __khrplatform_h_ | |
| 41 | + | |
| 42 | +/* | |
| 43 | +** Copyright (c) 2008-2018 The Khronos Group Inc. | |
| 44 | +** | |
| 45 | +** Permission is hereby granted, free of charge, to any person obtaining a | |
| 46 | +** copy of this software and/or associated documentation files (the | |
| 47 | +** "Materials"), to deal in the Materials without restriction, including | |
| 48 | +** without limitation the rights to use, copy, modify, merge, publish, | |
| 49 | +** distribute, sublicense, and/or sell copies of the Materials, and to | |
| 50 | +** permit persons to whom the Materials are furnished to do so, subject to | |
| 51 | +** the following conditions: | |
| 52 | +** | |
| 53 | +** The above copyright notice and this permission notice shall be included | |
| 54 | +** in all copies or substantial portions of the Materials. | |
| 55 | +** | |
| 56 | +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
| 57 | +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 58 | +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
| 59 | +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
| 60 | +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
| 61 | +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
| 62 | +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. | |
| 63 | +*/ | |
| 64 | + | |
| 65 | +/* Khronos platform-specific types and definitions. | |
| 66 | + * | |
| 67 | + * The master copy of khrplatform.h is maintained in the Khronos EGL | |
| 68 | + * Registry repository at https://github.com/KhronosGroup/EGL-Registry | |
| 69 | + * The last semantic modification to khrplatform.h was at commit ID: | |
| 70 | + * 67a3e0864c2d75ea5287b9f3d2eb74a745936692 | |
| 71 | + * | |
| 72 | + * Adopters may modify this file to suit their platform. Adopters are | |
| 73 | + * encouraged to submit platform specific modifications to the Khronos | |
| 74 | + * group so that they can be included in future versions of this file. | |
| 75 | + * Please submit changes by filing pull requests or issues on | |
| 76 | + * the EGL Registry repository linked above. | |
| 77 | + * | |
| 78 | + * | |
| 79 | + * See the Implementer's Guidelines for information about where this file | |
| 80 | + * should be located on your system and for more details of its use: | |
| 81 | + * http://www.khronos.org/registry/implementers_guide.pdf | |
| 82 | + * | |
| 83 | + * This file should be included as | |
| 84 | + * #include <KHR/khrplatform.h> | |
| 85 | + * by Khronos client API header files that use its types and defines. | |
| 86 | + * | |
| 87 | + * The types in khrplatform.h should only be used to define API-specific types. | |
| 88 | + * | |
| 89 | + * Types defined in khrplatform.h: | |
| 90 | + * khronos_int8_t signed 8 bit | |
| 91 | + * khronos_uint8_t unsigned 8 bit | |
| 92 | + * khronos_int16_t signed 16 bit | |
| 93 | + * khronos_uint16_t unsigned 16 bit | |
| 94 | + * khronos_int32_t signed 32 bit | |
| 95 | + * khronos_uint32_t unsigned 32 bit | |
| 96 | + * khronos_int64_t signed 64 bit | |
| 97 | + * khronos_uint64_t unsigned 64 bit | |
| 98 | + * khronos_intptr_t signed same number of bits as a pointer | |
| 99 | + * khronos_uintptr_t unsigned same number of bits as a pointer | |
| 100 | + * khronos_ssize_t signed size | |
| 101 | + * khronos_usize_t unsigned size | |
| 102 | + * khronos_float_t signed 32 bit floating point | |
| 103 | + * khronos_time_ns_t unsigned 64 bit time in nanoseconds | |
| 104 | + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in | |
| 105 | + * nanoseconds | |
| 106 | + * khronos_stime_nanoseconds_t signed time interval in nanoseconds | |
| 107 | + * khronos_boolean_enum_t enumerated boolean type. This should | |
| 108 | + * only be used as a base type when a client API's boolean type is | |
| 109 | + * an enum. Client APIs which use an integer or other type for | |
| 110 | + * booleans cannot use this as the base type for their boolean. | |
| 111 | + * | |
| 112 | + * Tokens defined in khrplatform.h: | |
| 113 | + * | |
| 114 | + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. | |
| 115 | + * | |
| 116 | + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. | |
| 117 | + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. | |
| 118 | + * | |
| 119 | + * Calling convention macros defined in this file: | |
| 120 | + * KHRONOS_APICALL | |
| 121 | + * KHRONOS_APIENTRY | |
| 122 | + * KHRONOS_APIATTRIBUTES | |
| 123 | + * | |
| 124 | + * These may be used in function prototypes as: | |
| 125 | + * | |
| 126 | + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( | |
| 127 | + * int arg1, | |
| 128 | + * int arg2) KHRONOS_APIATTRIBUTES; | |
| 129 | + */ | |
| 130 | + | |
| 131 | +#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC) | |
| 132 | +# define KHRONOS_STATIC 1 | |
| 133 | +#endif | |
| 134 | + | |
| 135 | +/*------------------------------------------------------------------------- | |
| 136 | + * Definition of KHRONOS_APICALL | |
| 137 | + *------------------------------------------------------------------------- | |
| 138 | + * This precedes the return type of the function in the function prototype. | |
| 139 | + */ | |
| 140 | +#if defined(KHRONOS_STATIC) | |
| 141 | + /* If the preprocessor constant KHRONOS_STATIC is defined, make the | |
| 142 | + * header compatible with static linking. */ | |
| 143 | +# define KHRONOS_APICALL | |
| 144 | +#elif defined(_WIN32) | |
| 145 | +# define KHRONOS_APICALL __declspec(dllimport) | |
| 146 | +#elif defined (__SYMBIAN32__) | |
| 147 | +# define KHRONOS_APICALL IMPORT_C | |
| 148 | +#elif defined(__ANDROID__) | |
| 149 | +# define KHRONOS_APICALL __attribute__((visibility("default"))) | |
| 150 | +#else | |
| 151 | +# define KHRONOS_APICALL | |
| 152 | +#endif | |
| 153 | + | |
| 154 | +/*------------------------------------------------------------------------- | |
| 155 | + * Definition of KHRONOS_APIENTRY | |
| 156 | + *------------------------------------------------------------------------- | |
| 157 | + * This follows the return type of the function and precedes the function | |
| 158 | + * name in the function prototype. | |
| 159 | + */ | |
| 160 | +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) | |
| 161 | + /* Win32 but not WinCE */ | |
| 162 | +# define KHRONOS_APIENTRY __stdcall | |
| 163 | +#else | |
| 164 | +# define KHRONOS_APIENTRY | |
| 165 | +#endif | |
| 166 | + | |
| 167 | +/*------------------------------------------------------------------------- | |
| 168 | + * Definition of KHRONOS_APIATTRIBUTES | |
| 169 | + *------------------------------------------------------------------------- | |
| 170 | + * This follows the closing parenthesis of the function prototype arguments. | |
| 171 | + */ | |
| 172 | +#if defined (__ARMCC_2__) | |
| 173 | +#define KHRONOS_APIATTRIBUTES __softfp | |
| 174 | +#else | |
| 175 | +#define KHRONOS_APIATTRIBUTES | |
| 176 | +#endif | |
| 177 | + | |
| 178 | +/*------------------------------------------------------------------------- | |
| 179 | + * basic type definitions | |
| 180 | + *-----------------------------------------------------------------------*/ | |
| 181 | +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) | |
| 182 | + | |
| 183 | + | |
| 184 | +/* | |
| 185 | + * Using <stdint.h> | |
| 186 | + */ | |
| 187 | +#include <stdint.h> | |
| 188 | +typedef int32_t khronos_int32_t; | |
| 189 | +typedef uint32_t khronos_uint32_t; | |
| 190 | +typedef int64_t khronos_int64_t; | |
| 191 | +typedef uint64_t khronos_uint64_t; | |
| 192 | +#define KHRONOS_SUPPORT_INT64 1 | |
| 193 | +#define KHRONOS_SUPPORT_FLOAT 1 | |
| 194 | +/* | |
| 195 | + * To support platform where unsigned long cannot be used interchangeably with | |
| 196 | + * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t. | |
| 197 | + * Ideally, we could just use (u)intptr_t everywhere, but this could result in | |
| 198 | + * ABI breakage if khronos_uintptr_t is changed from unsigned long to | |
| 199 | + * unsigned long long or similar (this results in different C++ name mangling). | |
| 200 | + * To avoid changes for existing platforms, we restrict usage of intptr_t to | |
| 201 | + * platforms where the size of a pointer is larger than the size of long. | |
| 202 | + */ | |
| 203 | +#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__) | |
| 204 | +#if __SIZEOF_POINTER__ > __SIZEOF_LONG__ | |
| 205 | +#define KHRONOS_USE_INTPTR_T | |
| 206 | +#endif | |
| 207 | +#endif | |
| 208 | + | |
| 209 | +#elif defined(__VMS ) || defined(__sgi) | |
| 210 | + | |
| 211 | +/* | |
| 212 | + * Using <inttypes.h> | |
| 213 | + */ | |
| 214 | +#include <inttypes.h> | |
| 215 | +typedef int32_t khronos_int32_t; | |
| 216 | +typedef uint32_t khronos_uint32_t; | |
| 217 | +typedef int64_t khronos_int64_t; | |
| 218 | +typedef uint64_t khronos_uint64_t; | |
| 219 | +#define KHRONOS_SUPPORT_INT64 1 | |
| 220 | +#define KHRONOS_SUPPORT_FLOAT 1 | |
| 221 | + | |
| 222 | +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) | |
| 223 | + | |
| 224 | +/* | |
| 225 | + * Win32 | |
| 226 | + */ | |
| 227 | +typedef __int32 khronos_int32_t; | |
| 228 | +typedef unsigned __int32 khronos_uint32_t; | |
| 229 | +typedef __int64 khronos_int64_t; | |
| 230 | +typedef unsigned __int64 khronos_uint64_t; | |
| 231 | +#define KHRONOS_SUPPORT_INT64 1 | |
| 232 | +#define KHRONOS_SUPPORT_FLOAT 1 | |
| 233 | + | |
| 234 | +#elif defined(__sun__) || defined(__digital__) | |
| 235 | + | |
| 236 | +/* | |
| 237 | + * Sun or Digital | |
| 238 | + */ | |
| 239 | +typedef int khronos_int32_t; | |
| 240 | +typedef unsigned int khronos_uint32_t; | |
| 241 | +#if defined(__arch64__) || defined(_LP64) | |
| 242 | +typedef long int khronos_int64_t; | |
| 243 | +typedef unsigned long int khronos_uint64_t; | |
| 244 | +#else | |
| 245 | +typedef long long int khronos_int64_t; | |
| 246 | +typedef unsigned long long int khronos_uint64_t; | |
| 247 | +#endif /* __arch64__ */ | |
| 248 | +#define KHRONOS_SUPPORT_INT64 1 | |
| 249 | +#define KHRONOS_SUPPORT_FLOAT 1 | |
| 250 | + | |
| 251 | +#elif 0 | |
| 252 | + | |
| 253 | +/* | |
| 254 | + * Hypothetical platform with no float or int64 support | |
| 255 | + */ | |
| 256 | +typedef int khronos_int32_t; | |
| 257 | +typedef unsigned int khronos_uint32_t; | |
| 258 | +#define KHRONOS_SUPPORT_INT64 0 | |
| 259 | +#define KHRONOS_SUPPORT_FLOAT 0 | |
| 260 | + | |
| 261 | +#else | |
| 262 | + | |
| 263 | +/* | |
| 264 | + * Generic fallback | |
| 265 | + */ | |
| 266 | +#include <stdint.h> | |
| 267 | +typedef int32_t khronos_int32_t; | |
| 268 | +typedef uint32_t khronos_uint32_t; | |
| 269 | +typedef int64_t khronos_int64_t; | |
| 270 | +typedef uint64_t khronos_uint64_t; | |
| 271 | +#define KHRONOS_SUPPORT_INT64 1 | |
| 272 | +#define KHRONOS_SUPPORT_FLOAT 1 | |
| 273 | + | |
| 274 | +#endif | |
| 275 | + | |
| 276 | + | |
| 277 | +/* | |
| 278 | + * Types that are (so far) the same on all platforms | |
| 279 | + */ | |
| 280 | +typedef signed char khronos_int8_t; | |
| 281 | +typedef unsigned char khronos_uint8_t; | |
| 282 | +typedef signed short int khronos_int16_t; | |
| 283 | +typedef unsigned short int khronos_uint16_t; | |
| 284 | + | |
| 285 | +/* | |
| 286 | + * Types that differ between LLP64 and LP64 architectures - in LLP64, | |
| 287 | + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears | |
| 288 | + * to be the only LLP64 architecture in current use. | |
| 289 | + */ | |
| 290 | +#ifdef KHRONOS_USE_INTPTR_T | |
| 291 | +typedef intptr_t khronos_intptr_t; | |
| 292 | +typedef uintptr_t khronos_uintptr_t; | |
| 293 | +#elif defined(_WIN64) | |
| 294 | +typedef signed long long int khronos_intptr_t; | |
| 295 | +typedef unsigned long long int khronos_uintptr_t; | |
| 296 | +#else | |
| 297 | +typedef signed long int khronos_intptr_t; | |
| 298 | +typedef unsigned long int khronos_uintptr_t; | |
| 299 | +#endif | |
| 300 | + | |
| 301 | +#if defined(_WIN64) | |
| 302 | +typedef signed long long int khronos_ssize_t; | |
| 303 | +typedef unsigned long long int khronos_usize_t; | |
| 304 | +#else | |
| 305 | +typedef signed long int khronos_ssize_t; | |
| 306 | +typedef unsigned long int khronos_usize_t; | |
| 307 | +#endif | |
| 308 | + | |
| 309 | +#if KHRONOS_SUPPORT_FLOAT | |
| 310 | +/* | |
| 311 | + * Float type | |
| 312 | + */ | |
| 313 | +typedef float khronos_float_t; | |
| 314 | +#endif | |
| 315 | + | |
| 316 | +#if KHRONOS_SUPPORT_INT64 | |
| 317 | +/* Time types | |
| 318 | + * | |
| 319 | + * These types can be used to represent a time interval in nanoseconds or | |
| 320 | + * an absolute Unadjusted System Time. Unadjusted System Time is the number | |
| 321 | + * of nanoseconds since some arbitrary system event (e.g. since the last | |
| 322 | + * time the system booted). The Unadjusted System Time is an unsigned | |
| 323 | + * 64 bit value that wraps back to 0 every 584 years. Time intervals | |
| 324 | + * may be either signed or unsigned. | |
| 325 | + */ | |
| 326 | +typedef khronos_uint64_t khronos_utime_nanoseconds_t; | |
| 327 | +typedef khronos_int64_t khronos_stime_nanoseconds_t; | |
| 328 | +#endif | |
| 329 | + | |
| 330 | +/* | |
| 331 | + * Dummy value used to pad enum types to 32 bits. | |
| 332 | + */ | |
| 333 | +#ifndef KHRONOS_MAX_ENUM | |
| 334 | +#define KHRONOS_MAX_ENUM 0x7FFFFFFF | |
| 335 | +#endif | |
| 336 | + | |
| 337 | +/* | |
| 338 | + * Enumerated boolean type | |
| 339 | + * | |
| 340 | + * Values other than zero should be considered to be true. Therefore | |
| 341 | + * comparisons should not be made against KHRONOS_TRUE. | |
| 342 | + */ | |
| 343 | +typedef enum { | |
| 344 | + KHRONOS_FALSE = 0, | |
| 345 | + KHRONOS_TRUE = 1, | |
| 346 | + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM | |
| 347 | +} khronos_boolean_enum_t; | |
| 348 | + | |
| 349 | +#endif /* __khrplatform_h_ */ | |
| 350 | + | |
| 351 | + | |
| 352 | +#ifndef __eglplatform_h_ | |
| 353 | +#define __eglplatform_h_ | |
| 354 | + | |
| 355 | +/* | |
| 356 | +** Copyright 2007-2020 The Khronos Group Inc. | |
| 357 | +** SPDX-License-Identifier: Apache-2.0 | |
| 358 | +*/ | |
| 359 | + | |
| 360 | +/* Platform-specific types and definitions for egl.h | |
| 361 | + * | |
| 362 | + * Adopters may modify khrplatform.h and this file to suit their platform. | |
| 363 | + * You are encouraged to submit all modifications to the Khronos group so that | |
| 364 | + * they can be included in future versions of this file. Please submit changes | |
| 365 | + * by filing an issue or pull request on the public Khronos EGL Registry, at | |
| 366 | + * https://www.github.com/KhronosGroup/EGL-Registry/ | |
| 367 | + */ | |
| 368 | + | |
| 369 | +/*#include <KHR/khrplatform.h>*/ | |
| 370 | + | |
| 371 | +/* Macros used in EGL function prototype declarations. | |
| 372 | + * | |
| 373 | + * EGL functions should be prototyped as: | |
| 374 | + * | |
| 375 | + * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); | |
| 376 | + * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); | |
| 377 | + * | |
| 378 | + * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h | |
| 379 | + */ | |
| 380 | + | |
| 381 | +#ifndef EGLAPI | |
| 382 | +#define EGLAPI KHRONOS_APICALL | |
| 383 | +#endif | |
| 384 | + | |
| 385 | +#ifndef EGLAPIENTRY | |
| 386 | +#define EGLAPIENTRY KHRONOS_APIENTRY | |
| 387 | +#endif | |
| 388 | +#define EGLAPIENTRYP EGLAPIENTRY* | |
| 389 | + | |
| 390 | +/* The types NativeDisplayType, NativeWindowType, and NativePixmapType | |
| 391 | + * are aliases of window-system-dependent types, such as X Display * or | |
| 392 | + * Windows Device Context. They must be defined in platform-specific | |
| 393 | + * code below. The EGL-prefixed versions of Native*Type are the same | |
| 394 | + * types, renamed in EGL 1.3 so all types in the API start with "EGL". | |
| 395 | + * | |
| 396 | + * Khronos STRONGLY RECOMMENDS that you use the default definitions | |
| 397 | + * provided below, since these changes affect both binary and source | |
| 398 | + * portability of applications using EGL running on different EGL | |
| 399 | + * implementations. | |
| 400 | + */ | |
| 401 | + | |
| 402 | +#if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES) | |
| 403 | + | |
| 404 | +typedef void *EGLNativeDisplayType; | |
| 405 | +typedef void *EGLNativePixmapType; | |
| 406 | +typedef void *EGLNativeWindowType; | |
| 407 | + | |
| 408 | +#elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ | |
| 409 | +#ifndef WIN32_LEAN_AND_MEAN | |
| 410 | +#define WIN32_LEAN_AND_MEAN 1 | |
| 411 | +#endif | |
| 412 | +#include <windows.h> | |
| 413 | + | |
| 414 | +typedef HDC EGLNativeDisplayType; | |
| 415 | +typedef HBITMAP EGLNativePixmapType; | |
| 416 | +typedef HWND EGLNativeWindowType; | |
| 417 | + | |
| 418 | +#elif defined(__EMSCRIPTEN__) | |
| 419 | + | |
| 420 | +typedef int EGLNativeDisplayType; | |
| 421 | +typedef int EGLNativePixmapType; | |
| 422 | +typedef int EGLNativeWindowType; | |
| 423 | + | |
| 424 | +#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ | |
| 425 | + | |
| 426 | +typedef int EGLNativeDisplayType; | |
| 427 | +typedef void *EGLNativePixmapType; | |
| 428 | +typedef void *EGLNativeWindowType; | |
| 429 | + | |
| 430 | +#elif defined(WL_EGL_PLATFORM) | |
| 431 | + | |
| 432 | +typedef struct wl_display *EGLNativeDisplayType; | |
| 433 | +typedef struct wl_egl_pixmap *EGLNativePixmapType; | |
| 434 | +typedef struct wl_egl_window *EGLNativeWindowType; | |
| 435 | + | |
| 436 | +#elif defined(__GBM__) | |
| 437 | + | |
| 438 | +typedef struct gbm_device *EGLNativeDisplayType; | |
| 439 | +typedef struct gbm_bo *EGLNativePixmapType; | |
| 440 | +typedef void *EGLNativeWindowType; | |
| 441 | + | |
| 442 | +#elif defined(__ANDROID__) || defined(ANDROID) | |
| 443 | + | |
| 444 | +struct ANativeWindow; | |
| 445 | +struct egl_native_pixmap_t; | |
| 446 | + | |
| 447 | +typedef void* EGLNativeDisplayType; | |
| 448 | +typedef struct egl_native_pixmap_t* EGLNativePixmapType; | |
| 449 | +typedef struct ANativeWindow* EGLNativeWindowType; | |
| 450 | + | |
| 451 | +#elif defined(USE_OZONE) | |
| 452 | + | |
| 453 | +typedef intptr_t EGLNativeDisplayType; | |
| 454 | +typedef intptr_t EGLNativePixmapType; | |
| 455 | +typedef intptr_t EGLNativeWindowType; | |
| 456 | + | |
| 457 | +#elif defined(USE_X11) | |
| 458 | + | |
| 459 | +/* X11 (tentative) */ | |
| 460 | +#include <X11/Xlib.h> | |
| 461 | +#include <X11/Xutil.h> | |
| 462 | + | |
| 463 | +typedef Display *EGLNativeDisplayType; | |
| 464 | +typedef Pixmap EGLNativePixmapType; | |
| 465 | +typedef Window EGLNativeWindowType; | |
| 466 | + | |
| 467 | +#elif defined(__unix__) | |
| 468 | + | |
| 469 | +typedef void *EGLNativeDisplayType; | |
| 470 | +typedef khronos_uintptr_t EGLNativePixmapType; | |
| 471 | +typedef khronos_uintptr_t EGLNativeWindowType; | |
| 472 | + | |
| 473 | +#elif defined(__APPLE__) | |
| 474 | + | |
| 475 | +typedef int EGLNativeDisplayType; | |
| 476 | +typedef void *EGLNativePixmapType; | |
| 477 | +typedef void *EGLNativeWindowType; | |
| 478 | + | |
| 479 | +#elif defined(__HAIKU__) | |
| 480 | + | |
| 481 | +#include <kernel/image.h> | |
| 482 | + | |
| 483 | +typedef void *EGLNativeDisplayType; | |
| 484 | +typedef khronos_uintptr_t EGLNativePixmapType; | |
| 485 | +typedef khronos_uintptr_t EGLNativeWindowType; | |
| 486 | + | |
| 487 | +#elif defined(__Fuchsia__) | |
| 488 | + | |
| 489 | +typedef void *EGLNativeDisplayType; | |
| 490 | +typedef khronos_uintptr_t EGLNativePixmapType; | |
| 491 | +typedef khronos_uintptr_t EGLNativeWindowType; | |
| 492 | + | |
| 493 | +#else | |
| 494 | +#error "Platform not recognized" | |
| 495 | +#endif | |
| 496 | + | |
| 497 | +/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ | |
| 498 | +typedef EGLNativeDisplayType NativeDisplayType; | |
| 499 | +typedef EGLNativePixmapType NativePixmapType; | |
| 500 | +typedef EGLNativeWindowType NativeWindowType; | |
| 501 | + | |
| 502 | + | |
| 503 | +/* Define EGLint. This must be a signed integral type large enough to contain | |
| 504 | + * all legal attribute names and values passed into and out of EGL, whether | |
| 505 | + * their type is boolean, bitmask, enumerant (symbolic constant), integer, | |
| 506 | + * handle, or other. While in general a 32-bit integer will suffice, if | |
| 507 | + * handles are 64 bit types, then EGLint should be defined as a signed 64-bit | |
| 508 | + * integer type. | |
| 509 | + */ | |
| 510 | +typedef khronos_int32_t EGLint; | |
| 511 | + | |
| 512 | + | |
| 513 | +/* C++ / C typecast macros for special EGL handle values */ | |
| 514 | +#if defined(__cplusplus) | |
| 515 | +#define EGL_CAST(type, value) (static_cast<type>(value)) | |
| 516 | +#else | |
| 517 | +#define EGL_CAST(type, value) ((type) (value)) | |
| 518 | +#endif | |
| 519 | + | |
| 520 | +#endif /* __eglplatform_h */ | |
| 521 | + | |
| 522 | + | |
| 523 | +#ifndef __egl_h_ | |
| 524 | +#define __egl_h_ 1 | |
| 525 | + | |
| 526 | +#ifdef __cplusplus | |
| 527 | +extern "C" { | |
| 528 | +#endif | |
| 529 | + | |
| 530 | +/* | |
| 531 | +** Copyright 2013-2020 The Khronos Group Inc. | |
| 532 | +** SPDX-License-Identifier: Apache-2.0 | |
| 533 | +** | |
| 534 | +** This header is generated from the Khronos EGL XML API Registry. | |
| 535 | +** The current version of the Registry, generator scripts | |
| 536 | +** used to make the header, and the header can be found at | |
| 537 | +** http://www.khronos.org/registry/egl | |
| 538 | +** | |
| 539 | +** Khronos $Git commit SHA1: 6fb1daea15 $ on $Git commit date: 2022-05-25 09:41:13 -0600 $ | |
| 540 | +*/ | |
| 541 | + | |
| 542 | +/*#include <EGL/eglplatform.h>*/ | |
| 543 | + | |
| 544 | +#ifndef EGL_EGL_PROTOTYPES | |
| 545 | +#define EGL_EGL_PROTOTYPES 1 | |
| 546 | +#endif | |
| 547 | + | |
| 548 | +/* Generated on date 20220525 */ | |
| 549 | + | |
| 550 | +/* Generated C header for: | |
| 551 | + * API: egl | |
| 552 | + * Versions considered: .* | |
| 553 | + * Versions emitted: .* | |
| 554 | + * Default extensions included: None | |
| 555 | + * Additional extensions included: _nomatch_^ | |
| 556 | + * Extensions removed: _nomatch_^ | |
| 557 | + */ | |
| 558 | + | |
| 559 | +#ifndef EGL_VERSION_1_0 | |
| 560 | +#define EGL_VERSION_1_0 1 | |
| 561 | +typedef unsigned int EGLBoolean; | |
| 562 | +typedef void *EGLDisplay; | |
| 563 | +/*#include <KHR/khrplatform.h>*/ | |
| 564 | +/*#include <EGL/eglplatform.h>*/ | |
| 565 | +typedef void *EGLConfig; | |
| 566 | +typedef void *EGLSurface; | |
| 567 | +typedef void *EGLContext; | |
| 568 | +typedef void (*__eglMustCastToProperFunctionPointerType)(void); | |
| 569 | +#define EGL_ALPHA_SIZE 0x3021 | |
| 570 | +#define EGL_BAD_ACCESS 0x3002 | |
| 571 | +#define EGL_BAD_ALLOC 0x3003 | |
| 572 | +#define EGL_BAD_ATTRIBUTE 0x3004 | |
| 573 | +#define EGL_BAD_CONFIG 0x3005 | |
| 574 | +#define EGL_BAD_CONTEXT 0x3006 | |
| 575 | +#define EGL_BAD_CURRENT_SURFACE 0x3007 | |
| 576 | +#define EGL_BAD_DISPLAY 0x3008 | |
| 577 | +#define EGL_BAD_MATCH 0x3009 | |
| 578 | +#define EGL_BAD_NATIVE_PIXMAP 0x300A | |
| 579 | +#define EGL_BAD_NATIVE_WINDOW 0x300B | |
| 580 | +#define EGL_BAD_PARAMETER 0x300C | |
| 581 | +#define EGL_BAD_SURFACE 0x300D | |
| 582 | +#define EGL_BLUE_SIZE 0x3022 | |
| 583 | +#define EGL_BUFFER_SIZE 0x3020 | |
| 584 | +#define EGL_CONFIG_CAVEAT 0x3027 | |
| 585 | +#define EGL_CONFIG_ID 0x3028 | |
| 586 | +#define EGL_CORE_NATIVE_ENGINE 0x305B | |
| 587 | +#define EGL_DEPTH_SIZE 0x3025 | |
| 588 | +#define EGL_DONT_CARE EGL_CAST(EGLint,-1) | |
| 589 | +#define EGL_DRAW 0x3059 | |
| 590 | +#define EGL_EXTENSIONS 0x3055 | |
| 591 | +#define EGL_FALSE 0 | |
| 592 | +#define EGL_GREEN_SIZE 0x3023 | |
| 593 | +#define EGL_HEIGHT 0x3056 | |
| 594 | +#define EGL_LARGEST_PBUFFER 0x3058 | |
| 595 | +#define EGL_LEVEL 0x3029 | |
| 596 | +#define EGL_MAX_PBUFFER_HEIGHT 0x302A | |
| 597 | +#define EGL_MAX_PBUFFER_PIXELS 0x302B | |
| 598 | +#define EGL_MAX_PBUFFER_WIDTH 0x302C | |
| 599 | +#define EGL_NATIVE_RENDERABLE 0x302D | |
| 600 | +#define EGL_NATIVE_VISUAL_ID 0x302E | |
| 601 | +#define EGL_NATIVE_VISUAL_TYPE 0x302F | |
| 602 | +#define EGL_NONE 0x3038 | |
| 603 | +#define EGL_NON_CONFORMANT_CONFIG 0x3051 | |
| 604 | +#define EGL_NOT_INITIALIZED 0x3001 | |
| 605 | +#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0) | |
| 606 | +#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0) | |
| 607 | +#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0) | |
| 608 | +#define EGL_PBUFFER_BIT 0x0001 | |
| 609 | +#define EGL_PIXMAP_BIT 0x0002 | |
| 610 | +#define EGL_READ 0x305A | |
| 611 | +#define EGL_RED_SIZE 0x3024 | |
| 612 | +#define EGL_SAMPLES 0x3031 | |
| 613 | +#define EGL_SAMPLE_BUFFERS 0x3032 | |
| 614 | +#define EGL_SLOW_CONFIG 0x3050 | |
| 615 | +#define EGL_STENCIL_SIZE 0x3026 | |
| 616 | +#define EGL_SUCCESS 0x3000 | |
| 617 | +#define EGL_SURFACE_TYPE 0x3033 | |
| 618 | +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 | |
| 619 | +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 | |
| 620 | +#define EGL_TRANSPARENT_RED_VALUE 0x3037 | |
| 621 | +#define EGL_TRANSPARENT_RGB 0x3052 | |
| 622 | +#define EGL_TRANSPARENT_TYPE 0x3034 | |
| 623 | +#define EGL_TRUE 1 | |
| 624 | +#define EGL_VENDOR 0x3053 | |
| 625 | +#define EGL_VERSION 0x3054 | |
| 626 | +#define EGL_WIDTH 0x3057 | |
| 627 | +#define EGL_WINDOW_BIT 0x0004 | |
| 628 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSECONFIGPROC) (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); | |
| 629 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); | |
| 630 | +typedef EGLContext (EGLAPIENTRYP PFNEGLCREATECONTEXTPROC) (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); | |
| 631 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERSURFACEPROC) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); | |
| 632 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); | |
| 633 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); | |
| 634 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx); | |
| 635 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface); | |
| 636 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGATTRIBPROC) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); | |
| 637 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGSPROC) (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); | |
| 638 | +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETCURRENTDISPLAYPROC) (void); | |
| 639 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLGETCURRENTSURFACEPROC) (EGLint readdraw); | |
| 640 | +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDISPLAYPROC) (EGLNativeDisplayType display_id); | |
| 641 | +typedef EGLint (EGLAPIENTRYP PFNEGLGETERRORPROC) (void); | |
| 642 | +typedef __eglMustCastToProperFunctionPointerType (EGLAPIENTRYP PFNEGLGETPROCADDRESSPROC) (const char *procname); | |
| 643 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLINITIALIZEPROC) (EGLDisplay dpy, EGLint *major, EGLint *minor); | |
| 644 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLMAKECURRENTPROC) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); | |
| 645 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); | |
| 646 | +typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGPROC) (EGLDisplay dpy, EGLint name); | |
| 647 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); | |
| 648 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface); | |
| 649 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLTERMINATEPROC) (EGLDisplay dpy); | |
| 650 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITGLPROC) (void); | |
| 651 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITNATIVEPROC) (EGLint engine); | |
| 652 | +#if EGL_EGL_PROTOTYPES | |
| 653 | +EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); | |
| 654 | +EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); | |
| 655 | +EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); | |
| 656 | +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); | |
| 657 | +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); | |
| 658 | +EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); | |
| 659 | +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); | |
| 660 | +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); | |
| 661 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); | |
| 662 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); | |
| 663 | +EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void); | |
| 664 | +EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw); | |
| 665 | +EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id); | |
| 666 | +EGLAPI EGLint EGLAPIENTRY eglGetError (void); | |
| 667 | +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); | |
| 668 | +EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); | |
| 669 | +EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); | |
| 670 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); | |
| 671 | +EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name); | |
| 672 | +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); | |
| 673 | +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface); | |
| 674 | +EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy); | |
| 675 | +EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void); | |
| 676 | +EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); | |
| 677 | +#endif | |
| 678 | +#endif /* EGL_VERSION_1_0 */ | |
| 679 | + | |
| 680 | +#ifndef EGL_VERSION_1_1 | |
| 681 | +#define EGL_VERSION_1_1 1 | |
| 682 | +#define EGL_BACK_BUFFER 0x3084 | |
| 683 | +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 | |
| 684 | +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A | |
| 685 | +#define EGL_CONTEXT_LOST 0x300E | |
| 686 | +#define EGL_MIN_SWAP_INTERVAL 0x303B | |
| 687 | +#define EGL_MAX_SWAP_INTERVAL 0x303C | |
| 688 | +#define EGL_MIPMAP_TEXTURE 0x3082 | |
| 689 | +#define EGL_MIPMAP_LEVEL 0x3083 | |
| 690 | +#define EGL_NO_TEXTURE 0x305C | |
| 691 | +#define EGL_TEXTURE_2D 0x305F | |
| 692 | +#define EGL_TEXTURE_FORMAT 0x3080 | |
| 693 | +#define EGL_TEXTURE_RGB 0x305D | |
| 694 | +#define EGL_TEXTURE_RGBA 0x305E | |
| 695 | +#define EGL_TEXTURE_TARGET 0x3081 | |
| 696 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDTEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer); | |
| 697 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASETEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer); | |
| 698 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSURFACEATTRIBPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); | |
| 699 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPINTERVALPROC) (EGLDisplay dpy, EGLint interval); | |
| 700 | +#if EGL_EGL_PROTOTYPES | |
| 701 | +EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); | |
| 702 | +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); | |
| 703 | +EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); | |
| 704 | +EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval); | |
| 705 | +#endif | |
| 706 | +#endif /* EGL_VERSION_1_1 */ | |
| 707 | + | |
| 708 | +#ifndef EGL_VERSION_1_2 | |
| 709 | +#define EGL_VERSION_1_2 1 | |
| 710 | +typedef unsigned int EGLenum; | |
| 711 | +typedef void *EGLClientBuffer; | |
| 712 | +#define EGL_ALPHA_FORMAT 0x3088 | |
| 713 | +#define EGL_ALPHA_FORMAT_NONPRE 0x308B | |
| 714 | +#define EGL_ALPHA_FORMAT_PRE 0x308C | |
| 715 | +#define EGL_ALPHA_MASK_SIZE 0x303E | |
| 716 | +#define EGL_BUFFER_PRESERVED 0x3094 | |
| 717 | +#define EGL_BUFFER_DESTROYED 0x3095 | |
| 718 | +#define EGL_CLIENT_APIS 0x308D | |
| 719 | +#define EGL_COLORSPACE 0x3087 | |
| 720 | +#define EGL_COLORSPACE_sRGB 0x3089 | |
| 721 | +#define EGL_COLORSPACE_LINEAR 0x308A | |
| 722 | +#define EGL_COLOR_BUFFER_TYPE 0x303F | |
| 723 | +#define EGL_CONTEXT_CLIENT_TYPE 0x3097 | |
| 724 | +#define EGL_DISPLAY_SCALING 10000 | |
| 725 | +#define EGL_HORIZONTAL_RESOLUTION 0x3090 | |
| 726 | +#define EGL_LUMINANCE_BUFFER 0x308F | |
| 727 | +#define EGL_LUMINANCE_SIZE 0x303D | |
| 728 | +#define EGL_OPENGL_ES_BIT 0x0001 | |
| 729 | +#define EGL_OPENVG_BIT 0x0002 | |
| 730 | +#define EGL_OPENGL_ES_API 0x30A0 | |
| 731 | +#define EGL_OPENVG_API 0x30A1 | |
| 732 | +#define EGL_OPENVG_IMAGE 0x3096 | |
| 733 | +#define EGL_PIXEL_ASPECT_RATIO 0x3092 | |
| 734 | +#define EGL_RENDERABLE_TYPE 0x3040 | |
| 735 | +#define EGL_RENDER_BUFFER 0x3086 | |
| 736 | +#define EGL_RGB_BUFFER 0x308E | |
| 737 | +#define EGL_SINGLE_BUFFER 0x3085 | |
| 738 | +#define EGL_SWAP_BEHAVIOR 0x3093 | |
| 739 | +#define EGL_UNKNOWN EGL_CAST(EGLint,-1) | |
| 740 | +#define EGL_VERTICAL_RESOLUTION 0x3091 | |
| 741 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDAPIPROC) (EGLenum api); | |
| 742 | +typedef EGLenum (EGLAPIENTRYP PFNEGLQUERYAPIPROC) (void); | |
| 743 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC) (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); | |
| 744 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASETHREADPROC) (void); | |
| 745 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITCLIENTPROC) (void); | |
| 746 | +#if EGL_EGL_PROTOTYPES | |
| 747 | +EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api); | |
| 748 | +EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void); | |
| 749 | +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); | |
| 750 | +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void); | |
| 751 | +EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); | |
| 752 | +#endif | |
| 753 | +#endif /* EGL_VERSION_1_2 */ | |
| 754 | + | |
| 755 | +#ifndef EGL_VERSION_1_3 | |
| 756 | +#define EGL_VERSION_1_3 1 | |
| 757 | +#define EGL_CONFORMANT 0x3042 | |
| 758 | +#define EGL_CONTEXT_CLIENT_VERSION 0x3098 | |
| 759 | +#define EGL_MATCH_NATIVE_PIXMAP 0x3041 | |
| 760 | +#define EGL_OPENGL_ES2_BIT 0x0004 | |
| 761 | +#define EGL_VG_ALPHA_FORMAT 0x3088 | |
| 762 | +#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B | |
| 763 | +#define EGL_VG_ALPHA_FORMAT_PRE 0x308C | |
| 764 | +#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 | |
| 765 | +#define EGL_VG_COLORSPACE 0x3087 | |
| 766 | +#define EGL_VG_COLORSPACE_sRGB 0x3089 | |
| 767 | +#define EGL_VG_COLORSPACE_LINEAR 0x308A | |
| 768 | +#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 | |
| 769 | +#endif /* EGL_VERSION_1_3 */ | |
| 770 | + | |
| 771 | +#ifndef EGL_VERSION_1_4 | |
| 772 | +#define EGL_VERSION_1_4 1 | |
| 773 | +#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0) | |
| 774 | +#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 | |
| 775 | +#define EGL_MULTISAMPLE_RESOLVE 0x3099 | |
| 776 | +#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A | |
| 777 | +#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B | |
| 778 | +#define EGL_OPENGL_API 0x30A2 | |
| 779 | +#define EGL_OPENGL_BIT 0x0008 | |
| 780 | +#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 | |
| 781 | +typedef EGLContext (EGLAPIENTRYP PFNEGLGETCURRENTCONTEXTPROC) (void); | |
| 782 | +#if EGL_EGL_PROTOTYPES | |
| 783 | +EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); | |
| 784 | +#endif | |
| 785 | +#endif /* EGL_VERSION_1_4 */ | |
| 786 | + | |
| 787 | +#ifndef EGL_VERSION_1_5 | |
| 788 | +#define EGL_VERSION_1_5 1 | |
| 789 | +typedef void *EGLSync; | |
| 790 | +typedef intptr_t EGLAttrib; | |
| 791 | +typedef khronos_utime_nanoseconds_t EGLTime; | |
| 792 | +typedef void *EGLImage; | |
| 793 | +#define EGL_CONTEXT_MAJOR_VERSION 0x3098 | |
| 794 | +#define EGL_CONTEXT_MINOR_VERSION 0x30FB | |
| 795 | +#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD | |
| 796 | +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD | |
| 797 | +#define EGL_NO_RESET_NOTIFICATION 0x31BE | |
| 798 | +#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF | |
| 799 | +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001 | |
| 800 | +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002 | |
| 801 | +#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0 | |
| 802 | +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1 | |
| 803 | +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2 | |
| 804 | +#define EGL_OPENGL_ES3_BIT 0x00000040 | |
| 805 | +#define EGL_CL_EVENT_HANDLE 0x309C | |
| 806 | +#define EGL_SYNC_CL_EVENT 0x30FE | |
| 807 | +#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF | |
| 808 | +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0 | |
| 809 | +#define EGL_SYNC_TYPE 0x30F7 | |
| 810 | +#define EGL_SYNC_STATUS 0x30F1 | |
| 811 | +#define EGL_SYNC_CONDITION 0x30F8 | |
| 812 | +#define EGL_SIGNALED 0x30F2 | |
| 813 | +#define EGL_UNSIGNALED 0x30F3 | |
| 814 | +#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001 | |
| 815 | +#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull | |
| 816 | +#define EGL_TIMEOUT_EXPIRED 0x30F5 | |
| 817 | +#define EGL_CONDITION_SATISFIED 0x30F6 | |
| 818 | +#define EGL_NO_SYNC EGL_CAST(EGLSync,0) | |
| 819 | +#define EGL_SYNC_FENCE 0x30F9 | |
| 820 | +#define EGL_GL_COLORSPACE 0x309D | |
| 821 | +#define EGL_GL_COLORSPACE_SRGB 0x3089 | |
| 822 | +#define EGL_GL_COLORSPACE_LINEAR 0x308A | |
| 823 | +#define EGL_GL_RENDERBUFFER 0x30B9 | |
| 824 | +#define EGL_GL_TEXTURE_2D 0x30B1 | |
| 825 | +#define EGL_GL_TEXTURE_LEVEL 0x30BC | |
| 826 | +#define EGL_GL_TEXTURE_3D 0x30B2 | |
| 827 | +#define EGL_GL_TEXTURE_ZOFFSET 0x30BD | |
| 828 | +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 | |
| 829 | +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 | |
| 830 | +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 | |
| 831 | +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 | |
| 832 | +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 | |
| 833 | +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 | |
| 834 | +#define EGL_IMAGE_PRESERVED 0x30D2 | |
| 835 | +#define EGL_NO_IMAGE EGL_CAST(EGLImage,0) | |
| 836 | +typedef EGLSync (EGLAPIENTRYP PFNEGLCREATESYNCPROC) (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); | |
| 837 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCPROC) (EGLDisplay dpy, EGLSync sync); | |
| 838 | +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); | |
| 839 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBPROC) (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); | |
| 840 | +typedef EGLImage (EGLAPIENTRYP PFNEGLCREATEIMAGEPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); | |
| 841 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEPROC) (EGLDisplay dpy, EGLImage image); | |
| 842 | +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYPROC) (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); | |
| 843 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); | |
| 844 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); | |
| 845 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags); | |
| 846 | +#if EGL_EGL_PROTOTYPES | |
| 847 | +EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); | |
| 848 | +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync); | |
| 849 | +EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); | |
| 850 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); | |
| 851 | +EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); | |
| 852 | +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image); | |
| 853 | +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); | |
| 854 | +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); | |
| 855 | +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); | |
| 856 | +EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); | |
| 857 | +#endif | |
| 858 | +#endif /* EGL_VERSION_1_5 */ | |
| 859 | + | |
| 860 | +#ifdef __cplusplus | |
| 861 | +} | |
| 862 | +#endif | |
| 863 | + | |
| 864 | +#endif /* __egl_h_ */ | |
| 865 | + | |
| 866 | + | |
| 867 | +#ifndef __eglext_h_ | |
| 868 | +#define __eglext_h_ 1 | |
| 869 | + | |
| 870 | +#ifdef __cplusplus | |
| 871 | +extern "C" { | |
| 872 | +#endif | |
| 873 | + | |
| 874 | +/* | |
| 875 | +** Copyright 2013-2020 The Khronos Group Inc. | |
| 876 | +** SPDX-License-Identifier: Apache-2.0 | |
| 877 | +** | |
| 878 | +** This header is generated from the Khronos EGL XML API Registry. | |
| 879 | +** The current version of the Registry, generator scripts | |
| 880 | +** used to make the header, and the header can be found at | |
| 881 | +** http://www.khronos.org/registry/egl | |
| 882 | +** | |
| 883 | +** Khronos $Git commit SHA1: 6fb1daea15 $ on $Git commit date: 2022-05-25 09:41:13 -0600 $ | |
| 884 | +*/ | |
| 885 | + | |
| 886 | +/*#include <EGL/eglplatform.h>*/ | |
| 887 | + | |
| 888 | +#define EGL_EGLEXT_VERSION 20220525 | |
| 889 | + | |
| 890 | +/* Generated C header for: | |
| 891 | + * API: egl | |
| 892 | + * Versions considered: .* | |
| 893 | + * Versions emitted: _nomatch_^ | |
| 894 | + * Default extensions included: egl | |
| 895 | + * Additional extensions included: _nomatch_^ | |
| 896 | + * Extensions removed: _nomatch_^ | |
| 897 | + */ | |
| 898 | + | |
| 899 | +#ifndef EGL_KHR_cl_event | |
| 900 | +#define EGL_KHR_cl_event 1 | |
| 901 | +#define EGL_CL_EVENT_HANDLE_KHR 0x309C | |
| 902 | +#define EGL_SYNC_CL_EVENT_KHR 0x30FE | |
| 903 | +#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF | |
| 904 | +#endif /* EGL_KHR_cl_event */ | |
| 905 | + | |
| 906 | +#ifndef EGL_KHR_cl_event2 | |
| 907 | +#define EGL_KHR_cl_event2 1 | |
| 908 | +typedef void *EGLSyncKHR; | |
| 909 | +typedef intptr_t EGLAttribKHR; | |
| 910 | +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); | |
| 911 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 912 | +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); | |
| 913 | +#endif | |
| 914 | +#endif /* EGL_KHR_cl_event2 */ | |
| 915 | + | |
| 916 | +#ifndef EGL_KHR_client_get_all_proc_addresses | |
| 917 | +#define EGL_KHR_client_get_all_proc_addresses 1 | |
| 918 | +#endif /* EGL_KHR_client_get_all_proc_addresses */ | |
| 919 | + | |
| 920 | +#ifndef EGL_KHR_config_attribs | |
| 921 | +#define EGL_KHR_config_attribs 1 | |
| 922 | +#define EGL_CONFORMANT_KHR 0x3042 | |
| 923 | +#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 | |
| 924 | +#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 | |
| 925 | +#endif /* EGL_KHR_config_attribs */ | |
| 926 | + | |
| 927 | +#ifndef EGL_KHR_context_flush_control | |
| 928 | +#define EGL_KHR_context_flush_control 1 | |
| 929 | +#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0 | |
| 930 | +#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097 | |
| 931 | +#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098 | |
| 932 | +#endif /* EGL_KHR_context_flush_control */ | |
| 933 | + | |
| 934 | +#ifndef EGL_KHR_create_context | |
| 935 | +#define EGL_KHR_create_context 1 | |
| 936 | +#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 | |
| 937 | +#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB | |
| 938 | +#define EGL_CONTEXT_FLAGS_KHR 0x30FC | |
| 939 | +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD | |
| 940 | +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD | |
| 941 | +#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE | |
| 942 | +#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF | |
| 943 | +#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 | |
| 944 | +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 | |
| 945 | +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 | |
| 946 | +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 | |
| 947 | +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 | |
| 948 | +#define EGL_OPENGL_ES3_BIT_KHR 0x00000040 | |
| 949 | +#endif /* EGL_KHR_create_context */ | |
| 950 | + | |
| 951 | +#ifndef EGL_KHR_create_context_no_error | |
| 952 | +#define EGL_KHR_create_context_no_error 1 | |
| 953 | +#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3 | |
| 954 | +#endif /* EGL_KHR_create_context_no_error */ | |
| 955 | + | |
| 956 | +#ifndef EGL_KHR_debug | |
| 957 | +#define EGL_KHR_debug 1 | |
| 958 | +typedef void *EGLLabelKHR; | |
| 959 | +typedef void *EGLObjectKHR; | |
| 960 | +typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message); | |
| 961 | +#define EGL_OBJECT_THREAD_KHR 0x33B0 | |
| 962 | +#define EGL_OBJECT_DISPLAY_KHR 0x33B1 | |
| 963 | +#define EGL_OBJECT_CONTEXT_KHR 0x33B2 | |
| 964 | +#define EGL_OBJECT_SURFACE_KHR 0x33B3 | |
| 965 | +#define EGL_OBJECT_IMAGE_KHR 0x33B4 | |
| 966 | +#define EGL_OBJECT_SYNC_KHR 0x33B5 | |
| 967 | +#define EGL_OBJECT_STREAM_KHR 0x33B6 | |
| 968 | +#define EGL_DEBUG_MSG_CRITICAL_KHR 0x33B9 | |
| 969 | +#define EGL_DEBUG_MSG_ERROR_KHR 0x33BA | |
| 970 | +#define EGL_DEBUG_MSG_WARN_KHR 0x33BB | |
| 971 | +#define EGL_DEBUG_MSG_INFO_KHR 0x33BC | |
| 972 | +#define EGL_DEBUG_CALLBACK_KHR 0x33B8 | |
| 973 | +typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); | |
| 974 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib *value); | |
| 975 | +typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); | |
| 976 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 977 | +EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); | |
| 978 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib *value); | |
| 979 | +EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); | |
| 980 | +#endif | |
| 981 | +#endif /* EGL_KHR_debug */ | |
| 982 | + | |
| 983 | +#ifndef EGL_KHR_display_reference | |
| 984 | +#define EGL_KHR_display_reference 1 | |
| 985 | +#define EGL_TRACK_REFERENCES_KHR 0x3352 | |
| 986 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBKHRPROC) (EGLDisplay dpy, EGLint name, EGLAttrib *value); | |
| 987 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 988 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribKHR (EGLDisplay dpy, EGLint name, EGLAttrib *value); | |
| 989 | +#endif | |
| 990 | +#endif /* EGL_KHR_display_reference */ | |
| 991 | + | |
| 992 | +#ifndef EGL_KHR_fence_sync | |
| 993 | +#define EGL_KHR_fence_sync 1 | |
| 994 | +typedef khronos_utime_nanoseconds_t EGLTimeKHR; | |
| 995 | +#ifdef KHRONOS_SUPPORT_INT64 | |
| 996 | +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 | |
| 997 | +#define EGL_SYNC_CONDITION_KHR 0x30F8 | |
| 998 | +#define EGL_SYNC_FENCE_KHR 0x30F9 | |
| 999 | +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); | |
| 1000 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); | |
| 1001 | +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); | |
| 1002 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); | |
| 1003 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1004 | +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); | |
| 1005 | +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync); | |
| 1006 | +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); | |
| 1007 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); | |
| 1008 | +#endif | |
| 1009 | +#endif /* KHRONOS_SUPPORT_INT64 */ | |
| 1010 | +#endif /* EGL_KHR_fence_sync */ | |
| 1011 | + | |
| 1012 | +#ifndef EGL_KHR_get_all_proc_addresses | |
| 1013 | +#define EGL_KHR_get_all_proc_addresses 1 | |
| 1014 | +#endif /* EGL_KHR_get_all_proc_addresses */ | |
| 1015 | + | |
| 1016 | +#ifndef EGL_KHR_gl_colorspace | |
| 1017 | +#define EGL_KHR_gl_colorspace 1 | |
| 1018 | +#define EGL_GL_COLORSPACE_KHR 0x309D | |
| 1019 | +#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 | |
| 1020 | +#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A | |
| 1021 | +#endif /* EGL_KHR_gl_colorspace */ | |
| 1022 | + | |
| 1023 | +#ifndef EGL_KHR_gl_renderbuffer_image | |
| 1024 | +#define EGL_KHR_gl_renderbuffer_image 1 | |
| 1025 | +#define EGL_GL_RENDERBUFFER_KHR 0x30B9 | |
| 1026 | +#endif /* EGL_KHR_gl_renderbuffer_image */ | |
| 1027 | + | |
| 1028 | +#ifndef EGL_KHR_gl_texture_2D_image | |
| 1029 | +#define EGL_KHR_gl_texture_2D_image 1 | |
| 1030 | +#define EGL_GL_TEXTURE_2D_KHR 0x30B1 | |
| 1031 | +#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC | |
| 1032 | +#endif /* EGL_KHR_gl_texture_2D_image */ | |
| 1033 | + | |
| 1034 | +#ifndef EGL_KHR_gl_texture_3D_image | |
| 1035 | +#define EGL_KHR_gl_texture_3D_image 1 | |
| 1036 | +#define EGL_GL_TEXTURE_3D_KHR 0x30B2 | |
| 1037 | +#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD | |
| 1038 | +#endif /* EGL_KHR_gl_texture_3D_image */ | |
| 1039 | + | |
| 1040 | +#ifndef EGL_KHR_gl_texture_cubemap_image | |
| 1041 | +#define EGL_KHR_gl_texture_cubemap_image 1 | |
| 1042 | +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 | |
| 1043 | +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 | |
| 1044 | +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 | |
| 1045 | +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 | |
| 1046 | +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 | |
| 1047 | +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 | |
| 1048 | +#endif /* EGL_KHR_gl_texture_cubemap_image */ | |
| 1049 | + | |
| 1050 | +#ifndef EGL_KHR_image | |
| 1051 | +#define EGL_KHR_image 1 | |
| 1052 | +typedef void *EGLImageKHR; | |
| 1053 | +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 | |
| 1054 | +#define EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0) | |
| 1055 | +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); | |
| 1056 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); | |
| 1057 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1058 | +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); | |
| 1059 | +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); | |
| 1060 | +#endif | |
| 1061 | +#endif /* EGL_KHR_image */ | |
| 1062 | + | |
| 1063 | +#ifndef EGL_KHR_image_base | |
| 1064 | +#define EGL_KHR_image_base 1 | |
| 1065 | +#define EGL_IMAGE_PRESERVED_KHR 0x30D2 | |
| 1066 | +#endif /* EGL_KHR_image_base */ | |
| 1067 | + | |
| 1068 | +#ifndef EGL_KHR_image_pixmap | |
| 1069 | +#define EGL_KHR_image_pixmap 1 | |
| 1070 | +#endif /* EGL_KHR_image_pixmap */ | |
| 1071 | + | |
| 1072 | +#ifndef EGL_KHR_lock_surface | |
| 1073 | +#define EGL_KHR_lock_surface 1 | |
| 1074 | +#define EGL_READ_SURFACE_BIT_KHR 0x0001 | |
| 1075 | +#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 | |
| 1076 | +#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 | |
| 1077 | +#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 | |
| 1078 | +#define EGL_MATCH_FORMAT_KHR 0x3043 | |
| 1079 | +#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 | |
| 1080 | +#define EGL_FORMAT_RGB_565_KHR 0x30C1 | |
| 1081 | +#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 | |
| 1082 | +#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 | |
| 1083 | +#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 | |
| 1084 | +#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 | |
| 1085 | +#define EGL_BITMAP_POINTER_KHR 0x30C6 | |
| 1086 | +#define EGL_BITMAP_PITCH_KHR 0x30C7 | |
| 1087 | +#define EGL_BITMAP_ORIGIN_KHR 0x30C8 | |
| 1088 | +#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 | |
| 1089 | +#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA | |
| 1090 | +#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB | |
| 1091 | +#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC | |
| 1092 | +#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD | |
| 1093 | +#define EGL_LOWER_LEFT_KHR 0x30CE | |
| 1094 | +#define EGL_UPPER_LEFT_KHR 0x30CF | |
| 1095 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); | |
| 1096 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface); | |
| 1097 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1098 | +EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); | |
| 1099 | +EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface); | |
| 1100 | +#endif | |
| 1101 | +#endif /* EGL_KHR_lock_surface */ | |
| 1102 | + | |
| 1103 | +#ifndef EGL_KHR_lock_surface2 | |
| 1104 | +#define EGL_KHR_lock_surface2 1 | |
| 1105 | +#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 | |
| 1106 | +#endif /* EGL_KHR_lock_surface2 */ | |
| 1107 | + | |
| 1108 | +#ifndef EGL_KHR_lock_surface3 | |
| 1109 | +#define EGL_KHR_lock_surface3 1 | |
| 1110 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); | |
| 1111 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1112 | +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); | |
| 1113 | +#endif | |
| 1114 | +#endif /* EGL_KHR_lock_surface3 */ | |
| 1115 | + | |
| 1116 | +#ifndef EGL_KHR_mutable_render_buffer | |
| 1117 | +#define EGL_KHR_mutable_render_buffer 1 | |
| 1118 | +#define EGL_MUTABLE_RENDER_BUFFER_BIT_KHR 0x1000 | |
| 1119 | +#endif /* EGL_KHR_mutable_render_buffer */ | |
| 1120 | + | |
| 1121 | +#ifndef EGL_KHR_no_config_context | |
| 1122 | +#define EGL_KHR_no_config_context 1 | |
| 1123 | +#define EGL_NO_CONFIG_KHR EGL_CAST(EGLConfig,0) | |
| 1124 | +#endif /* EGL_KHR_no_config_context */ | |
| 1125 | + | |
| 1126 | +#ifndef EGL_KHR_partial_update | |
| 1127 | +#define EGL_KHR_partial_update 1 | |
| 1128 | +#define EGL_BUFFER_AGE_KHR 0x313D | |
| 1129 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); | |
| 1130 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1131 | +EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); | |
| 1132 | +#endif | |
| 1133 | +#endif /* EGL_KHR_partial_update */ | |
| 1134 | + | |
| 1135 | +#ifndef EGL_KHR_platform_android | |
| 1136 | +#define EGL_KHR_platform_android 1 | |
| 1137 | +#define EGL_PLATFORM_ANDROID_KHR 0x3141 | |
| 1138 | +#endif /* EGL_KHR_platform_android */ | |
| 1139 | + | |
| 1140 | +#ifndef EGL_KHR_platform_gbm | |
| 1141 | +#define EGL_KHR_platform_gbm 1 | |
| 1142 | +#define EGL_PLATFORM_GBM_KHR 0x31D7 | |
| 1143 | +#endif /* EGL_KHR_platform_gbm */ | |
| 1144 | + | |
| 1145 | +#ifndef EGL_KHR_platform_wayland | |
| 1146 | +#define EGL_KHR_platform_wayland 1 | |
| 1147 | +#define EGL_PLATFORM_WAYLAND_KHR 0x31D8 | |
| 1148 | +#endif /* EGL_KHR_platform_wayland */ | |
| 1149 | + | |
| 1150 | +#ifndef EGL_KHR_platform_x11 | |
| 1151 | +#define EGL_KHR_platform_x11 1 | |
| 1152 | +#define EGL_PLATFORM_X11_KHR 0x31D5 | |
| 1153 | +#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6 | |
| 1154 | +#endif /* EGL_KHR_platform_x11 */ | |
| 1155 | + | |
| 1156 | +#ifndef EGL_KHR_reusable_sync | |
| 1157 | +#define EGL_KHR_reusable_sync 1 | |
| 1158 | +#ifdef KHRONOS_SUPPORT_INT64 | |
| 1159 | +#define EGL_SYNC_STATUS_KHR 0x30F1 | |
| 1160 | +#define EGL_SIGNALED_KHR 0x30F2 | |
| 1161 | +#define EGL_UNSIGNALED_KHR 0x30F3 | |
| 1162 | +#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 | |
| 1163 | +#define EGL_CONDITION_SATISFIED_KHR 0x30F6 | |
| 1164 | +#define EGL_SYNC_TYPE_KHR 0x30F7 | |
| 1165 | +#define EGL_SYNC_REUSABLE_KHR 0x30FA | |
| 1166 | +#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 | |
| 1167 | +#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull | |
| 1168 | +#define EGL_NO_SYNC_KHR EGL_CAST(EGLSyncKHR,0) | |
| 1169 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); | |
| 1170 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1171 | +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); | |
| 1172 | +#endif | |
| 1173 | +#endif /* KHRONOS_SUPPORT_INT64 */ | |
| 1174 | +#endif /* EGL_KHR_reusable_sync */ | |
| 1175 | + | |
| 1176 | +#ifndef EGL_KHR_stream | |
| 1177 | +#define EGL_KHR_stream 1 | |
| 1178 | +typedef void *EGLStreamKHR; | |
| 1179 | +typedef khronos_uint64_t EGLuint64KHR; | |
| 1180 | +#ifdef KHRONOS_SUPPORT_INT64 | |
| 1181 | +#define EGL_NO_STREAM_KHR EGL_CAST(EGLStreamKHR,0) | |
| 1182 | +#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 | |
| 1183 | +#define EGL_PRODUCER_FRAME_KHR 0x3212 | |
| 1184 | +#define EGL_CONSUMER_FRAME_KHR 0x3213 | |
| 1185 | +#define EGL_STREAM_STATE_KHR 0x3214 | |
| 1186 | +#define EGL_STREAM_STATE_CREATED_KHR 0x3215 | |
| 1187 | +#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 | |
| 1188 | +#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 | |
| 1189 | +#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 | |
| 1190 | +#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 | |
| 1191 | +#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A | |
| 1192 | +#define EGL_BAD_STREAM_KHR 0x321B | |
| 1193 | +#define EGL_BAD_STATE_KHR 0x321C | |
| 1194 | +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list); | |
| 1195 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); | |
| 1196 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); | |
| 1197 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); | |
| 1198 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); | |
| 1199 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1200 | +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list); | |
| 1201 | +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream); | |
| 1202 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); | |
| 1203 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); | |
| 1204 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); | |
| 1205 | +#endif | |
| 1206 | +#endif /* KHRONOS_SUPPORT_INT64 */ | |
| 1207 | +#endif /* EGL_KHR_stream */ | |
| 1208 | + | |
| 1209 | +#ifndef EGL_KHR_stream_attrib | |
| 1210 | +#define EGL_KHR_stream_attrib 1 | |
| 1211 | +#ifdef KHRONOS_SUPPORT_INT64 | |
| 1212 | +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBKHRPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list); | |
| 1213 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); | |
| 1214 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); | |
| 1215 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); | |
| 1216 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); | |
| 1217 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1218 | +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribKHR (EGLDisplay dpy, const EGLAttrib *attrib_list); | |
| 1219 | +EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); | |
| 1220 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); | |
| 1221 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); | |
| 1222 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); | |
| 1223 | +#endif | |
| 1224 | +#endif /* KHRONOS_SUPPORT_INT64 */ | |
| 1225 | +#endif /* EGL_KHR_stream_attrib */ | |
| 1226 | + | |
| 1227 | +#ifndef EGL_KHR_stream_consumer_gltexture | |
| 1228 | +#define EGL_KHR_stream_consumer_gltexture 1 | |
| 1229 | +#ifdef EGL_KHR_stream | |
| 1230 | +#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E | |
| 1231 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); | |
| 1232 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); | |
| 1233 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); | |
| 1234 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1235 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream); | |
| 1236 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream); | |
| 1237 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream); | |
| 1238 | +#endif | |
| 1239 | +#endif /* EGL_KHR_stream */ | |
| 1240 | +#endif /* EGL_KHR_stream_consumer_gltexture */ | |
| 1241 | + | |
| 1242 | +#ifndef EGL_KHR_stream_cross_process_fd | |
| 1243 | +#define EGL_KHR_stream_cross_process_fd 1 | |
| 1244 | +typedef int EGLNativeFileDescriptorKHR; | |
| 1245 | +#ifdef EGL_KHR_stream | |
| 1246 | +#define EGL_NO_FILE_DESCRIPTOR_KHR EGL_CAST(EGLNativeFileDescriptorKHR,-1) | |
| 1247 | +typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); | |
| 1248 | +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); | |
| 1249 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1250 | +EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream); | |
| 1251 | +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); | |
| 1252 | +#endif | |
| 1253 | +#endif /* EGL_KHR_stream */ | |
| 1254 | +#endif /* EGL_KHR_stream_cross_process_fd */ | |
| 1255 | + | |
| 1256 | +#ifndef EGL_KHR_stream_fifo | |
| 1257 | +#define EGL_KHR_stream_fifo 1 | |
| 1258 | +#ifdef EGL_KHR_stream | |
| 1259 | +#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC | |
| 1260 | +#define EGL_STREAM_TIME_NOW_KHR 0x31FD | |
| 1261 | +#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE | |
| 1262 | +#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF | |
| 1263 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); | |
| 1264 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1265 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); | |
| 1266 | +#endif | |
| 1267 | +#endif /* EGL_KHR_stream */ | |
| 1268 | +#endif /* EGL_KHR_stream_fifo */ | |
| 1269 | + | |
| 1270 | +#ifndef EGL_KHR_stream_producer_aldatalocator | |
| 1271 | +#define EGL_KHR_stream_producer_aldatalocator 1 | |
| 1272 | +#ifdef EGL_KHR_stream | |
| 1273 | +#endif /* EGL_KHR_stream */ | |
| 1274 | +#endif /* EGL_KHR_stream_producer_aldatalocator */ | |
| 1275 | + | |
| 1276 | +#ifndef EGL_KHR_stream_producer_eglsurface | |
| 1277 | +#define EGL_KHR_stream_producer_eglsurface 1 | |
| 1278 | +#ifdef EGL_KHR_stream | |
| 1279 | +#define EGL_STREAM_BIT_KHR 0x0800 | |
| 1280 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); | |
| 1281 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1282 | +EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); | |
| 1283 | +#endif | |
| 1284 | +#endif /* EGL_KHR_stream */ | |
| 1285 | +#endif /* EGL_KHR_stream_producer_eglsurface */ | |
| 1286 | + | |
| 1287 | +#ifndef EGL_KHR_surfaceless_context | |
| 1288 | +#define EGL_KHR_surfaceless_context 1 | |
| 1289 | +#endif /* EGL_KHR_surfaceless_context */ | |
| 1290 | + | |
| 1291 | +#ifndef EGL_KHR_swap_buffers_with_damage | |
| 1292 | +#define EGL_KHR_swap_buffers_with_damage 1 | |
| 1293 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *rects, EGLint n_rects); | |
| 1294 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1295 | +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *rects, EGLint n_rects); | |
| 1296 | +#endif | |
| 1297 | +#endif /* EGL_KHR_swap_buffers_with_damage */ | |
| 1298 | + | |
| 1299 | +#ifndef EGL_KHR_vg_parent_image | |
| 1300 | +#define EGL_KHR_vg_parent_image 1 | |
| 1301 | +#define EGL_VG_PARENT_IMAGE_KHR 0x30BA | |
| 1302 | +#endif /* EGL_KHR_vg_parent_image */ | |
| 1303 | + | |
| 1304 | +#ifndef EGL_KHR_wait_sync | |
| 1305 | +#define EGL_KHR_wait_sync 1 | |
| 1306 | +typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); | |
| 1307 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1308 | +EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); | |
| 1309 | +#endif | |
| 1310 | +#endif /* EGL_KHR_wait_sync */ | |
| 1311 | + | |
| 1312 | +#ifndef EGL_ANDROID_GLES_layers | |
| 1313 | +#define EGL_ANDROID_GLES_layers 1 | |
| 1314 | +#endif /* EGL_ANDROID_GLES_layers */ | |
| 1315 | + | |
| 1316 | +#ifndef EGL_ANDROID_blob_cache | |
| 1317 | +#define EGL_ANDROID_blob_cache 1 | |
| 1318 | +typedef khronos_ssize_t EGLsizeiANDROID; | |
| 1319 | +typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); | |
| 1320 | +typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); | |
| 1321 | +typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); | |
| 1322 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1323 | +EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); | |
| 1324 | +#endif | |
| 1325 | +#endif /* EGL_ANDROID_blob_cache */ | |
| 1326 | + | |
| 1327 | +#ifndef EGL_ANDROID_create_native_client_buffer | |
| 1328 | +#define EGL_ANDROID_create_native_client_buffer 1 | |
| 1329 | +#define EGL_NATIVE_BUFFER_USAGE_ANDROID 0x3143 | |
| 1330 | +#define EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID 0x00000001 | |
| 1331 | +#define EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID 0x00000002 | |
| 1332 | +#define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x00000004 | |
| 1333 | +typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint *attrib_list); | |
| 1334 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1335 | +EGLAPI EGLClientBuffer EGLAPIENTRY eglCreateNativeClientBufferANDROID (const EGLint *attrib_list); | |
| 1336 | +#endif | |
| 1337 | +#endif /* EGL_ANDROID_create_native_client_buffer */ | |
| 1338 | + | |
| 1339 | +#ifndef EGL_ANDROID_framebuffer_target | |
| 1340 | +#define EGL_ANDROID_framebuffer_target 1 | |
| 1341 | +#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147 | |
| 1342 | +#endif /* EGL_ANDROID_framebuffer_target */ | |
| 1343 | + | |
| 1344 | +#ifndef EGL_ANDROID_front_buffer_auto_refresh | |
| 1345 | +#define EGL_ANDROID_front_buffer_auto_refresh 1 | |
| 1346 | +#define EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID 0x314C | |
| 1347 | +#endif /* EGL_ANDROID_front_buffer_auto_refresh */ | |
| 1348 | + | |
| 1349 | +#ifndef EGL_ANDROID_get_frame_timestamps | |
| 1350 | +#define EGL_ANDROID_get_frame_timestamps 1 | |
| 1351 | +typedef khronos_stime_nanoseconds_t EGLnsecsANDROID; | |
| 1352 | +#define EGL_TIMESTAMP_PENDING_ANDROID EGL_CAST(EGLnsecsANDROID,-2) | |
| 1353 | +#define EGL_TIMESTAMP_INVALID_ANDROID EGL_CAST(EGLnsecsANDROID,-1) | |
| 1354 | +#define EGL_TIMESTAMPS_ANDROID 0x3430 | |
| 1355 | +#define EGL_COMPOSITE_DEADLINE_ANDROID 0x3431 | |
| 1356 | +#define EGL_COMPOSITE_INTERVAL_ANDROID 0x3432 | |
| 1357 | +#define EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID 0x3433 | |
| 1358 | +#define EGL_REQUESTED_PRESENT_TIME_ANDROID 0x3434 | |
| 1359 | +#define EGL_RENDERING_COMPLETE_TIME_ANDROID 0x3435 | |
| 1360 | +#define EGL_COMPOSITION_LATCH_TIME_ANDROID 0x3436 | |
| 1361 | +#define EGL_FIRST_COMPOSITION_START_TIME_ANDROID 0x3437 | |
| 1362 | +#define EGL_LAST_COMPOSITION_START_TIME_ANDROID 0x3438 | |
| 1363 | +#define EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID 0x3439 | |
| 1364 | +#define EGL_DISPLAY_PRESENT_TIME_ANDROID 0x343A | |
| 1365 | +#define EGL_DEQUEUE_READY_TIME_ANDROID 0x343B | |
| 1366 | +#define EGL_READS_DONE_TIME_ANDROID 0x343C | |
| 1367 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint name); | |
| 1368 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCOMPOSITORTIMINGANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numTimestamps, const EGLint *names, EGLnsecsANDROID *values); | |
| 1369 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETNEXTFRAMEIDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR *frameId); | |
| 1370 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint timestamp); | |
| 1371 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETFRAMETIMESTAMPSANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR frameId, EGLint numTimestamps, const EGLint *timestamps, EGLnsecsANDROID *values); | |
| 1372 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1373 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetCompositorTimingSupportedANDROID (EGLDisplay dpy, EGLSurface surface, EGLint name); | |
| 1374 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetCompositorTimingANDROID (EGLDisplay dpy, EGLSurface surface, EGLint numTimestamps, const EGLint *names, EGLnsecsANDROID *values); | |
| 1375 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetNextFrameIdANDROID (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR *frameId); | |
| 1376 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetFrameTimestampSupportedANDROID (EGLDisplay dpy, EGLSurface surface, EGLint timestamp); | |
| 1377 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetFrameTimestampsANDROID (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR frameId, EGLint numTimestamps, const EGLint *timestamps, EGLnsecsANDROID *values); | |
| 1378 | +#endif | |
| 1379 | +#endif /* EGL_ANDROID_get_frame_timestamps */ | |
| 1380 | + | |
| 1381 | +#ifndef EGL_ANDROID_get_native_client_buffer | |
| 1382 | +#define EGL_ANDROID_get_native_client_buffer 1 | |
| 1383 | +struct AHardwareBuffer; | |
| 1384 | +typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC) (const struct AHardwareBuffer *buffer); | |
| 1385 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1386 | +EGLAPI EGLClientBuffer EGLAPIENTRY eglGetNativeClientBufferANDROID (const struct AHardwareBuffer *buffer); | |
| 1387 | +#endif | |
| 1388 | +#endif /* EGL_ANDROID_get_native_client_buffer */ | |
| 1389 | + | |
| 1390 | +#ifndef EGL_ANDROID_image_native_buffer | |
| 1391 | +#define EGL_ANDROID_image_native_buffer 1 | |
| 1392 | +#define EGL_NATIVE_BUFFER_ANDROID 0x3140 | |
| 1393 | +#endif /* EGL_ANDROID_image_native_buffer */ | |
| 1394 | + | |
| 1395 | +#ifndef EGL_ANDROID_native_fence_sync | |
| 1396 | +#define EGL_ANDROID_native_fence_sync 1 | |
| 1397 | +#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144 | |
| 1398 | +#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 | |
| 1399 | +#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 | |
| 1400 | +#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1 | |
| 1401 | +typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync); | |
| 1402 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1403 | +EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync); | |
| 1404 | +#endif | |
| 1405 | +#endif /* EGL_ANDROID_native_fence_sync */ | |
| 1406 | + | |
| 1407 | +#ifndef EGL_ANDROID_presentation_time | |
| 1408 | +#define EGL_ANDROID_presentation_time 1 | |
| 1409 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time); | |
| 1410 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1411 | +EGLAPI EGLBoolean EGLAPIENTRY eglPresentationTimeANDROID (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time); | |
| 1412 | +#endif | |
| 1413 | +#endif /* EGL_ANDROID_presentation_time */ | |
| 1414 | + | |
| 1415 | +#ifndef EGL_ANDROID_recordable | |
| 1416 | +#define EGL_ANDROID_recordable 1 | |
| 1417 | +#define EGL_RECORDABLE_ANDROID 0x3142 | |
| 1418 | +#endif /* EGL_ANDROID_recordable */ | |
| 1419 | + | |
| 1420 | +#ifndef EGL_ANGLE_d3d_share_handle_client_buffer | |
| 1421 | +#define EGL_ANGLE_d3d_share_handle_client_buffer 1 | |
| 1422 | +#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 | |
| 1423 | +#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */ | |
| 1424 | + | |
| 1425 | +#ifndef EGL_ANGLE_device_d3d | |
| 1426 | +#define EGL_ANGLE_device_d3d 1 | |
| 1427 | +#define EGL_D3D9_DEVICE_ANGLE 0x33A0 | |
| 1428 | +#define EGL_D3D11_DEVICE_ANGLE 0x33A1 | |
| 1429 | +#endif /* EGL_ANGLE_device_d3d */ | |
| 1430 | + | |
| 1431 | +#ifndef EGL_ANGLE_query_surface_pointer | |
| 1432 | +#define EGL_ANGLE_query_surface_pointer 1 | |
| 1433 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); | |
| 1434 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1435 | +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); | |
| 1436 | +#endif | |
| 1437 | +#endif /* EGL_ANGLE_query_surface_pointer */ | |
| 1438 | + | |
| 1439 | +#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle | |
| 1440 | +#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 | |
| 1441 | +#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */ | |
| 1442 | + | |
| 1443 | +#ifndef EGL_ANGLE_sync_control_rate | |
| 1444 | +#define EGL_ANGLE_sync_control_rate 1 | |
| 1445 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETMSCRATEANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *numerator, EGLint *denominator); | |
| 1446 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1447 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetMscRateANGLE (EGLDisplay dpy, EGLSurface surface, EGLint *numerator, EGLint *denominator); | |
| 1448 | +#endif | |
| 1449 | +#endif /* EGL_ANGLE_sync_control_rate */ | |
| 1450 | + | |
| 1451 | +#ifndef EGL_ANGLE_window_fixed_size | |
| 1452 | +#define EGL_ANGLE_window_fixed_size 1 | |
| 1453 | +#define EGL_FIXED_SIZE_ANGLE 0x3201 | |
| 1454 | +#endif /* EGL_ANGLE_window_fixed_size */ | |
| 1455 | + | |
| 1456 | +#ifndef EGL_ARM_image_format | |
| 1457 | +#define EGL_ARM_image_format 1 | |
| 1458 | +#define EGL_COLOR_COMPONENT_TYPE_UNSIGNED_INTEGER_ARM 0x3287 | |
| 1459 | +#define EGL_COLOR_COMPONENT_TYPE_INTEGER_ARM 0x3288 | |
| 1460 | +#endif /* EGL_ARM_image_format */ | |
| 1461 | + | |
| 1462 | +#ifndef EGL_ARM_implicit_external_sync | |
| 1463 | +#define EGL_ARM_implicit_external_sync 1 | |
| 1464 | +#define EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM 0x328A | |
| 1465 | +#endif /* EGL_ARM_implicit_external_sync */ | |
| 1466 | + | |
| 1467 | +#ifndef EGL_ARM_pixmap_multisample_discard | |
| 1468 | +#define EGL_ARM_pixmap_multisample_discard 1 | |
| 1469 | +#define EGL_DISCARD_SAMPLES_ARM 0x3286 | |
| 1470 | +#endif /* EGL_ARM_pixmap_multisample_discard */ | |
| 1471 | + | |
| 1472 | +#ifndef EGL_EXT_bind_to_front | |
| 1473 | +#define EGL_EXT_bind_to_front 1 | |
| 1474 | +#define EGL_FRONT_BUFFER_EXT 0x3464 | |
| 1475 | +#endif /* EGL_EXT_bind_to_front */ | |
| 1476 | + | |
| 1477 | +#ifndef EGL_EXT_buffer_age | |
| 1478 | +#define EGL_EXT_buffer_age 1 | |
| 1479 | +#define EGL_BUFFER_AGE_EXT 0x313D | |
| 1480 | +#endif /* EGL_EXT_buffer_age */ | |
| 1481 | + | |
| 1482 | +#ifndef EGL_EXT_client_extensions | |
| 1483 | +#define EGL_EXT_client_extensions 1 | |
| 1484 | +#endif /* EGL_EXT_client_extensions */ | |
| 1485 | + | |
| 1486 | +#ifndef EGL_EXT_client_sync | |
| 1487 | +#define EGL_EXT_client_sync 1 | |
| 1488 | +#define EGL_SYNC_CLIENT_EXT 0x3364 | |
| 1489 | +#define EGL_SYNC_CLIENT_SIGNAL_EXT 0x3365 | |
| 1490 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCLIENTSIGNALSYNCEXTPROC) (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list); | |
| 1491 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1492 | +EGLAPI EGLBoolean EGLAPIENTRY eglClientSignalSyncEXT (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list); | |
| 1493 | +#endif | |
| 1494 | +#endif /* EGL_EXT_client_sync */ | |
| 1495 | + | |
| 1496 | +#ifndef EGL_EXT_compositor | |
| 1497 | +#define EGL_EXT_compositor 1 | |
| 1498 | +#define EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT 0x3460 | |
| 1499 | +#define EGL_EXTERNAL_REF_ID_EXT 0x3461 | |
| 1500 | +#define EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT 0x3462 | |
| 1501 | +#define EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT 0x3463 | |
| 1502 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC) (const EGLint *external_ref_ids, EGLint num_entries); | |
| 1503 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC) (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries); | |
| 1504 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC) (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries); | |
| 1505 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC) (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries); | |
| 1506 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC) (EGLint external_win_id); | |
| 1507 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETSIZEEXTPROC) (EGLint external_win_id, EGLint width, EGLint height); | |
| 1508 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSWAPPOLICYEXTPROC) (EGLint external_win_id, EGLint policy); | |
| 1509 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1510 | +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextListEXT (const EGLint *external_ref_ids, EGLint num_entries); | |
| 1511 | +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextAttributesEXT (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries); | |
| 1512 | +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowListEXT (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries); | |
| 1513 | +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowAttributesEXT (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries); | |
| 1514 | +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorBindTexWindowEXT (EGLint external_win_id); | |
| 1515 | +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetSizeEXT (EGLint external_win_id, EGLint width, EGLint height); | |
| 1516 | +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSwapPolicyEXT (EGLint external_win_id, EGLint policy); | |
| 1517 | +#endif | |
| 1518 | +#endif /* EGL_EXT_compositor */ | |
| 1519 | + | |
| 1520 | +#ifndef EGL_EXT_config_select_group | |
| 1521 | +#define EGL_EXT_config_select_group 1 | |
| 1522 | +#define EGL_CONFIG_SELECT_GROUP_EXT 0x34C0 | |
| 1523 | +#endif /* EGL_EXT_config_select_group */ | |
| 1524 | + | |
| 1525 | +#ifndef EGL_EXT_create_context_robustness | |
| 1526 | +#define EGL_EXT_create_context_robustness 1 | |
| 1527 | +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF | |
| 1528 | +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 | |
| 1529 | +#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE | |
| 1530 | +#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF | |
| 1531 | +#endif /* EGL_EXT_create_context_robustness */ | |
| 1532 | + | |
| 1533 | +#ifndef EGL_EXT_device_base | |
| 1534 | +#define EGL_EXT_device_base 1 | |
| 1535 | +typedef void *EGLDeviceEXT; | |
| 1536 | +#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0) | |
| 1537 | +#define EGL_BAD_DEVICE_EXT 0x322B | |
| 1538 | +#define EGL_DEVICE_EXT 0x322C | |
| 1539 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); | |
| 1540 | +typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); | |
| 1541 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); | |
| 1542 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); | |
| 1543 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1544 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); | |
| 1545 | +EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name); | |
| 1546 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); | |
| 1547 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); | |
| 1548 | +#endif | |
| 1549 | +#endif /* EGL_EXT_device_base */ | |
| 1550 | + | |
| 1551 | +#ifndef EGL_EXT_device_drm | |
| 1552 | +#define EGL_EXT_device_drm 1 | |
| 1553 | +#define EGL_DRM_DEVICE_FILE_EXT 0x3233 | |
| 1554 | +#define EGL_DRM_MASTER_FD_EXT 0x333C | |
| 1555 | +#endif /* EGL_EXT_device_drm */ | |
| 1556 | + | |
| 1557 | +#ifndef EGL_EXT_device_drm_render_node | |
| 1558 | +#define EGL_EXT_device_drm_render_node 1 | |
| 1559 | +#define EGL_DRM_RENDER_NODE_FILE_EXT 0x3377 | |
| 1560 | +#endif /* EGL_EXT_device_drm_render_node */ | |
| 1561 | + | |
| 1562 | +#ifndef EGL_EXT_device_enumeration | |
| 1563 | +#define EGL_EXT_device_enumeration 1 | |
| 1564 | +#endif /* EGL_EXT_device_enumeration */ | |
| 1565 | + | |
| 1566 | +#ifndef EGL_EXT_device_openwf | |
| 1567 | +#define EGL_EXT_device_openwf 1 | |
| 1568 | +#define EGL_OPENWF_DEVICE_ID_EXT 0x3237 | |
| 1569 | +#define EGL_OPENWF_DEVICE_EXT 0x333D | |
| 1570 | +#endif /* EGL_EXT_device_openwf */ | |
| 1571 | + | |
| 1572 | +#ifndef EGL_EXT_device_persistent_id | |
| 1573 | +#define EGL_EXT_device_persistent_id 1 | |
| 1574 | +#define EGL_DEVICE_UUID_EXT 0x335C | |
| 1575 | +#define EGL_DRIVER_UUID_EXT 0x335D | |
| 1576 | +#define EGL_DRIVER_NAME_EXT 0x335E | |
| 1577 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEBINARYEXTPROC) (EGLDeviceEXT device, EGLint name, EGLint max_size, void *value, EGLint *size); | |
| 1578 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1579 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceBinaryEXT (EGLDeviceEXT device, EGLint name, EGLint max_size, void *value, EGLint *size); | |
| 1580 | +#endif | |
| 1581 | +#endif /* EGL_EXT_device_persistent_id */ | |
| 1582 | + | |
| 1583 | +#ifndef EGL_EXT_device_query | |
| 1584 | +#define EGL_EXT_device_query 1 | |
| 1585 | +#endif /* EGL_EXT_device_query */ | |
| 1586 | + | |
| 1587 | +#ifndef EGL_EXT_device_query_name | |
| 1588 | +#define EGL_EXT_device_query_name 1 | |
| 1589 | +#define EGL_RENDERER_EXT 0x335F | |
| 1590 | +#endif /* EGL_EXT_device_query_name */ | |
| 1591 | + | |
| 1592 | +#ifndef EGL_EXT_explicit_device | |
| 1593 | +#define EGL_EXT_explicit_device 1 | |
| 1594 | +#endif /* EGL_EXT_explicit_device */ | |
| 1595 | + | |
| 1596 | +#ifndef EGL_EXT_gl_colorspace_bt2020_linear | |
| 1597 | +#define EGL_EXT_gl_colorspace_bt2020_linear 1 | |
| 1598 | +#define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F | |
| 1599 | +#endif /* EGL_EXT_gl_colorspace_bt2020_linear */ | |
| 1600 | + | |
| 1601 | +#ifndef EGL_EXT_gl_colorspace_bt2020_pq | |
| 1602 | +#define EGL_EXT_gl_colorspace_bt2020_pq 1 | |
| 1603 | +#define EGL_GL_COLORSPACE_BT2020_PQ_EXT 0x3340 | |
| 1604 | +#endif /* EGL_EXT_gl_colorspace_bt2020_pq */ | |
| 1605 | + | |
| 1606 | +#ifndef EGL_EXT_gl_colorspace_display_p3 | |
| 1607 | +#define EGL_EXT_gl_colorspace_display_p3 1 | |
| 1608 | +#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT 0x3363 | |
| 1609 | +#endif /* EGL_EXT_gl_colorspace_display_p3 */ | |
| 1610 | + | |
| 1611 | +#ifndef EGL_EXT_gl_colorspace_display_p3_linear | |
| 1612 | +#define EGL_EXT_gl_colorspace_display_p3_linear 1 | |
| 1613 | +#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362 | |
| 1614 | +#endif /* EGL_EXT_gl_colorspace_display_p3_linear */ | |
| 1615 | + | |
| 1616 | +#ifndef EGL_EXT_gl_colorspace_display_p3_passthrough | |
| 1617 | +#define EGL_EXT_gl_colorspace_display_p3_passthrough 1 | |
| 1618 | +#define EGL_GL_COLORSPACE_DISPLAY_P3_PASSTHROUGH_EXT 0x3490 | |
| 1619 | +#endif /* EGL_EXT_gl_colorspace_display_p3_passthrough */ | |
| 1620 | + | |
| 1621 | +#ifndef EGL_EXT_gl_colorspace_scrgb | |
| 1622 | +#define EGL_EXT_gl_colorspace_scrgb 1 | |
| 1623 | +#define EGL_GL_COLORSPACE_SCRGB_EXT 0x3351 | |
| 1624 | +#endif /* EGL_EXT_gl_colorspace_scrgb */ | |
| 1625 | + | |
| 1626 | +#ifndef EGL_EXT_gl_colorspace_scrgb_linear | |
| 1627 | +#define EGL_EXT_gl_colorspace_scrgb_linear 1 | |
| 1628 | +#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT 0x3350 | |
| 1629 | +#endif /* EGL_EXT_gl_colorspace_scrgb_linear */ | |
| 1630 | + | |
| 1631 | +#ifndef EGL_EXT_image_dma_buf_import | |
| 1632 | +#define EGL_EXT_image_dma_buf_import 1 | |
| 1633 | +#define EGL_LINUX_DMA_BUF_EXT 0x3270 | |
| 1634 | +#define EGL_LINUX_DRM_FOURCC_EXT 0x3271 | |
| 1635 | +#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 | |
| 1636 | +#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 | |
| 1637 | +#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 | |
| 1638 | +#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 | |
| 1639 | +#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 | |
| 1640 | +#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 | |
| 1641 | +#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 | |
| 1642 | +#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 | |
| 1643 | +#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A | |
| 1644 | +#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B | |
| 1645 | +#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C | |
| 1646 | +#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D | |
| 1647 | +#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E | |
| 1648 | +#define EGL_ITU_REC601_EXT 0x327F | |
| 1649 | +#define EGL_ITU_REC709_EXT 0x3280 | |
| 1650 | +#define EGL_ITU_REC2020_EXT 0x3281 | |
| 1651 | +#define EGL_YUV_FULL_RANGE_EXT 0x3282 | |
| 1652 | +#define EGL_YUV_NARROW_RANGE_EXT 0x3283 | |
| 1653 | +#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 | |
| 1654 | +#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 | |
| 1655 | +#endif /* EGL_EXT_image_dma_buf_import */ | |
| 1656 | + | |
| 1657 | +#ifndef EGL_EXT_image_dma_buf_import_modifiers | |
| 1658 | +#define EGL_EXT_image_dma_buf_import_modifiers 1 | |
| 1659 | +#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440 | |
| 1660 | +#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441 | |
| 1661 | +#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442 | |
| 1662 | +#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443 | |
| 1663 | +#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444 | |
| 1664 | +#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445 | |
| 1665 | +#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446 | |
| 1666 | +#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447 | |
| 1667 | +#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448 | |
| 1668 | +#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449 | |
| 1669 | +#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A | |
| 1670 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats); | |
| 1671 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers); | |
| 1672 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1673 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufFormatsEXT (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats); | |
| 1674 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufModifiersEXT (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers); | |
| 1675 | +#endif | |
| 1676 | +#endif /* EGL_EXT_image_dma_buf_import_modifiers */ | |
| 1677 | + | |
| 1678 | +#ifndef EGL_EXT_image_gl_colorspace | |
| 1679 | +#define EGL_EXT_image_gl_colorspace 1 | |
| 1680 | +#define EGL_GL_COLORSPACE_DEFAULT_EXT 0x314D | |
| 1681 | +#endif /* EGL_EXT_image_gl_colorspace */ | |
| 1682 | + | |
| 1683 | +#ifndef EGL_EXT_image_implicit_sync_control | |
| 1684 | +#define EGL_EXT_image_implicit_sync_control 1 | |
| 1685 | +#define EGL_IMPORT_SYNC_TYPE_EXT 0x3470 | |
| 1686 | +#define EGL_IMPORT_IMPLICIT_SYNC_EXT 0x3471 | |
| 1687 | +#define EGL_IMPORT_EXPLICIT_SYNC_EXT 0x3472 | |
| 1688 | +#endif /* EGL_EXT_image_implicit_sync_control */ | |
| 1689 | + | |
| 1690 | +#ifndef EGL_EXT_multiview_window | |
| 1691 | +#define EGL_EXT_multiview_window 1 | |
| 1692 | +#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134 | |
| 1693 | +#endif /* EGL_EXT_multiview_window */ | |
| 1694 | + | |
| 1695 | +#ifndef EGL_EXT_output_base | |
| 1696 | +#define EGL_EXT_output_base 1 | |
| 1697 | +typedef void *EGLOutputLayerEXT; | |
| 1698 | +typedef void *EGLOutputPortEXT; | |
| 1699 | +#define EGL_NO_OUTPUT_LAYER_EXT EGL_CAST(EGLOutputLayerEXT,0) | |
| 1700 | +#define EGL_NO_OUTPUT_PORT_EXT EGL_CAST(EGLOutputPortEXT,0) | |
| 1701 | +#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D | |
| 1702 | +#define EGL_BAD_OUTPUT_PORT_EXT 0x322E | |
| 1703 | +#define EGL_SWAP_INTERVAL_EXT 0x322F | |
| 1704 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); | |
| 1705 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); | |
| 1706 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); | |
| 1707 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); | |
| 1708 | +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); | |
| 1709 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); | |
| 1710 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); | |
| 1711 | +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); | |
| 1712 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1713 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); | |
| 1714 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); | |
| 1715 | +EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); | |
| 1716 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); | |
| 1717 | +EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); | |
| 1718 | +EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); | |
| 1719 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); | |
| 1720 | +EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); | |
| 1721 | +#endif | |
| 1722 | +#endif /* EGL_EXT_output_base */ | |
| 1723 | + | |
| 1724 | +#ifndef EGL_EXT_output_drm | |
| 1725 | +#define EGL_EXT_output_drm 1 | |
| 1726 | +#define EGL_DRM_CRTC_EXT 0x3234 | |
| 1727 | +#define EGL_DRM_PLANE_EXT 0x3235 | |
| 1728 | +#define EGL_DRM_CONNECTOR_EXT 0x3236 | |
| 1729 | +#endif /* EGL_EXT_output_drm */ | |
| 1730 | + | |
| 1731 | +#ifndef EGL_EXT_output_openwf | |
| 1732 | +#define EGL_EXT_output_openwf 1 | |
| 1733 | +#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238 | |
| 1734 | +#define EGL_OPENWF_PORT_ID_EXT 0x3239 | |
| 1735 | +#endif /* EGL_EXT_output_openwf */ | |
| 1736 | + | |
| 1737 | +#ifndef EGL_EXT_pixel_format_float | |
| 1738 | +#define EGL_EXT_pixel_format_float 1 | |
| 1739 | +#define EGL_COLOR_COMPONENT_TYPE_EXT 0x3339 | |
| 1740 | +#define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT 0x333A | |
| 1741 | +#define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT 0x333B | |
| 1742 | +#endif /* EGL_EXT_pixel_format_float */ | |
| 1743 | + | |
| 1744 | +#ifndef EGL_EXT_platform_base | |
| 1745 | +#define EGL_EXT_platform_base 1 | |
| 1746 | +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); | |
| 1747 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); | |
| 1748 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); | |
| 1749 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1750 | +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list); | |
| 1751 | +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); | |
| 1752 | +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); | |
| 1753 | +#endif | |
| 1754 | +#endif /* EGL_EXT_platform_base */ | |
| 1755 | + | |
| 1756 | +#ifndef EGL_EXT_platform_device | |
| 1757 | +#define EGL_EXT_platform_device 1 | |
| 1758 | +#define EGL_PLATFORM_DEVICE_EXT 0x313F | |
| 1759 | +#endif /* EGL_EXT_platform_device */ | |
| 1760 | + | |
| 1761 | +#ifndef EGL_EXT_platform_wayland | |
| 1762 | +#define EGL_EXT_platform_wayland 1 | |
| 1763 | +#define EGL_PLATFORM_WAYLAND_EXT 0x31D8 | |
| 1764 | +#endif /* EGL_EXT_platform_wayland */ | |
| 1765 | + | |
| 1766 | +#ifndef EGL_EXT_platform_x11 | |
| 1767 | +#define EGL_EXT_platform_x11 1 | |
| 1768 | +#define EGL_PLATFORM_X11_EXT 0x31D5 | |
| 1769 | +#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6 | |
| 1770 | +#endif /* EGL_EXT_platform_x11 */ | |
| 1771 | + | |
| 1772 | +#ifndef EGL_EXT_platform_xcb | |
| 1773 | +#define EGL_EXT_platform_xcb 1 | |
| 1774 | +#define EGL_PLATFORM_XCB_EXT 0x31DC | |
| 1775 | +#define EGL_PLATFORM_XCB_SCREEN_EXT 0x31DE | |
| 1776 | +#endif /* EGL_EXT_platform_xcb */ | |
| 1777 | + | |
| 1778 | +#ifndef EGL_EXT_present_opaque | |
| 1779 | +#define EGL_EXT_present_opaque 1 | |
| 1780 | +#define EGL_PRESENT_OPAQUE_EXT 0x31DF | |
| 1781 | +#endif /* EGL_EXT_present_opaque */ | |
| 1782 | + | |
| 1783 | +#ifndef EGL_EXT_protected_content | |
| 1784 | +#define EGL_EXT_protected_content 1 | |
| 1785 | +#define EGL_PROTECTED_CONTENT_EXT 0x32C0 | |
| 1786 | +#endif /* EGL_EXT_protected_content */ | |
| 1787 | + | |
| 1788 | +#ifndef EGL_EXT_protected_surface | |
| 1789 | +#define EGL_EXT_protected_surface 1 | |
| 1790 | +#endif /* EGL_EXT_protected_surface */ | |
| 1791 | + | |
| 1792 | +#ifndef EGL_EXT_stream_consumer_egloutput | |
| 1793 | +#define EGL_EXT_stream_consumer_egloutput 1 | |
| 1794 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); | |
| 1795 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1796 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); | |
| 1797 | +#endif | |
| 1798 | +#endif /* EGL_EXT_stream_consumer_egloutput */ | |
| 1799 | + | |
| 1800 | +#ifndef EGL_EXT_surface_CTA861_3_metadata | |
| 1801 | +#define EGL_EXT_surface_CTA861_3_metadata 1 | |
| 1802 | +#define EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT 0x3360 | |
| 1803 | +#define EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT 0x3361 | |
| 1804 | +#endif /* EGL_EXT_surface_CTA861_3_metadata */ | |
| 1805 | + | |
| 1806 | +#ifndef EGL_EXT_surface_SMPTE2086_metadata | |
| 1807 | +#define EGL_EXT_surface_SMPTE2086_metadata 1 | |
| 1808 | +#define EGL_SMPTE2086_DISPLAY_PRIMARY_RX_EXT 0x3341 | |
| 1809 | +#define EGL_SMPTE2086_DISPLAY_PRIMARY_RY_EXT 0x3342 | |
| 1810 | +#define EGL_SMPTE2086_DISPLAY_PRIMARY_GX_EXT 0x3343 | |
| 1811 | +#define EGL_SMPTE2086_DISPLAY_PRIMARY_GY_EXT 0x3344 | |
| 1812 | +#define EGL_SMPTE2086_DISPLAY_PRIMARY_BX_EXT 0x3345 | |
| 1813 | +#define EGL_SMPTE2086_DISPLAY_PRIMARY_BY_EXT 0x3346 | |
| 1814 | +#define EGL_SMPTE2086_WHITE_POINT_X_EXT 0x3347 | |
| 1815 | +#define EGL_SMPTE2086_WHITE_POINT_Y_EXT 0x3348 | |
| 1816 | +#define EGL_SMPTE2086_MAX_LUMINANCE_EXT 0x3349 | |
| 1817 | +#define EGL_SMPTE2086_MIN_LUMINANCE_EXT 0x334A | |
| 1818 | +#define EGL_METADATA_SCALING_EXT 50000 | |
| 1819 | +#endif /* EGL_EXT_surface_SMPTE2086_metadata */ | |
| 1820 | + | |
| 1821 | +#ifndef EGL_EXT_surface_compression | |
| 1822 | +#define EGL_EXT_surface_compression 1 | |
| 1823 | +#define EGL_SURFACE_COMPRESSION_EXT 0x34B0 | |
| 1824 | +#define EGL_SURFACE_COMPRESSION_PLANE1_EXT 0x328E | |
| 1825 | +#define EGL_SURFACE_COMPRESSION_PLANE2_EXT 0x328F | |
| 1826 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_NONE_EXT 0x34B1 | |
| 1827 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_DEFAULT_EXT 0x34B2 | |
| 1828 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_1BPC_EXT 0x34B4 | |
| 1829 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_2BPC_EXT 0x34B5 | |
| 1830 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_3BPC_EXT 0x34B6 | |
| 1831 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_4BPC_EXT 0x34B7 | |
| 1832 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_5BPC_EXT 0x34B8 | |
| 1833 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_6BPC_EXT 0x34B9 | |
| 1834 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_7BPC_EXT 0x34BA | |
| 1835 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_8BPC_EXT 0x34BB | |
| 1836 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_9BPC_EXT 0x34BC | |
| 1837 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_10BPC_EXT 0x34BD | |
| 1838 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_11BPC_EXT 0x34BE | |
| 1839 | +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_12BPC_EXT 0x34BF | |
| 1840 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSUPPORTEDCOMPRESSIONRATESEXTPROC) (EGLDisplay dpy, EGLConfig config, const EGLAttrib *attrib_list, EGLint *rates, EGLint rate_size, EGLint *num_rates); | |
| 1841 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1842 | +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySupportedCompressionRatesEXT (EGLDisplay dpy, EGLConfig config, const EGLAttrib *attrib_list, EGLint *rates, EGLint rate_size, EGLint *num_rates); | |
| 1843 | +#endif | |
| 1844 | +#endif /* EGL_EXT_surface_compression */ | |
| 1845 | + | |
| 1846 | +#ifndef EGL_EXT_swap_buffers_with_damage | |
| 1847 | +#define EGL_EXT_swap_buffers_with_damage 1 | |
| 1848 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *rects, EGLint n_rects); | |
| 1849 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1850 | +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, const EGLint *rects, EGLint n_rects); | |
| 1851 | +#endif | |
| 1852 | +#endif /* EGL_EXT_swap_buffers_with_damage */ | |
| 1853 | + | |
| 1854 | +#ifndef EGL_EXT_sync_reuse | |
| 1855 | +#define EGL_EXT_sync_reuse 1 | |
| 1856 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNSIGNALSYNCEXTPROC) (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list); | |
| 1857 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1858 | +EGLAPI EGLBoolean EGLAPIENTRY eglUnsignalSyncEXT (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list); | |
| 1859 | +#endif | |
| 1860 | +#endif /* EGL_EXT_sync_reuse */ | |
| 1861 | + | |
| 1862 | +#ifndef EGL_EXT_yuv_surface | |
| 1863 | +#define EGL_EXT_yuv_surface 1 | |
| 1864 | +#define EGL_YUV_ORDER_EXT 0x3301 | |
| 1865 | +#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311 | |
| 1866 | +#define EGL_YUV_SUBSAMPLE_EXT 0x3312 | |
| 1867 | +#define EGL_YUV_DEPTH_RANGE_EXT 0x3317 | |
| 1868 | +#define EGL_YUV_CSC_STANDARD_EXT 0x330A | |
| 1869 | +#define EGL_YUV_PLANE_BPP_EXT 0x331A | |
| 1870 | +#define EGL_YUV_BUFFER_EXT 0x3300 | |
| 1871 | +#define EGL_YUV_ORDER_YUV_EXT 0x3302 | |
| 1872 | +#define EGL_YUV_ORDER_YVU_EXT 0x3303 | |
| 1873 | +#define EGL_YUV_ORDER_YUYV_EXT 0x3304 | |
| 1874 | +#define EGL_YUV_ORDER_UYVY_EXT 0x3305 | |
| 1875 | +#define EGL_YUV_ORDER_YVYU_EXT 0x3306 | |
| 1876 | +#define EGL_YUV_ORDER_VYUY_EXT 0x3307 | |
| 1877 | +#define EGL_YUV_ORDER_AYUV_EXT 0x3308 | |
| 1878 | +#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313 | |
| 1879 | +#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314 | |
| 1880 | +#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315 | |
| 1881 | +#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318 | |
| 1882 | +#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319 | |
| 1883 | +#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B | |
| 1884 | +#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C | |
| 1885 | +#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D | |
| 1886 | +#define EGL_YUV_PLANE_BPP_0_EXT 0x331B | |
| 1887 | +#define EGL_YUV_PLANE_BPP_8_EXT 0x331C | |
| 1888 | +#define EGL_YUV_PLANE_BPP_10_EXT 0x331D | |
| 1889 | +#endif /* EGL_EXT_yuv_surface */ | |
| 1890 | + | |
| 1891 | +#ifndef EGL_HI_clientpixmap | |
| 1892 | +#define EGL_HI_clientpixmap 1 | |
| 1893 | +struct EGLClientPixmapHI { | |
| 1894 | + void *pData; | |
| 1895 | + EGLint iWidth; | |
| 1896 | + EGLint iHeight; | |
| 1897 | + EGLint iStride; | |
| 1898 | +}; | |
| 1899 | +#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 | |
| 1900 | +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); | |
| 1901 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1902 | +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); | |
| 1903 | +#endif | |
| 1904 | +#endif /* EGL_HI_clientpixmap */ | |
| 1905 | + | |
| 1906 | +#ifndef EGL_HI_colorformats | |
| 1907 | +#define EGL_HI_colorformats 1 | |
| 1908 | +#define EGL_COLOR_FORMAT_HI 0x8F70 | |
| 1909 | +#define EGL_COLOR_RGB_HI 0x8F71 | |
| 1910 | +#define EGL_COLOR_RGBA_HI 0x8F72 | |
| 1911 | +#define EGL_COLOR_ARGB_HI 0x8F73 | |
| 1912 | +#endif /* EGL_HI_colorformats */ | |
| 1913 | + | |
| 1914 | +#ifndef EGL_IMG_context_priority | |
| 1915 | +#define EGL_IMG_context_priority 1 | |
| 1916 | +#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 | |
| 1917 | +#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 | |
| 1918 | +#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 | |
| 1919 | +#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 | |
| 1920 | +#endif /* EGL_IMG_context_priority */ | |
| 1921 | + | |
| 1922 | +#ifndef EGL_IMG_image_plane_attribs | |
| 1923 | +#define EGL_IMG_image_plane_attribs 1 | |
| 1924 | +#define EGL_NATIVE_BUFFER_MULTIPLANE_SEPARATE_IMG 0x3105 | |
| 1925 | +#define EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG 0x3106 | |
| 1926 | +#endif /* EGL_IMG_image_plane_attribs */ | |
| 1927 | + | |
| 1928 | +#ifndef EGL_MESA_drm_image | |
| 1929 | +#define EGL_MESA_drm_image 1 | |
| 1930 | +#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 | |
| 1931 | +#define EGL_DRM_BUFFER_USE_MESA 0x31D1 | |
| 1932 | +#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 | |
| 1933 | +#define EGL_DRM_BUFFER_MESA 0x31D3 | |
| 1934 | +#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 | |
| 1935 | +#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 | |
| 1936 | +#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 | |
| 1937 | +#define EGL_DRM_BUFFER_USE_CURSOR_MESA 0x00000004 | |
| 1938 | +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); | |
| 1939 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); | |
| 1940 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1941 | +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); | |
| 1942 | +EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); | |
| 1943 | +#endif | |
| 1944 | +#endif /* EGL_MESA_drm_image */ | |
| 1945 | + | |
| 1946 | +#ifndef EGL_MESA_image_dma_buf_export | |
| 1947 | +#define EGL_MESA_image_dma_buf_export 1 | |
| 1948 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); | |
| 1949 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); | |
| 1950 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1951 | +EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); | |
| 1952 | +EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); | |
| 1953 | +#endif | |
| 1954 | +#endif /* EGL_MESA_image_dma_buf_export */ | |
| 1955 | + | |
| 1956 | +#ifndef EGL_MESA_platform_gbm | |
| 1957 | +#define EGL_MESA_platform_gbm 1 | |
| 1958 | +#define EGL_PLATFORM_GBM_MESA 0x31D7 | |
| 1959 | +#endif /* EGL_MESA_platform_gbm */ | |
| 1960 | + | |
| 1961 | +#ifndef EGL_MESA_platform_surfaceless | |
| 1962 | +#define EGL_MESA_platform_surfaceless 1 | |
| 1963 | +#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD | |
| 1964 | +#endif /* EGL_MESA_platform_surfaceless */ | |
| 1965 | + | |
| 1966 | +#ifndef EGL_MESA_query_driver | |
| 1967 | +#define EGL_MESA_query_driver 1 | |
| 1968 | +typedef char *(EGLAPIENTRYP PFNEGLGETDISPLAYDRIVERCONFIGPROC) (EGLDisplay dpy); | |
| 1969 | +typedef const char *(EGLAPIENTRYP PFNEGLGETDISPLAYDRIVERNAMEPROC) (EGLDisplay dpy); | |
| 1970 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1971 | +EGLAPI char *EGLAPIENTRY eglGetDisplayDriverConfig (EGLDisplay dpy); | |
| 1972 | +EGLAPI const char *EGLAPIENTRY eglGetDisplayDriverName (EGLDisplay dpy); | |
| 1973 | +#endif | |
| 1974 | +#endif /* EGL_MESA_query_driver */ | |
| 1975 | + | |
| 1976 | +#ifndef EGL_NOK_swap_region | |
| 1977 | +#define EGL_NOK_swap_region 1 | |
| 1978 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); | |
| 1979 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1980 | +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); | |
| 1981 | +#endif | |
| 1982 | +#endif /* EGL_NOK_swap_region */ | |
| 1983 | + | |
| 1984 | +#ifndef EGL_NOK_swap_region2 | |
| 1985 | +#define EGL_NOK_swap_region2 1 | |
| 1986 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); | |
| 1987 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 1988 | +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); | |
| 1989 | +#endif | |
| 1990 | +#endif /* EGL_NOK_swap_region2 */ | |
| 1991 | + | |
| 1992 | +#ifndef EGL_NOK_texture_from_pixmap | |
| 1993 | +#define EGL_NOK_texture_from_pixmap 1 | |
| 1994 | +#define EGL_Y_INVERTED_NOK 0x307F | |
| 1995 | +#endif /* EGL_NOK_texture_from_pixmap */ | |
| 1996 | + | |
| 1997 | +#ifndef EGL_NV_3dvision_surface | |
| 1998 | +#define EGL_NV_3dvision_surface 1 | |
| 1999 | +#define EGL_AUTO_STEREO_NV 0x3136 | |
| 2000 | +#endif /* EGL_NV_3dvision_surface */ | |
| 2001 | + | |
| 2002 | +#ifndef EGL_NV_context_priority_realtime | |
| 2003 | +#define EGL_NV_context_priority_realtime 1 | |
| 2004 | +#define EGL_CONTEXT_PRIORITY_REALTIME_NV 0x3357 | |
| 2005 | +#endif /* EGL_NV_context_priority_realtime */ | |
| 2006 | + | |
| 2007 | +#ifndef EGL_NV_coverage_sample | |
| 2008 | +#define EGL_NV_coverage_sample 1 | |
| 2009 | +#define EGL_COVERAGE_BUFFERS_NV 0x30E0 | |
| 2010 | +#define EGL_COVERAGE_SAMPLES_NV 0x30E1 | |
| 2011 | +#endif /* EGL_NV_coverage_sample */ | |
| 2012 | + | |
| 2013 | +#ifndef EGL_NV_coverage_sample_resolve | |
| 2014 | +#define EGL_NV_coverage_sample_resolve 1 | |
| 2015 | +#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131 | |
| 2016 | +#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132 | |
| 2017 | +#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133 | |
| 2018 | +#endif /* EGL_NV_coverage_sample_resolve */ | |
| 2019 | + | |
| 2020 | +#ifndef EGL_NV_cuda_event | |
| 2021 | +#define EGL_NV_cuda_event 1 | |
| 2022 | +#define EGL_CUDA_EVENT_HANDLE_NV 0x323B | |
| 2023 | +#define EGL_SYNC_CUDA_EVENT_NV 0x323C | |
| 2024 | +#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D | |
| 2025 | +#endif /* EGL_NV_cuda_event */ | |
| 2026 | + | |
| 2027 | +#ifndef EGL_NV_depth_nonlinear | |
| 2028 | +#define EGL_NV_depth_nonlinear 1 | |
| 2029 | +#define EGL_DEPTH_ENCODING_NV 0x30E2 | |
| 2030 | +#define EGL_DEPTH_ENCODING_NONE_NV 0 | |
| 2031 | +#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 | |
| 2032 | +#endif /* EGL_NV_depth_nonlinear */ | |
| 2033 | + | |
| 2034 | +#ifndef EGL_NV_device_cuda | |
| 2035 | +#define EGL_NV_device_cuda 1 | |
| 2036 | +#define EGL_CUDA_DEVICE_NV 0x323A | |
| 2037 | +#endif /* EGL_NV_device_cuda */ | |
| 2038 | + | |
| 2039 | +#ifndef EGL_NV_native_query | |
| 2040 | +#define EGL_NV_native_query 1 | |
| 2041 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id); | |
| 2042 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); | |
| 2043 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); | |
| 2044 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2045 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id); | |
| 2046 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); | |
| 2047 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); | |
| 2048 | +#endif | |
| 2049 | +#endif /* EGL_NV_native_query */ | |
| 2050 | + | |
| 2051 | +#ifndef EGL_NV_post_convert_rounding | |
| 2052 | +#define EGL_NV_post_convert_rounding 1 | |
| 2053 | +#endif /* EGL_NV_post_convert_rounding */ | |
| 2054 | + | |
| 2055 | +#ifndef EGL_NV_post_sub_buffer | |
| 2056 | +#define EGL_NV_post_sub_buffer 1 | |
| 2057 | +#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE | |
| 2058 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); | |
| 2059 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2060 | +EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); | |
| 2061 | +#endif | |
| 2062 | +#endif /* EGL_NV_post_sub_buffer */ | |
| 2063 | + | |
| 2064 | +#ifndef EGL_NV_quadruple_buffer | |
| 2065 | +#define EGL_NV_quadruple_buffer 1 | |
| 2066 | +#define EGL_QUADRUPLE_BUFFER_NV 0x3231 | |
| 2067 | +#endif /* EGL_NV_quadruple_buffer */ | |
| 2068 | + | |
| 2069 | +#ifndef EGL_NV_robustness_video_memory_purge | |
| 2070 | +#define EGL_NV_robustness_video_memory_purge 1 | |
| 2071 | +#define EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C | |
| 2072 | +#endif /* EGL_NV_robustness_video_memory_purge */ | |
| 2073 | + | |
| 2074 | +#ifndef EGL_NV_stream_consumer_eglimage | |
| 2075 | +#define EGL_NV_stream_consumer_eglimage 1 | |
| 2076 | +#define EGL_STREAM_CONSUMER_IMAGE_NV 0x3373 | |
| 2077 | +#define EGL_STREAM_IMAGE_ADD_NV 0x3374 | |
| 2078 | +#define EGL_STREAM_IMAGE_REMOVE_NV 0x3375 | |
| 2079 | +#define EGL_STREAM_IMAGE_AVAILABLE_NV 0x3376 | |
| 2080 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMIMAGECONSUMERCONNECTNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint num_modifiers, const EGLuint64KHR *modifiers, const EGLAttrib *attrib_list); | |
| 2081 | +typedef EGLint (EGLAPIENTRYP PFNEGLQUERYSTREAMCONSUMEREVENTNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLTime timeout, EGLenum *event, EGLAttrib *aux); | |
| 2082 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMACQUIREIMAGENVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLImage *pImage, EGLSync sync); | |
| 2083 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMRELEASEIMAGENVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLImage image, EGLSync sync); | |
| 2084 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2085 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamImageConsumerConnectNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint num_modifiers, const EGLuint64KHR *modifiers, const EGLAttrib *attrib_list); | |
| 2086 | +EGLAPI EGLint EGLAPIENTRY eglQueryStreamConsumerEventNV (EGLDisplay dpy, EGLStreamKHR stream, EGLTime timeout, EGLenum *event, EGLAttrib *aux); | |
| 2087 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamAcquireImageNV (EGLDisplay dpy, EGLStreamKHR stream, EGLImage *pImage, EGLSync sync); | |
| 2088 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamReleaseImageNV (EGLDisplay dpy, EGLStreamKHR stream, EGLImage image, EGLSync sync); | |
| 2089 | +#endif | |
| 2090 | +#endif /* EGL_NV_stream_consumer_eglimage */ | |
| 2091 | + | |
| 2092 | +#ifndef EGL_NV_stream_consumer_gltexture_yuv | |
| 2093 | +#define EGL_NV_stream_consumer_gltexture_yuv 1 | |
| 2094 | +#define EGL_YUV_PLANE0_TEXTURE_UNIT_NV 0x332C | |
| 2095 | +#define EGL_YUV_PLANE1_TEXTURE_UNIT_NV 0x332D | |
| 2096 | +#define EGL_YUV_PLANE2_TEXTURE_UNIT_NV 0x332E | |
| 2097 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); | |
| 2098 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2099 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); | |
| 2100 | +#endif | |
| 2101 | +#endif /* EGL_NV_stream_consumer_gltexture_yuv */ | |
| 2102 | + | |
| 2103 | +#ifndef EGL_NV_stream_cross_display | |
| 2104 | +#define EGL_NV_stream_cross_display 1 | |
| 2105 | +#define EGL_STREAM_CROSS_DISPLAY_NV 0x334E | |
| 2106 | +#endif /* EGL_NV_stream_cross_display */ | |
| 2107 | + | |
| 2108 | +#ifndef EGL_NV_stream_cross_object | |
| 2109 | +#define EGL_NV_stream_cross_object 1 | |
| 2110 | +#define EGL_STREAM_CROSS_OBJECT_NV 0x334D | |
| 2111 | +#endif /* EGL_NV_stream_cross_object */ | |
| 2112 | + | |
| 2113 | +#ifndef EGL_NV_stream_cross_partition | |
| 2114 | +#define EGL_NV_stream_cross_partition 1 | |
| 2115 | +#define EGL_STREAM_CROSS_PARTITION_NV 0x323F | |
| 2116 | +#endif /* EGL_NV_stream_cross_partition */ | |
| 2117 | + | |
| 2118 | +#ifndef EGL_NV_stream_cross_process | |
| 2119 | +#define EGL_NV_stream_cross_process 1 | |
| 2120 | +#define EGL_STREAM_CROSS_PROCESS_NV 0x3245 | |
| 2121 | +#endif /* EGL_NV_stream_cross_process */ | |
| 2122 | + | |
| 2123 | +#ifndef EGL_NV_stream_cross_system | |
| 2124 | +#define EGL_NV_stream_cross_system 1 | |
| 2125 | +#define EGL_STREAM_CROSS_SYSTEM_NV 0x334F | |
| 2126 | +#endif /* EGL_NV_stream_cross_system */ | |
| 2127 | + | |
| 2128 | +#ifndef EGL_NV_stream_dma | |
| 2129 | +#define EGL_NV_stream_dma 1 | |
| 2130 | +#define EGL_STREAM_DMA_NV 0x3371 | |
| 2131 | +#define EGL_STREAM_DMA_SERVER_NV 0x3372 | |
| 2132 | +#endif /* EGL_NV_stream_dma */ | |
| 2133 | + | |
| 2134 | +#ifndef EGL_NV_stream_fifo_next | |
| 2135 | +#define EGL_NV_stream_fifo_next 1 | |
| 2136 | +#define EGL_PENDING_FRAME_NV 0x3329 | |
| 2137 | +#define EGL_STREAM_TIME_PENDING_NV 0x332A | |
| 2138 | +#endif /* EGL_NV_stream_fifo_next */ | |
| 2139 | + | |
| 2140 | +#ifndef EGL_NV_stream_fifo_synchronous | |
| 2141 | +#define EGL_NV_stream_fifo_synchronous 1 | |
| 2142 | +#define EGL_STREAM_FIFO_SYNCHRONOUS_NV 0x3336 | |
| 2143 | +#endif /* EGL_NV_stream_fifo_synchronous */ | |
| 2144 | + | |
| 2145 | +#ifndef EGL_NV_stream_flush | |
| 2146 | +#define EGL_NV_stream_flush 1 | |
| 2147 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMFLUSHNVPROC) (EGLDisplay dpy, EGLStreamKHR stream); | |
| 2148 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2149 | +EGLAPI EGLBoolean EGLAPIENTRY eglStreamFlushNV (EGLDisplay dpy, EGLStreamKHR stream); | |
| 2150 | +#endif | |
| 2151 | +#endif /* EGL_NV_stream_flush */ | |
| 2152 | + | |
| 2153 | +#ifndef EGL_NV_stream_frame_limits | |
| 2154 | +#define EGL_NV_stream_frame_limits 1 | |
| 2155 | +#define EGL_PRODUCER_MAX_FRAME_HINT_NV 0x3337 | |
| 2156 | +#define EGL_CONSUMER_MAX_FRAME_HINT_NV 0x3338 | |
| 2157 | +#endif /* EGL_NV_stream_frame_limits */ | |
| 2158 | + | |
| 2159 | +#ifndef EGL_NV_stream_metadata | |
| 2160 | +#define EGL_NV_stream_metadata 1 | |
| 2161 | +#define EGL_MAX_STREAM_METADATA_BLOCKS_NV 0x3250 | |
| 2162 | +#define EGL_MAX_STREAM_METADATA_BLOCK_SIZE_NV 0x3251 | |
| 2163 | +#define EGL_MAX_STREAM_METADATA_TOTAL_SIZE_NV 0x3252 | |
| 2164 | +#define EGL_PRODUCER_METADATA_NV 0x3253 | |
| 2165 | +#define EGL_CONSUMER_METADATA_NV 0x3254 | |
| 2166 | +#define EGL_PENDING_METADATA_NV 0x3328 | |
| 2167 | +#define EGL_METADATA0_SIZE_NV 0x3255 | |
| 2168 | +#define EGL_METADATA1_SIZE_NV 0x3256 | |
| 2169 | +#define EGL_METADATA2_SIZE_NV 0x3257 | |
| 2170 | +#define EGL_METADATA3_SIZE_NV 0x3258 | |
| 2171 | +#define EGL_METADATA0_TYPE_NV 0x3259 | |
| 2172 | +#define EGL_METADATA1_TYPE_NV 0x325A | |
| 2173 | +#define EGL_METADATA2_TYPE_NV 0x325B | |
| 2174 | +#define EGL_METADATA3_TYPE_NV 0x325C | |
| 2175 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBNVPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); | |
| 2176 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data); | |
| 2177 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data); | |
| 2178 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2179 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribNV (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); | |
| 2180 | +EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data); | |
| 2181 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data); | |
| 2182 | +#endif | |
| 2183 | +#endif /* EGL_NV_stream_metadata */ | |
| 2184 | + | |
| 2185 | +#ifndef EGL_NV_stream_origin | |
| 2186 | +#define EGL_NV_stream_origin 1 | |
| 2187 | +#define EGL_STREAM_FRAME_ORIGIN_X_NV 0x3366 | |
| 2188 | +#define EGL_STREAM_FRAME_ORIGIN_Y_NV 0x3367 | |
| 2189 | +#define EGL_STREAM_FRAME_MAJOR_AXIS_NV 0x3368 | |
| 2190 | +#define EGL_CONSUMER_AUTO_ORIENTATION_NV 0x3369 | |
| 2191 | +#define EGL_PRODUCER_AUTO_ORIENTATION_NV 0x336A | |
| 2192 | +#define EGL_LEFT_NV 0x336B | |
| 2193 | +#define EGL_RIGHT_NV 0x336C | |
| 2194 | +#define EGL_TOP_NV 0x336D | |
| 2195 | +#define EGL_BOTTOM_NV 0x336E | |
| 2196 | +#define EGL_X_AXIS_NV 0x336F | |
| 2197 | +#define EGL_Y_AXIS_NV 0x3370 | |
| 2198 | +#endif /* EGL_NV_stream_origin */ | |
| 2199 | + | |
| 2200 | +#ifndef EGL_NV_stream_remote | |
| 2201 | +#define EGL_NV_stream_remote 1 | |
| 2202 | +#define EGL_STREAM_STATE_INITIALIZING_NV 0x3240 | |
| 2203 | +#define EGL_STREAM_TYPE_NV 0x3241 | |
| 2204 | +#define EGL_STREAM_PROTOCOL_NV 0x3242 | |
| 2205 | +#define EGL_STREAM_ENDPOINT_NV 0x3243 | |
| 2206 | +#define EGL_STREAM_LOCAL_NV 0x3244 | |
| 2207 | +#define EGL_STREAM_PRODUCER_NV 0x3247 | |
| 2208 | +#define EGL_STREAM_CONSUMER_NV 0x3248 | |
| 2209 | +#define EGL_STREAM_PROTOCOL_FD_NV 0x3246 | |
| 2210 | +#endif /* EGL_NV_stream_remote */ | |
| 2211 | + | |
| 2212 | +#ifndef EGL_NV_stream_reset | |
| 2213 | +#define EGL_NV_stream_reset 1 | |
| 2214 | +#define EGL_SUPPORT_RESET_NV 0x3334 | |
| 2215 | +#define EGL_SUPPORT_REUSE_NV 0x3335 | |
| 2216 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR stream); | |
| 2217 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2218 | +EGLAPI EGLBoolean EGLAPIENTRY eglResetStreamNV (EGLDisplay dpy, EGLStreamKHR stream); | |
| 2219 | +#endif | |
| 2220 | +#endif /* EGL_NV_stream_reset */ | |
| 2221 | + | |
| 2222 | +#ifndef EGL_NV_stream_socket | |
| 2223 | +#define EGL_NV_stream_socket 1 | |
| 2224 | +#define EGL_STREAM_PROTOCOL_SOCKET_NV 0x324B | |
| 2225 | +#define EGL_SOCKET_HANDLE_NV 0x324C | |
| 2226 | +#define EGL_SOCKET_TYPE_NV 0x324D | |
| 2227 | +#endif /* EGL_NV_stream_socket */ | |
| 2228 | + | |
| 2229 | +#ifndef EGL_NV_stream_socket_inet | |
| 2230 | +#define EGL_NV_stream_socket_inet 1 | |
| 2231 | +#define EGL_SOCKET_TYPE_INET_NV 0x324F | |
| 2232 | +#endif /* EGL_NV_stream_socket_inet */ | |
| 2233 | + | |
| 2234 | +#ifndef EGL_NV_stream_socket_unix | |
| 2235 | +#define EGL_NV_stream_socket_unix 1 | |
| 2236 | +#define EGL_SOCKET_TYPE_UNIX_NV 0x324E | |
| 2237 | +#endif /* EGL_NV_stream_socket_unix */ | |
| 2238 | + | |
| 2239 | +#ifndef EGL_NV_stream_sync | |
| 2240 | +#define EGL_NV_stream_sync 1 | |
| 2241 | +#define EGL_SYNC_NEW_FRAME_NV 0x321F | |
| 2242 | +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); | |
| 2243 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2244 | +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); | |
| 2245 | +#endif | |
| 2246 | +#endif /* EGL_NV_stream_sync */ | |
| 2247 | + | |
| 2248 | +#ifndef EGL_NV_sync | |
| 2249 | +#define EGL_NV_sync 1 | |
| 2250 | +typedef void *EGLSyncNV; | |
| 2251 | +typedef khronos_utime_nanoseconds_t EGLTimeNV; | |
| 2252 | +#ifdef KHRONOS_SUPPORT_INT64 | |
| 2253 | +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 | |
| 2254 | +#define EGL_SYNC_STATUS_NV 0x30E7 | |
| 2255 | +#define EGL_SIGNALED_NV 0x30E8 | |
| 2256 | +#define EGL_UNSIGNALED_NV 0x30E9 | |
| 2257 | +#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 | |
| 2258 | +#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull | |
| 2259 | +#define EGL_ALREADY_SIGNALED_NV 0x30EA | |
| 2260 | +#define EGL_TIMEOUT_EXPIRED_NV 0x30EB | |
| 2261 | +#define EGL_CONDITION_SATISFIED_NV 0x30EC | |
| 2262 | +#define EGL_SYNC_TYPE_NV 0x30ED | |
| 2263 | +#define EGL_SYNC_CONDITION_NV 0x30EE | |
| 2264 | +#define EGL_SYNC_FENCE_NV 0x30EF | |
| 2265 | +#define EGL_NO_SYNC_NV EGL_CAST(EGLSyncNV,0) | |
| 2266 | +typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); | |
| 2267 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); | |
| 2268 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); | |
| 2269 | +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); | |
| 2270 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); | |
| 2271 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); | |
| 2272 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2273 | +EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); | |
| 2274 | +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync); | |
| 2275 | +EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync); | |
| 2276 | +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); | |
| 2277 | +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); | |
| 2278 | +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); | |
| 2279 | +#endif | |
| 2280 | +#endif /* KHRONOS_SUPPORT_INT64 */ | |
| 2281 | +#endif /* EGL_NV_sync */ | |
| 2282 | + | |
| 2283 | +#ifndef EGL_NV_system_time | |
| 2284 | +#define EGL_NV_system_time 1 | |
| 2285 | +typedef khronos_utime_nanoseconds_t EGLuint64NV; | |
| 2286 | +#ifdef KHRONOS_SUPPORT_INT64 | |
| 2287 | +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); | |
| 2288 | +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); | |
| 2289 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2290 | +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void); | |
| 2291 | +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); | |
| 2292 | +#endif | |
| 2293 | +#endif /* KHRONOS_SUPPORT_INT64 */ | |
| 2294 | +#endif /* EGL_NV_system_time */ | |
| 2295 | + | |
| 2296 | +#ifndef EGL_NV_triple_buffer | |
| 2297 | +#define EGL_NV_triple_buffer 1 | |
| 2298 | +#define EGL_TRIPLE_BUFFER_NV 0x3230 | |
| 2299 | +#endif /* EGL_NV_triple_buffer */ | |
| 2300 | + | |
| 2301 | +#ifndef EGL_TIZEN_image_native_buffer | |
| 2302 | +#define EGL_TIZEN_image_native_buffer 1 | |
| 2303 | +#define EGL_NATIVE_BUFFER_TIZEN 0x32A0 | |
| 2304 | +#endif /* EGL_TIZEN_image_native_buffer */ | |
| 2305 | + | |
| 2306 | +#ifndef EGL_TIZEN_image_native_surface | |
| 2307 | +#define EGL_TIZEN_image_native_surface 1 | |
| 2308 | +#define EGL_NATIVE_SURFACE_TIZEN 0x32A1 | |
| 2309 | +#endif /* EGL_TIZEN_image_native_surface */ | |
| 2310 | + | |
| 2311 | +#ifndef EGL_WL_bind_wayland_display | |
| 2312 | +#define EGL_WL_bind_wayland_display 1 | |
| 2313 | +#define PFNEGLBINDWAYLANDDISPLAYWL PFNEGLBINDWAYLANDDISPLAYWLPROC | |
| 2314 | +#define PFNEGLUNBINDWAYLANDDISPLAYWL PFNEGLUNBINDWAYLANDDISPLAYWLPROC | |
| 2315 | +#define PFNEGLQUERYWAYLANDBUFFERWL PFNEGLQUERYWAYLANDBUFFERWLPROC | |
| 2316 | +struct wl_display; | |
| 2317 | +struct wl_resource; | |
| 2318 | +#define EGL_WAYLAND_BUFFER_WL 0x31D5 | |
| 2319 | +#define EGL_WAYLAND_PLANE_WL 0x31D6 | |
| 2320 | +#define EGL_TEXTURE_Y_U_V_WL 0x31D7 | |
| 2321 | +#define EGL_TEXTURE_Y_UV_WL 0x31D8 | |
| 2322 | +#define EGL_TEXTURE_Y_XUXV_WL 0x31D9 | |
| 2323 | +#define EGL_TEXTURE_EXTERNAL_WL 0x31DA | |
| 2324 | +#define EGL_WAYLAND_Y_INVERTED_WL 0x31DB | |
| 2325 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWLPROC) (EGLDisplay dpy, struct wl_display *display); | |
| 2326 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWLPROC) (EGLDisplay dpy, struct wl_display *display); | |
| 2327 | +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWLPROC) (EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value); | |
| 2328 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2329 | +EGLAPI EGLBoolean EGLAPIENTRY eglBindWaylandDisplayWL (EGLDisplay dpy, struct wl_display *display); | |
| 2330 | +EGLAPI EGLBoolean EGLAPIENTRY eglUnbindWaylandDisplayWL (EGLDisplay dpy, struct wl_display *display); | |
| 2331 | +EGLAPI EGLBoolean EGLAPIENTRY eglQueryWaylandBufferWL (EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value); | |
| 2332 | +#endif | |
| 2333 | +#endif /* EGL_WL_bind_wayland_display */ | |
| 2334 | + | |
| 2335 | +#ifndef EGL_WL_create_wayland_buffer_from_image | |
| 2336 | +#define EGL_WL_create_wayland_buffer_from_image 1 | |
| 2337 | +#define PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC | |
| 2338 | +struct wl_buffer; | |
| 2339 | +typedef struct wl_buffer *(EGLAPIENTRYP PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC) (EGLDisplay dpy, EGLImageKHR image); | |
| 2340 | +#ifdef EGL_EGLEXT_PROTOTYPES | |
| 2341 | +EGLAPI struct wl_buffer *EGLAPIENTRY eglCreateWaylandBufferFromImageWL (EGLDisplay dpy, EGLImageKHR image); | |
| 2342 | +#endif | |
| 2343 | +#endif /* EGL_WL_create_wayland_buffer_from_image */ | |
| 2344 | + | |
| 2345 | +#ifdef __cplusplus | |
| 2346 | +} | |
| 2347 | +#endif | |
| 2348 | + | |
| 2349 | +#endif /* __eglext_h_ */ | |
| 2350 | + | |
| 2351 | +#endif /* _MSC_VER */ |
| @@ -0,0 +1,396 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryEndian | |
| 24 | + * | |
| 25 | + * Functions for reading and writing endian-specific values | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_endian_h_ | |
| 29 | +#define SDL_endian_h_ | |
| 30 | + | |
| 31 | +#include "SDL_stdinc.h" | |
| 32 | + | |
| 33 | +#if defined(_MSC_VER) && (_MSC_VER >= 1400) | |
| 34 | +/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version, | |
| 35 | + so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */ | |
| 36 | +#ifdef __clang__ | |
| 37 | +#ifndef __PRFCHWINTRIN_H | |
| 38 | +#define __PRFCHWINTRIN_H | |
| 39 | +static __inline__ void __attribute__((__always_inline__, __nodebug__)) | |
| 40 | +_m_prefetch(void *__P) | |
| 41 | +{ | |
| 42 | + __builtin_prefetch(__P, 0, 3 /* _MM_HINT_T0 */); | |
| 43 | +} | |
| 44 | +#endif /* __PRFCHWINTRIN_H */ | |
| 45 | +#endif /* __clang__ */ | |
| 46 | + | |
| 47 | +#include <intrin.h> | |
| 48 | +#endif | |
| 49 | + | |
| 50 | +/** | |
| 51 | + * \name The two types of endianness | |
| 52 | + */ | |
| 53 | +/* @{ */ | |
| 54 | +#define SDL_LIL_ENDIAN 1234 | |
| 55 | +#define SDL_BIG_ENDIAN 4321 | |
| 56 | +/* @} */ | |
| 57 | + | |
| 58 | +#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ | |
| 59 | +#ifdef __linux__ | |
| 60 | +#include <endian.h> | |
| 61 | +#define SDL_BYTEORDER __BYTE_ORDER | |
| 62 | +#elif defined(__sun) && defined(__SVR4) /* Solaris */ | |
| 63 | +#include <sys/byteorder.h> | |
| 64 | +#if defined(_LITTLE_ENDIAN) | |
| 65 | +#define SDL_BYTEORDER SDL_LIL_ENDIAN | |
| 66 | +#elif defined(_BIG_ENDIAN) | |
| 67 | +#define SDL_BYTEORDER SDL_BIG_ENDIAN | |
| 68 | +#else | |
| 69 | +#error Unsupported endianness | |
| 70 | +#endif | |
| 71 | +#elif defined(__OpenBSD__) || defined(__DragonFly__) | |
| 72 | +#include <endian.h> | |
| 73 | +#define SDL_BYTEORDER BYTE_ORDER | |
| 74 | +#elif defined(__FreeBSD__) || defined(__NetBSD__) | |
| 75 | +#include <sys/endian.h> | |
| 76 | +#define SDL_BYTEORDER BYTE_ORDER | |
| 77 | +/* predefs from newer gcc and clang versions: */ | |
| 78 | +#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__) | |
| 79 | +#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) | |
| 80 | +#define SDL_BYTEORDER SDL_LIL_ENDIAN | |
| 81 | +#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) | |
| 82 | +#define SDL_BYTEORDER SDL_BIG_ENDIAN | |
| 83 | +#else | |
| 84 | +#error Unsupported endianness | |
| 85 | +#endif /**/ | |
| 86 | +#else | |
| 87 | +#if defined(__hppa__) || \ | |
| 88 | + defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ | |
| 89 | + (defined(__MIPS__) && defined(__MIPSEB__)) || \ | |
| 90 | + defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \ | |
| 91 | + defined(__sparc__) || defined(__sparc) | |
| 92 | +#define SDL_BYTEORDER SDL_BIG_ENDIAN | |
| 93 | +#else | |
| 94 | +#define SDL_BYTEORDER SDL_LIL_ENDIAN | |
| 95 | +#endif | |
| 96 | +#endif /* __linux__ */ | |
| 97 | +#endif /* !SDL_BYTEORDER */ | |
| 98 | + | |
| 99 | +#ifndef SDL_FLOATWORDORDER /* Not defined in SDL_config.h? */ | |
| 100 | +/* predefs from newer gcc versions: */ | |
| 101 | +#if defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__FLOAT_WORD_ORDER__) | |
| 102 | +#if (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__) | |
| 103 | +#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN | |
| 104 | +#elif (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__) | |
| 105 | +#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN | |
| 106 | +#else | |
| 107 | +#error Unsupported endianness | |
| 108 | +#endif /**/ | |
| 109 | +#elif defined(__MAVERICK__) | |
| 110 | +/* For Maverick, float words are always little-endian. */ | |
| 111 | +#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN | |
| 112 | +#elif (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__) && !defined(__ARM_EABI__) | |
| 113 | +/* For FPA, float words are always big-endian. */ | |
| 114 | +#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN | |
| 115 | +#else | |
| 116 | +/* By default, assume that floats words follow the memory system mode. */ | |
| 117 | +#define SDL_FLOATWORDORDER SDL_BYTEORDER | |
| 118 | +#endif /* __FLOAT_WORD_ORDER__ */ | |
| 119 | +#endif /* !SDL_FLOATWORDORDER */ | |
| 120 | + | |
| 121 | + | |
| 122 | +#include "begin_code.h" | |
| 123 | +/* Set up for C function definitions, even when using C++ */ | |
| 124 | +#ifdef __cplusplus | |
| 125 | +extern "C" { | |
| 126 | +#endif | |
| 127 | + | |
| 128 | +/** | |
| 129 | + * \file SDL_endian.h | |
| 130 | + */ | |
| 131 | + | |
| 132 | +/* various modern compilers may have builtin swap */ | |
| 133 | +#if defined(__GNUC__) || defined(__clang__) | |
| 134 | +# define HAS_BUILTIN_BSWAP16 (_SDL_HAS_BUILTIN(__builtin_bswap16)) || \ | |
| 135 | + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) | |
| 136 | +# define HAS_BUILTIN_BSWAP32 (_SDL_HAS_BUILTIN(__builtin_bswap32)) || \ | |
| 137 | + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) | |
| 138 | +# define HAS_BUILTIN_BSWAP64 (_SDL_HAS_BUILTIN(__builtin_bswap64)) || \ | |
| 139 | + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) | |
| 140 | + | |
| 141 | + /* this one is broken */ | |
| 142 | +# define HAS_BROKEN_BSWAP (__GNUC__ == 2 && __GNUC_MINOR__ <= 95) | |
| 143 | +#else | |
| 144 | +# define HAS_BUILTIN_BSWAP16 0 | |
| 145 | +# define HAS_BUILTIN_BSWAP32 0 | |
| 146 | +# define HAS_BUILTIN_BSWAP64 0 | |
| 147 | +# define HAS_BROKEN_BSWAP 0 | |
| 148 | +#endif | |
| 149 | + | |
| 150 | +#if HAS_BUILTIN_BSWAP16 | |
| 151 | +#define SDL_Swap16(x) __builtin_bswap16(x) | |
| 152 | +#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL) | |
| 153 | +#pragma intrinsic(_byteswap_ushort) | |
| 154 | +#define SDL_Swap16(x) _byteswap_ushort(x) | |
| 155 | +#elif defined(__i386__) && !HAS_BROKEN_BSWAP | |
| 156 | +SDL_FORCE_INLINE Uint16 | |
| 157 | +SDL_Swap16(Uint16 x) | |
| 158 | +{ | |
| 159 | + __asm__("xchgb %b0,%h0": "=q"(x):"0"(x)); | |
| 160 | + return x; | |
| 161 | +} | |
| 162 | +#elif defined(__x86_64__) | |
| 163 | +SDL_FORCE_INLINE Uint16 | |
| 164 | +SDL_Swap16(Uint16 x) | |
| 165 | +{ | |
| 166 | + __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x)); | |
| 167 | + return x; | |
| 168 | +} | |
| 169 | +#elif (defined(__powerpc__) || defined(__ppc__)) | |
| 170 | +SDL_FORCE_INLINE Uint16 | |
| 171 | +SDL_Swap16(Uint16 x) | |
| 172 | +{ | |
| 173 | + int result; | |
| 174 | + | |
| 175 | + __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x)); | |
| 176 | + return (Uint16)result; | |
| 177 | +} | |
| 178 | +#elif (defined(__m68k__) && !defined(__mcoldfire__)) | |
| 179 | +SDL_FORCE_INLINE Uint16 | |
| 180 | +SDL_Swap16(Uint16 x) | |
| 181 | +{ | |
| 182 | + __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); | |
| 183 | + return x; | |
| 184 | +} | |
| 185 | +#elif defined(__WATCOMC__) && defined(__386__) | |
| 186 | +extern __inline Uint16 SDL_Swap16(Uint16); | |
| 187 | +#pragma aux SDL_Swap16 = \ | |
| 188 | + "xchg al, ah" \ | |
| 189 | + parm [ax] \ | |
| 190 | + modify [ax]; | |
| 191 | +#else | |
| 192 | + | |
| 193 | +/** | |
| 194 | + * Use this function to swap the byte order of a 16-bit value. | |
| 195 | + * | |
| 196 | + * \param x the value to be swapped. | |
| 197 | + * \returns the swapped value. | |
| 198 | + * | |
| 199 | + * \sa SDL_SwapBE16 | |
| 200 | + * \sa SDL_SwapLE16 | |
| 201 | + */ | |
| 202 | +SDL_FORCE_INLINE Uint16 | |
| 203 | +SDL_Swap16(Uint16 x) | |
| 204 | +{ | |
| 205 | + return SDL_static_cast(Uint16, ((x << 8) | (x >> 8))); | |
| 206 | +} | |
| 207 | +#endif | |
| 208 | + | |
| 209 | +#if HAS_BUILTIN_BSWAP32 | |
| 210 | +#define SDL_Swap32(x) __builtin_bswap32(x) | |
| 211 | +#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL) | |
| 212 | +#pragma intrinsic(_byteswap_ulong) | |
| 213 | +#define SDL_Swap32(x) _byteswap_ulong(x) | |
| 214 | +#elif defined(__i386__) && !HAS_BROKEN_BSWAP | |
| 215 | +SDL_FORCE_INLINE Uint32 | |
| 216 | +SDL_Swap32(Uint32 x) | |
| 217 | +{ | |
| 218 | + __asm__("bswap %0": "=r"(x):"0"(x)); | |
| 219 | + return x; | |
| 220 | +} | |
| 221 | +#elif defined(__x86_64__) | |
| 222 | +SDL_FORCE_INLINE Uint32 | |
| 223 | +SDL_Swap32(Uint32 x) | |
| 224 | +{ | |
| 225 | + __asm__("bswapl %0": "=r"(x):"0"(x)); | |
| 226 | + return x; | |
| 227 | +} | |
| 228 | +#elif (defined(__powerpc__) || defined(__ppc__)) | |
| 229 | +SDL_FORCE_INLINE Uint32 | |
| 230 | +SDL_Swap32(Uint32 x) | |
| 231 | +{ | |
| 232 | + Uint32 result; | |
| 233 | + | |
| 234 | + __asm__("rlwimi %0,%2,24,16,23": "=&r"(result): "0" (x>>24), "r"(x)); | |
| 235 | + __asm__("rlwimi %0,%2,8,8,15" : "=&r"(result): "0" (result), "r"(x)); | |
| 236 | + __asm__("rlwimi %0,%2,24,0,7" : "=&r"(result): "0" (result), "r"(x)); | |
| 237 | + return result; | |
| 238 | +} | |
| 239 | +#elif (defined(__m68k__) && !defined(__mcoldfire__)) | |
| 240 | +SDL_FORCE_INLINE Uint32 | |
| 241 | +SDL_Swap32(Uint32 x) | |
| 242 | +{ | |
| 243 | + __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); | |
| 244 | + return x; | |
| 245 | +} | |
| 246 | +#elif defined(__WATCOMC__) && defined(__386__) | |
| 247 | +extern __inline Uint32 SDL_Swap32(Uint32); | |
| 248 | +#pragma aux SDL_Swap32 = \ | |
| 249 | + "bswap eax" \ | |
| 250 | + parm [eax] \ | |
| 251 | + modify [eax]; | |
| 252 | +#else | |
| 253 | + | |
| 254 | +/** | |
| 255 | + * Use this function to swap the byte order of a 32-bit value. | |
| 256 | + * | |
| 257 | + * \param x the value to be swapped. | |
| 258 | + * \returns the swapped value. | |
| 259 | + * | |
| 260 | + * \sa SDL_SwapBE32 | |
| 261 | + * \sa SDL_SwapLE32 | |
| 262 | + */ | |
| 263 | +SDL_FORCE_INLINE Uint32 | |
| 264 | +SDL_Swap32(Uint32 x) | |
| 265 | +{ | |
| 266 | + return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) | | |
| 267 | + ((x >> 8) & 0x0000FF00) | (x >> 24))); | |
| 268 | +} | |
| 269 | +#endif | |
| 270 | + | |
| 271 | +#if HAS_BUILTIN_BSWAP64 | |
| 272 | +#define SDL_Swap64(x) __builtin_bswap64(x) | |
| 273 | +#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL) | |
| 274 | +#pragma intrinsic(_byteswap_uint64) | |
| 275 | +#define SDL_Swap64(x) _byteswap_uint64(x) | |
| 276 | +#elif defined(__i386__) && !HAS_BROKEN_BSWAP | |
| 277 | +SDL_FORCE_INLINE Uint64 | |
| 278 | +SDL_Swap64(Uint64 x) | |
| 279 | +{ | |
| 280 | + union { | |
| 281 | + struct { | |
| 282 | + Uint32 a, b; | |
| 283 | + } s; | |
| 284 | + Uint64 u; | |
| 285 | + } v; | |
| 286 | + v.u = x; | |
| 287 | + __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1" | |
| 288 | + : "=r"(v.s.a), "=r"(v.s.b) | |
| 289 | + : "0" (v.s.a), "1"(v.s.b)); | |
| 290 | + return v.u; | |
| 291 | +} | |
| 292 | +#elif defined(__x86_64__) | |
| 293 | +SDL_FORCE_INLINE Uint64 | |
| 294 | +SDL_Swap64(Uint64 x) | |
| 295 | +{ | |
| 296 | + __asm__("bswapq %0": "=r"(x):"0"(x)); | |
| 297 | + return x; | |
| 298 | +} | |
| 299 | +#elif defined(__WATCOMC__) && defined(__386__) | |
| 300 | +extern __inline Uint64 SDL_Swap64(Uint64); | |
| 301 | +#pragma aux SDL_Swap64 = \ | |
| 302 | + "bswap eax" \ | |
| 303 | + "bswap edx" \ | |
| 304 | + "xchg eax,edx" \ | |
| 305 | + parm [eax edx] \ | |
| 306 | + modify [eax edx]; | |
| 307 | +#else | |
| 308 | + | |
| 309 | +/** | |
| 310 | + * Use this function to swap the byte order of a 64-bit value. | |
| 311 | + * | |
| 312 | + * \param x the value to be swapped. | |
| 313 | + * \returns the swapped value. | |
| 314 | + * | |
| 315 | + * \sa SDL_SwapBE64 | |
| 316 | + * \sa SDL_SwapLE64 | |
| 317 | + */ | |
| 318 | +SDL_FORCE_INLINE Uint64 | |
| 319 | +SDL_Swap64(Uint64 x) | |
| 320 | +{ | |
| 321 | + Uint32 hi, lo; | |
| 322 | + | |
| 323 | + /* Separate into high and low 32-bit values and swap them */ | |
| 324 | + lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF); | |
| 325 | + x >>= 32; | |
| 326 | + hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF); | |
| 327 | + x = SDL_Swap32(lo); | |
| 328 | + x <<= 32; | |
| 329 | + x |= SDL_Swap32(hi); | |
| 330 | + return (x); | |
| 331 | +} | |
| 332 | +#endif | |
| 333 | + | |
| 334 | + | |
| 335 | +/** | |
| 336 | + * Use this function to swap the byte order of a floating point value. | |
| 337 | + * | |
| 338 | + * \param x the value to be swapped. | |
| 339 | + * \returns the swapped value. | |
| 340 | + * | |
| 341 | + * \sa SDL_SwapFloatBE | |
| 342 | + * \sa SDL_SwapFloatLE | |
| 343 | + */ | |
| 344 | +SDL_FORCE_INLINE float | |
| 345 | +SDL_SwapFloat(float x) | |
| 346 | +{ | |
| 347 | + union { | |
| 348 | + float f; | |
| 349 | + Uint32 ui32; | |
| 350 | + } swapper; | |
| 351 | + swapper.f = x; | |
| 352 | + swapper.ui32 = SDL_Swap32(swapper.ui32); | |
| 353 | + return swapper.f; | |
| 354 | +} | |
| 355 | + | |
| 356 | +/* remove extra macros */ | |
| 357 | +#undef HAS_BROKEN_BSWAP | |
| 358 | +#undef HAS_BUILTIN_BSWAP16 | |
| 359 | +#undef HAS_BUILTIN_BSWAP32 | |
| 360 | +#undef HAS_BUILTIN_BSWAP64 | |
| 361 | + | |
| 362 | +/** | |
| 363 | + * \name Swap to native | |
| 364 | + * Byteswap item from the specified endianness to the native endianness. | |
| 365 | + */ | |
| 366 | +/* @{ */ | |
| 367 | +#if SDL_BYTEORDER == SDL_LIL_ENDIAN | |
| 368 | +#define SDL_SwapLE16(X) (X) | |
| 369 | +#define SDL_SwapLE32(X) (X) | |
| 370 | +#define SDL_SwapLE64(X) (X) | |
| 371 | +#define SDL_SwapFloatLE(X) (X) | |
| 372 | +#define SDL_SwapBE16(X) SDL_Swap16(X) | |
| 373 | +#define SDL_SwapBE32(X) SDL_Swap32(X) | |
| 374 | +#define SDL_SwapBE64(X) SDL_Swap64(X) | |
| 375 | +#define SDL_SwapFloatBE(X) SDL_SwapFloat(X) | |
| 376 | +#else | |
| 377 | +#define SDL_SwapLE16(X) SDL_Swap16(X) | |
| 378 | +#define SDL_SwapLE32(X) SDL_Swap32(X) | |
| 379 | +#define SDL_SwapLE64(X) SDL_Swap64(X) | |
| 380 | +#define SDL_SwapFloatLE(X) SDL_SwapFloat(X) | |
| 381 | +#define SDL_SwapBE16(X) (X) | |
| 382 | +#define SDL_SwapBE32(X) (X) | |
| 383 | +#define SDL_SwapBE64(X) (X) | |
| 384 | +#define SDL_SwapFloatBE(X) (X) | |
| 385 | +#endif | |
| 386 | +/* @} *//* Swap to native */ | |
| 387 | + | |
| 388 | +/* Ends C function definitions when using C++ */ | |
| 389 | +#ifdef __cplusplus | |
| 390 | +} | |
| 391 | +#endif | |
| 392 | +#include "close_code.h" | |
| 393 | + | |
| 394 | +#endif /* SDL_endian_h_ */ | |
| 395 | + | |
| 396 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,163 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryError | |
| 24 | + * | |
| 25 | + * Simple error message routines for SDL. | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_error_h_ | |
| 29 | +#define SDL_error_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 | +/* Public functions */ | |
| 40 | + | |
| 41 | + | |
| 42 | +/** | |
| 43 | + * Set the SDL error message for the current thread. | |
| 44 | + * | |
| 45 | + * Calling this function will replace any previous error message that was set. | |
| 46 | + * | |
| 47 | + * This function always returns -1, since SDL frequently uses -1 to signify an | |
| 48 | + * failing result, leading to this idiom: | |
| 49 | + * | |
| 50 | + * ```c | |
| 51 | + * if (error_code) { | |
| 52 | + * return SDL_SetError("This operation has failed: %d", error_code); | |
| 53 | + * } | |
| 54 | + * ``` | |
| 55 | + * | |
| 56 | + * \param fmt a printf()-style message format string. | |
| 57 | + * \param ... additional parameters matching % tokens in the `fmt` string, if | |
| 58 | + * any. | |
| 59 | + * \returns always -1. | |
| 60 | + * | |
| 61 | + * \since This function is available since SDL 2.0.0. | |
| 62 | + * | |
| 63 | + * \sa SDL_ClearError | |
| 64 | + * \sa SDL_GetError | |
| 65 | + */ | |
| 66 | +extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); | |
| 67 | + | |
| 68 | +/** | |
| 69 | + * Retrieve a message about the last error that occurred on the current | |
| 70 | + * thread. | |
| 71 | + * | |
| 72 | + * It is possible for multiple errors to occur before calling SDL_GetError(). | |
| 73 | + * Only the last error is returned. | |
| 74 | + * | |
| 75 | + * The message is only applicable when an SDL function has signaled an error. | |
| 76 | + * You must check the return values of SDL function calls to determine when to | |
| 77 | + * appropriately call SDL_GetError(). You should *not* use the results of | |
| 78 | + * SDL_GetError() to decide if an error has occurred! Sometimes SDL will set | |
| 79 | + * an error string even when reporting success. | |
| 80 | + * | |
| 81 | + * SDL will *not* clear the error string for successful API calls. You *must* | |
| 82 | + * check return values for failure cases before you can assume the error | |
| 83 | + * string applies. | |
| 84 | + * | |
| 85 | + * Error strings are set per-thread, so an error set in a different thread | |
| 86 | + * will not interfere with the current thread's operation. | |
| 87 | + * | |
| 88 | + * The returned string is internally allocated and must not be freed by the | |
| 89 | + * application. | |
| 90 | + * | |
| 91 | + * \returns a message with information about the specific error that occurred, | |
| 92 | + * or an empty string if there hasn't been an error message set since | |
| 93 | + * the last call to SDL_ClearError(). The message is only applicable | |
| 94 | + * when an SDL function has signaled an error. You must check the | |
| 95 | + * return values of SDL function calls to determine when to | |
| 96 | + * appropriately call SDL_GetError(). | |
| 97 | + * | |
| 98 | + * \since This function is available since SDL 2.0.0. | |
| 99 | + * | |
| 100 | + * \sa SDL_ClearError | |
| 101 | + * \sa SDL_SetError | |
| 102 | + */ | |
| 103 | +extern DECLSPEC const char *SDLCALL SDL_GetError(void); | |
| 104 | + | |
| 105 | +/** | |
| 106 | + * Get the last error message that was set for the current thread. | |
| 107 | + * | |
| 108 | + * This allows the caller to copy the error string into a provided buffer, but | |
| 109 | + * otherwise operates exactly the same as SDL_GetError(). | |
| 110 | + * | |
| 111 | + * \param errstr A buffer to fill with the last error message that was set for | |
| 112 | + * the current thread. | |
| 113 | + * \param maxlen The size of the buffer pointed to by the errstr parameter. | |
| 114 | + * \returns the pointer passed in as the `errstr` parameter. | |
| 115 | + * | |
| 116 | + * \since This function is available since SDL 2.0.14. | |
| 117 | + * | |
| 118 | + * \sa SDL_GetError | |
| 119 | + */ | |
| 120 | +extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen); | |
| 121 | + | |
| 122 | +/** | |
| 123 | + * Clear any previous error message for this thread. | |
| 124 | + * | |
| 125 | + * \since This function is available since SDL 2.0.0. | |
| 126 | + * | |
| 127 | + * \sa SDL_GetError | |
| 128 | + * \sa SDL_SetError | |
| 129 | + */ | |
| 130 | +extern DECLSPEC void SDLCALL SDL_ClearError(void); | |
| 131 | + | |
| 132 | +/** | |
| 133 | + * \name Internal error functions | |
| 134 | + * | |
| 135 | + * \internal | |
| 136 | + * Private error reporting function - used internally. | |
| 137 | + */ | |
| 138 | +/* @{ */ | |
| 139 | +#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) | |
| 140 | +#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) | |
| 141 | +#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) | |
| 142 | +typedef enum | |
| 143 | +{ | |
| 144 | + SDL_ENOMEM, | |
| 145 | + SDL_EFREAD, | |
| 146 | + SDL_EFWRITE, | |
| 147 | + SDL_EFSEEK, | |
| 148 | + SDL_UNSUPPORTED, | |
| 149 | + SDL_LASTERROR | |
| 150 | +} SDL_errorcode; | |
| 151 | +/* SDL_Error() unconditionally returns -1. */ | |
| 152 | +extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); | |
| 153 | +/* @} *//* Internal error functions */ | |
| 154 | + | |
| 155 | +/* Ends C function definitions when using C++ */ | |
| 156 | +#ifdef __cplusplus | |
| 157 | +} | |
| 158 | +#endif | |
| 159 | +#include "close_code.h" | |
| 160 | + | |
| 161 | +#endif /* SDL_error_h_ */ | |
| 162 | + | |
| 163 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,1196 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryEvents | |
| 24 | + * | |
| 25 | + * Include file for SDL event handling. | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_events_h_ | |
| 29 | +#define SDL_events_h_ | |
| 30 | + | |
| 31 | +#include "SDL_stdinc.h" | |
| 32 | +#include "SDL_error.h" | |
| 33 | +#include "SDL_video.h" | |
| 34 | +#include "SDL_keyboard.h" | |
| 35 | +#include "SDL_mouse.h" | |
| 36 | +#include "SDL_joystick.h" | |
| 37 | +#include "SDL_gamecontroller.h" | |
| 38 | +#include "SDL_quit.h" | |
| 39 | +#include "SDL_gesture.h" | |
| 40 | +#include "SDL_touch.h" | |
| 41 | + | |
| 42 | +#include "begin_code.h" | |
| 43 | +/* Set up for C function definitions, even when using C++ */ | |
| 44 | +#ifdef __cplusplus | |
| 45 | +extern "C" { | |
| 46 | +#endif | |
| 47 | + | |
| 48 | +/* General keyboard/mouse state definitions */ | |
| 49 | +#define SDL_RELEASED 0 | |
| 50 | +#define SDL_PRESSED 1 | |
| 51 | + | |
| 52 | +/** | |
| 53 | + * The types of events that can be delivered. | |
| 54 | + */ | |
| 55 | +typedef enum SDL_EventType | |
| 56 | +{ | |
| 57 | + SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */ | |
| 58 | + | |
| 59 | + /* Application events */ | |
| 60 | + SDL_QUIT = 0x100, /**< User-requested quit */ | |
| 61 | + | |
| 62 | + /* These application events have special meaning on iOS, see README-ios.md for details */ | |
| 63 | + SDL_APP_TERMINATING, /**< The application is being terminated by the OS | |
| 64 | + Called on iOS in applicationWillTerminate() | |
| 65 | + Called on Android in onDestroy() | |
| 66 | + */ | |
| 67 | + SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible. | |
| 68 | + Called on iOS in applicationDidReceiveMemoryWarning() | |
| 69 | + Called on Android in onLowMemory() | |
| 70 | + */ | |
| 71 | + SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background | |
| 72 | + Called on iOS in applicationWillResignActive() | |
| 73 | + Called on Android in onPause() | |
| 74 | + */ | |
| 75 | + SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time | |
| 76 | + Called on iOS in applicationDidEnterBackground() | |
| 77 | + Called on Android in onPause() | |
| 78 | + */ | |
| 79 | + SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground | |
| 80 | + Called on iOS in applicationWillEnterForeground() | |
| 81 | + Called on Android in onResume() | |
| 82 | + */ | |
| 83 | + SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive | |
| 84 | + Called on iOS in applicationDidBecomeActive() | |
| 85 | + Called on Android in onResume() | |
| 86 | + */ | |
| 87 | + | |
| 88 | + SDL_LOCALECHANGED, /**< The user's locale preferences have changed. */ | |
| 89 | + | |
| 90 | + /* Display events */ | |
| 91 | + SDL_DISPLAYEVENT = 0x150, /**< Display state change */ | |
| 92 | + | |
| 93 | + /* Window events */ | |
| 94 | + SDL_WINDOWEVENT = 0x200, /**< Window state change */ | |
| 95 | + SDL_SYSWMEVENT, /**< System specific event */ | |
| 96 | + | |
| 97 | + /* Keyboard events */ | |
| 98 | + SDL_KEYDOWN = 0x300, /**< Key pressed */ | |
| 99 | + SDL_KEYUP, /**< Key released */ | |
| 100 | + SDL_TEXTEDITING, /**< Keyboard text editing (composition) */ | |
| 101 | + SDL_TEXTINPUT, /**< Keyboard text input */ | |
| 102 | + SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an | |
| 103 | + input language or keyboard layout change. | |
| 104 | + */ | |
| 105 | + SDL_TEXTEDITING_EXT, /**< Extended keyboard text editing (composition) */ | |
| 106 | + | |
| 107 | + /* Mouse events */ | |
| 108 | + SDL_MOUSEMOTION = 0x400, /**< Mouse moved */ | |
| 109 | + SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */ | |
| 110 | + SDL_MOUSEBUTTONUP, /**< Mouse button released */ | |
| 111 | + SDL_MOUSEWHEEL, /**< Mouse wheel motion */ | |
| 112 | + | |
| 113 | + /* Joystick events */ | |
| 114 | + SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */ | |
| 115 | + SDL_JOYBALLMOTION, /**< Joystick trackball motion */ | |
| 116 | + SDL_JOYHATMOTION, /**< Joystick hat position change */ | |
| 117 | + SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ | |
| 118 | + SDL_JOYBUTTONUP, /**< Joystick button released */ | |
| 119 | + SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */ | |
| 120 | + SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */ | |
| 121 | + SDL_JOYBATTERYUPDATED, /**< Joystick battery level change */ | |
| 122 | + | |
| 123 | + /* Game controller events */ | |
| 124 | + SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */ | |
| 125 | + SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */ | |
| 126 | + SDL_CONTROLLERBUTTONUP, /**< Game controller button released */ | |
| 127 | + SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */ | |
| 128 | + SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */ | |
| 129 | + SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */ | |
| 130 | + SDL_CONTROLLERTOUCHPADDOWN, /**< Game controller touchpad was touched */ | |
| 131 | + SDL_CONTROLLERTOUCHPADMOTION, /**< Game controller touchpad finger was moved */ | |
| 132 | + SDL_CONTROLLERTOUCHPADUP, /**< Game controller touchpad finger was lifted */ | |
| 133 | + SDL_CONTROLLERSENSORUPDATE, /**< Game controller sensor was updated */ | |
| 134 | + SDL_CONTROLLERUPDATECOMPLETE_RESERVED_FOR_SDL3, | |
| 135 | + SDL_CONTROLLERSTEAMHANDLEUPDATED, /**< Game controller Steam handle has changed */ | |
| 136 | + | |
| 137 | + /* Touch events */ | |
| 138 | + SDL_FINGERDOWN = 0x700, | |
| 139 | + SDL_FINGERUP, | |
| 140 | + SDL_FINGERMOTION, | |
| 141 | + | |
| 142 | + /* Gesture events */ | |
| 143 | + SDL_DOLLARGESTURE = 0x800, | |
| 144 | + SDL_DOLLARRECORD, | |
| 145 | + SDL_MULTIGESTURE, | |
| 146 | + | |
| 147 | + /* Clipboard events */ | |
| 148 | + SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard or primary selection changed */ | |
| 149 | + | |
| 150 | + /* Drag and drop events */ | |
| 151 | + SDL_DROPFILE = 0x1000, /**< The system requests a file open */ | |
| 152 | + SDL_DROPTEXT, /**< text/plain drag-and-drop event */ | |
| 153 | + SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */ | |
| 154 | + SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */ | |
| 155 | + | |
| 156 | + /* Audio hotplug events */ | |
| 157 | + SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ | |
| 158 | + SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ | |
| 159 | + | |
| 160 | + /* Sensor events */ | |
| 161 | + SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */ | |
| 162 | + | |
| 163 | + /* Render events */ | |
| 164 | + SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ | |
| 165 | + SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */ | |
| 166 | + | |
| 167 | + /* Internal events */ | |
| 168 | + SDL_POLLSENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */ | |
| 169 | + | |
| 170 | + /** Events SDL_USEREVENT through SDL_LASTEVENT are for your use, | |
| 171 | + * and should be allocated with SDL_RegisterEvents() | |
| 172 | + */ | |
| 173 | + SDL_USEREVENT = 0x8000, | |
| 174 | + | |
| 175 | + /** | |
| 176 | + * This last event is only for bounding internal arrays | |
| 177 | + */ | |
| 178 | + SDL_LASTEVENT = 0xFFFF | |
| 179 | +} SDL_EventType; | |
| 180 | + | |
| 181 | +/** | |
| 182 | + * Fields shared by every event | |
| 183 | + */ | |
| 184 | +typedef struct SDL_CommonEvent | |
| 185 | +{ | |
| 186 | + Uint32 type; | |
| 187 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 188 | +} SDL_CommonEvent; | |
| 189 | + | |
| 190 | +/** | |
| 191 | + * Display state change event data (event.display.*) | |
| 192 | + */ | |
| 193 | +typedef struct SDL_DisplayEvent | |
| 194 | +{ | |
| 195 | + Uint32 type; /**< SDL_DISPLAYEVENT */ | |
| 196 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 197 | + Uint32 display; /**< The associated display index */ | |
| 198 | + Uint8 event; /**< SDL_DisplayEventID */ | |
| 199 | + Uint8 padding1; | |
| 200 | + Uint8 padding2; | |
| 201 | + Uint8 padding3; | |
| 202 | + Sint32 data1; /**< event dependent data */ | |
| 203 | +} SDL_DisplayEvent; | |
| 204 | + | |
| 205 | +/** | |
| 206 | + * Window state change event data (event.window.*) | |
| 207 | + */ | |
| 208 | +typedef struct SDL_WindowEvent | |
| 209 | +{ | |
| 210 | + Uint32 type; /**< SDL_WINDOWEVENT */ | |
| 211 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 212 | + Uint32 windowID; /**< The associated window */ | |
| 213 | + Uint8 event; /**< SDL_WindowEventID */ | |
| 214 | + Uint8 padding1; | |
| 215 | + Uint8 padding2; | |
| 216 | + Uint8 padding3; | |
| 217 | + Sint32 data1; /**< event dependent data */ | |
| 218 | + Sint32 data2; /**< event dependent data */ | |
| 219 | +} SDL_WindowEvent; | |
| 220 | + | |
| 221 | +/** | |
| 222 | + * Keyboard button event structure (event.key.*) | |
| 223 | + */ | |
| 224 | +typedef struct SDL_KeyboardEvent | |
| 225 | +{ | |
| 226 | + Uint32 type; /**< SDL_KEYDOWN or SDL_KEYUP */ | |
| 227 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 228 | + Uint32 windowID; /**< The window with keyboard focus, if any */ | |
| 229 | + Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ | |
| 230 | + Uint8 repeat; /**< Non-zero if this is a key repeat */ | |
| 231 | + Uint8 padding2; | |
| 232 | + Uint8 padding3; | |
| 233 | + SDL_Keysym keysym; /**< The key that was pressed or released */ | |
| 234 | +} SDL_KeyboardEvent; | |
| 235 | + | |
| 236 | +#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32) | |
| 237 | + | |
| 238 | +/** | |
| 239 | + * Keyboard text editing event structure (event.edit.*) | |
| 240 | + */ | |
| 241 | +typedef struct SDL_TextEditingEvent | |
| 242 | +{ | |
| 243 | + Uint32 type; /**< SDL_TEXTEDITING */ | |
| 244 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 245 | + Uint32 windowID; /**< The window with keyboard focus, if any */ | |
| 246 | + char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ | |
| 247 | + Sint32 start; /**< The start cursor of selected editing text */ | |
| 248 | + Sint32 length; /**< The length of selected editing text */ | |
| 249 | +} SDL_TextEditingEvent; | |
| 250 | + | |
| 251 | +/** | |
| 252 | + * Extended keyboard text editing event structure (event.editExt.*) when text | |
| 253 | + * would be truncated if stored in the text buffer SDL_TextEditingEvent | |
| 254 | + */ | |
| 255 | +typedef struct SDL_TextEditingExtEvent | |
| 256 | +{ | |
| 257 | + Uint32 type; /**< SDL_TEXTEDITING_EXT */ | |
| 258 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 259 | + Uint32 windowID; /**< The window with keyboard focus, if any */ | |
| 260 | + char* text; /**< The editing text, which should be freed with SDL_free(), and will not be NULL */ | |
| 261 | + Sint32 start; /**< The start cursor of selected editing text */ | |
| 262 | + Sint32 length; /**< The length of selected editing text */ | |
| 263 | +} SDL_TextEditingExtEvent; | |
| 264 | + | |
| 265 | +/** | |
| 266 | + * The maximum bytes of text that can be supplied in an SDL_TextInputEvent. | |
| 267 | + */ | |
| 268 | +#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32) | |
| 269 | + | |
| 270 | +/** | |
| 271 | + * Keyboard text input event structure (event.text.*) | |
| 272 | + * | |
| 273 | + * `text` is limited to SDL_TEXTINPUTEVENT_TEXT_SIZE bytes. If the incoming | |
| 274 | + * string is larger than this, SDL will split it and send it in pieces, across | |
| 275 | + * multiple events. The string is in UTF-8 format, and if split, SDL | |
| 276 | + * guarantees that it will not split in the middle of a UTF-8 sequence, so any | |
| 277 | + * event will only contain complete codepoints. However, if there are several | |
| 278 | + * codepoints that go together into a single glyph (like an emoji "thumbs up" | |
| 279 | + * followed by a skin color), they may be split between events. | |
| 280 | + * | |
| 281 | + * This event will never be delivered unless text input is enabled by calling | |
| 282 | + * SDL_StartTextInput(). Text input is enabled by default on desktop | |
| 283 | + * platforms, and disabled by default on mobile platforms! | |
| 284 | + * | |
| 285 | + * \sa SDL_StartTextInput | |
| 286 | + * \sa SDL_StopTextInput | |
| 287 | + */ | |
| 288 | +typedef struct SDL_TextInputEvent | |
| 289 | +{ | |
| 290 | + Uint32 type; /**< SDL_TEXTINPUT */ | |
| 291 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 292 | + Uint32 windowID; /**< The window with keyboard focus, if any */ | |
| 293 | + char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text; UTF-8 encoded. */ | |
| 294 | +} SDL_TextInputEvent; | |
| 295 | + | |
| 296 | +/** | |
| 297 | + * Mouse motion event structure (event.motion.*) | |
| 298 | + */ | |
| 299 | +typedef struct SDL_MouseMotionEvent | |
| 300 | +{ | |
| 301 | + Uint32 type; /**< SDL_MOUSEMOTION */ | |
| 302 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 303 | + Uint32 windowID; /**< The window with mouse focus, if any */ | |
| 304 | + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ | |
| 305 | + Uint32 state; /**< The current button state */ | |
| 306 | + Sint32 x; /**< X coordinate, relative to window */ | |
| 307 | + Sint32 y; /**< Y coordinate, relative to window */ | |
| 308 | + Sint32 xrel; /**< The relative motion in the X direction */ | |
| 309 | + Sint32 yrel; /**< The relative motion in the Y direction */ | |
| 310 | +} SDL_MouseMotionEvent; | |
| 311 | + | |
| 312 | +/** | |
| 313 | + * Mouse button event structure (event.button.*) | |
| 314 | + */ | |
| 315 | +typedef struct SDL_MouseButtonEvent | |
| 316 | +{ | |
| 317 | + Uint32 type; /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ | |
| 318 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 319 | + Uint32 windowID; /**< The window with mouse focus, if any */ | |
| 320 | + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ | |
| 321 | + Uint8 button; /**< The mouse button index */ | |
| 322 | + Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ | |
| 323 | + Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */ | |
| 324 | + Uint8 padding1; | |
| 325 | + Sint32 x; /**< X coordinate, relative to window */ | |
| 326 | + Sint32 y; /**< Y coordinate, relative to window */ | |
| 327 | +} SDL_MouseButtonEvent; | |
| 328 | + | |
| 329 | +/** | |
| 330 | + * Mouse wheel event structure (event.wheel.*) | |
| 331 | + */ | |
| 332 | +typedef struct SDL_MouseWheelEvent | |
| 333 | +{ | |
| 334 | + Uint32 type; /**< SDL_MOUSEWHEEL */ | |
| 335 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 336 | + Uint32 windowID; /**< The window with mouse focus, if any */ | |
| 337 | + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ | |
| 338 | + Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */ | |
| 339 | + Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */ | |
| 340 | + Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */ | |
| 341 | + float preciseX; /**< The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) */ | |
| 342 | + float preciseY; /**< The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) */ | |
| 343 | + Sint32 mouseX; /**< X coordinate, relative to window (added in 2.26.0) */ | |
| 344 | + Sint32 mouseY; /**< Y coordinate, relative to window (added in 2.26.0) */ | |
| 345 | +} SDL_MouseWheelEvent; | |
| 346 | + | |
| 347 | +/** | |
| 348 | + * Joystick axis motion event structure (event.jaxis.*) | |
| 349 | + */ | |
| 350 | +typedef struct SDL_JoyAxisEvent | |
| 351 | +{ | |
| 352 | + Uint32 type; /**< SDL_JOYAXISMOTION */ | |
| 353 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 354 | + SDL_JoystickID which; /**< The joystick instance id */ | |
| 355 | + Uint8 axis; /**< The joystick axis index */ | |
| 356 | + Uint8 padding1; | |
| 357 | + Uint8 padding2; | |
| 358 | + Uint8 padding3; | |
| 359 | + Sint16 value; /**< The axis value (range: -32768 to 32767) */ | |
| 360 | + Uint16 padding4; | |
| 361 | +} SDL_JoyAxisEvent; | |
| 362 | + | |
| 363 | +/** | |
| 364 | + * Joystick trackball motion event structure (event.jball.*) | |
| 365 | + */ | |
| 366 | +typedef struct SDL_JoyBallEvent | |
| 367 | +{ | |
| 368 | + Uint32 type; /**< SDL_JOYBALLMOTION */ | |
| 369 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 370 | + SDL_JoystickID which; /**< The joystick instance id */ | |
| 371 | + Uint8 ball; /**< The joystick trackball index */ | |
| 372 | + Uint8 padding1; | |
| 373 | + Uint8 padding2; | |
| 374 | + Uint8 padding3; | |
| 375 | + Sint16 xrel; /**< The relative motion in the X direction */ | |
| 376 | + Sint16 yrel; /**< The relative motion in the Y direction */ | |
| 377 | +} SDL_JoyBallEvent; | |
| 378 | + | |
| 379 | +/** | |
| 380 | + * Joystick hat position change event structure (event.jhat.*) | |
| 381 | + */ | |
| 382 | +typedef struct SDL_JoyHatEvent | |
| 383 | +{ | |
| 384 | + Uint32 type; /**< SDL_JOYHATMOTION */ | |
| 385 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 386 | + SDL_JoystickID which; /**< The joystick instance id */ | |
| 387 | + Uint8 hat; /**< The joystick hat index */ | |
| 388 | + Uint8 value; /**< The hat position value. | |
| 389 | + * \sa SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP | |
| 390 | + * \sa SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT | |
| 391 | + * \sa SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN | |
| 392 | + * | |
| 393 | + * Note that zero means the POV is centered. | |
| 394 | + */ | |
| 395 | + Uint8 padding1; | |
| 396 | + Uint8 padding2; | |
| 397 | +} SDL_JoyHatEvent; | |
| 398 | + | |
| 399 | +/** | |
| 400 | + * Joystick button event structure (event.jbutton.*) | |
| 401 | + */ | |
| 402 | +typedef struct SDL_JoyButtonEvent | |
| 403 | +{ | |
| 404 | + Uint32 type; /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ | |
| 405 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 406 | + SDL_JoystickID which; /**< The joystick instance id */ | |
| 407 | + Uint8 button; /**< The joystick button index */ | |
| 408 | + Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ | |
| 409 | + Uint8 padding1; | |
| 410 | + Uint8 padding2; | |
| 411 | +} SDL_JoyButtonEvent; | |
| 412 | + | |
| 413 | +/** | |
| 414 | + * Joystick device event structure (event.jdevice.*) | |
| 415 | + * | |
| 416 | + * SDL will send JOYSTICK_ADDED events for devices that are already plugged in | |
| 417 | + * during SDL_Init. | |
| 418 | + * | |
| 419 | + * \sa SDL_ControllerDeviceEvent | |
| 420 | + */ | |
| 421 | +typedef struct SDL_JoyDeviceEvent | |
| 422 | +{ | |
| 423 | + Uint32 type; /**< SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED */ | |
| 424 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 425 | + Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ | |
| 426 | +} SDL_JoyDeviceEvent; | |
| 427 | + | |
| 428 | +/** | |
| 429 | + * Joysick battery level change event structure (event.jbattery.*) | |
| 430 | + */ | |
| 431 | +typedef struct SDL_JoyBatteryEvent | |
| 432 | +{ | |
| 433 | + Uint32 type; /**< SDL_JOYBATTERYUPDATED */ | |
| 434 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 435 | + SDL_JoystickID which; /**< The joystick instance id */ | |
| 436 | + SDL_JoystickPowerLevel level; /**< The joystick battery level */ | |
| 437 | +} SDL_JoyBatteryEvent; | |
| 438 | + | |
| 439 | +/** | |
| 440 | + * Game controller axis motion event structure (event.caxis.*) | |
| 441 | + */ | |
| 442 | +typedef struct SDL_ControllerAxisEvent | |
| 443 | +{ | |
| 444 | + Uint32 type; /**< SDL_CONTROLLERAXISMOTION */ | |
| 445 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 446 | + SDL_JoystickID which; /**< The joystick instance id */ | |
| 447 | + Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ | |
| 448 | + Uint8 padding1; | |
| 449 | + Uint8 padding2; | |
| 450 | + Uint8 padding3; | |
| 451 | + Sint16 value; /**< The axis value (range: -32768 to 32767) */ | |
| 452 | + Uint16 padding4; | |
| 453 | +} SDL_ControllerAxisEvent; | |
| 454 | + | |
| 455 | + | |
| 456 | +/** | |
| 457 | + * Game controller button event structure (event.cbutton.*) | |
| 458 | + */ | |
| 459 | +typedef struct SDL_ControllerButtonEvent | |
| 460 | +{ | |
| 461 | + Uint32 type; /**< SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP */ | |
| 462 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 463 | + SDL_JoystickID which; /**< The joystick instance id */ | |
| 464 | + Uint8 button; /**< The controller button (SDL_GameControllerButton) */ | |
| 465 | + Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ | |
| 466 | + Uint8 padding1; | |
| 467 | + Uint8 padding2; | |
| 468 | +} SDL_ControllerButtonEvent; | |
| 469 | + | |
| 470 | + | |
| 471 | +/** | |
| 472 | + * Controller device event structure (event.cdevice.*) | |
| 473 | + * | |
| 474 | + * Joysticks that are supported game controllers receive both an | |
| 475 | + * SDL_JoyDeviceEvent and an SDL_ControllerDeviceEvent. | |
| 476 | + * | |
| 477 | + * SDL will send CONTROLLERDEVICEADDED events for joysticks that are already | |
| 478 | + * plugged in during SDL_Init() and are recognized as game controllers. | |
| 479 | + */ | |
| 480 | +typedef struct SDL_ControllerDeviceEvent | |
| 481 | +{ | |
| 482 | + Uint32 type; /**< SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED, or SDL_CONTROLLERSTEAMHANDLEUPDATED */ | |
| 483 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 484 | + Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ | |
| 485 | +} SDL_ControllerDeviceEvent; | |
| 486 | + | |
| 487 | +/** | |
| 488 | + * Game controller touchpad event structure (event.ctouchpad.*) | |
| 489 | + */ | |
| 490 | +typedef struct SDL_ControllerTouchpadEvent | |
| 491 | +{ | |
| 492 | + Uint32 type; /**< SDL_CONTROLLERTOUCHPADDOWN or SDL_CONTROLLERTOUCHPADMOTION or SDL_CONTROLLERTOUCHPADUP */ | |
| 493 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 494 | + SDL_JoystickID which; /**< The joystick instance id */ | |
| 495 | + Sint32 touchpad; /**< The index of the touchpad */ | |
| 496 | + Sint32 finger; /**< The index of the finger on the touchpad */ | |
| 497 | + float x; /**< Normalized in the range 0...1 with 0 being on the left */ | |
| 498 | + float y; /**< Normalized in the range 0...1 with 0 being at the top */ | |
| 499 | + float pressure; /**< Normalized in the range 0...1 */ | |
| 500 | +} SDL_ControllerTouchpadEvent; | |
| 501 | + | |
| 502 | +/** | |
| 503 | + * Game controller sensor event structure (event.csensor.*) | |
| 504 | + */ | |
| 505 | +typedef struct SDL_ControllerSensorEvent | |
| 506 | +{ | |
| 507 | + Uint32 type; /**< SDL_CONTROLLERSENSORUPDATE */ | |
| 508 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 509 | + SDL_JoystickID which; /**< The joystick instance id */ | |
| 510 | + Sint32 sensor; /**< The type of the sensor, one of the values of SDL_SensorType */ | |
| 511 | + float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */ | |
| 512 | + Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */ | |
| 513 | +} SDL_ControllerSensorEvent; | |
| 514 | + | |
| 515 | +/** | |
| 516 | + * Audio device event structure (event.adevice.*) | |
| 517 | + */ | |
| 518 | +typedef struct SDL_AudioDeviceEvent | |
| 519 | +{ | |
| 520 | + Uint32 type; /**< SDL_AUDIODEVICEADDED, or SDL_AUDIODEVICEREMOVED */ | |
| 521 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 522 | + Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */ | |
| 523 | + Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */ | |
| 524 | + Uint8 padding1; | |
| 525 | + Uint8 padding2; | |
| 526 | + Uint8 padding3; | |
| 527 | +} SDL_AudioDeviceEvent; | |
| 528 | + | |
| 529 | + | |
| 530 | +/** | |
| 531 | + * Touch finger event structure (event.tfinger.*) | |
| 532 | + */ | |
| 533 | +typedef struct SDL_TouchFingerEvent | |
| 534 | +{ | |
| 535 | + Uint32 type; /**< SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP */ | |
| 536 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 537 | + SDL_TouchID touchId; /**< The touch device id */ | |
| 538 | + SDL_FingerID fingerId; | |
| 539 | + float x; /**< Normalized in the range 0...1 */ | |
| 540 | + float y; /**< Normalized in the range 0...1 */ | |
| 541 | + float dx; /**< Normalized in the range -1...1 */ | |
| 542 | + float dy; /**< Normalized in the range -1...1 */ | |
| 543 | + float pressure; /**< Normalized in the range 0...1 */ | |
| 544 | + Uint32 windowID; /**< The window underneath the finger, if any */ | |
| 545 | +} SDL_TouchFingerEvent; | |
| 546 | + | |
| 547 | + | |
| 548 | +/** | |
| 549 | + * Multiple Finger Gesture Event (event.mgesture.*) | |
| 550 | + */ | |
| 551 | +typedef struct SDL_MultiGestureEvent | |
| 552 | +{ | |
| 553 | + Uint32 type; /**< SDL_MULTIGESTURE */ | |
| 554 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 555 | + SDL_TouchID touchId; /**< The touch device id */ | |
| 556 | + float dTheta; | |
| 557 | + float dDist; | |
| 558 | + float x; | |
| 559 | + float y; | |
| 560 | + Uint16 numFingers; | |
| 561 | + Uint16 padding; | |
| 562 | +} SDL_MultiGestureEvent; | |
| 563 | + | |
| 564 | + | |
| 565 | +/** | |
| 566 | + * Dollar Gesture Event (event.dgesture.*) | |
| 567 | + */ | |
| 568 | +typedef struct SDL_DollarGestureEvent | |
| 569 | +{ | |
| 570 | + Uint32 type; /**< SDL_DOLLARGESTURE or SDL_DOLLARRECORD */ | |
| 571 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 572 | + SDL_TouchID touchId; /**< The touch device id */ | |
| 573 | + SDL_GestureID gestureId; | |
| 574 | + Uint32 numFingers; | |
| 575 | + float error; | |
| 576 | + float x; /**< Normalized center of gesture */ | |
| 577 | + float y; /**< Normalized center of gesture */ | |
| 578 | +} SDL_DollarGestureEvent; | |
| 579 | + | |
| 580 | + | |
| 581 | +/** | |
| 582 | + * An event used to request a file open by the system (event.drop.*) | |
| 583 | + * | |
| 584 | + * This event is enabled by default, you can disable it with SDL_EventState(). | |
| 585 | + * | |
| 586 | + * If this event is enabled, you must free the filename in the event. | |
| 587 | + */ | |
| 588 | +typedef struct SDL_DropEvent | |
| 589 | +{ | |
| 590 | + Uint32 type; /**< SDL_DROPBEGIN or SDL_DROPFILE or SDL_DROPTEXT or SDL_DROPCOMPLETE */ | |
| 591 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 592 | + char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ | |
| 593 | + Uint32 windowID; /**< The window that was dropped on, if any */ | |
| 594 | +} SDL_DropEvent; | |
| 595 | + | |
| 596 | + | |
| 597 | +/** | |
| 598 | + * Sensor event structure (event.sensor.*) | |
| 599 | + */ | |
| 600 | +typedef struct SDL_SensorEvent | |
| 601 | +{ | |
| 602 | + Uint32 type; /**< SDL_SENSORUPDATE */ | |
| 603 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 604 | + Sint32 which; /**< The instance ID of the sensor */ | |
| 605 | + float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ | |
| 606 | + Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */ | |
| 607 | +} SDL_SensorEvent; | |
| 608 | + | |
| 609 | +/** | |
| 610 | + * The "quit requested" event | |
| 611 | + */ | |
| 612 | +typedef struct SDL_QuitEvent | |
| 613 | +{ | |
| 614 | + Uint32 type; /**< SDL_QUIT */ | |
| 615 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 616 | +} SDL_QuitEvent; | |
| 617 | + | |
| 618 | +/** | |
| 619 | + * A user-defined event type (event.user.*) | |
| 620 | + */ | |
| 621 | +typedef struct SDL_UserEvent | |
| 622 | +{ | |
| 623 | + Uint32 type; /**< SDL_USEREVENT through SDL_LASTEVENT-1 */ | |
| 624 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 625 | + Uint32 windowID; /**< The associated window if any */ | |
| 626 | + Sint32 code; /**< User defined event code */ | |
| 627 | + void *data1; /**< User defined data pointer */ | |
| 628 | + void *data2; /**< User defined data pointer */ | |
| 629 | +} SDL_UserEvent; | |
| 630 | + | |
| 631 | + | |
| 632 | +struct SDL_SysWMmsg; | |
| 633 | +typedef struct SDL_SysWMmsg SDL_SysWMmsg; | |
| 634 | + | |
| 635 | +/** | |
| 636 | + * A video driver dependent system event (event.syswm.*) | |
| 637 | + * | |
| 638 | + * This event is disabled by default, you can enable it with SDL_EventState() | |
| 639 | + * | |
| 640 | + * If you want to use this event, you should include SDL_syswm.h. | |
| 641 | + */ | |
| 642 | +typedef struct SDL_SysWMEvent | |
| 643 | +{ | |
| 644 | + Uint32 type; /**< SDL_SYSWMEVENT */ | |
| 645 | + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ | |
| 646 | + SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ | |
| 647 | +} SDL_SysWMEvent; | |
| 648 | + | |
| 649 | +/** | |
| 650 | + * General event structure | |
| 651 | + * | |
| 652 | + * The SDL_Event structure is the core of all event handling in SDL. SDL_Event | |
| 653 | + * is a union of all event structures used in SDL. | |
| 654 | + */ | |
| 655 | +typedef union SDL_Event | |
| 656 | +{ | |
| 657 | + Uint32 type; /**< Event type, shared with all events */ | |
| 658 | + SDL_CommonEvent common; /**< Common event data */ | |
| 659 | + SDL_DisplayEvent display; /**< Display event data */ | |
| 660 | + SDL_WindowEvent window; /**< Window event data */ | |
| 661 | + SDL_KeyboardEvent key; /**< Keyboard event data */ | |
| 662 | + SDL_TextEditingEvent edit; /**< Text editing event data */ | |
| 663 | + SDL_TextEditingExtEvent editExt; /**< Extended text editing event data */ | |
| 664 | + SDL_TextInputEvent text; /**< Text input event data */ | |
| 665 | + SDL_MouseMotionEvent motion; /**< Mouse motion event data */ | |
| 666 | + SDL_MouseButtonEvent button; /**< Mouse button event data */ | |
| 667 | + SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */ | |
| 668 | + SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */ | |
| 669 | + SDL_JoyBallEvent jball; /**< Joystick ball event data */ | |
| 670 | + SDL_JoyHatEvent jhat; /**< Joystick hat event data */ | |
| 671 | + SDL_JoyButtonEvent jbutton; /**< Joystick button event data */ | |
| 672 | + SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */ | |
| 673 | + SDL_JoyBatteryEvent jbattery; /**< Joystick battery event data */ | |
| 674 | + SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */ | |
| 675 | + SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ | |
| 676 | + SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ | |
| 677 | + SDL_ControllerTouchpadEvent ctouchpad; /**< Game Controller touchpad event data */ | |
| 678 | + SDL_ControllerSensorEvent csensor; /**< Game Controller sensor event data */ | |
| 679 | + SDL_AudioDeviceEvent adevice; /**< Audio device event data */ | |
| 680 | + SDL_SensorEvent sensor; /**< Sensor event data */ | |
| 681 | + SDL_QuitEvent quit; /**< Quit request event data */ | |
| 682 | + SDL_UserEvent user; /**< Custom event data */ | |
| 683 | + SDL_SysWMEvent syswm; /**< System dependent window event data */ | |
| 684 | + SDL_TouchFingerEvent tfinger; /**< Touch finger event data */ | |
| 685 | + SDL_MultiGestureEvent mgesture; /**< Gesture event data */ | |
| 686 | + SDL_DollarGestureEvent dgesture; /**< Gesture event data */ | |
| 687 | + SDL_DropEvent drop; /**< Drag and drop event data */ | |
| 688 | + | |
| 689 | + /* This is necessary for ABI compatibility between Visual C++ and GCC. | |
| 690 | + Visual C++ will respect the push pack pragma and use 52 bytes (size of | |
| 691 | + SDL_TextEditingEvent, the largest structure for 32-bit and 64-bit | |
| 692 | + architectures) for this union, and GCC will use the alignment of the | |
| 693 | + largest datatype within the union, which is 8 bytes on 64-bit | |
| 694 | + architectures. | |
| 695 | + | |
| 696 | + So... we'll add padding to force the size to be 56 bytes for both. | |
| 697 | + | |
| 698 | + On architectures where pointers are 16 bytes, this needs rounding up to | |
| 699 | + the next multiple of 16, 64, and on architectures where pointers are | |
| 700 | + even larger the size of SDL_UserEvent will dominate as being 3 pointers. | |
| 701 | + */ | |
| 702 | + Uint8 padding[sizeof(void *) <= 8 ? 56 : sizeof(void *) == 16 ? 64 : 3 * sizeof(void *)]; | |
| 703 | +} SDL_Event; | |
| 704 | + | |
| 705 | +/* Make sure we haven't broken binary compatibility */ | |
| 706 | +SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NULL)->padding)); | |
| 707 | + | |
| 708 | + | |
| 709 | +/* Function prototypes */ | |
| 710 | + | |
| 711 | +/** | |
| 712 | + * Pump the event loop, gathering events from the input devices. | |
| 713 | + * | |
| 714 | + * This function updates the event queue and internal input device state. | |
| 715 | + * | |
| 716 | + * **WARNING**: This should only be run in the thread that initialized the | |
| 717 | + * video subsystem, and for extra safety, you should consider only doing those | |
| 718 | + * things on the main thread in any case. | |
| 719 | + * | |
| 720 | + * SDL_PumpEvents() gathers all the pending input information from devices and | |
| 721 | + * places it in the event queue. Without calls to SDL_PumpEvents() no events | |
| 722 | + * would ever be placed on the queue. Often the need for calls to | |
| 723 | + * SDL_PumpEvents() is hidden from the user since SDL_PollEvent() and | |
| 724 | + * SDL_WaitEvent() implicitly call SDL_PumpEvents(). However, if you are not | |
| 725 | + * polling or waiting for events (e.g. you are filtering them), then you must | |
| 726 | + * call SDL_PumpEvents() to force an event queue update. | |
| 727 | + * | |
| 728 | + * \since This function is available since SDL 2.0.0. | |
| 729 | + * | |
| 730 | + * \sa SDL_PollEvent | |
| 731 | + * \sa SDL_WaitEvent | |
| 732 | + */ | |
| 733 | +extern DECLSPEC void SDLCALL SDL_PumpEvents(void); | |
| 734 | + | |
| 735 | +/* @{ */ | |
| 736 | +typedef enum SDL_eventaction | |
| 737 | +{ | |
| 738 | + SDL_ADDEVENT, | |
| 739 | + SDL_PEEKEVENT, | |
| 740 | + SDL_GETEVENT | |
| 741 | +} SDL_eventaction; | |
| 742 | + | |
| 743 | +/** | |
| 744 | + * Check the event queue for messages and optionally return them. | |
| 745 | + * | |
| 746 | + * `action` may be any of the following: | |
| 747 | + * | |
| 748 | + * - `SDL_ADDEVENT`: up to `numevents` events will be added to the back of the | |
| 749 | + * event queue. | |
| 750 | + * - `SDL_PEEKEVENT`: `numevents` events at the front of the event queue, | |
| 751 | + * within the specified minimum and maximum type, will be returned to the | |
| 752 | + * caller and will _not_ be removed from the queue. | |
| 753 | + * - `SDL_GETEVENT`: up to `numevents` events at the front of the event queue, | |
| 754 | + * within the specified minimum and maximum type, will be returned to the | |
| 755 | + * caller and will be removed from the queue. | |
| 756 | + * | |
| 757 | + * You may have to call SDL_PumpEvents() before calling this function. | |
| 758 | + * Otherwise, the events may not be ready to be filtered when you call | |
| 759 | + * SDL_PeepEvents(). | |
| 760 | + * | |
| 761 | + * This function is thread-safe. | |
| 762 | + * | |
| 763 | + * \param events destination buffer for the retrieved events. | |
| 764 | + * \param numevents if action is SDL_ADDEVENT, the number of events to add | |
| 765 | + * back to the event queue; if action is SDL_PEEKEVENT or | |
| 766 | + * SDL_GETEVENT, the maximum number of events to retrieve. | |
| 767 | + * \param action action to take; see [[#action|Remarks]] for details. | |
| 768 | + * \param minType minimum value of the event type to be considered; | |
| 769 | + * SDL_FIRSTEVENT is a safe choice. | |
| 770 | + * \param maxType maximum value of the event type to be considered; | |
| 771 | + * SDL_LASTEVENT is a safe choice. | |
| 772 | + * \returns the number of events actually stored or a negative error code on | |
| 773 | + * failure; call SDL_GetError() for more information. | |
| 774 | + * | |
| 775 | + * \since This function is available since SDL 2.0.0. | |
| 776 | + * | |
| 777 | + * \sa SDL_PollEvent | |
| 778 | + * \sa SDL_PumpEvents | |
| 779 | + * \sa SDL_PushEvent | |
| 780 | + */ | |
| 781 | +extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents, | |
| 782 | + SDL_eventaction action, | |
| 783 | + Uint32 minType, Uint32 maxType); | |
| 784 | +/* @} */ | |
| 785 | + | |
| 786 | +/** | |
| 787 | + * Check for the existence of a certain event type in the event queue. | |
| 788 | + * | |
| 789 | + * If you need to check for a range of event types, use SDL_HasEvents() | |
| 790 | + * instead. | |
| 791 | + * | |
| 792 | + * \param type the type of event to be queried; see SDL_EventType for details. | |
| 793 | + * \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if | |
| 794 | + * events matching `type` are not present. | |
| 795 | + * | |
| 796 | + * \since This function is available since SDL 2.0.0. | |
| 797 | + * | |
| 798 | + * \sa SDL_HasEvents | |
| 799 | + */ | |
| 800 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); | |
| 801 | + | |
| 802 | + | |
| 803 | +/** | |
| 804 | + * Check for the existence of certain event types in the event queue. | |
| 805 | + * | |
| 806 | + * If you need to check for a single event type, use SDL_HasEvent() instead. | |
| 807 | + * | |
| 808 | + * \param minType the low end of event type to be queried, inclusive; see | |
| 809 | + * SDL_EventType for details. | |
| 810 | + * \param maxType the high end of event type to be queried, inclusive; see | |
| 811 | + * SDL_EventType for details. | |
| 812 | + * \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are | |
| 813 | + * present, or SDL_FALSE if not. | |
| 814 | + * | |
| 815 | + * \since This function is available since SDL 2.0.0. | |
| 816 | + * | |
| 817 | + * \sa SDL_HasEvents | |
| 818 | + */ | |
| 819 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); | |
| 820 | + | |
| 821 | +/** | |
| 822 | + * Clear events of a specific type from the event queue. | |
| 823 | + * | |
| 824 | + * This will unconditionally remove any events from the queue that match | |
| 825 | + * `type`. If you need to remove a range of event types, use SDL_FlushEvents() | |
| 826 | + * instead. | |
| 827 | + * | |
| 828 | + * It's also normal to just ignore events you don't care about in your event | |
| 829 | + * loop without calling this function. | |
| 830 | + * | |
| 831 | + * This function only affects currently queued events. If you want to make | |
| 832 | + * sure that all pending OS events are flushed, you can call SDL_PumpEvents() | |
| 833 | + * on the main thread immediately before the flush call. | |
| 834 | + * | |
| 835 | + * \param type the type of event to be cleared; see SDL_EventType for details. | |
| 836 | + * | |
| 837 | + * \since This function is available since SDL 2.0.0. | |
| 838 | + * | |
| 839 | + * \sa SDL_FlushEvents | |
| 840 | + */ | |
| 841 | +extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); | |
| 842 | + | |
| 843 | +/** | |
| 844 | + * Clear events of a range of types from the event queue. | |
| 845 | + * | |
| 846 | + * This will unconditionally remove any events from the queue that are in the | |
| 847 | + * range of `minType` to `maxType`, inclusive. If you need to remove a single | |
| 848 | + * event type, use SDL_FlushEvent() instead. | |
| 849 | + * | |
| 850 | + * It's also normal to just ignore events you don't care about in your event | |
| 851 | + * loop without calling this function. | |
| 852 | + * | |
| 853 | + * This function only affects currently queued events. If you want to make | |
| 854 | + * sure that all pending OS events are flushed, you can call SDL_PumpEvents() | |
| 855 | + * on the main thread immediately before the flush call. | |
| 856 | + * | |
| 857 | + * \param minType the low end of event type to be cleared, inclusive; see | |
| 858 | + * SDL_EventType for details. | |
| 859 | + * \param maxType the high end of event type to be cleared, inclusive; see | |
| 860 | + * SDL_EventType for details. | |
| 861 | + * | |
| 862 | + * \since This function is available since SDL 2.0.0. | |
| 863 | + * | |
| 864 | + * \sa SDL_FlushEvent | |
| 865 | + */ | |
| 866 | +extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType); | |
| 867 | + | |
| 868 | +/** | |
| 869 | + * Poll for currently pending events. | |
| 870 | + * | |
| 871 | + * If `event` is not NULL, the next event is removed from the queue and stored | |
| 872 | + * in the SDL_Event structure pointed to by `event`. The 1 returned refers to | |
| 873 | + * this event, immediately stored in the SDL Event structure -- not an event | |
| 874 | + * to follow. | |
| 875 | + * | |
| 876 | + * If `event` is NULL, it simply returns 1 if there is an event in the queue, | |
| 877 | + * but will not remove it from the queue. | |
| 878 | + * | |
| 879 | + * As this function may implicitly call SDL_PumpEvents(), you can only call | |
| 880 | + * this function in the thread that set the video mode. | |
| 881 | + * | |
| 882 | + * SDL_PollEvent() is the favored way of receiving system events since it can | |
| 883 | + * be done from the main loop and does not suspend the main loop while waiting | |
| 884 | + * on an event to be posted. | |
| 885 | + * | |
| 886 | + * The common practice is to fully process the event queue once every frame, | |
| 887 | + * usually as a first step before updating the game's state: | |
| 888 | + * | |
| 889 | + * ```c | |
| 890 | + * while (game_is_still_running) { | |
| 891 | + * SDL_Event event; | |
| 892 | + * while (SDL_PollEvent(&event)) { // poll until all events are handled! | |
| 893 | + * // decide what to do with this event. | |
| 894 | + * } | |
| 895 | + * | |
| 896 | + * // update game state, draw the current frame | |
| 897 | + * } | |
| 898 | + * ``` | |
| 899 | + * | |
| 900 | + * \param event the SDL_Event structure to be filled with the next event from | |
| 901 | + * the queue, or NULL. | |
| 902 | + * \returns 1 if there is a pending event or 0 if there are none available. | |
| 903 | + * | |
| 904 | + * \since This function is available since SDL 2.0.0. | |
| 905 | + * | |
| 906 | + * \sa SDL_GetEventFilter | |
| 907 | + * \sa SDL_PeepEvents | |
| 908 | + * \sa SDL_PushEvent | |
| 909 | + * \sa SDL_SetEventFilter | |
| 910 | + * \sa SDL_WaitEvent | |
| 911 | + * \sa SDL_WaitEventTimeout | |
| 912 | + */ | |
| 913 | +extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event); | |
| 914 | + | |
| 915 | +/** | |
| 916 | + * Wait indefinitely for the next available event. | |
| 917 | + * | |
| 918 | + * If `event` is not NULL, the next event is removed from the queue and stored | |
| 919 | + * in the SDL_Event structure pointed to by `event`. | |
| 920 | + * | |
| 921 | + * As this function may implicitly call SDL_PumpEvents(), you can only call | |
| 922 | + * this function in the thread that initialized the video subsystem. | |
| 923 | + * | |
| 924 | + * \param event the SDL_Event structure to be filled in with the next event | |
| 925 | + * from the queue, or NULL. | |
| 926 | + * \returns 1 on success or 0 if there was an error while waiting for events; | |
| 927 | + * call SDL_GetError() for more information. | |
| 928 | + * | |
| 929 | + * \since This function is available since SDL 2.0.0. | |
| 930 | + * | |
| 931 | + * \sa SDL_PollEvent | |
| 932 | + * \sa SDL_PumpEvents | |
| 933 | + * \sa SDL_WaitEventTimeout | |
| 934 | + */ | |
| 935 | +extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event); | |
| 936 | + | |
| 937 | +/** | |
| 938 | + * Wait until the specified timeout (in milliseconds) for the next available | |
| 939 | + * event. | |
| 940 | + * | |
| 941 | + * If `event` is not NULL, the next event is removed from the queue and stored | |
| 942 | + * in the SDL_Event structure pointed to by `event`. | |
| 943 | + * | |
| 944 | + * As this function may implicitly call SDL_PumpEvents(), you can only call | |
| 945 | + * this function in the thread that initialized the video subsystem. | |
| 946 | + * | |
| 947 | + * \param event the SDL_Event structure to be filled in with the next event | |
| 948 | + * from the queue, or NULL. | |
| 949 | + * \param timeout the maximum number of milliseconds to wait for the next | |
| 950 | + * available event. | |
| 951 | + * \returns 1 on success or 0 if there was an error while waiting for events; | |
| 952 | + * call SDL_GetError() for more information. This also returns 0 if | |
| 953 | + * the timeout elapsed without an event arriving. | |
| 954 | + * | |
| 955 | + * \since This function is available since SDL 2.0.0. | |
| 956 | + * | |
| 957 | + * \sa SDL_PollEvent | |
| 958 | + * \sa SDL_PumpEvents | |
| 959 | + * \sa SDL_WaitEvent | |
| 960 | + */ | |
| 961 | +extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event, | |
| 962 | + int timeout); | |
| 963 | + | |
| 964 | +/** | |
| 965 | + * Add an event to the event queue. | |
| 966 | + * | |
| 967 | + * The event queue can actually be used as a two way communication channel. | |
| 968 | + * Not only can events be read from the queue, but the user can also push | |
| 969 | + * their own events onto it. `event` is a pointer to the event structure you | |
| 970 | + * wish to push onto the queue. The event is copied into the queue, and the | |
| 971 | + * caller may dispose of the memory pointed to after SDL_PushEvent() returns. | |
| 972 | + * | |
| 973 | + * Note: Pushing device input events onto the queue doesn't modify the state | |
| 974 | + * of the device within SDL. | |
| 975 | + * | |
| 976 | + * This function is thread-safe, and can be called from other threads safely. | |
| 977 | + * | |
| 978 | + * Note: Events pushed onto the queue with SDL_PushEvent() get passed through | |
| 979 | + * the event filter but events added with SDL_PeepEvents() do not. | |
| 980 | + * | |
| 981 | + * For pushing application-specific events, please use SDL_RegisterEvents() to | |
| 982 | + * get an event type that does not conflict with other code that also wants | |
| 983 | + * its own custom event types. | |
| 984 | + * | |
| 985 | + * \param event the SDL_Event to be added to the queue. | |
| 986 | + * \returns 1 on success, 0 if the event was filtered, or a negative error | |
| 987 | + * code on failure; call SDL_GetError() for more information. A | |
| 988 | + * common reason for error is the event queue being full. | |
| 989 | + * | |
| 990 | + * \since This function is available since SDL 2.0.0. | |
| 991 | + * | |
| 992 | + * \sa SDL_PeepEvents | |
| 993 | + * \sa SDL_PollEvent | |
| 994 | + * \sa SDL_RegisterEvents | |
| 995 | + */ | |
| 996 | +extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event); | |
| 997 | + | |
| 998 | +/** | |
| 999 | + * A function pointer used for callbacks that watch the event queue. | |
| 1000 | + * | |
| 1001 | + * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or | |
| 1002 | + * SDL_AddEventWatch, etc. | |
| 1003 | + * \param event the event that triggered the callback. | |
| 1004 | + * \returns 1 to permit event to be added to the queue, and 0 to disallow it. | |
| 1005 | + * When used with SDL_AddEventWatch, the return value is ignored. | |
| 1006 | + * | |
| 1007 | + * \sa SDL_SetEventFilter | |
| 1008 | + * \sa SDL_AddEventWatch | |
| 1009 | + */ | |
| 1010 | +typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event); | |
| 1011 | + | |
| 1012 | +/** | |
| 1013 | + * Set up a filter to process all events before they change internal state and | |
| 1014 | + * are posted to the internal event queue. | |
| 1015 | + * | |
| 1016 | + * If the filter function returns 1 when called, then the event will be added | |
| 1017 | + * to the internal queue. If it returns 0, then the event will be dropped from | |
| 1018 | + * the queue, but the internal state will still be updated. This allows | |
| 1019 | + * selective filtering of dynamically arriving events. | |
| 1020 | + * | |
| 1021 | + * **WARNING**: Be very careful of what you do in the event filter function, | |
| 1022 | + * as it may run in a different thread! | |
| 1023 | + * | |
| 1024 | + * On platforms that support it, if the quit event is generated by an | |
| 1025 | + * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the | |
| 1026 | + * application at the next event poll. | |
| 1027 | + * | |
| 1028 | + * There is one caveat when dealing with the SDL_QuitEvent event type. The | |
| 1029 | + * event filter is only called when the window manager desires to close the | |
| 1030 | + * application window. If the event filter returns 1, then the window will be | |
| 1031 | + * closed, otherwise the window will remain open if possible. | |
| 1032 | + * | |
| 1033 | + * Note: Disabled events never make it to the event filter function; see | |
| 1034 | + * SDL_EventState(). | |
| 1035 | + * | |
| 1036 | + * Note: If you just want to inspect events without filtering, you should use | |
| 1037 | + * SDL_AddEventWatch() instead. | |
| 1038 | + * | |
| 1039 | + * Note: Events pushed onto the queue with SDL_PushEvent() get passed through | |
| 1040 | + * the event filter, but events pushed onto the queue with SDL_PeepEvents() do | |
| 1041 | + * not. | |
| 1042 | + * | |
| 1043 | + * \param filter An SDL_EventFilter function to call when an event happens. | |
| 1044 | + * \param userdata a pointer that is passed to `filter`. | |
| 1045 | + * | |
| 1046 | + * \since This function is available since SDL 2.0.0. | |
| 1047 | + * | |
| 1048 | + * \sa SDL_AddEventWatch | |
| 1049 | + * \sa SDL_EventState | |
| 1050 | + * \sa SDL_GetEventFilter | |
| 1051 | + * \sa SDL_PeepEvents | |
| 1052 | + * \sa SDL_PushEvent | |
| 1053 | + */ | |
| 1054 | +extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, | |
| 1055 | + void *userdata); | |
| 1056 | + | |
| 1057 | +/** | |
| 1058 | + * Query the current event filter. | |
| 1059 | + * | |
| 1060 | + * This function can be used to "chain" filters, by saving the existing filter | |
| 1061 | + * before replacing it with a function that will call that saved filter. | |
| 1062 | + * | |
| 1063 | + * \param filter the current callback function will be stored here. | |
| 1064 | + * \param userdata the pointer that is passed to the current event filter will | |
| 1065 | + * be stored here. | |
| 1066 | + * \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set. | |
| 1067 | + * | |
| 1068 | + * \since This function is available since SDL 2.0.0. | |
| 1069 | + * | |
| 1070 | + * \sa SDL_SetEventFilter | |
| 1071 | + */ | |
| 1072 | +extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter, | |
| 1073 | + void **userdata); | |
| 1074 | + | |
| 1075 | +/** | |
| 1076 | + * Add a callback to be triggered when an event is added to the event queue. | |
| 1077 | + * | |
| 1078 | + * `filter` will be called when an event happens, and its return value is | |
| 1079 | + * ignored. | |
| 1080 | + * | |
| 1081 | + * **WARNING**: Be very careful of what you do in the event filter function, | |
| 1082 | + * as it may run in a different thread! | |
| 1083 | + * | |
| 1084 | + * If the quit event is generated by a signal (e.g. SIGINT), it will bypass | |
| 1085 | + * the internal queue and be delivered to the watch callback immediately, and | |
| 1086 | + * arrive at the next event poll. | |
| 1087 | + * | |
| 1088 | + * Note: the callback is called for events posted by the user through | |
| 1089 | + * SDL_PushEvent(), but not for disabled events, nor for events by a filter | |
| 1090 | + * callback set with SDL_SetEventFilter(), nor for events posted by the user | |
| 1091 | + * through SDL_PeepEvents(). | |
| 1092 | + * | |
| 1093 | + * \param filter an SDL_EventFilter function to call when an event happens. | |
| 1094 | + * \param userdata a pointer that is passed to `filter`. | |
| 1095 | + * | |
| 1096 | + * \since This function is available since SDL 2.0.0. | |
| 1097 | + * | |
| 1098 | + * \sa SDL_DelEventWatch | |
| 1099 | + * \sa SDL_SetEventFilter | |
| 1100 | + */ | |
| 1101 | +extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, | |
| 1102 | + void *userdata); | |
| 1103 | + | |
| 1104 | +/** | |
| 1105 | + * Remove an event watch callback added with SDL_AddEventWatch(). | |
| 1106 | + * | |
| 1107 | + * This function takes the same input as SDL_AddEventWatch() to identify and | |
| 1108 | + * delete the corresponding callback. | |
| 1109 | + * | |
| 1110 | + * \param filter the function originally passed to SDL_AddEventWatch(). | |
| 1111 | + * \param userdata the pointer originally passed to SDL_AddEventWatch(). | |
| 1112 | + * | |
| 1113 | + * \since This function is available since SDL 2.0.0. | |
| 1114 | + * | |
| 1115 | + * \sa SDL_AddEventWatch | |
| 1116 | + */ | |
| 1117 | +extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, | |
| 1118 | + void *userdata); | |
| 1119 | + | |
| 1120 | +/** | |
| 1121 | + * Run a specific filter function on the current event queue, removing any | |
| 1122 | + * events for which the filter returns 0. | |
| 1123 | + * | |
| 1124 | + * See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(), | |
| 1125 | + * this function does not change the filter permanently, it only uses the | |
| 1126 | + * supplied filter until this function returns. | |
| 1127 | + * | |
| 1128 | + * \param filter the SDL_EventFilter function to call when an event happens. | |
| 1129 | + * \param userdata a pointer that is passed to `filter`. | |
| 1130 | + * | |
| 1131 | + * \since This function is available since SDL 2.0.0. | |
| 1132 | + * | |
| 1133 | + * \sa SDL_GetEventFilter | |
| 1134 | + * \sa SDL_SetEventFilter | |
| 1135 | + */ | |
| 1136 | +extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, | |
| 1137 | + void *userdata); | |
| 1138 | + | |
| 1139 | +/* @{ */ | |
| 1140 | +#define SDL_QUERY -1 | |
| 1141 | +#define SDL_IGNORE 0 | |
| 1142 | +#define SDL_DISABLE 0 | |
| 1143 | +#define SDL_ENABLE 1 | |
| 1144 | + | |
| 1145 | +/** | |
| 1146 | + * Set the state of processing events by type. | |
| 1147 | + * | |
| 1148 | + * `state` may be any of the following: | |
| 1149 | + * | |
| 1150 | + * - `SDL_QUERY`: returns the current processing state of the specified event | |
| 1151 | + * - `SDL_IGNORE` (aka `SDL_DISABLE`): the event will automatically be dropped | |
| 1152 | + * from the event queue and will not be filtered | |
| 1153 | + * - `SDL_ENABLE`: the event will be processed normally | |
| 1154 | + * | |
| 1155 | + * \param type the type of event; see SDL_EventType for details. | |
| 1156 | + * \param state how to process the event. | |
| 1157 | + * \returns `SDL_DISABLE` or `SDL_ENABLE`, representing the processing state | |
| 1158 | + * of the event before this function makes any changes to it. | |
| 1159 | + * | |
| 1160 | + * \since This function is available since SDL 2.0.0. | |
| 1161 | + * | |
| 1162 | + * \sa SDL_GetEventState | |
| 1163 | + */ | |
| 1164 | +extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state); | |
| 1165 | +/* @} */ | |
| 1166 | +#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY) | |
| 1167 | + | |
| 1168 | +/** | |
| 1169 | + * Allocate a set of user-defined events, and return the beginning event | |
| 1170 | + * number for that set of events. | |
| 1171 | + * | |
| 1172 | + * Calling this function with `numevents` <= 0 is an error and will return | |
| 1173 | + * (Uint32)-1. | |
| 1174 | + * | |
| 1175 | + * Note, (Uint32)-1 means the maximum unsigned 32-bit integer value (or | |
| 1176 | + * 0xFFFFFFFF), but is clearer to write. | |
| 1177 | + * | |
| 1178 | + * \param numevents the number of events to be allocated. | |
| 1179 | + * \returns the beginning event number, or (Uint32)-1 if there are not enough | |
| 1180 | + * user-defined events left. | |
| 1181 | + * | |
| 1182 | + * \since This function is available since SDL 2.0.0. | |
| 1183 | + * | |
| 1184 | + * \sa SDL_PushEvent | |
| 1185 | + */ | |
| 1186 | +extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); | |
| 1187 | + | |
| 1188 | +/* Ends C function definitions when using C++ */ | |
| 1189 | +#ifdef __cplusplus | |
| 1190 | +} | |
| 1191 | +#endif | |
| 1192 | +#include "close_code.h" | |
| 1193 | + | |
| 1194 | +#endif /* SDL_events_h_ */ | |
| 1195 | + | |
| 1196 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,149 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryFilesystem | |
| 24 | + * | |
| 25 | + * Include file for filesystem SDL API functions | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_filesystem_h_ | |
| 29 | +#define SDL_filesystem_h_ | |
| 30 | + | |
| 31 | +#include "SDL_stdinc.h" | |
| 32 | + | |
| 33 | +#include "begin_code.h" | |
| 34 | + | |
| 35 | +/* Set up for C function definitions, even when using C++ */ | |
| 36 | +#ifdef __cplusplus | |
| 37 | +extern "C" { | |
| 38 | +#endif | |
| 39 | + | |
| 40 | +/** | |
| 41 | + * Get the directory where the application was run from. | |
| 42 | + * | |
| 43 | + * This is not necessarily a fast call, so you should call this once near | |
| 44 | + * startup and save the string if you need it. | |
| 45 | + * | |
| 46 | + * **Mac OS X and iOS Specific Functionality**: If the application is in a | |
| 47 | + * ".app" bundle, this function returns the Resource directory (e.g. | |
| 48 | + * MyApp.app/Contents/Resources/). This behaviour can be overridden by adding | |
| 49 | + * a property to the Info.plist file. Adding a string key with the name | |
| 50 | + * SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the | |
| 51 | + * behaviour. | |
| 52 | + * | |
| 53 | + * Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an | |
| 54 | + * application in /Applications/SDLApp/MyApp.app): | |
| 55 | + * | |
| 56 | + * - `resource`: bundle resource directory (the default). For example: | |
| 57 | + * `/Applications/SDLApp/MyApp.app/Contents/Resources` | |
| 58 | + * - `bundle`: the Bundle directory. For example: | |
| 59 | + * `/Applications/SDLApp/MyApp.app/` | |
| 60 | + * - `parent`: the containing directory of the bundle. For example: | |
| 61 | + * `/Applications/SDLApp/` | |
| 62 | + * | |
| 63 | + * **Nintendo 3DS Specific Functionality**: This function returns "romfs" | |
| 64 | + * directory of the application as it is uncommon to store resources outside | |
| 65 | + * the executable. As such it is not a writable directory. | |
| 66 | + * | |
| 67 | + * The returned path is guaranteed to end with a path separator ('\\' on | |
| 68 | + * Windows, '/' on most other platforms). | |
| 69 | + * | |
| 70 | + * The pointer returned is owned by the caller. Please call SDL_free() on the | |
| 71 | + * pointer when done with it. | |
| 72 | + * | |
| 73 | + * \returns an absolute path in UTF-8 encoding to the application data | |
| 74 | + * directory. NULL will be returned on error or when the platform | |
| 75 | + * doesn't implement this functionality, call SDL_GetError() for more | |
| 76 | + * information. | |
| 77 | + * | |
| 78 | + * \since This function is available since SDL 2.0.1. | |
| 79 | + * | |
| 80 | + * \sa SDL_GetPrefPath | |
| 81 | + */ | |
| 82 | +extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); | |
| 83 | + | |
| 84 | +/** | |
| 85 | + * Get the user-and-app-specific path where files can be written. | |
| 86 | + * | |
| 87 | + * Get the "pref dir". This is meant to be where users can write personal | |
| 88 | + * files (preferences and save games, etc) that are specific to your | |
| 89 | + * application. This directory is unique per user, per application. | |
| 90 | + * | |
| 91 | + * This function will decide the appropriate location in the native | |
| 92 | + * filesystem, create the directory if necessary, and return a string of the | |
| 93 | + * absolute path to the directory in UTF-8 encoding. | |
| 94 | + * | |
| 95 | + * On Windows, the string might look like: | |
| 96 | + * | |
| 97 | + * `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\` | |
| 98 | + * | |
| 99 | + * On Linux, the string might look like: | |
| 100 | + * | |
| 101 | + * `/home/bob/.local/share/My Program Name/` | |
| 102 | + * | |
| 103 | + * On Mac OS X, the string might look like: | |
| 104 | + * | |
| 105 | + * `/Users/bob/Library/Application Support/My Program Name/` | |
| 106 | + * | |
| 107 | + * You should assume the path returned by this function is the only safe place | |
| 108 | + * to write files (and that SDL_GetBasePath(), while it might be writable, or | |
| 109 | + * even the parent of the returned path, isn't where you should be writing | |
| 110 | + * things). | |
| 111 | + * | |
| 112 | + * Both the org and app strings may become part of a directory name, so please | |
| 113 | + * follow these rules: | |
| 114 | + * | |
| 115 | + * - Try to use the same org string (_including case-sensitivity_) for all | |
| 116 | + * your applications that use this function. | |
| 117 | + * - Always use a unique app string for each one, and make sure it never | |
| 118 | + * changes for an app once you've decided on it. | |
| 119 | + * - Unicode characters are legal, as long as it's UTF-8 encoded, but... | |
| 120 | + * - ...only use letters, numbers, and spaces. Avoid punctuation like "Game | |
| 121 | + * Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. | |
| 122 | + * | |
| 123 | + * The returned path is guaranteed to end with a path separator ('\\' on | |
| 124 | + * Windows, '/' on most other platforms). | |
| 125 | + * | |
| 126 | + * The pointer returned is owned by the caller. Please call SDL_free() on the | |
| 127 | + * pointer when done with it. | |
| 128 | + * | |
| 129 | + * \param org the name of your organization. | |
| 130 | + * \param app the name of your application. | |
| 131 | + * \returns a UTF-8 string of the user directory in platform-dependent | |
| 132 | + * notation. NULL if there's a problem (creating directory failed, | |
| 133 | + * etc.). | |
| 134 | + * | |
| 135 | + * \since This function is available since SDL 2.0.1. | |
| 136 | + * | |
| 137 | + * \sa SDL_GetBasePath | |
| 138 | + */ | |
| 139 | +extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); | |
| 140 | + | |
| 141 | +/* Ends C function definitions when using C++ */ | |
| 142 | +#ifdef __cplusplus | |
| 143 | +} | |
| 144 | +#endif | |
| 145 | +#include "close_code.h" | |
| 146 | + | |
| 147 | +#endif /* SDL_filesystem_h_ */ | |
| 148 | + | |
| 149 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,1110 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | +/* WIKI CATEGORY: GameController */ | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * # CategoryGameController | |
| 26 | + * | |
| 27 | + * Include file for SDL game controller event handling | |
| 28 | + */ | |
| 29 | + | |
| 30 | +#ifndef SDL_gamecontroller_h_ | |
| 31 | +#define SDL_gamecontroller_h_ | |
| 32 | + | |
| 33 | +#include "SDL_stdinc.h" | |
| 34 | +#include "SDL_error.h" | |
| 35 | +#include "SDL_rwops.h" | |
| 36 | +#include "SDL_sensor.h" | |
| 37 | +#include "SDL_joystick.h" | |
| 38 | + | |
| 39 | +#include "begin_code.h" | |
| 40 | +/* Set up for C function definitions, even when using C++ */ | |
| 41 | +#ifdef __cplusplus | |
| 42 | +extern "C" { | |
| 43 | +#endif | |
| 44 | + | |
| 45 | +/** | |
| 46 | + * \file SDL_gamecontroller.h | |
| 47 | + * | |
| 48 | + * In order to use these functions, SDL_Init() must have been called | |
| 49 | + * with the SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system | |
| 50 | + * for game controllers, and load appropriate drivers. | |
| 51 | + * | |
| 52 | + * If you would like to receive controller updates while the application | |
| 53 | + * is in the background, you should set the following hint before calling | |
| 54 | + * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS | |
| 55 | + */ | |
| 56 | + | |
| 57 | +/** | |
| 58 | + * The gamecontroller structure used to identify an SDL game controller | |
| 59 | + */ | |
| 60 | +struct _SDL_GameController; | |
| 61 | +typedef struct _SDL_GameController SDL_GameController; | |
| 62 | + | |
| 63 | +typedef enum SDL_GameControllerType | |
| 64 | +{ | |
| 65 | + SDL_CONTROLLER_TYPE_UNKNOWN = 0, | |
| 66 | + SDL_CONTROLLER_TYPE_XBOX360, | |
| 67 | + SDL_CONTROLLER_TYPE_XBOXONE, | |
| 68 | + SDL_CONTROLLER_TYPE_PS3, | |
| 69 | + SDL_CONTROLLER_TYPE_PS4, | |
| 70 | + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO, | |
| 71 | + SDL_CONTROLLER_TYPE_VIRTUAL, | |
| 72 | + SDL_CONTROLLER_TYPE_PS5, | |
| 73 | + SDL_CONTROLLER_TYPE_AMAZON_LUNA, | |
| 74 | + SDL_CONTROLLER_TYPE_GOOGLE_STADIA, | |
| 75 | + SDL_CONTROLLER_TYPE_NVIDIA_SHIELD, | |
| 76 | + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, | |
| 77 | + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, | |
| 78 | + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR, | |
| 79 | + SDL_CONTROLLER_TYPE_MAX | |
| 80 | +} SDL_GameControllerType; | |
| 81 | + | |
| 82 | +typedef enum SDL_GameControllerBindType | |
| 83 | +{ | |
| 84 | + SDL_CONTROLLER_BINDTYPE_NONE = 0, | |
| 85 | + SDL_CONTROLLER_BINDTYPE_BUTTON, | |
| 86 | + SDL_CONTROLLER_BINDTYPE_AXIS, | |
| 87 | + SDL_CONTROLLER_BINDTYPE_HAT | |
| 88 | +} SDL_GameControllerBindType; | |
| 89 | + | |
| 90 | +/** | |
| 91 | + * Get the SDL joystick layer binding for this controller button/axis mapping | |
| 92 | + */ | |
| 93 | +typedef struct SDL_GameControllerButtonBind | |
| 94 | +{ | |
| 95 | + SDL_GameControllerBindType bindType; | |
| 96 | + union | |
| 97 | + { | |
| 98 | + int button; | |
| 99 | + int axis; | |
| 100 | + struct { | |
| 101 | + int hat; | |
| 102 | + int hat_mask; | |
| 103 | + } hat; | |
| 104 | + } value; | |
| 105 | + | |
| 106 | +} SDL_GameControllerButtonBind; | |
| 107 | + | |
| 108 | + | |
| 109 | +/** | |
| 110 | + * To count the number of game controllers in the system for the following: | |
| 111 | + * | |
| 112 | + * ```c | |
| 113 | + * int nJoysticks = SDL_NumJoysticks(); | |
| 114 | + * int nGameControllers = 0; | |
| 115 | + * for (int i = 0; i < nJoysticks; i++) { | |
| 116 | + * if (SDL_IsGameController(i)) { | |
| 117 | + * nGameControllers++; | |
| 118 | + * } | |
| 119 | + * } | |
| 120 | + * ``` | |
| 121 | + * | |
| 122 | + * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: | |
| 123 | + * guid,name,mappings | |
| 124 | + * | |
| 125 | + * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. | |
| 126 | + * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. | |
| 127 | + * The mapping format for joystick is: | |
| 128 | + * bX - a joystick button, index X | |
| 129 | + * hX.Y - hat X with value Y | |
| 130 | + * aX - axis X of the joystick | |
| 131 | + * Buttons can be used as a controller axis and vice versa. | |
| 132 | + * | |
| 133 | + * This string shows an example of a valid mapping for a controller | |
| 134 | + * | |
| 135 | + * ```c | |
| 136 | + * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", | |
| 137 | + * ``` | |
| 138 | + */ | |
| 139 | + | |
| 140 | +/** | |
| 141 | + * Load a set of Game Controller mappings from a seekable SDL data stream. | |
| 142 | + * | |
| 143 | + * You can call this function several times, if needed, to load different | |
| 144 | + * database files. | |
| 145 | + * | |
| 146 | + * If a new mapping is loaded for an already known controller GUID, the later | |
| 147 | + * version will overwrite the one currently loaded. | |
| 148 | + * | |
| 149 | + * If this function is called before SDL_Init, SDL will generate an | |
| 150 | + * SDL_CONTROLLERDEVICEADDED event for matching controllers that are plugged | |
| 151 | + * in at the time that SDL_Init is called. | |
| 152 | + * | |
| 153 | + * Mappings not belonging to the current platform or with no platform field | |
| 154 | + * specified will be ignored (i.e. mappings for Linux will be ignored in | |
| 155 | + * Windows, etc). | |
| 156 | + * | |
| 157 | + * This function will load the text database entirely in memory before | |
| 158 | + * processing it, so take this into consideration if you are in a memory | |
| 159 | + * constrained environment. | |
| 160 | + * | |
| 161 | + * \param rw the data stream for the mappings to be added. | |
| 162 | + * \param freerw non-zero to close the stream after being read. | |
| 163 | + * \returns the number of mappings added or -1 on error; call SDL_GetError() | |
| 164 | + * for more information. | |
| 165 | + * | |
| 166 | + * \since This function is available since SDL 2.0.2. | |
| 167 | + * | |
| 168 | + * \sa SDL_GameControllerAddMapping | |
| 169 | + * \sa SDL_GameControllerAddMappingsFromFile | |
| 170 | + * \sa SDL_GameControllerMappingForGUID | |
| 171 | + * \sa SDL_CONTROLLERDEVICEADDED | |
| 172 | + */ | |
| 173 | +extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw); | |
| 174 | + | |
| 175 | +/** | |
| 176 | + * Load a set of mappings from a file, filtered by the current | |
| 177 | + * SDL_GetPlatform() | |
| 178 | + * | |
| 179 | + * Convenience macro. | |
| 180 | + */ | |
| 181 | +#define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1) | |
| 182 | + | |
| 183 | +/** | |
| 184 | + * Add support for controllers that SDL is unaware of or to cause an existing | |
| 185 | + * controller to have a different binding. | |
| 186 | + * | |
| 187 | + * The mapping string has the format "GUID,name,mapping", where GUID is the | |
| 188 | + * string value from SDL_JoystickGetGUIDString(), name is the human readable | |
| 189 | + * string for the device and mappings are controller mappings to joystick | |
| 190 | + * ones. Under Windows there is a reserved GUID of "xinput" that covers all | |
| 191 | + * XInput devices. The mapping format for joystick is: {| |bX |a joystick | |
| 192 | + * button, index X |- |hX.Y |hat X with value Y |- |aX |axis X of the joystick | |
| 193 | + * |} Buttons can be used as a controller axes and vice versa. | |
| 194 | + * | |
| 195 | + * This string shows an example of a valid mapping for a controller: | |
| 196 | + * | |
| 197 | + * ```c | |
| 198 | + * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7" | |
| 199 | + * ``` | |
| 200 | + * | |
| 201 | + * If this function is called before SDL_Init, SDL will generate an | |
| 202 | + * SDL_CONTROLLERDEVICEADDED event for matching controllers that are plugged | |
| 203 | + * in at the time that SDL_Init is called. | |
| 204 | + * | |
| 205 | + * \param mappingString the mapping string. | |
| 206 | + * \returns 1 if a new mapping is added, 0 if an existing mapping is updated, | |
| 207 | + * -1 on error; call SDL_GetError() for more information. | |
| 208 | + * | |
| 209 | + * \since This function is available since SDL 2.0.0. | |
| 210 | + * | |
| 211 | + * \sa SDL_GameControllerMapping | |
| 212 | + * \sa SDL_GameControllerMappingForGUID | |
| 213 | + * \sa SDL_CONTROLLERDEVICEADDED | |
| 214 | + */ | |
| 215 | +extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString); | |
| 216 | + | |
| 217 | +/** | |
| 218 | + * Get the number of mappings installed. | |
| 219 | + * | |
| 220 | + * \returns the number of mappings. | |
| 221 | + * | |
| 222 | + * \since This function is available since SDL 2.0.6. | |
| 223 | + */ | |
| 224 | +extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void); | |
| 225 | + | |
| 226 | +/** | |
| 227 | + * Get the mapping at a particular index. | |
| 228 | + * | |
| 229 | + * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if | |
| 230 | + * the index is out of range. | |
| 231 | + * | |
| 232 | + * \since This function is available since SDL 2.0.6. | |
| 233 | + */ | |
| 234 | +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index); | |
| 235 | + | |
| 236 | +/** | |
| 237 | + * Get the game controller mapping string for a given GUID. | |
| 238 | + * | |
| 239 | + * The returned string must be freed with SDL_free(). | |
| 240 | + * | |
| 241 | + * \param guid a structure containing the GUID for which a mapping is desired. | |
| 242 | + * \returns a mapping string or NULL on error; call SDL_GetError() for more | |
| 243 | + * information. | |
| 244 | + * | |
| 245 | + * \since This function is available since SDL 2.0.0. | |
| 246 | + * | |
| 247 | + * \sa SDL_JoystickGetDeviceGUID | |
| 248 | + * \sa SDL_JoystickGetGUID | |
| 249 | + */ | |
| 250 | +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid); | |
| 251 | + | |
| 252 | +/** | |
| 253 | + * Get the current mapping of a Game Controller. | |
| 254 | + * | |
| 255 | + * The returned string must be freed with SDL_free(). | |
| 256 | + * | |
| 257 | + * Details about mappings are discussed with SDL_GameControllerAddMapping(). | |
| 258 | + * | |
| 259 | + * \param gamecontroller the game controller you want to get the current | |
| 260 | + * mapping for. | |
| 261 | + * \returns a string that has the controller's mapping or NULL if no mapping | |
| 262 | + * is available; call SDL_GetError() for more information. | |
| 263 | + * | |
| 264 | + * \since This function is available since SDL 2.0.0. | |
| 265 | + * | |
| 266 | + * \sa SDL_GameControllerAddMapping | |
| 267 | + * \sa SDL_GameControllerMappingForGUID | |
| 268 | + */ | |
| 269 | +extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController *gamecontroller); | |
| 270 | + | |
| 271 | +/** | |
| 272 | + * Check if the given joystick is supported by the game controller interface. | |
| 273 | + * | |
| 274 | + * `joystick_index` is the same as the `device_index` passed to | |
| 275 | + * SDL_JoystickOpen(). | |
| 276 | + * | |
| 277 | + * \param joystick_index the device_index of a device, up to | |
| 278 | + * SDL_NumJoysticks(). | |
| 279 | + * \returns SDL_TRUE if the given joystick is supported by the game controller | |
| 280 | + * interface, SDL_FALSE if it isn't or it's an invalid index. | |
| 281 | + * | |
| 282 | + * \since This function is available since SDL 2.0.0. | |
| 283 | + * | |
| 284 | + * \sa SDL_GameControllerNameForIndex | |
| 285 | + * \sa SDL_GameControllerOpen | |
| 286 | + */ | |
| 287 | +extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); | |
| 288 | + | |
| 289 | +/** | |
| 290 | + * Get the implementation dependent name for the game controller. | |
| 291 | + * | |
| 292 | + * This function can be called before any controllers are opened. | |
| 293 | + * | |
| 294 | + * `joystick_index` is the same as the `device_index` passed to | |
| 295 | + * SDL_JoystickOpen(). | |
| 296 | + * | |
| 297 | + * \param joystick_index the device_index of a device, from zero to | |
| 298 | + * SDL_NumJoysticks()-1. | |
| 299 | + * \returns the implementation-dependent name for the game controller, or NULL | |
| 300 | + * if there is no name or the index is invalid. | |
| 301 | + * | |
| 302 | + * \since This function is available since SDL 2.0.0. | |
| 303 | + * | |
| 304 | + * \sa SDL_GameControllerName | |
| 305 | + * \sa SDL_GameControllerOpen | |
| 306 | + * \sa SDL_IsGameController | |
| 307 | + */ | |
| 308 | +extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); | |
| 309 | + | |
| 310 | +/** | |
| 311 | + * Get the implementation dependent path for the game controller. | |
| 312 | + * | |
| 313 | + * This function can be called before any controllers are opened. | |
| 314 | + * | |
| 315 | + * `joystick_index` is the same as the `device_index` passed to | |
| 316 | + * SDL_JoystickOpen(). | |
| 317 | + * | |
| 318 | + * \param joystick_index the device_index of a device, from zero to | |
| 319 | + * SDL_NumJoysticks()-1. | |
| 320 | + * \returns the implementation-dependent path for the game controller, or NULL | |
| 321 | + * if there is no path or the index is invalid. | |
| 322 | + * | |
| 323 | + * \since This function is available since SDL 2.24.0. | |
| 324 | + * | |
| 325 | + * \sa SDL_GameControllerPath | |
| 326 | + */ | |
| 327 | +extern DECLSPEC const char *SDLCALL SDL_GameControllerPathForIndex(int joystick_index); | |
| 328 | + | |
| 329 | +/** | |
| 330 | + * Get the type of a game controller. | |
| 331 | + * | |
| 332 | + * This can be called before any controllers are opened. | |
| 333 | + * | |
| 334 | + * \param joystick_index the device_index of a device, from zero to | |
| 335 | + * SDL_NumJoysticks()-1. | |
| 336 | + * \returns the controller type. | |
| 337 | + * | |
| 338 | + * \since This function is available since SDL 2.0.12. | |
| 339 | + */ | |
| 340 | +extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index); | |
| 341 | + | |
| 342 | +/** | |
| 343 | + * Get the mapping of a game controller. | |
| 344 | + * | |
| 345 | + * This can be called before any controllers are opened. | |
| 346 | + * | |
| 347 | + * \param joystick_index the device_index of a device, from zero to | |
| 348 | + * SDL_NumJoysticks()-1. | |
| 349 | + * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if | |
| 350 | + * no mapping is available. | |
| 351 | + * | |
| 352 | + * \since This function is available since SDL 2.0.9. | |
| 353 | + */ | |
| 354 | +extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index); | |
| 355 | + | |
| 356 | +/** | |
| 357 | + * Open a game controller for use. | |
| 358 | + * | |
| 359 | + * `joystick_index` is the same as the `device_index` passed to | |
| 360 | + * SDL_JoystickOpen(). | |
| 361 | + * | |
| 362 | + * The index passed as an argument refers to the N'th game controller on the | |
| 363 | + * system. This index is not the value which will identify this controller in | |
| 364 | + * future controller events. The joystick's instance id (SDL_JoystickID) will | |
| 365 | + * be used there instead. | |
| 366 | + * | |
| 367 | + * \param joystick_index the device_index of a device, up to | |
| 368 | + * SDL_NumJoysticks(). | |
| 369 | + * \returns a gamecontroller identifier or NULL if an error occurred; call | |
| 370 | + * SDL_GetError() for more information. | |
| 371 | + * | |
| 372 | + * \since This function is available since SDL 2.0.0. | |
| 373 | + * | |
| 374 | + * \sa SDL_GameControllerClose | |
| 375 | + * \sa SDL_GameControllerNameForIndex | |
| 376 | + * \sa SDL_IsGameController | |
| 377 | + */ | |
| 378 | +extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); | |
| 379 | + | |
| 380 | +/** | |
| 381 | + * Get the SDL_GameController associated with an instance id. | |
| 382 | + * | |
| 383 | + * \param joyid the instance id to get the SDL_GameController for. | |
| 384 | + * \returns an SDL_GameController on success or NULL on failure; call | |
| 385 | + * SDL_GetError() for more information. | |
| 386 | + * | |
| 387 | + * \since This function is available since SDL 2.0.4. | |
| 388 | + */ | |
| 389 | +extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid); | |
| 390 | + | |
| 391 | +/** | |
| 392 | + * Get the SDL_GameController associated with a player index. | |
| 393 | + * | |
| 394 | + * Please note that the player index is _not_ the device index, nor is it the | |
| 395 | + * instance id! | |
| 396 | + * | |
| 397 | + * \param player_index the player index, which is not the device index or the | |
| 398 | + * instance id! | |
| 399 | + * \returns the SDL_GameController associated with a player index. | |
| 400 | + * | |
| 401 | + * \since This function is available since SDL 2.0.12. | |
| 402 | + * | |
| 403 | + * \sa SDL_GameControllerGetPlayerIndex | |
| 404 | + * \sa SDL_GameControllerSetPlayerIndex | |
| 405 | + */ | |
| 406 | +extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index); | |
| 407 | + | |
| 408 | +/** | |
| 409 | + * Get the implementation-dependent name for an opened game controller. | |
| 410 | + * | |
| 411 | + * This is the same name as returned by SDL_GameControllerNameForIndex(), but | |
| 412 | + * it takes a controller identifier instead of the (unstable) device index. | |
| 413 | + * | |
| 414 | + * \param gamecontroller a game controller identifier previously returned by | |
| 415 | + * SDL_GameControllerOpen(). | |
| 416 | + * \returns the implementation dependent name for the game controller, or NULL | |
| 417 | + * if there is no name or the identifier passed is invalid. | |
| 418 | + * | |
| 419 | + * \since This function is available since SDL 2.0.0. | |
| 420 | + * | |
| 421 | + * \sa SDL_GameControllerNameForIndex | |
| 422 | + * \sa SDL_GameControllerOpen | |
| 423 | + */ | |
| 424 | +extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); | |
| 425 | + | |
| 426 | +/** | |
| 427 | + * Get the implementation-dependent path for an opened game controller. | |
| 428 | + * | |
| 429 | + * This is the same path as returned by SDL_GameControllerNameForIndex(), but | |
| 430 | + * it takes a controller identifier instead of the (unstable) device index. | |
| 431 | + * | |
| 432 | + * \param gamecontroller a game controller identifier previously returned by | |
| 433 | + * SDL_GameControllerOpen(). | |
| 434 | + * \returns the implementation dependent path for the game controller, or NULL | |
| 435 | + * if there is no path or the identifier passed is invalid. | |
| 436 | + * | |
| 437 | + * \since This function is available since SDL 2.24.0. | |
| 438 | + * | |
| 439 | + * \sa SDL_GameControllerPathForIndex | |
| 440 | + */ | |
| 441 | +extern DECLSPEC const char *SDLCALL SDL_GameControllerPath(SDL_GameController *gamecontroller); | |
| 442 | + | |
| 443 | +/** | |
| 444 | + * Get the type of this currently opened controller | |
| 445 | + * | |
| 446 | + * This is the same name as returned by SDL_GameControllerTypeForIndex(), but | |
| 447 | + * it takes a controller identifier instead of the (unstable) device index. | |
| 448 | + * | |
| 449 | + * \param gamecontroller the game controller object to query. | |
| 450 | + * \returns the controller type. | |
| 451 | + * | |
| 452 | + * \since This function is available since SDL 2.0.12. | |
| 453 | + */ | |
| 454 | +extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller); | |
| 455 | + | |
| 456 | +/** | |
| 457 | + * Get the player index of an opened game controller. | |
| 458 | + * | |
| 459 | + * For XInput controllers this returns the XInput user index. | |
| 460 | + * | |
| 461 | + * \param gamecontroller the game controller object to query. | |
| 462 | + * \returns the player index for controller, or -1 if it's not available. | |
| 463 | + * | |
| 464 | + * \since This function is available since SDL 2.0.9. | |
| 465 | + */ | |
| 466 | +extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); | |
| 467 | + | |
| 468 | +/** | |
| 469 | + * Set the player index of an opened game controller. | |
| 470 | + * | |
| 471 | + * \param gamecontroller the game controller object to adjust. | |
| 472 | + * \param player_index Player index to assign to this controller, or -1 to | |
| 473 | + * clear the player index and turn off player LEDs. | |
| 474 | + * | |
| 475 | + * \since This function is available since SDL 2.0.12. | |
| 476 | + */ | |
| 477 | +extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index); | |
| 478 | + | |
| 479 | +/** | |
| 480 | + * Get the USB vendor ID of an opened controller, if available. | |
| 481 | + * | |
| 482 | + * If the vendor ID isn't available this function returns 0. | |
| 483 | + * | |
| 484 | + * \param gamecontroller the game controller object to query. | |
| 485 | + * \return the USB vendor ID, or zero if unavailable. | |
| 486 | + * | |
| 487 | + * \since This function is available since SDL 2.0.6. | |
| 488 | + */ | |
| 489 | +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *gamecontroller); | |
| 490 | + | |
| 491 | +/** | |
| 492 | + * Get the USB product ID of an opened controller, if available. | |
| 493 | + * | |
| 494 | + * If the product ID isn't available this function returns 0. | |
| 495 | + * | |
| 496 | + * \param gamecontroller the game controller object to query. | |
| 497 | + * \return the USB product ID, or zero if unavailable. | |
| 498 | + * | |
| 499 | + * \since This function is available since SDL 2.0.6. | |
| 500 | + */ | |
| 501 | +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *gamecontroller); | |
| 502 | + | |
| 503 | +/** | |
| 504 | + * Get the product version of an opened controller, if available. | |
| 505 | + * | |
| 506 | + * If the product version isn't available this function returns 0. | |
| 507 | + * | |
| 508 | + * \param gamecontroller the game controller object to query. | |
| 509 | + * \return the USB product version, or zero if unavailable. | |
| 510 | + * | |
| 511 | + * \since This function is available since SDL 2.0.6. | |
| 512 | + */ | |
| 513 | +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller); | |
| 514 | + | |
| 515 | +/** | |
| 516 | + * Get the firmware version of an opened controller, if available. | |
| 517 | + * | |
| 518 | + * If the firmware version isn't available this function returns 0. | |
| 519 | + * | |
| 520 | + * \param gamecontroller the game controller object to query. | |
| 521 | + * \return the controller firmware version, or zero if unavailable. | |
| 522 | + * | |
| 523 | + * \since This function is available since SDL 2.24.0. | |
| 524 | + */ | |
| 525 | +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller); | |
| 526 | + | |
| 527 | +/** | |
| 528 | + * Get the serial number of an opened controller, if available. | |
| 529 | + * | |
| 530 | + * Returns the serial number of the controller, or NULL if it is not | |
| 531 | + * available. | |
| 532 | + * | |
| 533 | + * \param gamecontroller the game controller object to query. | |
| 534 | + * \return the serial number, or NULL if unavailable. | |
| 535 | + * | |
| 536 | + * \since This function is available since SDL 2.0.14. | |
| 537 | + */ | |
| 538 | +extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller); | |
| 539 | + | |
| 540 | +/** | |
| 541 | + * Get the Steam Input handle of an opened controller, if available. | |
| 542 | + * | |
| 543 | + * Returns an InputHandle_t for the controller that can be used with Steam | |
| 544 | + * Input API: https://partner.steamgames.com/doc/api/ISteamInput | |
| 545 | + * | |
| 546 | + * \param gamecontroller the game controller object to query. | |
| 547 | + * \returns the gamepad handle, or 0 if unavailable. | |
| 548 | + * | |
| 549 | + * \since This function is available since SDL 2.30.0. | |
| 550 | + */ | |
| 551 | +extern DECLSPEC Uint64 SDLCALL SDL_GameControllerGetSteamHandle(SDL_GameController *gamecontroller); | |
| 552 | + | |
| 553 | + | |
| 554 | +/** | |
| 555 | + * Check if a controller has been opened and is currently connected. | |
| 556 | + * | |
| 557 | + * \param gamecontroller a game controller identifier previously returned by | |
| 558 | + * SDL_GameControllerOpen(). | |
| 559 | + * \returns SDL_TRUE if the controller has been opened and is currently | |
| 560 | + * connected, or SDL_FALSE if not. | |
| 561 | + * | |
| 562 | + * \since This function is available since SDL 2.0.0. | |
| 563 | + * | |
| 564 | + * \sa SDL_GameControllerClose | |
| 565 | + * \sa SDL_GameControllerOpen | |
| 566 | + */ | |
| 567 | +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller); | |
| 568 | + | |
| 569 | +/** | |
| 570 | + * Get the Joystick ID from a Game Controller. | |
| 571 | + * | |
| 572 | + * This function will give you a SDL_Joystick object, which allows you to use | |
| 573 | + * the SDL_Joystick functions with a SDL_GameController object. This would be | |
| 574 | + * useful for getting a joystick's position at any given time, even if it | |
| 575 | + * hasn't moved (moving it would produce an event, which would have the axis' | |
| 576 | + * value). | |
| 577 | + * | |
| 578 | + * The pointer returned is owned by the SDL_GameController. You should not | |
| 579 | + * call SDL_JoystickClose() on it, for example, since doing so will likely | |
| 580 | + * cause SDL to crash. | |
| 581 | + * | |
| 582 | + * \param gamecontroller the game controller object that you want to get a | |
| 583 | + * joystick from. | |
| 584 | + * \returns a SDL_Joystick object; call SDL_GetError() for more information. | |
| 585 | + * | |
| 586 | + * \since This function is available since SDL 2.0.0. | |
| 587 | + */ | |
| 588 | +extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller); | |
| 589 | + | |
| 590 | +/** | |
| 591 | + * Query or change current state of Game Controller events. | |
| 592 | + * | |
| 593 | + * If controller events are disabled, you must call SDL_GameControllerUpdate() | |
| 594 | + * yourself and check the state of the controller when you want controller | |
| 595 | + * information. | |
| 596 | + * | |
| 597 | + * Any number can be passed to SDL_GameControllerEventState(), but only -1, 0, | |
| 598 | + * and 1 will have any effect. Other numbers will just be returned. | |
| 599 | + * | |
| 600 | + * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`. | |
| 601 | + * \returns the same value passed to the function, with exception to -1 | |
| 602 | + * (SDL_QUERY), which will return the current state. | |
| 603 | + * | |
| 604 | + * \since This function is available since SDL 2.0.0. | |
| 605 | + * | |
| 606 | + * \sa SDL_JoystickEventState | |
| 607 | + */ | |
| 608 | +extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state); | |
| 609 | + | |
| 610 | +/** | |
| 611 | + * Manually pump game controller updates if not using the loop. | |
| 612 | + * | |
| 613 | + * This function is called automatically by the event loop if events are | |
| 614 | + * enabled. Under such circumstances, it will not be necessary to call this | |
| 615 | + * function. | |
| 616 | + * | |
| 617 | + * \since This function is available since SDL 2.0.0. | |
| 618 | + */ | |
| 619 | +extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); | |
| 620 | + | |
| 621 | + | |
| 622 | +/** | |
| 623 | + * The list of axes available from a controller | |
| 624 | + * | |
| 625 | + * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to | |
| 626 | + * SDL_JOYSTICK_AXIS_MAX, and are centered within ~8000 of zero, though | |
| 627 | + * advanced UI will allow users to set or autodetect the dead zone, which | |
| 628 | + * varies between controllers. | |
| 629 | + * | |
| 630 | + * Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX (fully | |
| 631 | + * pressed) when reported by SDL_GameControllerGetAxis(). Note that this is | |
| 632 | + * not the same range that will be reported by the lower-level | |
| 633 | + * SDL_GetJoystickAxis(). | |
| 634 | + */ | |
| 635 | +typedef enum SDL_GameControllerAxis | |
| 636 | +{ | |
| 637 | + SDL_CONTROLLER_AXIS_INVALID = -1, | |
| 638 | + SDL_CONTROLLER_AXIS_LEFTX, | |
| 639 | + SDL_CONTROLLER_AXIS_LEFTY, | |
| 640 | + SDL_CONTROLLER_AXIS_RIGHTX, | |
| 641 | + SDL_CONTROLLER_AXIS_RIGHTY, | |
| 642 | + SDL_CONTROLLER_AXIS_TRIGGERLEFT, | |
| 643 | + SDL_CONTROLLER_AXIS_TRIGGERRIGHT, | |
| 644 | + SDL_CONTROLLER_AXIS_MAX | |
| 645 | +} SDL_GameControllerAxis; | |
| 646 | + | |
| 647 | +/** | |
| 648 | + * Convert a string into SDL_GameControllerAxis enum. | |
| 649 | + * | |
| 650 | + * This function is called internally to translate SDL_GameController mapping | |
| 651 | + * strings for the underlying joystick device into the consistent | |
| 652 | + * SDL_GameController mapping. You do not normally need to call this function | |
| 653 | + * unless you are parsing SDL_GameController mappings in your own code. | |
| 654 | + * | |
| 655 | + * Note specially that "righttrigger" and "lefttrigger" map to | |
| 656 | + * `SDL_CONTROLLER_AXIS_TRIGGERRIGHT` and `SDL_CONTROLLER_AXIS_TRIGGERLEFT`, | |
| 657 | + * respectively. | |
| 658 | + * | |
| 659 | + * \param str string representing a SDL_GameController axis. | |
| 660 | + * \returns the SDL_GameControllerAxis enum corresponding to the input string, | |
| 661 | + * or `SDL_CONTROLLER_AXIS_INVALID` if no match was found. | |
| 662 | + * | |
| 663 | + * \since This function is available since SDL 2.0.0. | |
| 664 | + * | |
| 665 | + * \sa SDL_GameControllerGetStringForAxis | |
| 666 | + */ | |
| 667 | +extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *str); | |
| 668 | + | |
| 669 | +/** | |
| 670 | + * Convert from an SDL_GameControllerAxis enum to a string. | |
| 671 | + * | |
| 672 | + * The caller should not SDL_free() the returned string. | |
| 673 | + * | |
| 674 | + * \param axis an enum value for a given SDL_GameControllerAxis. | |
| 675 | + * \returns a string for the given axis, or NULL if an invalid axis is | |
| 676 | + * specified. The string returned is of the format used by | |
| 677 | + * SDL_GameController mapping strings. | |
| 678 | + * | |
| 679 | + * \since This function is available since SDL 2.0.0. | |
| 680 | + * | |
| 681 | + * \sa SDL_GameControllerGetAxisFromString | |
| 682 | + */ | |
| 683 | +extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis); | |
| 684 | + | |
| 685 | +/** | |
| 686 | + * Get the SDL joystick layer binding for a controller axis mapping. | |
| 687 | + * | |
| 688 | + * \param gamecontroller a game controller. | |
| 689 | + * \param axis an axis enum value (one of the SDL_GameControllerAxis values). | |
| 690 | + * \returns a SDL_GameControllerButtonBind describing the bind. On failure | |
| 691 | + * (like the given Controller axis doesn't exist on the device), its | |
| 692 | + * `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`. | |
| 693 | + * | |
| 694 | + * \since This function is available since SDL 2.0.0. | |
| 695 | + * | |
| 696 | + * \sa SDL_GameControllerGetBindForButton | |
| 697 | + */ | |
| 698 | +extern DECLSPEC SDL_GameControllerButtonBind SDLCALL | |
| 699 | +SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, | |
| 700 | + SDL_GameControllerAxis axis); | |
| 701 | + | |
| 702 | +/** | |
| 703 | + * Query whether a game controller has a given axis. | |
| 704 | + * | |
| 705 | + * This merely reports whether the controller's mapping defined this axis, as | |
| 706 | + * that is all the information SDL has about the physical device. | |
| 707 | + * | |
| 708 | + * \param gamecontroller a game controller. | |
| 709 | + * \param axis an axis enum value (an SDL_GameControllerAxis value). | |
| 710 | + * \returns SDL_TRUE if the controller has this axis, SDL_FALSE otherwise. | |
| 711 | + * | |
| 712 | + * \since This function is available since SDL 2.0.14. | |
| 713 | + */ | |
| 714 | +extern DECLSPEC SDL_bool SDLCALL | |
| 715 | +SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); | |
| 716 | + | |
| 717 | +/** | |
| 718 | + * Get the current state of an axis control on a game controller. | |
| 719 | + * | |
| 720 | + * The axis indices start at index 0. | |
| 721 | + * | |
| 722 | + * For thumbsticks, the state is a value ranging from -32768 (up/left) to | |
| 723 | + * 32767 (down/right). | |
| 724 | + * | |
| 725 | + * Triggers range from 0 when released to 32767 when fully pressed, and never | |
| 726 | + * return a negative value. Note that this differs from the value reported by | |
| 727 | + * the lower-level SDL_JoystickGetAxis(), which normally uses the full range. | |
| 728 | + * | |
| 729 | + * \param gamecontroller a game controller. | |
| 730 | + * \param axis an axis index (one of the SDL_GameControllerAxis values). | |
| 731 | + * \returns axis state (including 0) on success or 0 (also) on failure; call | |
| 732 | + * SDL_GetError() for more information. | |
| 733 | + * | |
| 734 | + * \since This function is available since SDL 2.0.0. | |
| 735 | + * | |
| 736 | + * \sa SDL_GameControllerGetButton | |
| 737 | + */ | |
| 738 | +extern DECLSPEC Sint16 SDLCALL | |
| 739 | +SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); | |
| 740 | + | |
| 741 | +/** | |
| 742 | + * The list of buttons available from a controller | |
| 743 | + */ | |
| 744 | +typedef enum SDL_GameControllerButton | |
| 745 | +{ | |
| 746 | + SDL_CONTROLLER_BUTTON_INVALID = -1, | |
| 747 | + SDL_CONTROLLER_BUTTON_A, | |
| 748 | + SDL_CONTROLLER_BUTTON_B, | |
| 749 | + SDL_CONTROLLER_BUTTON_X, | |
| 750 | + SDL_CONTROLLER_BUTTON_Y, | |
| 751 | + SDL_CONTROLLER_BUTTON_BACK, | |
| 752 | + SDL_CONTROLLER_BUTTON_GUIDE, | |
| 753 | + SDL_CONTROLLER_BUTTON_START, | |
| 754 | + SDL_CONTROLLER_BUTTON_LEFTSTICK, | |
| 755 | + SDL_CONTROLLER_BUTTON_RIGHTSTICK, | |
| 756 | + SDL_CONTROLLER_BUTTON_LEFTSHOULDER, | |
| 757 | + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, | |
| 758 | + SDL_CONTROLLER_BUTTON_DPAD_UP, | |
| 759 | + SDL_CONTROLLER_BUTTON_DPAD_DOWN, | |
| 760 | + SDL_CONTROLLER_BUTTON_DPAD_LEFT, | |
| 761 | + SDL_CONTROLLER_BUTTON_DPAD_RIGHT, | |
| 762 | + SDL_CONTROLLER_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button */ | |
| 763 | + SDL_CONTROLLER_BUTTON_PADDLE1, /* Xbox Elite paddle P1 (upper left, facing the back) */ | |
| 764 | + SDL_CONTROLLER_BUTTON_PADDLE2, /* Xbox Elite paddle P3 (upper right, facing the back) */ | |
| 765 | + SDL_CONTROLLER_BUTTON_PADDLE3, /* Xbox Elite paddle P2 (lower left, facing the back) */ | |
| 766 | + SDL_CONTROLLER_BUTTON_PADDLE4, /* Xbox Elite paddle P4 (lower right, facing the back) */ | |
| 767 | + SDL_CONTROLLER_BUTTON_TOUCHPAD, /* PS4/PS5 touchpad button */ | |
| 768 | + SDL_CONTROLLER_BUTTON_MAX | |
| 769 | +} SDL_GameControllerButton; | |
| 770 | + | |
| 771 | +/** | |
| 772 | + * Convert a string into an SDL_GameControllerButton enum. | |
| 773 | + * | |
| 774 | + * This function is called internally to translate SDL_GameController mapping | |
| 775 | + * strings for the underlying joystick device into the consistent | |
| 776 | + * SDL_GameController mapping. You do not normally need to call this function | |
| 777 | + * unless you are parsing SDL_GameController mappings in your own code. | |
| 778 | + * | |
| 779 | + * \param str string representing a SDL_GameController axis. | |
| 780 | + * \returns the SDL_GameControllerButton enum corresponding to the input | |
| 781 | + * string, or `SDL_CONTROLLER_AXIS_INVALID` if no match was found. | |
| 782 | + * | |
| 783 | + * \since This function is available since SDL 2.0.0. | |
| 784 | + */ | |
| 785 | +extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *str); | |
| 786 | + | |
| 787 | +/** | |
| 788 | + * Convert from an SDL_GameControllerButton enum to a string. | |
| 789 | + * | |
| 790 | + * The caller should not SDL_free() the returned string. | |
| 791 | + * | |
| 792 | + * \param button an enum value for a given SDL_GameControllerButton. | |
| 793 | + * \returns a string for the given button, or NULL if an invalid button is | |
| 794 | + * specified. The string returned is of the format used by | |
| 795 | + * SDL_GameController mapping strings. | |
| 796 | + * | |
| 797 | + * \since This function is available since SDL 2.0.0. | |
| 798 | + * | |
| 799 | + * \sa SDL_GameControllerGetButtonFromString | |
| 800 | + */ | |
| 801 | +extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button); | |
| 802 | + | |
| 803 | +/** | |
| 804 | + * Get the SDL joystick layer binding for a controller button mapping. | |
| 805 | + * | |
| 806 | + * \param gamecontroller a game controller. | |
| 807 | + * \param button an button enum value (an SDL_GameControllerButton value). | |
| 808 | + * \returns a SDL_GameControllerButtonBind describing the bind. On failure | |
| 809 | + * (like the given Controller button doesn't exist on the device), | |
| 810 | + * its `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`. | |
| 811 | + * | |
| 812 | + * \since This function is available since SDL 2.0.0. | |
| 813 | + * | |
| 814 | + * \sa SDL_GameControllerGetBindForAxis | |
| 815 | + */ | |
| 816 | +extern DECLSPEC SDL_GameControllerButtonBind SDLCALL | |
| 817 | +SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, | |
| 818 | + SDL_GameControllerButton button); | |
| 819 | + | |
| 820 | +/** | |
| 821 | + * Query whether a game controller has a given button. | |
| 822 | + * | |
| 823 | + * This merely reports whether the controller's mapping defined this button, | |
| 824 | + * as that is all the information SDL has about the physical device. | |
| 825 | + * | |
| 826 | + * \param gamecontroller a game controller. | |
| 827 | + * \param button a button enum value (an SDL_GameControllerButton value). | |
| 828 | + * \returns SDL_TRUE if the controller has this button, SDL_FALSE otherwise. | |
| 829 | + * | |
| 830 | + * \since This function is available since SDL 2.0.14. | |
| 831 | + */ | |
| 832 | +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController *gamecontroller, | |
| 833 | + SDL_GameControllerButton button); | |
| 834 | + | |
| 835 | +/** | |
| 836 | + * Get the current state of a button on a game controller. | |
| 837 | + * | |
| 838 | + * \param gamecontroller a game controller. | |
| 839 | + * \param button a button index (one of the SDL_GameControllerButton values). | |
| 840 | + * \returns 1 for pressed state or 0 for not pressed state or error; call | |
| 841 | + * SDL_GetError() for more information. | |
| 842 | + * | |
| 843 | + * \since This function is available since SDL 2.0.0. | |
| 844 | + * | |
| 845 | + * \sa SDL_GameControllerGetAxis | |
| 846 | + */ | |
| 847 | +extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, | |
| 848 | + SDL_GameControllerButton button); | |
| 849 | + | |
| 850 | +/** | |
| 851 | + * Get the number of touchpads on a game controller. | |
| 852 | + * | |
| 853 | + * \since This function is available since SDL 2.0.14. | |
| 854 | + */ | |
| 855 | +extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpads(SDL_GameController *gamecontroller); | |
| 856 | + | |
| 857 | +/** | |
| 858 | + * Get the number of supported simultaneous fingers on a touchpad on a game | |
| 859 | + * controller. | |
| 860 | + * | |
| 861 | + * \since This function is available since SDL 2.0.14. | |
| 862 | + */ | |
| 863 | +extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpadFingers(SDL_GameController *gamecontroller, int touchpad); | |
| 864 | + | |
| 865 | +/** | |
| 866 | + * Get the current state of a finger on a touchpad on a game controller. | |
| 867 | + * | |
| 868 | + * \since This function is available since SDL 2.0.14. | |
| 869 | + */ | |
| 870 | +extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure); | |
| 871 | + | |
| 872 | +/** | |
| 873 | + * Return whether a game controller has a particular sensor. | |
| 874 | + * | |
| 875 | + * \param gamecontroller The controller to query. | |
| 876 | + * \param type The type of sensor to query. | |
| 877 | + * \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise. | |
| 878 | + * | |
| 879 | + * \since This function is available since SDL 2.0.14. | |
| 880 | + */ | |
| 881 | +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController *gamecontroller, SDL_SensorType type); | |
| 882 | + | |
| 883 | +/** | |
| 884 | + * Set whether data reporting for a game controller sensor is enabled. | |
| 885 | + * | |
| 886 | + * \param gamecontroller The controller to update. | |
| 887 | + * \param type The type of sensor to enable/disable. | |
| 888 | + * \param enabled Whether data reporting should be enabled. | |
| 889 | + * \returns 0 or -1 if an error occurred. | |
| 890 | + * | |
| 891 | + * \since This function is available since SDL 2.0.14. | |
| 892 | + */ | |
| 893 | +extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type, SDL_bool enabled); | |
| 894 | + | |
| 895 | +/** | |
| 896 | + * Query whether sensor data reporting is enabled for a game controller. | |
| 897 | + * | |
| 898 | + * \param gamecontroller The controller to query. | |
| 899 | + * \param type The type of sensor to query. | |
| 900 | + * \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise. | |
| 901 | + * | |
| 902 | + * \since This function is available since SDL 2.0.14. | |
| 903 | + */ | |
| 904 | +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type); | |
| 905 | + | |
| 906 | +/** | |
| 907 | + * Get the data rate (number of events per second) of a game controller | |
| 908 | + * sensor. | |
| 909 | + * | |
| 910 | + * \param gamecontroller The controller to query. | |
| 911 | + * \param type The type of sensor to query. | |
| 912 | + * \return the data rate, or 0.0f if the data rate is not available. | |
| 913 | + * | |
| 914 | + * \since This function is available since SDL 2.0.16. | |
| 915 | + */ | |
| 916 | +extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameController *gamecontroller, SDL_SensorType type); | |
| 917 | + | |
| 918 | +/** | |
| 919 | + * Get the current state of a game controller sensor. | |
| 920 | + * | |
| 921 | + * The number of values and interpretation of the data is sensor dependent. | |
| 922 | + * See SDL_sensor.h for the details for each type of sensor. | |
| 923 | + * | |
| 924 | + * \param gamecontroller The controller to query. | |
| 925 | + * \param type The type of sensor to query. | |
| 926 | + * \param data A pointer filled with the current sensor state. | |
| 927 | + * \param num_values The number of values to write to data. | |
| 928 | + * \return 0 or -1 if an error occurred. | |
| 929 | + * | |
| 930 | + * \since This function is available since SDL 2.0.14. | |
| 931 | + */ | |
| 932 | +extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values); | |
| 933 | + | |
| 934 | +/** | |
| 935 | + * Get the current state of a game controller sensor with the timestamp of the | |
| 936 | + * last update. | |
| 937 | + * | |
| 938 | + * The number of values and interpretation of the data is sensor dependent. | |
| 939 | + * See SDL_sensor.h for the details for each type of sensor. | |
| 940 | + * | |
| 941 | + * \param gamecontroller The controller to query. | |
| 942 | + * \param type The type of sensor to query. | |
| 943 | + * \param timestamp A pointer filled with the timestamp in microseconds of the | |
| 944 | + * current sensor reading if available, or 0 if not. | |
| 945 | + * \param data A pointer filled with the current sensor state. | |
| 946 | + * \param num_values The number of values to write to data. | |
| 947 | + * \return 0 or -1 if an error occurred. | |
| 948 | + * | |
| 949 | + * \since This function is available since SDL 2.26.0. | |
| 950 | + */ | |
| 951 | +extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller, SDL_SensorType type, Uint64 *timestamp, float *data, int num_values); | |
| 952 | + | |
| 953 | +/** | |
| 954 | + * Start a rumble effect on a game controller. | |
| 955 | + * | |
| 956 | + * Each call to this function cancels any previous rumble effect, and calling | |
| 957 | + * it with 0 intensity stops any rumbling. | |
| 958 | + * | |
| 959 | + * \param gamecontroller The controller to vibrate. | |
| 960 | + * \param low_frequency_rumble The intensity of the low frequency (left) | |
| 961 | + * rumble motor, from 0 to 0xFFFF. | |
| 962 | + * \param high_frequency_rumble The intensity of the high frequency (right) | |
| 963 | + * rumble motor, from 0 to 0xFFFF. | |
| 964 | + * \param duration_ms The duration of the rumble effect, in milliseconds. | |
| 965 | + * \returns 0, or -1 if rumble isn't supported on this controller. | |
| 966 | + * | |
| 967 | + * \since This function is available since SDL 2.0.9. | |
| 968 | + * | |
| 969 | + * \sa SDL_GameControllerHasRumble | |
| 970 | + */ | |
| 971 | +extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); | |
| 972 | + | |
| 973 | +/** | |
| 974 | + * Start a rumble effect in the game controller's triggers. | |
| 975 | + * | |
| 976 | + * Each call to this function cancels any previous trigger rumble effect, and | |
| 977 | + * calling it with 0 intensity stops any rumbling. | |
| 978 | + * | |
| 979 | + * Note that this is rumbling of the _triggers_ and not the game controller as | |
| 980 | + * a whole. This is currently only supported on Xbox One controllers. If you | |
| 981 | + * want the (more common) whole-controller rumble, use | |
| 982 | + * SDL_GameControllerRumble() instead. | |
| 983 | + * | |
| 984 | + * \param gamecontroller The controller to vibrate. | |
| 985 | + * \param left_rumble The intensity of the left trigger rumble motor, from 0 | |
| 986 | + * to 0xFFFF. | |
| 987 | + * \param right_rumble The intensity of the right trigger rumble motor, from 0 | |
| 988 | + * to 0xFFFF. | |
| 989 | + * \param duration_ms The duration of the rumble effect, in milliseconds. | |
| 990 | + * \returns 0, or -1 if trigger rumble isn't supported on this controller. | |
| 991 | + * | |
| 992 | + * \since This function is available since SDL 2.0.14. | |
| 993 | + * | |
| 994 | + * \sa SDL_GameControllerHasRumbleTriggers | |
| 995 | + */ | |
| 996 | +extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); | |
| 997 | + | |
| 998 | +/** | |
| 999 | + * Query whether a game controller has an LED. | |
| 1000 | + * | |
| 1001 | + * \param gamecontroller The controller to query. | |
| 1002 | + * \returns SDL_TRUE, or SDL_FALSE if this controller does not have a | |
| 1003 | + * modifiable LED. | |
| 1004 | + * | |
| 1005 | + * \since This function is available since SDL 2.0.14. | |
| 1006 | + */ | |
| 1007 | +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *gamecontroller); | |
| 1008 | + | |
| 1009 | +/** | |
| 1010 | + * Query whether a game controller has rumble support. | |
| 1011 | + * | |
| 1012 | + * \param gamecontroller The controller to query. | |
| 1013 | + * \returns SDL_TRUE, or SDL_FALSE if this controller does not have rumble | |
| 1014 | + * support. | |
| 1015 | + * | |
| 1016 | + * \since This function is available since SDL 2.0.18. | |
| 1017 | + * | |
| 1018 | + * \sa SDL_GameControllerRumble | |
| 1019 | + */ | |
| 1020 | +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumble(SDL_GameController *gamecontroller); | |
| 1021 | + | |
| 1022 | +/** | |
| 1023 | + * Query whether a game controller has rumble support on triggers. | |
| 1024 | + * | |
| 1025 | + * \param gamecontroller The controller to query. | |
| 1026 | + * \returns SDL_TRUE, or SDL_FALSE if this controller does not have trigger | |
| 1027 | + * rumble support. | |
| 1028 | + * | |
| 1029 | + * \since This function is available since SDL 2.0.18. | |
| 1030 | + * | |
| 1031 | + * \sa SDL_GameControllerRumbleTriggers | |
| 1032 | + */ | |
| 1033 | +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumbleTriggers(SDL_GameController *gamecontroller); | |
| 1034 | + | |
| 1035 | +/** | |
| 1036 | + * Update a game controller's LED color. | |
| 1037 | + * | |
| 1038 | + * \param gamecontroller The controller to update. | |
| 1039 | + * \param red The intensity of the red LED. | |
| 1040 | + * \param green The intensity of the green LED. | |
| 1041 | + * \param blue The intensity of the blue LED. | |
| 1042 | + * \returns 0, or -1 if this controller does not have a modifiable LED. | |
| 1043 | + * | |
| 1044 | + * \since This function is available since SDL 2.0.14. | |
| 1045 | + */ | |
| 1046 | +extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 green, Uint8 blue); | |
| 1047 | + | |
| 1048 | +/** | |
| 1049 | + * Send a controller specific effect packet | |
| 1050 | + * | |
| 1051 | + * \param gamecontroller The controller to affect. | |
| 1052 | + * \param data The data to send to the controller. | |
| 1053 | + * \param size The size of the data to send to the controller. | |
| 1054 | + * \returns 0, or -1 if this controller or driver doesn't support effect | |
| 1055 | + * packets. | |
| 1056 | + * | |
| 1057 | + * \since This function is available since SDL 2.0.16. | |
| 1058 | + */ | |
| 1059 | +extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gamecontroller, const void *data, int size); | |
| 1060 | + | |
| 1061 | +/** | |
| 1062 | + * Close a game controller previously opened with SDL_GameControllerOpen(). | |
| 1063 | + * | |
| 1064 | + * \param gamecontroller a game controller identifier previously returned by | |
| 1065 | + * SDL_GameControllerOpen(). | |
| 1066 | + * | |
| 1067 | + * \since This function is available since SDL 2.0.0. | |
| 1068 | + * | |
| 1069 | + * \sa SDL_GameControllerOpen | |
| 1070 | + */ | |
| 1071 | +extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller); | |
| 1072 | + | |
| 1073 | +/** | |
| 1074 | + * Return the sfSymbolsName for a given button on a game controller on Apple | |
| 1075 | + * platforms. | |
| 1076 | + * | |
| 1077 | + * \param gamecontroller the controller to query. | |
| 1078 | + * \param button a button on the game controller. | |
| 1079 | + * \returns the sfSymbolsName or NULL if the name can't be found. | |
| 1080 | + * | |
| 1081 | + * \since This function is available since SDL 2.0.18. | |
| 1082 | + * | |
| 1083 | + * \sa SDL_GameControllerGetAppleSFSymbolsNameForAxis | |
| 1084 | + */ | |
| 1085 | +extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); | |
| 1086 | + | |
| 1087 | +/** | |
| 1088 | + * Return the sfSymbolsName for a given axis on a game controller on Apple | |
| 1089 | + * platforms. | |
| 1090 | + * | |
| 1091 | + * \param gamecontroller the controller to query. | |
| 1092 | + * \param axis an axis on the game controller. | |
| 1093 | + * \returns the sfSymbolsName or NULL if the name can't be found. | |
| 1094 | + * | |
| 1095 | + * \since This function is available since SDL 2.0.18. | |
| 1096 | + * | |
| 1097 | + * \sa SDL_GameControllerGetAppleSFSymbolsNameForButton | |
| 1098 | + */ | |
| 1099 | +extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); | |
| 1100 | + | |
| 1101 | + | |
| 1102 | +/* Ends C function definitions when using C++ */ | |
| 1103 | +#ifdef __cplusplus | |
| 1104 | +} | |
| 1105 | +#endif | |
| 1106 | +#include "close_code.h" | |
| 1107 | + | |
| 1108 | +#endif /* SDL_gamecontroller_h_ */ | |
| 1109 | + | |
| 1110 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,117 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryGesture | |
| 24 | + * | |
| 25 | + * Include file for SDL gesture event handling. | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_gesture_h_ | |
| 29 | +#define SDL_gesture_h_ | |
| 30 | + | |
| 31 | +#include "SDL_stdinc.h" | |
| 32 | +#include "SDL_error.h" | |
| 33 | +#include "SDL_video.h" | |
| 34 | + | |
| 35 | +#include "SDL_touch.h" | |
| 36 | + | |
| 37 | + | |
| 38 | +#include "begin_code.h" | |
| 39 | +/* Set up for C function definitions, even when using C++ */ | |
| 40 | +#ifdef __cplusplus | |
| 41 | +extern "C" { | |
| 42 | +#endif | |
| 43 | + | |
| 44 | +typedef Sint64 SDL_GestureID; | |
| 45 | + | |
| 46 | +/* Function prototypes */ | |
| 47 | + | |
| 48 | +/** | |
| 49 | + * Begin recording a gesture on a specified touch device or all touch devices. | |
| 50 | + * | |
| 51 | + * If the parameter `touchId` is -1 (i.e., all devices), this function will | |
| 52 | + * always return 1, regardless of whether there actually are any devices. | |
| 53 | + * | |
| 54 | + * \param touchId the touch device id, or -1 for all touch devices. | |
| 55 | + * \returns 1 on success or 0 if the specified device could not be found. | |
| 56 | + * | |
| 57 | + * \since This function is available since SDL 2.0.0. | |
| 58 | + * | |
| 59 | + * \sa SDL_GetTouchDevice | |
| 60 | + */ | |
| 61 | +extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); | |
| 62 | + | |
| 63 | + | |
| 64 | +/** | |
| 65 | + * Save all currently loaded Dollar Gesture templates. | |
| 66 | + * | |
| 67 | + * \param dst a SDL_RWops to save to. | |
| 68 | + * \returns the number of saved templates on success or 0 on failure; call | |
| 69 | + * SDL_GetError() for more information. | |
| 70 | + * | |
| 71 | + * \since This function is available since SDL 2.0.0. | |
| 72 | + * | |
| 73 | + * \sa SDL_LoadDollarTemplates | |
| 74 | + * \sa SDL_SaveDollarTemplate | |
| 75 | + */ | |
| 76 | +extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); | |
| 77 | + | |
| 78 | +/** | |
| 79 | + * Save a currently loaded Dollar Gesture template. | |
| 80 | + * | |
| 81 | + * \param gestureId a gesture id. | |
| 82 | + * \param dst a SDL_RWops to save to. | |
| 83 | + * \returns 1 on success or 0 on failure; call SDL_GetError() for more | |
| 84 | + * information. | |
| 85 | + * | |
| 86 | + * \since This function is available since SDL 2.0.0. | |
| 87 | + * | |
| 88 | + * \sa SDL_LoadDollarTemplates | |
| 89 | + * \sa SDL_SaveAllDollarTemplates | |
| 90 | + */ | |
| 91 | +extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); | |
| 92 | + | |
| 93 | + | |
| 94 | +/** | |
| 95 | + * Load Dollar Gesture templates from a file. | |
| 96 | + * | |
| 97 | + * \param touchId a touch id. | |
| 98 | + * \param src a SDL_RWops to load from. | |
| 99 | + * \returns the number of loaded templates on success or a negative error code | |
| 100 | + * (or 0) on failure; call SDL_GetError() for more information. | |
| 101 | + * | |
| 102 | + * \since This function is available since SDL 2.0.0. | |
| 103 | + * | |
| 104 | + * \sa SDL_SaveAllDollarTemplates | |
| 105 | + * \sa SDL_SaveDollarTemplate | |
| 106 | + */ | |
| 107 | +extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); | |
| 108 | + | |
| 109 | +/* Ends C function definitions when using C++ */ | |
| 110 | +#ifdef __cplusplus | |
| 111 | +} | |
| 112 | +#endif | |
| 113 | +#include "close_code.h" | |
| 114 | + | |
| 115 | +#endif /* SDL_gesture_h_ */ | |
| 116 | + | |
| 117 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,107 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | +/* WIKI CATEGORY: GUID */ | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * # CategoryGUID | |
| 26 | + * | |
| 27 | + * A GUID is a 128-bit value that represents something that is uniquely | |
| 28 | + * identifiable by this value: "globally unique." | |
| 29 | + */ | |
| 30 | + | |
| 31 | +#ifndef SDL_guid_h_ | |
| 32 | +#define SDL_guid_h_ | |
| 33 | + | |
| 34 | +#include "SDL_stdinc.h" | |
| 35 | +#include "SDL_error.h" | |
| 36 | + | |
| 37 | +#include "begin_code.h" | |
| 38 | +/* Set up for C function definitions, even when using C++ */ | |
| 39 | +#ifdef __cplusplus | |
| 40 | +extern "C" { | |
| 41 | +#endif | |
| 42 | + | |
| 43 | +/** | |
| 44 | + * An SDL_GUID is a 128-bit identifier. | |
| 45 | + * | |
| 46 | + * This is an acronym for "Globally Unique ID." | |
| 47 | + * | |
| 48 | + * While a GUID can be used to assign a unique value to almost anything, in | |
| 49 | + * SDL these are largely used to identify input devices across runs of SDL | |
| 50 | + * programs on the same platform.If the device is detached and then | |
| 51 | + * re-attached to a different port, or if the base system is rebooted, the | |
| 52 | + * device should still report the same GUID. | |
| 53 | + * | |
| 54 | + * GUIDs are as precise as possible but are not guaranteed to distinguish | |
| 55 | + * physically distinct but equivalent devices. For example, two game | |
| 56 | + * controllers from the same vendor with the same product ID and revision may | |
| 57 | + * have the same GUID. | |
| 58 | + * | |
| 59 | + * GUIDs may be platform-dependent (i.e., the same device may report different | |
| 60 | + * GUIDs on different operating systems). | |
| 61 | + */ | |
| 62 | +typedef struct SDL_GUID { | |
| 63 | + Uint8 data[16]; | |
| 64 | +} SDL_GUID; | |
| 65 | + | |
| 66 | +/* Function prototypes */ | |
| 67 | + | |
| 68 | +/** | |
| 69 | + * Get an ASCII string representation for a given SDL_GUID. | |
| 70 | + * | |
| 71 | + * You should supply at least 33 bytes for pszGUID. | |
| 72 | + * | |
| 73 | + * \param guid the SDL_GUID you wish to convert to string. | |
| 74 | + * \param pszGUID buffer in which to write the ASCII string. | |
| 75 | + * \param cbGUID the size of pszGUID. | |
| 76 | + * | |
| 77 | + * \since This function is available since SDL 2.24.0. | |
| 78 | + * | |
| 79 | + * \sa SDL_GUIDFromString | |
| 80 | + */ | |
| 81 | +extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); | |
| 82 | + | |
| 83 | +/** | |
| 84 | + * Convert a GUID string into a SDL_GUID structure. | |
| 85 | + * | |
| 86 | + * Performs no error checking. If this function is given a string containing | |
| 87 | + * an invalid GUID, the function will silently succeed, but the GUID generated | |
| 88 | + * will not be useful. | |
| 89 | + * | |
| 90 | + * \param pchGUID string containing an ASCII representation of a GUID. | |
| 91 | + * \returns a SDL_GUID structure. | |
| 92 | + * | |
| 93 | + * \since This function is available since SDL 2.24.0. | |
| 94 | + * | |
| 95 | + * \sa SDL_GUIDToString | |
| 96 | + */ | |
| 97 | +extern DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID); | |
| 98 | + | |
| 99 | +/* Ends C function definitions when using C++ */ | |
| 100 | +#ifdef __cplusplus | |
| 101 | +} | |
| 102 | +#endif | |
| 103 | +#include "close_code.h" | |
| 104 | + | |
| 105 | +#endif /* SDL_guid_h_ */ | |
| 106 | + | |
| 107 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,1354 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryHaptic | |
| 24 | + * | |
| 25 | + * SDL haptic subsystem allows you to control haptic (force feedback) devices. | |
| 26 | + * | |
| 27 | + * The basic usage is as follows: | |
| 28 | + * | |
| 29 | + * - Initialize the subsystem (SDL_INIT_HAPTIC). | |
| 30 | + * - Open a haptic device. | |
| 31 | + * - SDL_HapticOpen() to open from index. | |
| 32 | + * - SDL_HapticOpenFromJoystick() to open from an existing joystick. | |
| 33 | + * - Create an effect (SDL_HapticEffect). | |
| 34 | + * - Upload the effect with SDL_HapticNewEffect(). | |
| 35 | + * - Run the effect with SDL_HapticRunEffect(). | |
| 36 | + * - (optional) Free the effect with SDL_HapticDestroyEffect(). | |
| 37 | + * - Close the haptic device with SDL_HapticClose(). | |
| 38 | + * | |
| 39 | + * Simple rumble example: | |
| 40 | + * | |
| 41 | + * ```c | |
| 42 | + * SDL_Haptic *haptic; | |
| 43 | + * | |
| 44 | + * // Open the device | |
| 45 | + * haptic = SDL_HapticOpen( 0 ); | |
| 46 | + * if (haptic == NULL) | |
| 47 | + * return -1; | |
| 48 | + * | |
| 49 | + * // Initialize simple rumble | |
| 50 | + * if (SDL_HapticRumbleInit( haptic ) != 0) | |
| 51 | + * return -1; | |
| 52 | + * | |
| 53 | + * // Play effect at 50% strength for 2 seconds | |
| 54 | + * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0) | |
| 55 | + * return -1; | |
| 56 | + * SDL_Delay( 2000 ); | |
| 57 | + * | |
| 58 | + * // Clean up | |
| 59 | + * SDL_HapticClose( haptic ); | |
| 60 | + * ``` | |
| 61 | + * | |
| 62 | + * Complete example: | |
| 63 | + * | |
| 64 | + * ```c | |
| 65 | + * int test_haptic( SDL_Joystick * joystick ) { | |
| 66 | + * SDL_Haptic *haptic; | |
| 67 | + * SDL_HapticEffect effect; | |
| 68 | + * int effect_id; | |
| 69 | + * | |
| 70 | + * // Open the device | |
| 71 | + * haptic = SDL_HapticOpenFromJoystick( joystick ); | |
| 72 | + * if (haptic == NULL) return -1; // Most likely joystick isn't haptic | |
| 73 | + * | |
| 74 | + * // See if it can do sine waves | |
| 75 | + * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) { | |
| 76 | + * SDL_HapticClose(haptic); // No sine effect | |
| 77 | + * return -1; | |
| 78 | + * } | |
| 79 | + * | |
| 80 | + * // Create the effect | |
| 81 | + * SDL_memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default | |
| 82 | + * effect.type = SDL_HAPTIC_SINE; | |
| 83 | + * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates | |
| 84 | + * effect.periodic.direction.dir[0] = 18000; // Force comes from south | |
| 85 | + * effect.periodic.period = 1000; // 1000 ms | |
| 86 | + * effect.periodic.magnitude = 20000; // 20000/32767 strength | |
| 87 | + * effect.periodic.length = 5000; // 5 seconds long | |
| 88 | + * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength | |
| 89 | + * effect.periodic.fade_length = 1000; // Takes 1 second to fade away | |
| 90 | + * | |
| 91 | + * // Upload the effect | |
| 92 | + * effect_id = SDL_HapticNewEffect( haptic, &effect ); | |
| 93 | + * | |
| 94 | + * // Test the effect | |
| 95 | + * SDL_HapticRunEffect( haptic, effect_id, 1 ); | |
| 96 | + * SDL_Delay( 5000); // Wait for the effect to finish | |
| 97 | + * | |
| 98 | + * // We destroy the effect, although closing the device also does this | |
| 99 | + * SDL_HapticDestroyEffect( haptic, effect_id ); | |
| 100 | + * | |
| 101 | + * // Close the device | |
| 102 | + * SDL_HapticClose(haptic); | |
| 103 | + * | |
| 104 | + * return 0; // Success | |
| 105 | + * } | |
| 106 | + * ``` | |
| 107 | + */ | |
| 108 | + | |
| 109 | +#ifndef SDL_haptic_h_ | |
| 110 | +#define SDL_haptic_h_ | |
| 111 | + | |
| 112 | +#include "SDL_stdinc.h" | |
| 113 | +#include "SDL_error.h" | |
| 114 | +#include "SDL_joystick.h" | |
| 115 | + | |
| 116 | +#include "begin_code.h" | |
| 117 | +/* Set up for C function definitions, even when using C++ */ | |
| 118 | +#ifdef __cplusplus | |
| 119 | +extern "C" { | |
| 120 | +#endif /* __cplusplus */ | |
| 121 | + | |
| 122 | +/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF). | |
| 123 | + * | |
| 124 | + * At the moment the magnitude variables are mixed between signed/unsigned, and | |
| 125 | + * it is also not made clear that ALL of those variables expect a max of 0x7FFF. | |
| 126 | + * | |
| 127 | + * Some platforms may have higher precision than that (Linux FF, Windows XInput) | |
| 128 | + * so we should fix the inconsistency in favor of higher possible precision, | |
| 129 | + * adjusting for platforms that use different scales. | |
| 130 | + * -flibit | |
| 131 | + */ | |
| 132 | + | |
| 133 | +/** | |
| 134 | + * \typedef SDL_Haptic | |
| 135 | + * | |
| 136 | + * \brief The haptic structure used to identify an SDL haptic. | |
| 137 | + * | |
| 138 | + * \sa SDL_HapticOpen | |
| 139 | + * \sa SDL_HapticOpenFromJoystick | |
| 140 | + * \sa SDL_HapticClose | |
| 141 | + */ | |
| 142 | +struct _SDL_Haptic; | |
| 143 | +typedef struct _SDL_Haptic SDL_Haptic; | |
| 144 | + | |
| 145 | + | |
| 146 | +/** | |
| 147 | + * \name Haptic features | |
| 148 | + * | |
| 149 | + * Different haptic features a device can have. | |
| 150 | + */ | |
| 151 | +/* @{ */ | |
| 152 | + | |
| 153 | +/** | |
| 154 | + * \name Haptic effects | |
| 155 | + */ | |
| 156 | +/* @{ */ | |
| 157 | + | |
| 158 | +/** | |
| 159 | + * Constant effect supported. | |
| 160 | + * | |
| 161 | + * Constant haptic effect. | |
| 162 | + * | |
| 163 | + * \sa SDL_HapticCondition | |
| 164 | + */ | |
| 165 | +#define SDL_HAPTIC_CONSTANT (1u<<0) | |
| 166 | + | |
| 167 | +/** | |
| 168 | + * Sine wave effect supported. | |
| 169 | + * | |
| 170 | + * Periodic haptic effect that simulates sine waves. | |
| 171 | + * | |
| 172 | + * \sa SDL_HapticPeriodic | |
| 173 | + */ | |
| 174 | +#define SDL_HAPTIC_SINE (1u<<1) | |
| 175 | + | |
| 176 | +/** | |
| 177 | + * Left/Right effect supported. | |
| 178 | + * | |
| 179 | + * Haptic effect for direct control over high/low frequency motors. | |
| 180 | + * | |
| 181 | + * \sa SDL_HapticLeftRight | |
| 182 | + */ | |
| 183 | +#define SDL_HAPTIC_LEFTRIGHT (1u<<2) | |
| 184 | + | |
| 185 | +/* !!! FIXME: put this back when we have more bits in 2.1 */ | |
| 186 | +/* #define SDL_HAPTIC_SQUARE (1<<2) */ | |
| 187 | + | |
| 188 | +/** | |
| 189 | + * Triangle wave effect supported. | |
| 190 | + * | |
| 191 | + * Periodic haptic effect that simulates triangular waves. | |
| 192 | + * | |
| 193 | + * \sa SDL_HapticPeriodic | |
| 194 | + */ | |
| 195 | +#define SDL_HAPTIC_TRIANGLE (1u<<3) | |
| 196 | + | |
| 197 | +/** | |
| 198 | + * Sawtoothup wave effect supported. | |
| 199 | + * | |
| 200 | + * Periodic haptic effect that simulates saw tooth up waves. | |
| 201 | + * | |
| 202 | + * \sa SDL_HapticPeriodic | |
| 203 | + */ | |
| 204 | +#define SDL_HAPTIC_SAWTOOTHUP (1u<<4) | |
| 205 | + | |
| 206 | +/** | |
| 207 | + * Sawtoothdown wave effect supported. | |
| 208 | + * | |
| 209 | + * Periodic haptic effect that simulates saw tooth down waves. | |
| 210 | + * | |
| 211 | + * \sa SDL_HapticPeriodic | |
| 212 | + */ | |
| 213 | +#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5) | |
| 214 | + | |
| 215 | +/** | |
| 216 | + * Ramp effect supported. | |
| 217 | + * | |
| 218 | + * Ramp haptic effect. | |
| 219 | + * | |
| 220 | + * \sa SDL_HapticRamp | |
| 221 | + */ | |
| 222 | +#define SDL_HAPTIC_RAMP (1u<<6) | |
| 223 | + | |
| 224 | +/** | |
| 225 | + * Spring effect supported - uses axes position. | |
| 226 | + * | |
| 227 | + * Condition haptic effect that simulates a spring. Effect is based on the | |
| 228 | + * axes position. | |
| 229 | + * | |
| 230 | + * \sa SDL_HapticCondition | |
| 231 | + */ | |
| 232 | +#define SDL_HAPTIC_SPRING (1u<<7) | |
| 233 | + | |
| 234 | +/** | |
| 235 | + * Damper effect supported - uses axes velocity. | |
| 236 | + * | |
| 237 | + * Condition haptic effect that simulates dampening. Effect is based on the | |
| 238 | + * axes velocity. | |
| 239 | + * | |
| 240 | + * \sa SDL_HapticCondition | |
| 241 | + */ | |
| 242 | +#define SDL_HAPTIC_DAMPER (1u<<8) | |
| 243 | + | |
| 244 | +/** | |
| 245 | + * Inertia effect supported - uses axes acceleration. | |
| 246 | + * | |
| 247 | + * Condition haptic effect that simulates inertia. Effect is based on the axes | |
| 248 | + * acceleration. | |
| 249 | + * | |
| 250 | + * \sa SDL_HapticCondition | |
| 251 | + */ | |
| 252 | +#define SDL_HAPTIC_INERTIA (1u<<9) | |
| 253 | + | |
| 254 | +/** | |
| 255 | + * Friction effect supported - uses axes movement. | |
| 256 | + * | |
| 257 | + * Condition haptic effect that simulates friction. Effect is based on the | |
| 258 | + * axes movement. | |
| 259 | + * | |
| 260 | + * \sa SDL_HapticCondition | |
| 261 | + */ | |
| 262 | +#define SDL_HAPTIC_FRICTION (1u<<10) | |
| 263 | + | |
| 264 | +/** | |
| 265 | + * Custom effect is supported. | |
| 266 | + * | |
| 267 | + * User defined custom haptic effect. | |
| 268 | + */ | |
| 269 | +#define SDL_HAPTIC_CUSTOM (1u<<11) | |
| 270 | + | |
| 271 | +/* @} *//* Haptic effects */ | |
| 272 | + | |
| 273 | +/* These last few are features the device has, not effects */ | |
| 274 | + | |
| 275 | +/** | |
| 276 | + * Device can set global gain. | |
| 277 | + * | |
| 278 | + * Device supports setting the global gain. | |
| 279 | + * | |
| 280 | + * \sa SDL_HapticSetGain | |
| 281 | + */ | |
| 282 | +#define SDL_HAPTIC_GAIN (1u<<12) | |
| 283 | + | |
| 284 | +/** | |
| 285 | + * Device can set autocenter. | |
| 286 | + * | |
| 287 | + * Device supports setting autocenter. | |
| 288 | + * | |
| 289 | + * \sa SDL_HapticSetAutocenter | |
| 290 | + */ | |
| 291 | +#define SDL_HAPTIC_AUTOCENTER (1u<<13) | |
| 292 | + | |
| 293 | +/** | |
| 294 | + * Device can be queried for effect status. | |
| 295 | + * | |
| 296 | + * Device supports querying effect status. | |
| 297 | + * | |
| 298 | + * \sa SDL_HapticGetEffectStatus | |
| 299 | + */ | |
| 300 | +#define SDL_HAPTIC_STATUS (1u<<14) | |
| 301 | + | |
| 302 | +/** | |
| 303 | + * Device can be paused. | |
| 304 | + * | |
| 305 | + * Devices supports being paused. | |
| 306 | + * | |
| 307 | + * \sa SDL_HapticPause | |
| 308 | + * \sa SDL_HapticUnpause | |
| 309 | + */ | |
| 310 | +#define SDL_HAPTIC_PAUSE (1u<<15) | |
| 311 | + | |
| 312 | + | |
| 313 | +/** | |
| 314 | + * \name Direction encodings | |
| 315 | + */ | |
| 316 | +/* @{ */ | |
| 317 | + | |
| 318 | +/** | |
| 319 | + * Uses polar coordinates for the direction. | |
| 320 | + * | |
| 321 | + * \sa SDL_HapticDirection | |
| 322 | + */ | |
| 323 | +#define SDL_HAPTIC_POLAR 0 | |
| 324 | + | |
| 325 | +/** | |
| 326 | + * Uses cartesian coordinates for the direction. | |
| 327 | + * | |
| 328 | + * \sa SDL_HapticDirection | |
| 329 | + */ | |
| 330 | +#define SDL_HAPTIC_CARTESIAN 1 | |
| 331 | + | |
| 332 | +/** | |
| 333 | + * Uses spherical coordinates for the direction. | |
| 334 | + * | |
| 335 | + * \sa SDL_HapticDirection | |
| 336 | + */ | |
| 337 | +#define SDL_HAPTIC_SPHERICAL 2 | |
| 338 | + | |
| 339 | +/** | |
| 340 | + * Use this value to play an effect on the steering wheel axis. | |
| 341 | + * | |
| 342 | + * This provides better compatibility across platforms and devices as SDL will | |
| 343 | + * guess the correct axis. | |
| 344 | + * | |
| 345 | + * \sa SDL_HapticDirection | |
| 346 | + */ | |
| 347 | +#define SDL_HAPTIC_STEERING_AXIS 3 | |
| 348 | + | |
| 349 | +/* @} *//* Direction encodings */ | |
| 350 | + | |
| 351 | +/* @} *//* Haptic features */ | |
| 352 | + | |
| 353 | +/* | |
| 354 | + * Misc defines. | |
| 355 | + */ | |
| 356 | + | |
| 357 | +/** | |
| 358 | + * Used to play a device an infinite number of times. | |
| 359 | + * | |
| 360 | + * \sa SDL_HapticRunEffect | |
| 361 | + */ | |
| 362 | +#define SDL_HAPTIC_INFINITY 4294967295U | |
| 363 | + | |
| 364 | + | |
| 365 | +/** | |
| 366 | + * Structure that represents a haptic direction. | |
| 367 | + * | |
| 368 | + * This is the direction where the force comes from, instead of the direction | |
| 369 | + * in which the force is exerted. | |
| 370 | + * | |
| 371 | + * Directions can be specified by: | |
| 372 | + * | |
| 373 | + * - SDL_HAPTIC_POLAR : Specified by polar coordinates. | |
| 374 | + * - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. | |
| 375 | + * - SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. | |
| 376 | + * | |
| 377 | + * Cardinal directions of the haptic device are relative to the positioning of | |
| 378 | + * the device. North is considered to be away from the user. | |
| 379 | + * | |
| 380 | + * The following diagram represents the cardinal directions: | |
| 381 | + * | |
| 382 | + * ``` | |
| 383 | + * .--. | |
| 384 | + * |__| .-------. | |
| 385 | + * |=.| |.-----.| | |
| 386 | + * |--| || || | |
| 387 | + * | | |'-----'| | |
| 388 | + * |__|~')_____(' | |
| 389 | + * [ COMPUTER ] | |
| 390 | + * | |
| 391 | + * | |
| 392 | + * North (0,-1) | |
| 393 | + * ^ | |
| 394 | + * | | |
| 395 | + * | | |
| 396 | + * (-1,0) West <----[ HAPTIC ]----> East (1,0) | |
| 397 | + * | | |
| 398 | + * | | |
| 399 | + * v | |
| 400 | + * South (0,1) | |
| 401 | + * | |
| 402 | + * | |
| 403 | + * [ USER ] | |
| 404 | + * \|||/ | |
| 405 | + * (o o) | |
| 406 | + * ---ooO-(_)-Ooo--- | |
| 407 | + * ``` | |
| 408 | + * | |
| 409 | + * If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a degree | |
| 410 | + * starting north and turning clockwise. SDL_HAPTIC_POLAR only uses the first | |
| 411 | + * `dir` parameter. The cardinal directions would be: | |
| 412 | + * | |
| 413 | + * - North: 0 (0 degrees) | |
| 414 | + * - East: 9000 (90 degrees) | |
| 415 | + * - South: 18000 (180 degrees) | |
| 416 | + * - West: 27000 (270 degrees) | |
| 417 | + * | |
| 418 | + * If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions (X | |
| 419 | + * axis, Y axis and Z axis (with 3 axes)). SDL_HAPTIC_CARTESIAN uses the first | |
| 420 | + * three `dir` parameters. The cardinal directions would be: | |
| 421 | + * | |
| 422 | + * - North: 0,-1, 0 | |
| 423 | + * - East: 1, 0, 0 | |
| 424 | + * - South: 0, 1, 0 | |
| 425 | + * - West: -1, 0, 0 | |
| 426 | + * | |
| 427 | + * The Z axis represents the height of the effect if supported, otherwise it's | |
| 428 | + * unused. In cartesian encoding (1, 2) would be the same as (2, 4), you can | |
| 429 | + * use any multiple you want, only the direction matters. | |
| 430 | + * | |
| 431 | + * If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. The | |
| 432 | + * first two `dir` parameters are used. The `dir` parameters are as follows | |
| 433 | + * (all values are in hundredths of degrees): | |
| 434 | + * | |
| 435 | + * - Degrees from (1, 0) rotated towards (0, 1). | |
| 436 | + * - Degrees towards (0, 0, 1) (device needs at least 3 axes). | |
| 437 | + * | |
| 438 | + * Example of force coming from the south with all encodings (force coming | |
| 439 | + * from the south means the user will have to pull the stick to counteract): | |
| 440 | + * | |
| 441 | + * ```c | |
| 442 | + * SDL_HapticDirection direction; | |
| 443 | + * | |
| 444 | + * // Cartesian directions | |
| 445 | + * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. | |
| 446 | + * direction.dir[0] = 0; // X position | |
| 447 | + * direction.dir[1] = 1; // Y position | |
| 448 | + * // Assuming the device has 2 axes, we don't need to specify third parameter. | |
| 449 | + * | |
| 450 | + * // Polar directions | |
| 451 | + * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. | |
| 452 | + * direction.dir[0] = 18000; // Polar only uses first parameter | |
| 453 | + * | |
| 454 | + * // Spherical coordinates | |
| 455 | + * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding | |
| 456 | + * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. | |
| 457 | + * ``` | |
| 458 | + * | |
| 459 | + * \sa SDL_HAPTIC_POLAR | |
| 460 | + * \sa SDL_HAPTIC_CARTESIAN | |
| 461 | + * \sa SDL_HAPTIC_SPHERICAL | |
| 462 | + * \sa SDL_HAPTIC_STEERING_AXIS | |
| 463 | + * \sa SDL_HapticEffect | |
| 464 | + * \sa SDL_HapticNumAxes | |
| 465 | + */ | |
| 466 | +typedef struct SDL_HapticDirection | |
| 467 | +{ | |
| 468 | + Uint8 type; /**< The type of encoding. */ | |
| 469 | + Sint32 dir[3]; /**< The encoded direction. */ | |
| 470 | +} SDL_HapticDirection; | |
| 471 | + | |
| 472 | + | |
| 473 | +/** | |
| 474 | + * A structure containing a template for a Constant effect. | |
| 475 | + * | |
| 476 | + * This struct is exclusively for the SDL_HAPTIC_CONSTANT effect. | |
| 477 | + * | |
| 478 | + * A constant effect applies a constant force in the specified direction to | |
| 479 | + * the joystick. | |
| 480 | + * | |
| 481 | + * \sa SDL_HAPTIC_CONSTANT | |
| 482 | + * \sa SDL_HapticEffect | |
| 483 | + */ | |
| 484 | +typedef struct SDL_HapticConstant | |
| 485 | +{ | |
| 486 | + /* Header */ | |
| 487 | + Uint16 type; /**< SDL_HAPTIC_CONSTANT */ | |
| 488 | + SDL_HapticDirection direction; /**< Direction of the effect. */ | |
| 489 | + | |
| 490 | + /* Replay */ | |
| 491 | + Uint32 length; /**< Duration of the effect. */ | |
| 492 | + Uint16 delay; /**< Delay before starting the effect. */ | |
| 493 | + | |
| 494 | + /* Trigger */ | |
| 495 | + Uint16 button; /**< Button that triggers the effect. */ | |
| 496 | + Uint16 interval; /**< How soon it can be triggered again after button. */ | |
| 497 | + | |
| 498 | + /* Constant */ | |
| 499 | + Sint16 level; /**< Strength of the constant effect. */ | |
| 500 | + | |
| 501 | + /* Envelope */ | |
| 502 | + Uint16 attack_length; /**< Duration of the attack. */ | |
| 503 | + Uint16 attack_level; /**< Level at the start of the attack. */ | |
| 504 | + Uint16 fade_length; /**< Duration of the fade. */ | |
| 505 | + Uint16 fade_level; /**< Level at the end of the fade. */ | |
| 506 | +} SDL_HapticConstant; | |
| 507 | + | |
| 508 | +/** | |
| 509 | + * A structure containing a template for a Periodic effect. | |
| 510 | + * | |
| 511 | + * The struct handles the following effects: | |
| 512 | + * | |
| 513 | + * - SDL_HAPTIC_SINE | |
| 514 | + * - SDL_HAPTIC_SQUARE | |
| 515 | + * - SDL_HAPTIC_TRIANGLE | |
| 516 | + * - SDL_HAPTIC_SAWTOOTHUP | |
| 517 | + * - SDL_HAPTIC_SAWTOOTHDOWN | |
| 518 | + * | |
| 519 | + * A periodic effect consists in a wave-shaped effect that repeats itself over | |
| 520 | + * time. The type determines the shape of the wave and the parameters | |
| 521 | + * determine the dimensions of the wave. | |
| 522 | + * | |
| 523 | + * Phase is given by hundredth of a degree meaning that giving the phase a | |
| 524 | + * value of 9000 will displace it 25% of its period. Here are sample values: | |
| 525 | + * | |
| 526 | + * - 0: No phase displacement. | |
| 527 | + * - 9000: Displaced 25% of its period. | |
| 528 | + * - 18000: Displaced 50% of its period. | |
| 529 | + * - 27000: Displaced 75% of its period. | |
| 530 | + * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. | |
| 531 | + * | |
| 532 | + * Examples: | |
| 533 | + * | |
| 534 | + * ``` | |
| 535 | + * SDL_HAPTIC_SINE | |
| 536 | + * __ __ __ __ | |
| 537 | + * / \ / \ / \ / | |
| 538 | + * / \__/ \__/ \__/ | |
| 539 | + * | |
| 540 | + * SDL_HAPTIC_SQUARE | |
| 541 | + * __ __ __ __ __ | |
| 542 | + * | | | | | | | | | | | |
| 543 | + * | |__| |__| |__| |__| | | |
| 544 | + * | |
| 545 | + * SDL_HAPTIC_TRIANGLE | |
| 546 | + * /\ /\ /\ /\ /\ | |
| 547 | + * / \ / \ / \ / \ / | |
| 548 | + * / \/ \/ \/ \/ | |
| 549 | + * | |
| 550 | + * SDL_HAPTIC_SAWTOOTHUP | |
| 551 | + * /| /| /| /| /| /| /| | |
| 552 | + * / | / | / | / | / | / | / | | |
| 553 | + * / |/ |/ |/ |/ |/ |/ | | |
| 554 | + * | |
| 555 | + * SDL_HAPTIC_SAWTOOTHDOWN | |
| 556 | + * \ |\ |\ |\ |\ |\ |\ | | |
| 557 | + * \ | \ | \ | \ | \ | \ | \ | | |
| 558 | + * \| \| \| \| \| \| \| | |
| 559 | + * ``` | |
| 560 | + * | |
| 561 | + * \sa SDL_HAPTIC_SINE | |
| 562 | + * \sa SDL_HAPTIC_LEFTRIGHT | |
| 563 | + * \sa SDL_HAPTIC_TRIANGLE | |
| 564 | + * \sa SDL_HAPTIC_SAWTOOTHUP | |
| 565 | + * \sa SDL_HAPTIC_SAWTOOTHDOWN | |
| 566 | + * \sa SDL_HapticEffect | |
| 567 | + */ | |
| 568 | +typedef struct SDL_HapticPeriodic | |
| 569 | +{ | |
| 570 | + /* Header */ | |
| 571 | + Uint16 type; /**< SDL_HAPTIC_SINE, SDL_HAPTIC_LEFTRIGHT, | |
| 572 | + SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or | |
| 573 | + SDL_HAPTIC_SAWTOOTHDOWN */ | |
| 574 | + SDL_HapticDirection direction; /**< Direction of the effect. */ | |
| 575 | + | |
| 576 | + /* Replay */ | |
| 577 | + Uint32 length; /**< Duration of the effect. */ | |
| 578 | + Uint16 delay; /**< Delay before starting the effect. */ | |
| 579 | + | |
| 580 | + /* Trigger */ | |
| 581 | + Uint16 button; /**< Button that triggers the effect. */ | |
| 582 | + Uint16 interval; /**< How soon it can be triggered again after button. */ | |
| 583 | + | |
| 584 | + /* Periodic */ | |
| 585 | + Uint16 period; /**< Period of the wave. */ | |
| 586 | + Sint16 magnitude; /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */ | |
| 587 | + Sint16 offset; /**< Mean value of the wave. */ | |
| 588 | + Uint16 phase; /**< Positive phase shift given by hundredth of a degree. */ | |
| 589 | + | |
| 590 | + /* Envelope */ | |
| 591 | + Uint16 attack_length; /**< Duration of the attack. */ | |
| 592 | + Uint16 attack_level; /**< Level at the start of the attack. */ | |
| 593 | + Uint16 fade_length; /**< Duration of the fade. */ | |
| 594 | + Uint16 fade_level; /**< Level at the end of the fade. */ | |
| 595 | +} SDL_HapticPeriodic; | |
| 596 | + | |
| 597 | +/** | |
| 598 | + * A structure containing a template for a Condition effect. | |
| 599 | + * | |
| 600 | + * The struct handles the following effects: | |
| 601 | + * | |
| 602 | + * - SDL_HAPTIC_SPRING: Effect based on axes position. | |
| 603 | + * - SDL_HAPTIC_DAMPER: Effect based on axes velocity. | |
| 604 | + * - SDL_HAPTIC_INERTIA: Effect based on axes acceleration. | |
| 605 | + * - SDL_HAPTIC_FRICTION: Effect based on axes movement. | |
| 606 | + * | |
| 607 | + * Direction is handled by condition internals instead of a direction member. | |
| 608 | + * The condition effect specific members have three parameters. The first | |
| 609 | + * refers to the X axis, the second refers to the Y axis and the third refers | |
| 610 | + * to the Z axis. The right terms refer to the positive side of the axis and | |
| 611 | + * the left terms refer to the negative side of the axis. Please refer to the | |
| 612 | + * SDL_HapticDirection diagram for which side is positive and which is | |
| 613 | + * negative. | |
| 614 | + * | |
| 615 | + * \sa SDL_HapticDirection | |
| 616 | + * \sa SDL_HAPTIC_SPRING | |
| 617 | + * \sa SDL_HAPTIC_DAMPER | |
| 618 | + * \sa SDL_HAPTIC_INERTIA | |
| 619 | + * \sa SDL_HAPTIC_FRICTION | |
| 620 | + * \sa SDL_HapticEffect | |
| 621 | + */ | |
| 622 | +typedef struct SDL_HapticCondition | |
| 623 | +{ | |
| 624 | + /* Header */ | |
| 625 | + Uint16 type; /**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER, | |
| 626 | + SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION */ | |
| 627 | + SDL_HapticDirection direction; /**< Direction of the effect. */ | |
| 628 | + | |
| 629 | + /* Replay */ | |
| 630 | + Uint32 length; /**< Duration of the effect. */ | |
| 631 | + Uint16 delay; /**< Delay before starting the effect. */ | |
| 632 | + | |
| 633 | + /* Trigger */ | |
| 634 | + Uint16 button; /**< Button that triggers the effect. */ | |
| 635 | + Uint16 interval; /**< How soon it can be triggered again after button. */ | |
| 636 | + | |
| 637 | + /* Condition */ | |
| 638 | + Uint16 right_sat[3]; /**< Level when joystick is to the positive side; max 0xFFFF. */ | |
| 639 | + Uint16 left_sat[3]; /**< Level when joystick is to the negative side; max 0xFFFF. */ | |
| 640 | + Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */ | |
| 641 | + Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */ | |
| 642 | + Uint16 deadband[3]; /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */ | |
| 643 | + Sint16 center[3]; /**< Position of the dead zone. */ | |
| 644 | +} SDL_HapticCondition; | |
| 645 | + | |
| 646 | +/** | |
| 647 | + * A structure containing a template for a Ramp effect. | |
| 648 | + * | |
| 649 | + * This struct is exclusively for the SDL_HAPTIC_RAMP effect. | |
| 650 | + * | |
| 651 | + * The ramp effect starts at start strength and ends at end strength. It | |
| 652 | + * augments in linear fashion. If you use attack and fade with a ramp the | |
| 653 | + * effects get added to the ramp effect making the effect become quadratic | |
| 654 | + * instead of linear. | |
| 655 | + * | |
| 656 | + * \sa SDL_HAPTIC_RAMP | |
| 657 | + * \sa SDL_HapticEffect | |
| 658 | + */ | |
| 659 | +typedef struct SDL_HapticRamp | |
| 660 | +{ | |
| 661 | + /* Header */ | |
| 662 | + Uint16 type; /**< SDL_HAPTIC_RAMP */ | |
| 663 | + SDL_HapticDirection direction; /**< Direction of the effect. */ | |
| 664 | + | |
| 665 | + /* Replay */ | |
| 666 | + Uint32 length; /**< Duration of the effect. */ | |
| 667 | + Uint16 delay; /**< Delay before starting the effect. */ | |
| 668 | + | |
| 669 | + /* Trigger */ | |
| 670 | + Uint16 button; /**< Button that triggers the effect. */ | |
| 671 | + Uint16 interval; /**< How soon it can be triggered again after button. */ | |
| 672 | + | |
| 673 | + /* Ramp */ | |
| 674 | + Sint16 start; /**< Beginning strength level. */ | |
| 675 | + Sint16 end; /**< Ending strength level. */ | |
| 676 | + | |
| 677 | + /* Envelope */ | |
| 678 | + Uint16 attack_length; /**< Duration of the attack. */ | |
| 679 | + Uint16 attack_level; /**< Level at the start of the attack. */ | |
| 680 | + Uint16 fade_length; /**< Duration of the fade. */ | |
| 681 | + Uint16 fade_level; /**< Level at the end of the fade. */ | |
| 682 | +} SDL_HapticRamp; | |
| 683 | + | |
| 684 | +/** | |
| 685 | + * A structure containing a template for a Left/Right effect. | |
| 686 | + * | |
| 687 | + * This struct is exclusively for the SDL_HAPTIC_LEFTRIGHT effect. | |
| 688 | + * | |
| 689 | + * The Left/Right effect is used to explicitly control the large and small | |
| 690 | + * motors, commonly found in modern game controllers. The small (right) motor | |
| 691 | + * is high frequency, and the large (left) motor is low frequency. | |
| 692 | + * | |
| 693 | + * \sa SDL_HAPTIC_LEFTRIGHT | |
| 694 | + * \sa SDL_HapticEffect | |
| 695 | + */ | |
| 696 | +typedef struct SDL_HapticLeftRight | |
| 697 | +{ | |
| 698 | + /* Header */ | |
| 699 | + Uint16 type; /**< SDL_HAPTIC_LEFTRIGHT */ | |
| 700 | + | |
| 701 | + /* Replay */ | |
| 702 | + Uint32 length; /**< Duration of the effect in milliseconds. */ | |
| 703 | + | |
| 704 | + /* Rumble */ | |
| 705 | + Uint16 large_magnitude; /**< Control of the large controller motor. */ | |
| 706 | + Uint16 small_magnitude; /**< Control of the small controller motor. */ | |
| 707 | +} SDL_HapticLeftRight; | |
| 708 | + | |
| 709 | +/** | |
| 710 | + * A structure containing a template for the SDL_HAPTIC_CUSTOM effect. | |
| 711 | + * | |
| 712 | + * This struct is exclusively for the SDL_HAPTIC_CUSTOM effect. | |
| 713 | + * | |
| 714 | + * A custom force feedback effect is much like a periodic effect, where the | |
| 715 | + * application can define its exact shape. You will have to allocate the data | |
| 716 | + * yourself. Data should consist of channels * samples Uint16 samples. | |
| 717 | + * | |
| 718 | + * If channels is one, the effect is rotated using the defined direction. | |
| 719 | + * Otherwise it uses the samples in data for the different axes. | |
| 720 | + * | |
| 721 | + * \sa SDL_HAPTIC_CUSTOM | |
| 722 | + * \sa SDL_HapticEffect | |
| 723 | + */ | |
| 724 | +typedef struct SDL_HapticCustom | |
| 725 | +{ | |
| 726 | + /* Header */ | |
| 727 | + Uint16 type; /**< SDL_HAPTIC_CUSTOM */ | |
| 728 | + SDL_HapticDirection direction; /**< Direction of the effect. */ | |
| 729 | + | |
| 730 | + /* Replay */ | |
| 731 | + Uint32 length; /**< Duration of the effect. */ | |
| 732 | + Uint16 delay; /**< Delay before starting the effect. */ | |
| 733 | + | |
| 734 | + /* Trigger */ | |
| 735 | + Uint16 button; /**< Button that triggers the effect. */ | |
| 736 | + Uint16 interval; /**< How soon it can be triggered again after button. */ | |
| 737 | + | |
| 738 | + /* Custom */ | |
| 739 | + Uint8 channels; /**< Axes to use, minimum of one. */ | |
| 740 | + Uint16 period; /**< Sample periods. */ | |
| 741 | + Uint16 samples; /**< Amount of samples. */ | |
| 742 | + Uint16 *data; /**< Should contain channels*samples items. */ | |
| 743 | + | |
| 744 | + /* Envelope */ | |
| 745 | + Uint16 attack_length; /**< Duration of the attack. */ | |
| 746 | + Uint16 attack_level; /**< Level at the start of the attack. */ | |
| 747 | + Uint16 fade_length; /**< Duration of the fade. */ | |
| 748 | + Uint16 fade_level; /**< Level at the end of the fade. */ | |
| 749 | +} SDL_HapticCustom; | |
| 750 | + | |
| 751 | +/** | |
| 752 | + * The generic template for any haptic effect. | |
| 753 | + * | |
| 754 | + * All values max at 32767 (0x7FFF). Signed values also can be negative. Time | |
| 755 | + * values unless specified otherwise are in milliseconds. | |
| 756 | + * | |
| 757 | + * You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value. | |
| 758 | + * Neither delay, interval, attack_length nor fade_length support | |
| 759 | + * SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. | |
| 760 | + * | |
| 761 | + * Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of | |
| 762 | + * SDL_HAPTIC_INFINITY. | |
| 763 | + * | |
| 764 | + * Button triggers may not be supported on all devices, it is advised to not | |
| 765 | + * use them if possible. Buttons start at index 1 instead of index 0 like the | |
| 766 | + * joystick. | |
| 767 | + * | |
| 768 | + * If both attack_length and fade_level are 0, the envelope is not used, | |
| 769 | + * otherwise both values are used. | |
| 770 | + * | |
| 771 | + * Common parts: | |
| 772 | + * | |
| 773 | + * ```c | |
| 774 | + * // Replay - All effects have this | |
| 775 | + * Uint32 length; // Duration of effect (ms). | |
| 776 | + * Uint16 delay; // Delay before starting effect. | |
| 777 | + * | |
| 778 | + * // Trigger - All effects have this | |
| 779 | + * Uint16 button; // Button that triggers effect. | |
| 780 | + * Uint16 interval; // How soon before effect can be triggered again. | |
| 781 | + * | |
| 782 | + * // Envelope - All effects except condition effects have this | |
| 783 | + * Uint16 attack_length; // Duration of the attack (ms). | |
| 784 | + * Uint16 attack_level; // Level at the start of the attack. | |
| 785 | + * Uint16 fade_length; // Duration of the fade out (ms). | |
| 786 | + * Uint16 fade_level; // Level at the end of the fade. | |
| 787 | + * ``` | |
| 788 | + * | |
| 789 | + * Here we have an example of a constant effect evolution in time: | |
| 790 | + * | |
| 791 | + * ``` | |
| 792 | + * Strength | |
| 793 | + * ^ | |
| 794 | + * | | |
| 795 | + * | effect level --> _________________ | |
| 796 | + * | / \ | |
| 797 | + * | / \ | |
| 798 | + * | / \ | |
| 799 | + * | / \ | |
| 800 | + * | attack_level --> | \ | |
| 801 | + * | | | <--- fade_level | |
| 802 | + * | | |
| 803 | + * +--------------------------------------------------> Time | |
| 804 | + * [--] [---] | |
| 805 | + * attack_length fade_length | |
| 806 | + * | |
| 807 | + * [------------------][-----------------------] | |
| 808 | + * delay length | |
| 809 | + * ``` | |
| 810 | + * | |
| 811 | + * Note either the attack_level or the fade_level may be above the actual | |
| 812 | + * effect level. | |
| 813 | + * | |
| 814 | + * \sa SDL_HapticConstant | |
| 815 | + * \sa SDL_HapticPeriodic | |
| 816 | + * \sa SDL_HapticCondition | |
| 817 | + * \sa SDL_HapticRamp | |
| 818 | + * \sa SDL_HapticLeftRight | |
| 819 | + * \sa SDL_HapticCustom | |
| 820 | + */ | |
| 821 | +typedef union SDL_HapticEffect | |
| 822 | +{ | |
| 823 | + /* Common for all force feedback effects */ | |
| 824 | + Uint16 type; /**< Effect type. */ | |
| 825 | + SDL_HapticConstant constant; /**< Constant effect. */ | |
| 826 | + SDL_HapticPeriodic periodic; /**< Periodic effect. */ | |
| 827 | + SDL_HapticCondition condition; /**< Condition effect. */ | |
| 828 | + SDL_HapticRamp ramp; /**< Ramp effect. */ | |
| 829 | + SDL_HapticLeftRight leftright; /**< Left/Right effect. */ | |
| 830 | + SDL_HapticCustom custom; /**< Custom effect. */ | |
| 831 | +} SDL_HapticEffect; | |
| 832 | + | |
| 833 | + | |
| 834 | +/* Function prototypes */ | |
| 835 | + | |
| 836 | +/** | |
| 837 | + * Count the number of haptic devices attached to the system. | |
| 838 | + * | |
| 839 | + * \returns the number of haptic devices detected on the system or a negative | |
| 840 | + * error code on failure; call SDL_GetError() for more information. | |
| 841 | + * | |
| 842 | + * \since This function is available since SDL 2.0.0. | |
| 843 | + * | |
| 844 | + * \sa SDL_HapticName | |
| 845 | + */ | |
| 846 | +extern DECLSPEC int SDLCALL SDL_NumHaptics(void); | |
| 847 | + | |
| 848 | +/** | |
| 849 | + * Get the implementation dependent name of a haptic device. | |
| 850 | + * | |
| 851 | + * This can be called before any joysticks are opened. If no name can be | |
| 852 | + * found, this function returns NULL. | |
| 853 | + * | |
| 854 | + * \param device_index index of the device to query. | |
| 855 | + * \returns the name of the device or NULL on failure; call SDL_GetError() for | |
| 856 | + * more information. | |
| 857 | + * | |
| 858 | + * \since This function is available since SDL 2.0.0. | |
| 859 | + * | |
| 860 | + * \sa SDL_NumHaptics | |
| 861 | + */ | |
| 862 | +extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); | |
| 863 | + | |
| 864 | +/** | |
| 865 | + * Open a haptic device for use. | |
| 866 | + * | |
| 867 | + * The index passed as an argument refers to the N'th haptic device on this | |
| 868 | + * system. | |
| 869 | + * | |
| 870 | + * When opening a haptic device, its gain will be set to maximum and | |
| 871 | + * autocenter will be disabled. To modify these values use SDL_HapticSetGain() | |
| 872 | + * and SDL_HapticSetAutocenter(). | |
| 873 | + * | |
| 874 | + * \param device_index index of the device to open. | |
| 875 | + * \returns the device identifier or NULL on failure; call SDL_GetError() for | |
| 876 | + * more information. | |
| 877 | + * | |
| 878 | + * \since This function is available since SDL 2.0.0. | |
| 879 | + * | |
| 880 | + * \sa SDL_HapticClose | |
| 881 | + * \sa SDL_HapticIndex | |
| 882 | + * \sa SDL_HapticOpenFromJoystick | |
| 883 | + * \sa SDL_HapticOpenFromMouse | |
| 884 | + * \sa SDL_HapticPause | |
| 885 | + * \sa SDL_HapticSetAutocenter | |
| 886 | + * \sa SDL_HapticSetGain | |
| 887 | + * \sa SDL_HapticStopAll | |
| 888 | + */ | |
| 889 | +extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index); | |
| 890 | + | |
| 891 | +/** | |
| 892 | + * Check if the haptic device at the designated index has been opened. | |
| 893 | + * | |
| 894 | + * \param device_index the index of the device to query. | |
| 895 | + * \returns 1 if it has been opened, 0 if it hasn't or on failure; call | |
| 896 | + * SDL_GetError() for more information. | |
| 897 | + * | |
| 898 | + * \since This function is available since SDL 2.0.0. | |
| 899 | + * | |
| 900 | + * \sa SDL_HapticIndex | |
| 901 | + * \sa SDL_HapticOpen | |
| 902 | + */ | |
| 903 | +extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index); | |
| 904 | + | |
| 905 | +/** | |
| 906 | + * Get the index of a haptic device. | |
| 907 | + * | |
| 908 | + * \param haptic the SDL_Haptic device to query. | |
| 909 | + * \returns the index of the specified haptic device or a negative error code | |
| 910 | + * on failure; call SDL_GetError() for more information. | |
| 911 | + * | |
| 912 | + * \since This function is available since SDL 2.0.0. | |
| 913 | + * | |
| 914 | + * \sa SDL_HapticOpen | |
| 915 | + * \sa SDL_HapticOpened | |
| 916 | + */ | |
| 917 | +extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic); | |
| 918 | + | |
| 919 | +/** | |
| 920 | + * Query whether or not the current mouse has haptic capabilities. | |
| 921 | + * | |
| 922 | + * \returns SDL_TRUE if the mouse is haptic or SDL_FALSE if it isn't. | |
| 923 | + * | |
| 924 | + * \since This function is available since SDL 2.0.0. | |
| 925 | + * | |
| 926 | + * \sa SDL_HapticOpenFromMouse | |
| 927 | + */ | |
| 928 | +extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void); | |
| 929 | + | |
| 930 | +/** | |
| 931 | + * Try to open a haptic device from the current mouse. | |
| 932 | + * | |
| 933 | + * \returns the haptic device identifier or NULL on failure; call | |
| 934 | + * SDL_GetError() for more information. | |
| 935 | + * | |
| 936 | + * \since This function is available since SDL 2.0.0. | |
| 937 | + * | |
| 938 | + * \sa SDL_HapticOpen | |
| 939 | + * \sa SDL_MouseIsHaptic | |
| 940 | + */ | |
| 941 | +extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); | |
| 942 | + | |
| 943 | +/** | |
| 944 | + * Query if a joystick has haptic features. | |
| 945 | + * | |
| 946 | + * \param joystick the SDL_Joystick to test for haptic capabilities. | |
| 947 | + * \returns SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't, or a | |
| 948 | + * negative error code on failure; call SDL_GetError() for more | |
| 949 | + * information. | |
| 950 | + * | |
| 951 | + * \since This function is available since SDL 2.0.0. | |
| 952 | + * | |
| 953 | + * \sa SDL_HapticOpenFromJoystick | |
| 954 | + */ | |
| 955 | +extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); | |
| 956 | + | |
| 957 | +/** | |
| 958 | + * Open a haptic device for use from a joystick device. | |
| 959 | + * | |
| 960 | + * You must still close the haptic device separately. It will not be closed | |
| 961 | + * with the joystick. | |
| 962 | + * | |
| 963 | + * When opened from a joystick you should first close the haptic device before | |
| 964 | + * closing the joystick device. If not, on some implementations the haptic | |
| 965 | + * device will also get unallocated and you'll be unable to use force feedback | |
| 966 | + * on that device. | |
| 967 | + * | |
| 968 | + * \param joystick the SDL_Joystick to create a haptic device from. | |
| 969 | + * \returns a valid haptic device identifier on success or NULL on failure; | |
| 970 | + * call SDL_GetError() for more information. | |
| 971 | + * | |
| 972 | + * \since This function is available since SDL 2.0.0. | |
| 973 | + * | |
| 974 | + * \sa SDL_HapticClose | |
| 975 | + * \sa SDL_HapticOpen | |
| 976 | + * \sa SDL_JoystickIsHaptic | |
| 977 | + */ | |
| 978 | +extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * | |
| 979 | + joystick); | |
| 980 | + | |
| 981 | +/** | |
| 982 | + * Close a haptic device previously opened with SDL_HapticOpen(). | |
| 983 | + * | |
| 984 | + * \param haptic the SDL_Haptic device to close. | |
| 985 | + * | |
| 986 | + * \since This function is available since SDL 2.0.0. | |
| 987 | + * | |
| 988 | + * \sa SDL_HapticOpen | |
| 989 | + */ | |
| 990 | +extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic); | |
| 991 | + | |
| 992 | +/** | |
| 993 | + * Get the number of effects a haptic device can store. | |
| 994 | + * | |
| 995 | + * On some platforms this isn't fully supported, and therefore is an | |
| 996 | + * approximation. Always check to see if your created effect was actually | |
| 997 | + * created and do not rely solely on SDL_HapticNumEffects(). | |
| 998 | + * | |
| 999 | + * \param haptic the SDL_Haptic device to query. | |
| 1000 | + * \returns the number of effects the haptic device can store or a negative | |
| 1001 | + * error code on failure; call SDL_GetError() for more information. | |
| 1002 | + * | |
| 1003 | + * \since This function is available since SDL 2.0.0. | |
| 1004 | + * | |
| 1005 | + * \sa SDL_HapticNumEffectsPlaying | |
| 1006 | + * \sa SDL_HapticQuery | |
| 1007 | + */ | |
| 1008 | +extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic); | |
| 1009 | + | |
| 1010 | +/** | |
| 1011 | + * Get the number of effects a haptic device can play at the same time. | |
| 1012 | + * | |
| 1013 | + * This is not supported on all platforms, but will always return a value. | |
| 1014 | + * | |
| 1015 | + * \param haptic the SDL_Haptic device to query maximum playing effects. | |
| 1016 | + * \returns the number of effects the haptic device can play at the same time | |
| 1017 | + * or a negative error code on failure; call SDL_GetError() for more | |
| 1018 | + * information. | |
| 1019 | + * | |
| 1020 | + * \since This function is available since SDL 2.0.0. | |
| 1021 | + * | |
| 1022 | + * \sa SDL_HapticNumEffects | |
| 1023 | + * \sa SDL_HapticQuery | |
| 1024 | + */ | |
| 1025 | +extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); | |
| 1026 | + | |
| 1027 | +/** | |
| 1028 | + * Get the haptic device's supported features in bitwise manner. | |
| 1029 | + * | |
| 1030 | + * \param haptic the SDL_Haptic device to query. | |
| 1031 | + * \returns a list of supported haptic features in bitwise manner (OR'd), or 0 | |
| 1032 | + * on failure; call SDL_GetError() for more information. | |
| 1033 | + * | |
| 1034 | + * \since This function is available since SDL 2.0.0. | |
| 1035 | + * | |
| 1036 | + * \sa SDL_HapticEffectSupported | |
| 1037 | + * \sa SDL_HapticNumEffects | |
| 1038 | + */ | |
| 1039 | +extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic); | |
| 1040 | + | |
| 1041 | + | |
| 1042 | +/** | |
| 1043 | + * Get the number of haptic axes the device has. | |
| 1044 | + * | |
| 1045 | + * The number of haptic axes might be useful if working with the | |
| 1046 | + * SDL_HapticDirection effect. | |
| 1047 | + * | |
| 1048 | + * \param haptic the SDL_Haptic device to query. | |
| 1049 | + * \returns the number of axes on success or a negative error code on failure; | |
| 1050 | + * call SDL_GetError() for more information. | |
| 1051 | + * | |
| 1052 | + * \since This function is available since SDL 2.0.0. | |
| 1053 | + */ | |
| 1054 | +extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic); | |
| 1055 | + | |
| 1056 | +/** | |
| 1057 | + * Check to see if an effect is supported by a haptic device. | |
| 1058 | + * | |
| 1059 | + * \param haptic the SDL_Haptic device to query. | |
| 1060 | + * \param effect the desired effect to query. | |
| 1061 | + * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a | |
| 1062 | + * negative error code on failure; call SDL_GetError() for more | |
| 1063 | + * information. | |
| 1064 | + * | |
| 1065 | + * \since This function is available since SDL 2.0.0. | |
| 1066 | + * | |
| 1067 | + * \sa SDL_HapticNewEffect | |
| 1068 | + * \sa SDL_HapticQuery | |
| 1069 | + */ | |
| 1070 | +extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, | |
| 1071 | + SDL_HapticEffect * | |
| 1072 | + effect); | |
| 1073 | + | |
| 1074 | +/** | |
| 1075 | + * Create a new haptic effect on a specified device. | |
| 1076 | + * | |
| 1077 | + * \param haptic an SDL_Haptic device to create the effect on. | |
| 1078 | + * \param effect an SDL_HapticEffect structure containing the properties of | |
| 1079 | + * the effect to create. | |
| 1080 | + * \returns the ID of the effect on success or a negative error code on | |
| 1081 | + * failure; call SDL_GetError() for more information. | |
| 1082 | + * | |
| 1083 | + * \since This function is available since SDL 2.0.0. | |
| 1084 | + * | |
| 1085 | + * \sa SDL_HapticDestroyEffect | |
| 1086 | + * \sa SDL_HapticRunEffect | |
| 1087 | + * \sa SDL_HapticUpdateEffect | |
| 1088 | + */ | |
| 1089 | +extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, | |
| 1090 | + SDL_HapticEffect * effect); | |
| 1091 | + | |
| 1092 | +/** | |
| 1093 | + * Update the properties of an effect. | |
| 1094 | + * | |
| 1095 | + * Can be used dynamically, although behavior when dynamically changing | |
| 1096 | + * direction may be strange. Specifically the effect may re-upload itself and | |
| 1097 | + * start playing from the start. You also cannot change the type either when | |
| 1098 | + * running SDL_HapticUpdateEffect(). | |
| 1099 | + * | |
| 1100 | + * \param haptic the SDL_Haptic device that has the effect. | |
| 1101 | + * \param effect the identifier of the effect to update. | |
| 1102 | + * \param data an SDL_HapticEffect structure containing the new effect | |
| 1103 | + * properties to use. | |
| 1104 | + * \returns 0 on success or a negative error code on failure; call | |
| 1105 | + * SDL_GetError() for more information. | |
| 1106 | + * | |
| 1107 | + * \since This function is available since SDL 2.0.0. | |
| 1108 | + * | |
| 1109 | + * \sa SDL_HapticDestroyEffect | |
| 1110 | + * \sa SDL_HapticNewEffect | |
| 1111 | + * \sa SDL_HapticRunEffect | |
| 1112 | + */ | |
| 1113 | +extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic, | |
| 1114 | + int effect, | |
| 1115 | + SDL_HapticEffect * data); | |
| 1116 | + | |
| 1117 | +/** | |
| 1118 | + * Run the haptic effect on its associated haptic device. | |
| 1119 | + * | |
| 1120 | + * To repeat the effect over and over indefinitely, set `iterations` to | |
| 1121 | + * `SDL_HAPTIC_INFINITY`. (Repeats the envelope - attack and fade.) To make | |
| 1122 | + * one instance of the effect last indefinitely (so the effect does not fade), | |
| 1123 | + * set the effect's `length` in its structure/union to `SDL_HAPTIC_INFINITY` | |
| 1124 | + * instead. | |
| 1125 | + * | |
| 1126 | + * \param haptic the SDL_Haptic device to run the effect on. | |
| 1127 | + * \param effect the ID of the haptic effect to run. | |
| 1128 | + * \param iterations the number of iterations to run the effect; use | |
| 1129 | + * `SDL_HAPTIC_INFINITY` to repeat forever. | |
| 1130 | + * \returns 0 on success or a negative error code on failure; call | |
| 1131 | + * SDL_GetError() for more information. | |
| 1132 | + * | |
| 1133 | + * \since This function is available since SDL 2.0.0. | |
| 1134 | + * | |
| 1135 | + * \sa SDL_HapticDestroyEffect | |
| 1136 | + * \sa SDL_HapticGetEffectStatus | |
| 1137 | + * \sa SDL_HapticStopEffect | |
| 1138 | + */ | |
| 1139 | +extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic, | |
| 1140 | + int effect, | |
| 1141 | + Uint32 iterations); | |
| 1142 | + | |
| 1143 | +/** | |
| 1144 | + * Stop the haptic effect on its associated haptic device. | |
| 1145 | + * | |
| 1146 | + * * | |
| 1147 | + * | |
| 1148 | + * \param haptic the SDL_Haptic device to stop the effect on. | |
| 1149 | + * \param effect the ID of the haptic effect to stop. | |
| 1150 | + * \returns 0 on success or a negative error code on failure; call | |
| 1151 | + * SDL_GetError() for more information. | |
| 1152 | + * | |
| 1153 | + * \since This function is available since SDL 2.0.0. | |
| 1154 | + * | |
| 1155 | + * \sa SDL_HapticDestroyEffect | |
| 1156 | + * \sa SDL_HapticRunEffect | |
| 1157 | + */ | |
| 1158 | +extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic, | |
| 1159 | + int effect); | |
| 1160 | + | |
| 1161 | +/** | |
| 1162 | + * Destroy a haptic effect on the device. | |
| 1163 | + * | |
| 1164 | + * This will stop the effect if it's running. Effects are automatically | |
| 1165 | + * destroyed when the device is closed. | |
| 1166 | + * | |
| 1167 | + * \param haptic the SDL_Haptic device to destroy the effect on. | |
| 1168 | + * \param effect the ID of the haptic effect to destroy. | |
| 1169 | + * | |
| 1170 | + * \since This function is available since SDL 2.0.0. | |
| 1171 | + * | |
| 1172 | + * \sa SDL_HapticNewEffect | |
| 1173 | + */ | |
| 1174 | +extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic, | |
| 1175 | + int effect); | |
| 1176 | + | |
| 1177 | +/** | |
| 1178 | + * Get the status of the current effect on the specified haptic device. | |
| 1179 | + * | |
| 1180 | + * Device must support the SDL_HAPTIC_STATUS feature. | |
| 1181 | + * | |
| 1182 | + * \param haptic the SDL_Haptic device to query for the effect status on. | |
| 1183 | + * \param effect the ID of the haptic effect to query its status. | |
| 1184 | + * \returns 0 if it isn't playing, 1 if it is playing, or a negative error | |
| 1185 | + * code on failure; call SDL_GetError() for more information. | |
| 1186 | + * | |
| 1187 | + * \since This function is available since SDL 2.0.0. | |
| 1188 | + * | |
| 1189 | + * \sa SDL_HapticRunEffect | |
| 1190 | + * \sa SDL_HapticStopEffect | |
| 1191 | + */ | |
| 1192 | +extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic, | |
| 1193 | + int effect); | |
| 1194 | + | |
| 1195 | +/** | |
| 1196 | + * Set the global gain of the specified haptic device. | |
| 1197 | + * | |
| 1198 | + * Device must support the SDL_HAPTIC_GAIN feature. | |
| 1199 | + * | |
| 1200 | + * The user may specify the maximum gain by setting the environment variable | |
| 1201 | + * `SDL_HAPTIC_GAIN_MAX` which should be between 0 and 100. All calls to | |
| 1202 | + * SDL_HapticSetGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the | |
| 1203 | + * maximum. | |
| 1204 | + * | |
| 1205 | + * \param haptic the SDL_Haptic device to set the gain on. | |
| 1206 | + * \param gain value to set the gain to, should be between 0 and 100 (0 - | |
| 1207 | + * 100). | |
| 1208 | + * \returns 0 on success or a negative error code on failure; call | |
| 1209 | + * SDL_GetError() for more information. | |
| 1210 | + * | |
| 1211 | + * \since This function is available since SDL 2.0.0. | |
| 1212 | + * | |
| 1213 | + * \sa SDL_HapticQuery | |
| 1214 | + */ | |
| 1215 | +extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain); | |
| 1216 | + | |
| 1217 | +/** | |
| 1218 | + * Set the global autocenter of the device. | |
| 1219 | + * | |
| 1220 | + * Autocenter should be between 0 and 100. Setting it to 0 will disable | |
| 1221 | + * autocentering. | |
| 1222 | + * | |
| 1223 | + * Device must support the SDL_HAPTIC_AUTOCENTER feature. | |
| 1224 | + * | |
| 1225 | + * \param haptic the SDL_Haptic device to set autocentering on. | |
| 1226 | + * \param autocenter value to set autocenter to (0-100). | |
| 1227 | + * \returns 0 on success or a negative error code on failure; call | |
| 1228 | + * SDL_GetError() for more information. | |
| 1229 | + * | |
| 1230 | + * \since This function is available since SDL 2.0.0. | |
| 1231 | + * | |
| 1232 | + * \sa SDL_HapticQuery | |
| 1233 | + */ | |
| 1234 | +extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic, | |
| 1235 | + int autocenter); | |
| 1236 | + | |
| 1237 | +/** | |
| 1238 | + * Pause a haptic device. | |
| 1239 | + * | |
| 1240 | + * Device must support the `SDL_HAPTIC_PAUSE` feature. Call | |
| 1241 | + * SDL_HapticUnpause() to resume playback. | |
| 1242 | + * | |
| 1243 | + * Do not modify the effects nor add new ones while the device is paused. That | |
| 1244 | + * can cause all sorts of weird errors. | |
| 1245 | + * | |
| 1246 | + * \param haptic the SDL_Haptic device to pause. | |
| 1247 | + * \returns 0 on success or a negative error code on failure; call | |
| 1248 | + * SDL_GetError() for more information. | |
| 1249 | + * | |
| 1250 | + * \since This function is available since SDL 2.0.0. | |
| 1251 | + * | |
| 1252 | + * \sa SDL_HapticUnpause | |
| 1253 | + */ | |
| 1254 | +extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic); | |
| 1255 | + | |
| 1256 | +/** | |
| 1257 | + * Unpause a haptic device. | |
| 1258 | + * | |
| 1259 | + * Call to unpause after SDL_HapticPause(). | |
| 1260 | + * | |
| 1261 | + * \param haptic the SDL_Haptic device to unpause. | |
| 1262 | + * \returns 0 on success or a negative error code on failure; call | |
| 1263 | + * SDL_GetError() for more information. | |
| 1264 | + * | |
| 1265 | + * \since This function is available since SDL 2.0.0. | |
| 1266 | + * | |
| 1267 | + * \sa SDL_HapticPause | |
| 1268 | + */ | |
| 1269 | +extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic); | |
| 1270 | + | |
| 1271 | +/** | |
| 1272 | + * Stop all the currently playing effects on a haptic device. | |
| 1273 | + * | |
| 1274 | + * \param haptic the SDL_Haptic device to stop. | |
| 1275 | + * \returns 0 on success or a negative error code on failure; call | |
| 1276 | + * SDL_GetError() for more information. | |
| 1277 | + * | |
| 1278 | + * \since This function is available since SDL 2.0.0. | |
| 1279 | + */ | |
| 1280 | +extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic); | |
| 1281 | + | |
| 1282 | +/** | |
| 1283 | + * Check whether rumble is supported on a haptic device. | |
| 1284 | + * | |
| 1285 | + * \param haptic haptic device to check for rumble support. | |
| 1286 | + * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a | |
| 1287 | + * negative error code on failure; call SDL_GetError() for more | |
| 1288 | + * information. | |
| 1289 | + * | |
| 1290 | + * \since This function is available since SDL 2.0.0. | |
| 1291 | + * | |
| 1292 | + * \sa SDL_HapticRumbleInit | |
| 1293 | + * \sa SDL_HapticRumblePlay | |
| 1294 | + * \sa SDL_HapticRumbleStop | |
| 1295 | + */ | |
| 1296 | +extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic); | |
| 1297 | + | |
| 1298 | +/** | |
| 1299 | + * Initialize a haptic device for simple rumble playback. | |
| 1300 | + * | |
| 1301 | + * \param haptic the haptic device to initialize for simple rumble playback. | |
| 1302 | + * \returns 0 on success or a negative error code on failure; call | |
| 1303 | + * SDL_GetError() for more information. | |
| 1304 | + * | |
| 1305 | + * \since This function is available since SDL 2.0.0. | |
| 1306 | + * | |
| 1307 | + * \sa SDL_HapticOpen | |
| 1308 | + * \sa SDL_HapticRumblePlay | |
| 1309 | + * \sa SDL_HapticRumbleStop | |
| 1310 | + * \sa SDL_HapticRumbleSupported | |
| 1311 | + */ | |
| 1312 | +extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic); | |
| 1313 | + | |
| 1314 | +/** | |
| 1315 | + * Run a simple rumble effect on a haptic device. | |
| 1316 | + * | |
| 1317 | + * \param haptic the haptic device to play the rumble effect on. | |
| 1318 | + * \param strength strength of the rumble to play as a 0-1 float value. | |
| 1319 | + * \param length length of the rumble to play in milliseconds. | |
| 1320 | + * \returns 0 on success or a negative error code on failure; call | |
| 1321 | + * SDL_GetError() for more information. | |
| 1322 | + * | |
| 1323 | + * \since This function is available since SDL 2.0.0. | |
| 1324 | + * | |
| 1325 | + * \sa SDL_HapticRumbleInit | |
| 1326 | + * \sa SDL_HapticRumbleStop | |
| 1327 | + * \sa SDL_HapticRumbleSupported | |
| 1328 | + */ | |
| 1329 | +extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length ); | |
| 1330 | + | |
| 1331 | +/** | |
| 1332 | + * Stop the simple rumble on a haptic device. | |
| 1333 | + * | |
| 1334 | + * \param haptic the haptic device to stop the rumble effect on. | |
| 1335 | + * \returns 0 on success or a negative error code on failure; call | |
| 1336 | + * SDL_GetError() for more information. | |
| 1337 | + * | |
| 1338 | + * \since This function is available since SDL 2.0.0. | |
| 1339 | + * | |
| 1340 | + * \sa SDL_HapticRumbleInit | |
| 1341 | + * \sa SDL_HapticRumblePlay | |
| 1342 | + * \sa SDL_HapticRumbleSupported | |
| 1343 | + */ | |
| 1344 | +extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); | |
| 1345 | + | |
| 1346 | +/* Ends C function definitions when using C++ */ | |
| 1347 | +#ifdef __cplusplus | |
| 1348 | +} | |
| 1349 | +#endif | |
| 1350 | +#include "close_code.h" | |
| 1351 | + | |
| 1352 | +#endif /* SDL_haptic_h_ */ | |
| 1353 | + | |
| 1354 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,443 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | +/* WIKI CATEGORY: HIDAPI */ | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * # CategoryHIDAPI | |
| 26 | + * | |
| 27 | + * Header file for SDL HIDAPI functions. | |
| 28 | + * | |
| 29 | + * This is an adaptation of the original HIDAPI interface by Alan Ott, and | |
| 30 | + * includes source code licensed under the following license: | |
| 31 | + * | |
| 32 | + * ``` | |
| 33 | + * HIDAPI - Multi-Platform library for | |
| 34 | + * communication with HID devices. | |
| 35 | + * | |
| 36 | + * Copyright 2009, Alan Ott, Signal 11 Software. | |
| 37 | + * All Rights Reserved. | |
| 38 | + * | |
| 39 | + * This software may be used by anyone for any reason so | |
| 40 | + * long as the copyright notice in the source files | |
| 41 | + * remains intact. | |
| 42 | + * ``` | |
| 43 | + * | |
| 44 | + * (Note that this license is the same as item three of SDL's zlib license, so | |
| 45 | + * it adds no new requirements on the user.) | |
| 46 | + * | |
| 47 | + * If you would like a version of SDL without this code, you can build SDL | |
| 48 | + * with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for | |
| 49 | + * example on iOS or tvOS to avoid a dependency on the CoreBluetooth | |
| 50 | + * framework. | |
| 51 | + */ | |
| 52 | + | |
| 53 | +#ifndef SDL_hidapi_h_ | |
| 54 | +#define SDL_hidapi_h_ | |
| 55 | + | |
| 56 | +#include "SDL_stdinc.h" | |
| 57 | + | |
| 58 | +#include "begin_code.h" | |
| 59 | +/* Set up for C function definitions, even when using C++ */ | |
| 60 | +#ifdef __cplusplus | |
| 61 | +extern "C" { | |
| 62 | +#endif | |
| 63 | + | |
| 64 | +/** | |
| 65 | + * A handle representing an open HID device | |
| 66 | + */ | |
| 67 | +struct SDL_hid_device_; | |
| 68 | +typedef struct SDL_hid_device_ SDL_hid_device; /**< opaque hidapi structure */ | |
| 69 | + | |
| 70 | +/** hidapi info structure */ | |
| 71 | + | |
| 72 | +/** | |
| 73 | + * Information about a connected HID device | |
| 74 | + */ | |
| 75 | +typedef struct SDL_hid_device_info | |
| 76 | +{ | |
| 77 | + /** Platform-specific device path */ | |
| 78 | + char *path; | |
| 79 | + /** Device Vendor ID */ | |
| 80 | + unsigned short vendor_id; | |
| 81 | + /** Device Product ID */ | |
| 82 | + unsigned short product_id; | |
| 83 | + /** Serial Number */ | |
| 84 | + wchar_t *serial_number; | |
| 85 | + /** Device Release Number in binary-coded decimal, | |
| 86 | + also known as Device Version Number */ | |
| 87 | + unsigned short release_number; | |
| 88 | + /** Manufacturer String */ | |
| 89 | + wchar_t *manufacturer_string; | |
| 90 | + /** Product string */ | |
| 91 | + wchar_t *product_string; | |
| 92 | + /** Usage Page for this Device/Interface | |
| 93 | + (Windows/Mac only). */ | |
| 94 | + unsigned short usage_page; | |
| 95 | + /** Usage for this Device/Interface | |
| 96 | + (Windows/Mac only).*/ | |
| 97 | + unsigned short usage; | |
| 98 | + /** The USB interface which this logical device | |
| 99 | + represents. | |
| 100 | + | |
| 101 | + * Valid on both Linux implementations in all cases. | |
| 102 | + * Valid on the Windows implementation only if the device | |
| 103 | + contains more than one interface. */ | |
| 104 | + int interface_number; | |
| 105 | + | |
| 106 | + /** Additional information about the USB interface. | |
| 107 | + Valid on libusb and Android implementations. */ | |
| 108 | + int interface_class; | |
| 109 | + int interface_subclass; | |
| 110 | + int interface_protocol; | |
| 111 | + | |
| 112 | + /** Pointer to the next device */ | |
| 113 | + struct SDL_hid_device_info *next; | |
| 114 | +} SDL_hid_device_info; | |
| 115 | + | |
| 116 | + | |
| 117 | +/** | |
| 118 | + * Initialize the HIDAPI library. | |
| 119 | + * | |
| 120 | + * This function initializes the HIDAPI library. Calling it is not strictly | |
| 121 | + * necessary, as it will be called automatically by SDL_hid_enumerate() and | |
| 122 | + * any of the SDL_hid_open_*() functions if it is needed. This function should | |
| 123 | + * be called at the beginning of execution however, if there is a chance of | |
| 124 | + * HIDAPI handles being opened by different threads simultaneously. | |
| 125 | + * | |
| 126 | + * Each call to this function should have a matching call to SDL_hid_exit() | |
| 127 | + * | |
| 128 | + * \returns 0 on success and -1 on error. | |
| 129 | + * | |
| 130 | + * \since This function is available since SDL 2.0.18. | |
| 131 | + * | |
| 132 | + * \sa SDL_hid_exit | |
| 133 | + */ | |
| 134 | +extern DECLSPEC int SDLCALL SDL_hid_init(void); | |
| 135 | + | |
| 136 | +/** | |
| 137 | + * Finalize the HIDAPI library. | |
| 138 | + * | |
| 139 | + * This function frees all of the static data associated with HIDAPI. It | |
| 140 | + * should be called at the end of execution to avoid memory leaks. | |
| 141 | + * | |
| 142 | + * \returns 0 on success and -1 on error. | |
| 143 | + * | |
| 144 | + * \since This function is available since SDL 2.0.18. | |
| 145 | + * | |
| 146 | + * \sa SDL_hid_init | |
| 147 | + */ | |
| 148 | +extern DECLSPEC int SDLCALL SDL_hid_exit(void); | |
| 149 | + | |
| 150 | +/** | |
| 151 | + * Check to see if devices may have been added or removed. | |
| 152 | + * | |
| 153 | + * Enumerating the HID devices is an expensive operation, so you can call this | |
| 154 | + * to see if there have been any system device changes since the last call to | |
| 155 | + * this function. A change in the counter returned doesn't necessarily mean | |
| 156 | + * that anything has changed, but you can call SDL_hid_enumerate() to get an | |
| 157 | + * updated device list. | |
| 158 | + * | |
| 159 | + * Calling this function for the first time may cause a thread or other system | |
| 160 | + * resource to be allocated to track device change notifications. | |
| 161 | + * | |
| 162 | + * \returns a change counter that is incremented with each potential device | |
| 163 | + * change, or 0 if device change detection isn't available. | |
| 164 | + * | |
| 165 | + * \since This function is available since SDL 2.0.18. | |
| 166 | + * | |
| 167 | + * \sa SDL_hid_enumerate | |
| 168 | + */ | |
| 169 | +extern DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void); | |
| 170 | + | |
| 171 | +/** | |
| 172 | + * Enumerate the HID Devices. | |
| 173 | + * | |
| 174 | + * This function returns a linked list of all the HID devices attached to the | |
| 175 | + * system which match vendor_id and product_id. If `vendor_id` is set to 0 | |
| 176 | + * then any vendor matches. If `product_id` is set to 0 then any product | |
| 177 | + * matches. If `vendor_id` and `product_id` are both set to 0, then all HID | |
| 178 | + * devices will be returned. | |
| 179 | + * | |
| 180 | + * \param vendor_id The Vendor ID (VID) of the types of device to open. | |
| 181 | + * \param product_id The Product ID (PID) of the types of device to open. | |
| 182 | + * \returns a pointer to a linked list of type SDL_hid_device_info, containing | |
| 183 | + * information about the HID devices attached to the system, or NULL | |
| 184 | + * in the case of failure. Free this linked list by calling | |
| 185 | + * SDL_hid_free_enumeration(). | |
| 186 | + * | |
| 187 | + * \since This function is available since SDL 2.0.18. | |
| 188 | + * | |
| 189 | + * \sa SDL_hid_device_change_count | |
| 190 | + */ | |
| 191 | +extern DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id); | |
| 192 | + | |
| 193 | +/** | |
| 194 | + * Free an enumeration Linked List | |
| 195 | + * | |
| 196 | + * This function frees a linked list created by SDL_hid_enumerate(). | |
| 197 | + * | |
| 198 | + * \param devs Pointer to a list of struct_device returned from | |
| 199 | + * SDL_hid_enumerate(). | |
| 200 | + * | |
| 201 | + * \since This function is available since SDL 2.0.18. | |
| 202 | + */ | |
| 203 | +extern DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs); | |
| 204 | + | |
| 205 | +/** | |
| 206 | + * Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally | |
| 207 | + * a serial number. | |
| 208 | + * | |
| 209 | + * If `serial_number` is NULL, the first device with the specified VID and PID | |
| 210 | + * is opened. | |
| 211 | + * | |
| 212 | + * \param vendor_id The Vendor ID (VID) of the device to open. | |
| 213 | + * \param product_id The Product ID (PID) of the device to open. | |
| 214 | + * \param serial_number The Serial Number of the device to open (Optionally | |
| 215 | + * NULL). | |
| 216 | + * \returns a pointer to a SDL_hid_device object on success or NULL on | |
| 217 | + * failure. | |
| 218 | + * | |
| 219 | + * \since This function is available since SDL 2.0.18. | |
| 220 | + */ | |
| 221 | +extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number); | |
| 222 | + | |
| 223 | +/** | |
| 224 | + * Open a HID device by its path name. | |
| 225 | + * | |
| 226 | + * The path name be determined by calling SDL_hid_enumerate(), or a | |
| 227 | + * platform-specific path name can be used (eg: /dev/hidraw0 on Linux). | |
| 228 | + * | |
| 229 | + * \param path The path name of the device to open. | |
| 230 | + * \returns a pointer to a SDL_hid_device object on success or NULL on | |
| 231 | + * failure. | |
| 232 | + * | |
| 233 | + * \since This function is available since SDL 2.0.18. | |
| 234 | + */ | |
| 235 | +extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive); | |
| 236 | + | |
| 237 | +/** | |
| 238 | + * Write an Output report to a HID device. | |
| 239 | + * | |
| 240 | + * The first byte of `data` must contain the Report ID. For devices which only | |
| 241 | + * support a single report, this must be set to 0x0. The remaining bytes | |
| 242 | + * contain the report data. Since the Report ID is mandatory, calls to | |
| 243 | + * SDL_hid_write() will always contain one more byte than the report contains. | |
| 244 | + * For example, if a hid report is 16 bytes long, 17 bytes must be passed to | |
| 245 | + * SDL_hid_write(), the Report ID (or 0x0, for devices with a single report), | |
| 246 | + * followed by the report data (16 bytes). In this example, the length passed | |
| 247 | + * in would be 17. | |
| 248 | + * | |
| 249 | + * SDL_hid_write() will send the data on the first OUT endpoint, if one | |
| 250 | + * exists. If it does not, it will send the data through the Control Endpoint | |
| 251 | + * (Endpoint 0). | |
| 252 | + * | |
| 253 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 254 | + * \param data The data to send, including the report number as the first | |
| 255 | + * byte. | |
| 256 | + * \param length The length in bytes of the data to send. | |
| 257 | + * \returns the actual number of bytes written and -1 on error. | |
| 258 | + * | |
| 259 | + * \since This function is available since SDL 2.0.18. | |
| 260 | + */ | |
| 261 | +extern DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length); | |
| 262 | + | |
| 263 | +/** | |
| 264 | + * Read an Input report from a HID device with timeout. | |
| 265 | + * | |
| 266 | + * Input reports are returned to the host through the INTERRUPT IN endpoint. | |
| 267 | + * The first byte will contain the Report number if the device uses numbered | |
| 268 | + * reports. | |
| 269 | + * | |
| 270 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 271 | + * \param data A buffer to put the read data into. | |
| 272 | + * \param length The number of bytes to read. For devices with multiple | |
| 273 | + * reports, make sure to read an extra byte for the report | |
| 274 | + * number. | |
| 275 | + * \param milliseconds timeout in milliseconds or -1 for blocking wait. | |
| 276 | + * \returns the actual number of bytes read and -1 on error. If no packet was | |
| 277 | + * available to be read within the timeout period, this function | |
| 278 | + * returns 0. | |
| 279 | + * | |
| 280 | + * \since This function is available since SDL 2.0.18. | |
| 281 | + */ | |
| 282 | +extern DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds); | |
| 283 | + | |
| 284 | +/** | |
| 285 | + * Read an Input report from a HID device. | |
| 286 | + * | |
| 287 | + * Input reports are returned to the host through the INTERRUPT IN endpoint. | |
| 288 | + * The first byte will contain the Report number if the device uses numbered | |
| 289 | + * reports. | |
| 290 | + * | |
| 291 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 292 | + * \param data A buffer to put the read data into. | |
| 293 | + * \param length The number of bytes to read. For devices with multiple | |
| 294 | + * reports, make sure to read an extra byte for the report | |
| 295 | + * number. | |
| 296 | + * \returns the actual number of bytes read and -1 on error. If no packet was | |
| 297 | + * available to be read and the handle is in non-blocking mode, this | |
| 298 | + * function returns 0. | |
| 299 | + * | |
| 300 | + * \since This function is available since SDL 2.0.18. | |
| 301 | + */ | |
| 302 | +extern DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *data, size_t length); | |
| 303 | + | |
| 304 | +/** | |
| 305 | + * Set the device handle to be non-blocking. | |
| 306 | + * | |
| 307 | + * In non-blocking mode calls to SDL_hid_read() will return immediately with a | |
| 308 | + * value of 0 if there is no data to be read. In blocking mode, SDL_hid_read() | |
| 309 | + * will wait (block) until there is data to read before returning. | |
| 310 | + * | |
| 311 | + * Nonblocking can be turned on and off at any time. | |
| 312 | + * | |
| 313 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 314 | + * \param nonblock enable or not the nonblocking reads - 1 to enable | |
| 315 | + * nonblocking - 0 to disable nonblocking. | |
| 316 | + * \returns 0 on success and -1 on error. | |
| 317 | + * | |
| 318 | + * \since This function is available since SDL 2.0.18. | |
| 319 | + */ | |
| 320 | +extern DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int nonblock); | |
| 321 | + | |
| 322 | +/** | |
| 323 | + * Send a Feature report to the device. | |
| 324 | + * | |
| 325 | + * Feature reports are sent over the Control endpoint as a Set_Report | |
| 326 | + * transfer. The first byte of `data` must contain the Report ID. For devices | |
| 327 | + * which only support a single report, this must be set to 0x0. The remaining | |
| 328 | + * bytes contain the report data. Since the Report ID is mandatory, calls to | |
| 329 | + * SDL_hid_send_feature_report() will always contain one more byte than the | |
| 330 | + * report contains. For example, if a hid report is 16 bytes long, 17 bytes | |
| 331 | + * must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for | |
| 332 | + * devices which do not use numbered reports), followed by the report data (16 | |
| 333 | + * bytes). In this example, the length passed in would be 17. | |
| 334 | + * | |
| 335 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 336 | + * \param data The data to send, including the report number as the first | |
| 337 | + * byte. | |
| 338 | + * \param length The length in bytes of the data to send, including the report | |
| 339 | + * number. | |
| 340 | + * \returns the actual number of bytes written and -1 on error. | |
| 341 | + * | |
| 342 | + * \since This function is available since SDL 2.0.18. | |
| 343 | + */ | |
| 344 | +extern DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length); | |
| 345 | + | |
| 346 | +/** | |
| 347 | + * Get a feature report from a HID device. | |
| 348 | + * | |
| 349 | + * Set the first byte of `data` to the Report ID of the report to be read. | |
| 350 | + * Make sure to allow space for this extra byte in `data`. Upon return, the | |
| 351 | + * first byte will still contain the Report ID, and the report data will start | |
| 352 | + * in data[1]. | |
| 353 | + * | |
| 354 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 355 | + * \param data A buffer to put the read data into, including the Report ID. | |
| 356 | + * Set the first byte of `data` to the Report ID of the report to | |
| 357 | + * be read, or set it to zero if your device does not use numbered | |
| 358 | + * reports. | |
| 359 | + * \param length The number of bytes to read, including an extra byte for the | |
| 360 | + * report ID. The buffer can be longer than the actual report. | |
| 361 | + * \returns the number of bytes read plus one for the report ID (which is | |
| 362 | + * still in the first byte), or -1 on error. | |
| 363 | + * | |
| 364 | + * \since This function is available since SDL 2.0.18. | |
| 365 | + */ | |
| 366 | +extern DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length); | |
| 367 | + | |
| 368 | +/** | |
| 369 | + * Close a HID device. | |
| 370 | + * | |
| 371 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 372 | + * | |
| 373 | + * \since This function is available since SDL 2.0.18. | |
| 374 | + */ | |
| 375 | +extern DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev); | |
| 376 | + | |
| 377 | +/** | |
| 378 | + * Get The Manufacturer String from a HID device. | |
| 379 | + * | |
| 380 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 381 | + * \param string A wide string buffer to put the data into. | |
| 382 | + * \param maxlen The length of the buffer in multiples of wchar_t. | |
| 383 | + * \returns 0 on success and -1 on error. | |
| 384 | + * | |
| 385 | + * \since This function is available since SDL 2.0.18. | |
| 386 | + */ | |
| 387 | +extern DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen); | |
| 388 | + | |
| 389 | +/** | |
| 390 | + * Get The Product String from a HID device. | |
| 391 | + * | |
| 392 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 393 | + * \param string A wide string buffer to put the data into. | |
| 394 | + * \param maxlen The length of the buffer in multiples of wchar_t. | |
| 395 | + * \returns 0 on success and -1 on error. | |
| 396 | + * | |
| 397 | + * \since This function is available since SDL 2.0.18. | |
| 398 | + */ | |
| 399 | +extern DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen); | |
| 400 | + | |
| 401 | +/** | |
| 402 | + * Get The Serial Number String from a HID device. | |
| 403 | + * | |
| 404 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 405 | + * \param string A wide string buffer to put the data into. | |
| 406 | + * \param maxlen The length of the buffer in multiples of wchar_t. | |
| 407 | + * \returns 0 on success and -1 on error. | |
| 408 | + * | |
| 409 | + * \since This function is available since SDL 2.0.18. | |
| 410 | + */ | |
| 411 | +extern DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen); | |
| 412 | + | |
| 413 | +/** | |
| 414 | + * Get a string from a HID device, based on its string index. | |
| 415 | + * | |
| 416 | + * \param dev A device handle returned from SDL_hid_open(). | |
| 417 | + * \param string_index The index of the string to get. | |
| 418 | + * \param string A wide string buffer to put the data into. | |
| 419 | + * \param maxlen The length of the buffer in multiples of wchar_t. | |
| 420 | + * \returns 0 on success and -1 on error. | |
| 421 | + * | |
| 422 | + * \since This function is available since SDL 2.0.18. | |
| 423 | + */ | |
| 424 | +extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen); | |
| 425 | + | |
| 426 | +/** | |
| 427 | + * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers | |
| 428 | + * | |
| 429 | + * \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan. | |
| 430 | + * | |
| 431 | + * \since This function is available since SDL 2.0.18. | |
| 432 | + */ | |
| 433 | +extern DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL_bool active); | |
| 434 | + | |
| 435 | +/* Ends C function definitions when using C++ */ | |
| 436 | +#ifdef __cplusplus | |
| 437 | +} | |
| 438 | +#endif | |
| 439 | +#include "close_code.h" | |
| 440 | + | |
| 441 | +#endif /* SDL_hidapi_h_ */ | |
| 442 | + | |
| 443 | +/* vi: set sts=4 ts=4 sw=4 expandtab: */ |
長いので途中までです
| @@ -0,0 +1,3303 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryHints | |
| 24 | + * | |
| 25 | + * Official documentation for SDL configuration variables | |
| 26 | + * | |
| 27 | + * This file contains functions to set and get configuration hints, as well as | |
| 28 | + * listing each of them alphabetically. | |
| 29 | + * | |
| 30 | + * The convention for naming hints is SDL_HINT_X, where "SDL_X" is the | |
| 31 | + * environment variable that can be used to override the default. | |
| 32 | + * | |
| 33 | + * In general these hints are just that - they may or may not be supported or | |
| 34 | + * applicable on any given platform, but they provide a way for an application | |
| 35 | + * or user to give the library a hint as to how they would like the library to | |
| 36 | + * work. | |
| 37 | + */ | |
| 38 | + | |
| 39 | +#ifndef SDL_hints_h_ | |
| 40 | +#define SDL_hints_h_ | |
| 41 | + | |
| 42 | +#include "SDL_stdinc.h" | |
| 43 | + | |
| 44 | +#include "begin_code.h" | |
| 45 | +/* Set up for C function definitions, even when using C++ */ | |
| 46 | +#ifdef __cplusplus | |
| 47 | +extern "C" { | |
| 48 | +#endif | |
| 49 | + | |
| 50 | +/** | |
| 51 | + * A variable controlling whether the Android / iOS built-in accelerometer | |
| 52 | + * should be listed as a joystick device. | |
| 53 | + * | |
| 54 | + * This variable can be set to the following values: | |
| 55 | + * | |
| 56 | + * - "0": The accelerometer is not listed as a joystick | |
| 57 | + * - "1": The accelerometer is available as a 3 axis joystick (the default). | |
| 58 | + */ | |
| 59 | +#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" | |
| 60 | + | |
| 61 | +/** | |
| 62 | + * Specify the behavior of Alt+Tab while the keyboard is grabbed. | |
| 63 | + * | |
| 64 | + * By default, SDL emulates Alt+Tab functionality while the keyboard is | |
| 65 | + * grabbed and your window is full-screen. This prevents the user from getting | |
| 66 | + * stuck in your application if you've enabled keyboard grab. | |
| 67 | + * | |
| 68 | + * The variable can be set to the following values: | |
| 69 | + * | |
| 70 | + * - "0": SDL will not handle Alt+Tab. Your application is responsible for | |
| 71 | + * handling Alt+Tab while the keyboard is grabbed. | |
| 72 | + * - "1": SDL will minimize your window when Alt+Tab is pressed (default) | |
| 73 | + */ | |
| 74 | +#define SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED "SDL_ALLOW_ALT_TAB_WHILE_GRABBED" | |
| 75 | + | |
| 76 | +/** | |
| 77 | + * If set to "0" then never set the top most bit on a SDL Window, even if the | |
| 78 | + * video mode expects it. | |
| 79 | + * | |
| 80 | + * This is a debugging aid for developers and not expected to be used by end | |
| 81 | + * users. The default is "1" | |
| 82 | + * | |
| 83 | + * This variable can be set to the following values: | |
| 84 | + * | |
| 85 | + * - "0": don't allow topmost | |
| 86 | + * - "1": allow topmost | |
| 87 | + */ | |
| 88 | +#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" | |
| 89 | + | |
| 90 | +/** | |
| 91 | + * Android APK expansion main file version. | |
| 92 | + * | |
| 93 | + * Should be a string number like "1", "2" etc. | |
| 94 | + * | |
| 95 | + * Must be set together with | |
| 96 | + * SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION. | |
| 97 | + * | |
| 98 | + * If both hints were set then SDL_RWFromFile() will look into expansion files | |
| 99 | + * after a given relative path was not found in the internal storage and | |
| 100 | + * assets. | |
| 101 | + * | |
| 102 | + * By default this hint is not set and the APK expansion files are not | |
| 103 | + * searched. | |
| 104 | + */ | |
| 105 | +#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION" | |
| 106 | + | |
| 107 | +/** | |
| 108 | + * Android APK expansion patch file version. | |
| 109 | + * | |
| 110 | + * Should be a string number like "1", "2" etc. | |
| 111 | + * | |
| 112 | + * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION. | |
| 113 | + * | |
| 114 | + * If both hints were set then SDL_RWFromFile() will look into expansion files | |
| 115 | + * after a given relative path was not found in the internal storage and | |
| 116 | + * assets. | |
| 117 | + * | |
| 118 | + * By default this hint is not set and the APK expansion files are not | |
| 119 | + * searched. | |
| 120 | + */ | |
| 121 | +#define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION" | |
| 122 | + | |
| 123 | +/** | |
| 124 | + * A variable to control whether the event loop will block itself when the app | |
| 125 | + * is paused. | |
| 126 | + * | |
| 127 | + * The variable can be set to the following values: | |
| 128 | + * | |
| 129 | + * - "0": Non blocking. | |
| 130 | + * - "1": Blocking. (default) | |
| 131 | + * | |
| 132 | + * The value should be set before SDL is initialized. | |
| 133 | + */ | |
| 134 | +#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE" | |
| 135 | + | |
| 136 | +/** | |
| 137 | + * A variable to control whether SDL will pause audio in background (Requires | |
| 138 | + * SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking") | |
| 139 | + * | |
| 140 | + * The variable can be set to the following values: | |
| 141 | + * | |
| 142 | + * - "0": Non paused. | |
| 143 | + * - "1": Paused. (default) | |
| 144 | + * | |
| 145 | + * The value should be set before SDL is initialized. | |
| 146 | + */ | |
| 147 | +#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO "SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO" | |
| 148 | + | |
| 149 | +/** | |
| 150 | + * A variable to control whether we trap the Android back button to handle it | |
| 151 | + * manually. | |
| 152 | + * | |
| 153 | + * This is necessary for the right mouse button to work on some Android | |
| 154 | + * devices, or to be able to trap the back button for use in your code | |
| 155 | + * reliably. If set to true, the back button will show up as an SDL_KEYDOWN / | |
| 156 | + * SDL_KEYUP pair with a keycode of SDL_SCANCODE_AC_BACK. | |
| 157 | + * | |
| 158 | + * The variable can be set to the following values: | |
| 159 | + * | |
| 160 | + * - "0": Back button will be handled as usual for system. (default) | |
| 161 | + * - "1": Back button will be trapped, allowing you to handle the key press | |
| 162 | + * manually. (This will also let right mouse click work on systems where the | |
| 163 | + * right mouse button functions as back.) | |
| 164 | + * | |
| 165 | + * The value of this hint is used at runtime, so it can be changed at any | |
| 166 | + * time. | |
| 167 | + */ | |
| 168 | +#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" | |
| 169 | + | |
| 170 | +/** | |
| 171 | + * Specify an application name. | |
| 172 | + * | |
| 173 | + * This hint lets you specify the application name sent to the OS when | |
| 174 | + * required. For example, this will often appear in volume control applets for | |
| 175 | + * audio streams, and in lists of applications which are inhibiting the | |
| 176 | + * screensaver. You should use a string that describes your program ("My Game | |
| 177 | + * 2: The Revenge") | |
| 178 | + * | |
| 179 | + * Setting this to "" or leaving it unset will have SDL use a reasonable | |
| 180 | + * default: probably the application's name or "SDL Application" if SDL | |
| 181 | + * doesn't have any better information. | |
| 182 | + * | |
| 183 | + * Note that, for audio streams, this can be overridden with | |
| 184 | + * SDL_HINT_AUDIO_DEVICE_APP_NAME. | |
| 185 | + * | |
| 186 | + * On targets where this is not supported, this hint does nothing. | |
| 187 | + */ | |
| 188 | +#define SDL_HINT_APP_NAME "SDL_APP_NAME" | |
| 189 | + | |
| 190 | +/** | |
| 191 | + * A variable controlling whether controllers used with the Apple TV generate | |
| 192 | + * UI events. | |
| 193 | + * | |
| 194 | + * When UI events are generated by controller input, the app will be | |
| 195 | + * backgrounded when the Apple TV remote's menu button is pressed, and when | |
| 196 | + * the pause or B buttons on gamepads are pressed. | |
| 197 | + * | |
| 198 | + * More information about properly making use of controllers for the Apple TV | |
| 199 | + * can be found here: | |
| 200 | + * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/ | |
| 201 | + * | |
| 202 | + * This variable can be set to the following values: | |
| 203 | + * | |
| 204 | + * - "0": Controller input does not generate UI events (the default). | |
| 205 | + * - "1": Controller input generates UI events. | |
| 206 | + */ | |
| 207 | +#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS" | |
| 208 | + | |
| 209 | +/** | |
| 210 | + * A variable controlling whether the Apple TV remote's joystick axes will | |
| 211 | + * automatically match the rotation of the remote. | |
| 212 | + * | |
| 213 | + * This variable can be set to the following values: | |
| 214 | + * | |
| 215 | + * - "0": Remote orientation does not affect joystick axes (the default). | |
| 216 | + * - "1": Joystick axes are based on the orientation of the remote. | |
| 217 | + */ | |
| 218 | +#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" | |
| 219 | + | |
| 220 | +/** | |
| 221 | + * A variable controlling the audio category on iOS and Mac OS X | |
| 222 | + * | |
| 223 | + * This variable can be set to the following values: | |
| 224 | + * | |
| 225 | + * - "ambient": Use the AVAudioSessionCategoryAmbient audio category, will be | |
| 226 | + * muted by the phone mute switch (default) | |
| 227 | + * - "playback": Use the AVAudioSessionCategoryPlayback category | |
| 228 | + * | |
| 229 | + * For more information, see Apple's documentation: | |
| 230 | + * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html | |
| 231 | + */ | |
| 232 | +#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" | |
| 233 | + | |
| 234 | +/** | |
| 235 | + * Specify an application name for an audio device. | |
| 236 | + * | |
| 237 | + * Some audio backends (such as PulseAudio) allow you to describe your audio | |
| 238 | + * stream. Among other things, this description might show up in a system | |
| 239 | + * control panel that lets the user adjust the volume on specific audio | |
| 240 | + * streams instead of using one giant master volume slider. | |
| 241 | + * | |
| 242 | + * This hints lets you transmit that information to the OS. The contents of | |
| 243 | + * this hint are used while opening an audio device. You should use a string | |
| 244 | + * that describes your program ("My Game 2: The Revenge") | |
| 245 | + * | |
| 246 | + * Setting this to "" or leaving it unset will have SDL use a reasonable | |
| 247 | + * default: this will be the name set with SDL_HINT_APP_NAME, if that hint is | |
| 248 | + * set. Otherwise, it'll probably the application's name or "SDL Application" | |
| 249 | + * if SDL doesn't have any better information. | |
| 250 | + * | |
| 251 | + * On targets where this is not supported, this hint does nothing. | |
| 252 | + */ | |
| 253 | +#define SDL_HINT_AUDIO_DEVICE_APP_NAME "SDL_AUDIO_DEVICE_APP_NAME" | |
| 254 | + | |
| 255 | +/** | |
| 256 | + * Specify an application name for an audio device. | |
| 257 | + * | |
| 258 | + * Some audio backends (such as PulseAudio) allow you to describe your audio | |
| 259 | + * stream. Among other things, this description might show up in a system | |
| 260 | + * control panel that lets the user adjust the volume on specific audio | |
| 261 | + * streams instead of using one giant master volume slider. | |
| 262 | + * | |
| 263 | + * This hints lets you transmit that information to the OS. The contents of | |
| 264 | + * this hint are used while opening an audio device. You should use a string | |
| 265 | + * that describes your what your program is playing ("audio stream" is | |
| 266 | + * probably sufficient in many cases, but this could be useful for something | |
| 267 | + * like "team chat" if you have a headset playing VoIP audio separately). | |
| 268 | + * | |
| 269 | + * Setting this to "" or leaving it unset will have SDL use a reasonable | |
| 270 | + * default: "audio stream" or something similar. | |
| 271 | + * | |
| 272 | + * On targets where this is not supported, this hint does nothing. | |
| 273 | + */ | |
| 274 | +#define SDL_HINT_AUDIO_DEVICE_STREAM_NAME "SDL_AUDIO_DEVICE_STREAM_NAME" | |
| 275 | + | |
| 276 | +/** | |
| 277 | + * Specify an application role for an audio device. | |
| 278 | + * | |
| 279 | + * Some audio backends (such as Pipewire) allow you to describe the role of | |
| 280 | + * your audio stream. Among other things, this description might show up in a | |
| 281 | + * system control panel or software for displaying and manipulating media | |
| 282 | + * playback/capture graphs. | |
| 283 | + * | |
| 284 | + * This hints lets you transmit that information to the OS. The contents of | |
| 285 | + * this hint are used while opening an audio device. You should use a string | |
| 286 | + * that describes your what your program is playing (Game, Music, Movie, | |
| 287 | + * etc...). | |
| 288 | + * | |
| 289 | + * Setting this to "" or leaving it unset will have SDL use a reasonable | |
| 290 | + * default: "Game" or something similar. | |
| 291 | + * | |
| 292 | + * On targets where this is not supported, this hint does nothing. | |
| 293 | + */ | |
| 294 | +#define SDL_HINT_AUDIO_DEVICE_STREAM_ROLE "SDL_AUDIO_DEVICE_STREAM_ROLE" | |
| 295 | + | |
| 296 | +/** | |
| 297 | + * A variable controlling speed/quality tradeoff of audio resampling. | |
| 298 | + * | |
| 299 | + * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) | |
| 300 | + * to handle audio resampling. There are different resampling modes available | |
| 301 | + * that produce different levels of quality, using more CPU. | |
| 302 | + * | |
| 303 | + * If this hint isn't specified to a valid setting, or libsamplerate isn't | |
| 304 | + * available, SDL will use the default, internal resampling algorithm. | |
| 305 | + * | |
| 306 | + * As of SDL 2.26, SDL_ConvertAudio() respects this hint when libsamplerate is | |
| 307 | + * available. | |
| 308 | + * | |
| 309 | + * This hint is currently only checked at audio subsystem initialization. | |
| 310 | + * | |
| 311 | + * This variable can be set to the following values: | |
| 312 | + * | |
| 313 | + * - "0" or "default": Use SDL's internal resampling (Default when not set - | |
| 314 | + * low quality, fast) | |
| 315 | + * - "1" or "fast": Use fast, slightly higher quality resampling, if available | |
| 316 | + * - "2" or "medium": Use medium quality resampling, if available | |
| 317 | + * - "3" or "best": Use high quality resampling, if available | |
| 318 | + */ | |
| 319 | +#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE" | |
| 320 | + | |
| 321 | +/** | |
| 322 | + * A variable controlling whether SDL updates joystick state when getting | |
| 323 | + * input events | |
| 324 | + * | |
| 325 | + * This variable can be set to the following values: | |
| 326 | + * | |
| 327 | + * - "0": You'll call SDL_JoystickUpdate() manually | |
| 328 | + * - "1": SDL will automatically call SDL_JoystickUpdate() (default) | |
| 329 | + * | |
| 330 | + * This hint can be toggled on and off at runtime. | |
| 331 | + */ | |
| 332 | +#define SDL_HINT_AUTO_UPDATE_JOYSTICKS "SDL_AUTO_UPDATE_JOYSTICKS" | |
| 333 | + | |
| 334 | +/** | |
| 335 | + * A variable controlling whether SDL updates sensor state when getting input | |
| 336 | + * events | |
| 337 | + * | |
| 338 | + * This variable can be set to the following values: | |
| 339 | + * | |
| 340 | + * - "0": You'll call SDL_SensorUpdate() manually | |
| 341 | + * - "1": SDL will automatically call SDL_SensorUpdate() (default) | |
| 342 | + * | |
| 343 | + * This hint can be toggled on and off at runtime. | |
| 344 | + */ | |
| 345 | +#define SDL_HINT_AUTO_UPDATE_SENSORS "SDL_AUTO_UPDATE_SENSORS" | |
| 346 | + | |
| 347 | +/** | |
| 348 | + * Prevent SDL from using version 4 of the bitmap header when saving BMPs. | |
| 349 | + * | |
| 350 | + * The bitmap header version 4 is required for proper alpha channel support | |
| 351 | + * and SDL will use it when required. Should this not be desired, this hint | |
| 352 | + * can force the use of the 40 byte header version which is supported | |
| 353 | + * everywhere. | |
| 354 | + * | |
| 355 | + * The variable can be set to the following values: | |
| 356 | + * | |
| 357 | + * - "0": Surfaces with a colorkey or an alpha channel are saved to a 32-bit | |
| 358 | + * BMP file with an alpha mask. SDL will use the bitmap header version 4 and | |
| 359 | + * set the alpha mask accordingly. | |
| 360 | + * - "1": Surfaces with a colorkey or an alpha channel are saved to a 32-bit | |
| 361 | + * BMP file without an alpha mask. The alpha channel data will be in the | |
| 362 | + * file, but applications are going to ignore it. | |
| 363 | + * | |
| 364 | + * The default value is "0". | |
| 365 | + */ | |
| 366 | +#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT" | |
| 367 | + | |
| 368 | +/** | |
| 369 | + * Override for SDL_GetDisplayUsableBounds() | |
| 370 | + * | |
| 371 | + * If set, this hint will override the expected results for | |
| 372 | + * SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want | |
| 373 | + * to do this, but this allows an embedded system to request that some of the | |
| 374 | + * screen be reserved for other uses when paired with a well-behaved | |
| 375 | + * application. | |
| 376 | + * | |
| 377 | + * The contents of this hint must be 4 comma-separated integers, the first is | |
| 378 | + * the bounds x, then y, width and height, in that order. | |
| 379 | + */ | |
| 380 | +#define SDL_HINT_DISPLAY_USABLE_BOUNDS "SDL_DISPLAY_USABLE_BOUNDS" | |
| 381 | + | |
| 382 | +/** | |
| 383 | + * Disable giving back control to the browser automatically when running with | |
| 384 | + * asyncify | |
| 385 | + * | |
| 386 | + * With -s ASYNCIFY, SDL2 calls emscripten_sleep during operations such as | |
| 387 | + * refreshing the screen or polling events. | |
| 388 | + * | |
| 389 | + * This hint only applies to the emscripten platform | |
| 390 | + * | |
| 391 | + * The variable can be set to the following values: | |
| 392 | + * | |
| 393 | + * - "0": Disable emscripten_sleep calls (if you give back browser control | |
| 394 | + * manually or use asyncify for other purposes) | |
| 395 | + * - "1": Enable emscripten_sleep calls (the default) | |
| 396 | + */ | |
| 397 | +#define SDL_HINT_EMSCRIPTEN_ASYNCIFY "SDL_EMSCRIPTEN_ASYNCIFY" | |
| 398 | + | |
| 399 | +/** | |
| 400 | + * override the binding element for keyboard inputs for Emscripten builds | |
| 401 | + * | |
| 402 | + * This hint only applies to the emscripten platform. | |
| 403 | + * | |
| 404 | + * The variable can be one of: | |
| 405 | + * | |
| 406 | + * - "#window": the javascript window object (this is the default) | |
| 407 | + * - "#document": the javascript document object | |
| 408 | + * - "#screen": the javascript window.screen object | |
| 409 | + * - "#canvas": the WebGL canvas element | |
| 410 | + * | |
| 411 | + * Any other string without a leading # sign applies to the element on the | |
| 412 | + * page with that ID. | |
| 413 | + */ | |
| 414 | +#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT" | |
| 415 | + | |
| 416 | +/** | |
| 417 | + * A variable that controls whether the on-screen keyboard should be shown | |
| 418 | + * when text input is active | |
| 419 | + * | |
| 420 | + * The variable can be set to the following values: | |
| 421 | + * | |
| 422 | + * - "0": Do not show the on-screen keyboard | |
| 423 | + * - "1": Show the on-screen keyboard | |
| 424 | + * | |
| 425 | + * The default value is "1". This hint must be set before text input is | |
| 426 | + * activated. | |
| 427 | + */ | |
| 428 | +#define SDL_HINT_ENABLE_SCREEN_KEYBOARD "SDL_ENABLE_SCREEN_KEYBOARD" | |
| 429 | + | |
| 430 | +/** | |
| 431 | + * A variable controlling verbosity of the logging of SDL events pushed onto | |
| 432 | + * the internal queue. | |
| 433 | + * | |
| 434 | + * This variable can be set to the following values, from least to most | |
| 435 | + * verbose: | |
| 436 | + * | |
| 437 | + * - "0": Don't log any events (default) | |
| 438 | + * - "1": Log most events (other than the really spammy ones). | |
| 439 | + * - "2": Include mouse and finger motion events. | |
| 440 | + * - "3": Include SDL_SysWMEvent events. | |
| 441 | + * | |
| 442 | + * This is generally meant to be used to debug SDL itself, but can be useful | |
| 443 | + * for application developers that need better visibility into what is going | |
| 444 | + * on in the event queue. Logged events are sent through SDL_Log(), which | |
| 445 | + * means by default they appear on stdout on most platforms or maybe | |
| 446 | + * OutputDebugString() on Windows, and can be funneled by the app with | |
| 447 | + * SDL_LogSetOutputFunction(), etc. | |
| 448 | + * | |
| 449 | + * This hint can be toggled on and off at runtime, if you only need to log | |
| 450 | + * events for a small subset of program execution. | |
| 451 | + */ | |
| 452 | +#define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING" | |
| 453 | + | |
| 454 | +/** | |
| 455 | + * A variable controlling whether raising the window should be done more | |
| 456 | + * forcefully | |
| 457 | + * | |
| 458 | + * This variable can be set to the following values: | |
| 459 | + * | |
| 460 | + * - "0": No forcing (the default) | |
| 461 | + * - "1": Extra level of forcing | |
| 462 | + * | |
| 463 | + * At present, this is only an issue under MS Windows, which makes it nearly | |
| 464 | + * impossible to programmatically move a window to the foreground, for | |
| 465 | + * "security" reasons. See http://stackoverflow.com/a/34414846 for a | |
| 466 | + * discussion. | |
| 467 | + */ | |
| 468 | +#define SDL_HINT_FORCE_RAISEWINDOW "SDL_HINT_FORCE_RAISEWINDOW" | |
| 469 | + | |
| 470 | +/** | |
| 471 | + * A variable controlling how 3D acceleration is used to accelerate the SDL | |
| 472 | + * screen surface. | |
| 473 | + * | |
| 474 | + * SDL can try to accelerate the SDL screen surface by using streaming | |
| 475 | + * textures with a 3D rendering engine. This variable controls whether and how | |
| 476 | + * this is done. | |
| 477 | + * | |
| 478 | + * This variable can be set to the following values: | |
| 479 | + * | |
| 480 | + * - "0": Disable 3D acceleration | |
| 481 | + * - "1": Enable 3D acceleration, using the default renderer. | |
| 482 | + * - "X": Enable 3D acceleration, using X where X is one of the valid | |
| 483 | + * rendering drivers. (e.g. "direct3d", "opengl", etc.) | |
| 484 | + * | |
| 485 | + * By default SDL tries to make a best guess for each platform whether to use | |
| 486 | + * acceleration or not. | |
| 487 | + */ | |
| 488 | +#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION" | |
| 489 | + | |
| 490 | +/** | |
| 491 | + * A variable that lets you manually hint extra gamecontroller db entries. | |
| 492 | + * | |
| 493 | + * The variable should be newline delimited rows of gamecontroller config | |
| 494 | + * data, see SDL_gamecontroller.h | |
| 495 | + * | |
| 496 | + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) You | |
| 497 | + * can update mappings after the system is initialized with | |
| 498 | + * SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() | |
| 499 | + */ | |
| 500 | +#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" | |
| 501 | + | |
| 502 | +/** | |
| 503 | + * A variable that lets you provide a file with extra gamecontroller db | |
| 504 | + * entries. | |
| 505 | + * | |
| 506 | + * The file should contain lines of gamecontroller config data, see | |
| 507 | + * SDL_gamecontroller.h | |
| 508 | + * | |
| 509 | + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) You | |
| 510 | + * can update mappings after the system is initialized with | |
| 511 | + * SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() | |
| 512 | + */ | |
| 513 | +#define SDL_HINT_GAMECONTROLLERCONFIG_FILE "SDL_GAMECONTROLLERCONFIG_FILE" | |
| 514 | + | |
| 515 | +/** | |
| 516 | + * A variable that overrides the automatic controller type detection | |
| 517 | + * | |
| 518 | + * The variable should be comma separated entries, in the form: VID/PID=type | |
| 519 | + * | |
| 520 | + * The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd | |
| 521 | + * | |
| 522 | + * The type should be one of: Xbox360 XboxOne PS3 PS4 PS5 SwitchPro | |
| 523 | + * | |
| 524 | + * This hint affects what driver is used, and must be set before calling | |
| 525 | + * SDL_Init(SDL_INIT_GAMECONTROLLER) | |
| 526 | + */ | |
| 527 | +#define SDL_HINT_GAMECONTROLLERTYPE "SDL_GAMECONTROLLERTYPE" | |
| 528 | + | |
| 529 | +/** | |
| 530 | + * A variable containing a list of devices to skip when scanning for game | |
| 531 | + * controllers. | |
| 532 | + * | |
| 533 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 534 | + * hexadecimal form, e.g. | |
| 535 | + * | |
| 536 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 537 | + * | |
| 538 | + * The variable can also take the form of @file, in which case the named file | |
| 539 | + * will be loaded and interpreted as the value of the variable. | |
| 540 | + */ | |
| 541 | +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES" | |
| 542 | + | |
| 543 | +/** | |
| 544 | + * If set, all devices will be skipped when scanning for game controllers | |
| 545 | + * except for the ones listed in this variable. | |
| 546 | + * | |
| 547 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 548 | + * hexadecimal form, e.g. | |
| 549 | + * | |
| 550 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 551 | + * | |
| 552 | + * The variable can also take the form of @file, in which case the named file | |
| 553 | + * will be loaded and interpreted as the value of the variable. | |
| 554 | + */ | |
| 555 | +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT" | |
| 556 | + | |
| 557 | +/** | |
| 558 | + * If set, game controller face buttons report their values according to their | |
| 559 | + * labels instead of their positional layout. | |
| 560 | + * | |
| 561 | + * For example, on Nintendo Switch controllers, normally you'd get: | |
| 562 | + * | |
| 563 | + * ``` | |
| 564 | + * (Y) | |
| 565 | + * (X) (B) | |
| 566 | + * (A) | |
| 567 | + * ``` | |
| 568 | + * | |
| 569 | + * but if this hint is set, you'll get: | |
| 570 | + * | |
| 571 | + * ``` | |
| 572 | + * (X) | |
| 573 | + * (Y) (A) | |
| 574 | + * (B) | |
| 575 | + * ``` | |
| 576 | + * | |
| 577 | + * The variable can be set to the following values: | |
| 578 | + * | |
| 579 | + * - "0": Report the face buttons by position, as though they were on an Xbox | |
| 580 | + * controller. | |
| 581 | + * - "1": Report the face buttons by label instead of position | |
| 582 | + * | |
| 583 | + * The default value is "1". This hint may be set at any time. | |
| 584 | + */ | |
| 585 | +#define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS" | |
| 586 | + | |
| 587 | +/** | |
| 588 | + * A variable controlling whether grabbing input grabs the keyboard | |
| 589 | + * | |
| 590 | + * This variable can be set to the following values: | |
| 591 | + * | |
| 592 | + * - "0": Grab will affect only the mouse | |
| 593 | + * - "1": Grab will affect mouse and keyboard | |
| 594 | + * | |
| 595 | + * By default SDL will not grab the keyboard so system shortcuts still work. | |
| 596 | + */ | |
| 597 | +#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" | |
| 598 | + | |
| 599 | +/** | |
| 600 | + * A variable containing a list of devices to ignore in SDL_hid_enumerate() | |
| 601 | + * | |
| 602 | + * For example, to ignore the Shanwan DS3 controller and any Valve controller, | |
| 603 | + * you might have the string "0x2563/0x0523,0x28de/0x0000" | |
| 604 | + */ | |
| 605 | +#define SDL_HINT_HIDAPI_IGNORE_DEVICES "SDL_HIDAPI_IGNORE_DEVICES" | |
| 606 | + | |
| 607 | +/** | |
| 608 | + * A variable controlling whether the idle timer is disabled on iOS. | |
| 609 | + * | |
| 610 | + * When an iOS app does not receive touches for some time, the screen is | |
| 611 | + * dimmed automatically. For games where the accelerometer is the only input | |
| 612 | + * this is problematic. This functionality can be disabled by setting this | |
| 613 | + * hint. | |
| 614 | + * | |
| 615 | + * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver() | |
| 616 | + * accomplish the same thing on iOS. They should be preferred over this hint. | |
| 617 | + * | |
| 618 | + * This variable can be set to the following values: | |
| 619 | + * | |
| 620 | + * - "0": Enable idle timer | |
| 621 | + * - "1": Disable idle timer | |
| 622 | + */ | |
| 623 | +#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" | |
| 624 | + | |
| 625 | +/** | |
| 626 | + * A variable to control whether certain IMEs should handle text editing | |
| 627 | + * internally instead of sending SDL_TEXTEDITING events. | |
| 628 | + * | |
| 629 | + * The variable can be set to the following values: | |
| 630 | + * | |
| 631 | + * - "0": SDL_TEXTEDITING events are sent, and it is the application's | |
| 632 | + * responsibility to render the text from these events and differentiate it | |
| 633 | + * somehow from committed text. (default) | |
| 634 | + * - "1": If supported by the IME then SDL_TEXTEDITING events are not sent, | |
| 635 | + * and text that is being composed will be rendered in its own UI. | |
| 636 | + */ | |
| 637 | +#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING" | |
| 638 | + | |
| 639 | +/** | |
| 640 | + * A variable to control whether certain IMEs should show native UI components | |
| 641 | + * (such as the Candidate List) instead of suppressing them. | |
| 642 | + * | |
| 643 | + * The variable can be set to the following values: | |
| 644 | + * | |
| 645 | + * - "0": Native UI components are not display. (default) | |
| 646 | + * - "1": Native UI components are displayed. | |
| 647 | + */ | |
| 648 | +#define SDL_HINT_IME_SHOW_UI "SDL_IME_SHOW_UI" | |
| 649 | + | |
| 650 | +/** | |
| 651 | + * A variable to control if extended IME text support is enabled. | |
| 652 | + * | |
| 653 | + * If enabled then SDL_TextEditingExtEvent will be issued if the text would be | |
| 654 | + * truncated otherwise. Additionally SDL_TextInputEvent will be dispatched | |
| 655 | + * multiple times so that it is not truncated. | |
| 656 | + * | |
| 657 | + * The variable can be set to the following values: | |
| 658 | + * | |
| 659 | + * - "0": Legacy behavior. Text can be truncated, no heap allocations. | |
| 660 | + * (default) | |
| 661 | + * - "1": Modern behavior. | |
| 662 | + */ | |
| 663 | +#define SDL_HINT_IME_SUPPORT_EXTENDED_TEXT "SDL_IME_SUPPORT_EXTENDED_TEXT" | |
| 664 | + | |
| 665 | +/** | |
| 666 | + * A variable controlling whether the home indicator bar on iPhone X should be | |
| 667 | + * hidden. | |
| 668 | + * | |
| 669 | + * This variable can be set to the following values: | |
| 670 | + * | |
| 671 | + * - "0": The indicator bar is not hidden (default for windowed applications) | |
| 672 | + * - "1": The indicator bar is hidden and is shown when the screen is touched | |
| 673 | + * (useful for movie playback applications) | |
| 674 | + * - "2": The indicator bar is dim and the first swipe makes it visible and | |
| 675 | + * the second swipe performs the "home" action (default for fullscreen | |
| 676 | + * applications) | |
| 677 | + */ | |
| 678 | +#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" | |
| 679 | + | |
| 680 | +/** | |
| 681 | + * A variable that lets you enable joystick (and gamecontroller) events even | |
| 682 | + * when your app is in the background. | |
| 683 | + * | |
| 684 | + * The variable can be set to the following values: | |
| 685 | + * | |
| 686 | + * - "0": Disable joystick & gamecontroller input events when the application | |
| 687 | + * is in the background. | |
| 688 | + * - "1": Enable joystick & gamecontroller input events when the application | |
| 689 | + * is in the background. | |
| 690 | + * | |
| 691 | + * The default value is "0". This hint may be set at any time. | |
| 692 | + */ | |
| 693 | +#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" | |
| 694 | + | |
| 695 | +/** | |
| 696 | + * A variable containing a list of arcade stick style controllers. | |
| 697 | + * | |
| 698 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 699 | + * hexadecimal form, e.g. | |
| 700 | + * | |
| 701 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 702 | + * | |
| 703 | + * The variable can also take the form of @file, in which case the named file | |
| 704 | + * will be loaded and interpreted as the value of the variable. | |
| 705 | + */ | |
| 706 | +#define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES "SDL_JOYSTICK_ARCADESTICK_DEVICES" | |
| 707 | + | |
| 708 | +/** | |
| 709 | + * A variable containing a list of devices that are not arcade stick style | |
| 710 | + * controllers. | |
| 711 | + * | |
| 712 | + * This will override SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES and the built in | |
| 713 | + * device list. | |
| 714 | + * | |
| 715 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 716 | + * hexadecimal form, e.g. | |
| 717 | + * | |
| 718 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 719 | + * | |
| 720 | + * The variable can also take the form of @file, in which case the named file | |
| 721 | + * will be loaded and interpreted as the value of the variable. | |
| 722 | + */ | |
| 723 | +#define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED" | |
| 724 | + | |
| 725 | +/** | |
| 726 | + * A variable containing a list of devices that should not be considerd | |
| 727 | + * joysticks. | |
| 728 | + * | |
| 729 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 730 | + * hexadecimal form, e.g. | |
| 731 | + * | |
| 732 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 733 | + * | |
| 734 | + * The variable can also take the form of @file, in which case the named file | |
| 735 | + * will be loaded and interpreted as the value of the variable. | |
| 736 | + */ | |
| 737 | +#define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES "SDL_JOYSTICK_BLACKLIST_DEVICES" | |
| 738 | + | |
| 739 | +/** | |
| 740 | + * A variable containing a list of devices that should be considered | |
| 741 | + * joysticks. | |
| 742 | + * | |
| 743 | + * This will override SDL_HINT_JOYSTICK_BLACKLIST_DEVICES and the built in | |
| 744 | + * device list. | |
| 745 | + * | |
| 746 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 747 | + * hexadecimal form, e.g. | |
| 748 | + * | |
| 749 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 750 | + * | |
| 751 | + * The variable can also take the form of @file, in which case the named file | |
| 752 | + * will be loaded and interpreted as the value of the variable. | |
| 753 | + */ | |
| 754 | +#define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED "SDL_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED" | |
| 755 | + | |
| 756 | +/** | |
| 757 | + * A variable containing a list of flightstick style controllers. | |
| 758 | + * | |
| 759 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 760 | + * hexadecimal form, e.g. | |
| 761 | + * | |
| 762 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 763 | + * | |
| 764 | + * The variable can also take the form of @file, in which case the named file | |
| 765 | + * will be loaded and interpreted as the value of the variable. | |
| 766 | + */ | |
| 767 | +#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES "SDL_JOYSTICK_FLIGHTSTICK_DEVICES" | |
| 768 | + | |
| 769 | +/** | |
| 770 | + * A variable containing a list of devices that are not flightstick style | |
| 771 | + * controllers. | |
| 772 | + * | |
| 773 | + * This will override SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES and the built in | |
| 774 | + * device list. | |
| 775 | + * | |
| 776 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 777 | + * hexadecimal form, e.g. | |
| 778 | + * | |
| 779 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 780 | + * | |
| 781 | + * The variable can also take the form of @file, in which case the named file | |
| 782 | + * will be loaded and interpreted as the value of the variable. | |
| 783 | + */ | |
| 784 | +#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED" | |
| 785 | + | |
| 786 | +/** | |
| 787 | + * A variable containing a list of devices known to have a GameCube form | |
| 788 | + * factor. | |
| 789 | + * | |
| 790 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 791 | + * hexadecimal form, e.g. | |
| 792 | + * | |
| 793 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 794 | + * | |
| 795 | + * The variable can also take the form of @file, in which case the named file | |
| 796 | + * will be loaded and interpreted as the value of the variable. | |
| 797 | + */ | |
| 798 | +#define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES "SDL_JOYSTICK_GAMECUBE_DEVICES" | |
| 799 | + | |
| 800 | +/** | |
| 801 | + * A variable containing a list of devices known not to have a GameCube form | |
| 802 | + * factor. | |
| 803 | + * | |
| 804 | + * This will override SDL_HINT_JOYSTICK_GAMECUBE_DEVICES and the built in | |
| 805 | + * device list. | |
| 806 | + * | |
| 807 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 808 | + * hexadecimal form, e.g. | |
| 809 | + * | |
| 810 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 811 | + * | |
| 812 | + * The variable can also take the form of @file, in which case the named file | |
| 813 | + * will be loaded and interpreted as the value of the variable. | |
| 814 | + */ | |
| 815 | +#define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED "SDL_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED" | |
| 816 | + | |
| 817 | +/** | |
| 818 | + * A variable controlling whether the HIDAPI joystick drivers should be used. | |
| 819 | + * | |
| 820 | + * This variable can be set to the following values: | |
| 821 | + * | |
| 822 | + * - "0": HIDAPI drivers are not used | |
| 823 | + * - "1": HIDAPI drivers are used (the default) | |
| 824 | + * | |
| 825 | + * This variable is the default for all drivers, but can be overridden by the | |
| 826 | + * hints for specific drivers below. | |
| 827 | + */ | |
| 828 | +#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI" | |
| 829 | + | |
| 830 | +/** | |
| 831 | + * A variable controlling whether the HIDAPI driver for Nintendo GameCube | |
| 832 | + * controllers should be used. | |
| 833 | + * | |
| 834 | + * This variable can be set to the following values: | |
| 835 | + * | |
| 836 | + * - "0": HIDAPI driver is not used | |
| 837 | + * - "1": HIDAPI driver is used | |
| 838 | + * | |
| 839 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI | |
| 840 | + */ | |
| 841 | +#define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE" | |
| 842 | + | |
| 843 | +/** | |
| 844 | + * A variable controlling whether "low_frequency_rumble" and | |
| 845 | + * "high_frequency_rumble" is used to implement the GameCube controller's 3 | |
| 846 | + * rumble modes, Stop(0), Rumble(1), and StopHard(2) this is useful for | |
| 847 | + * applications that need full compatibility for things like ADSR envelopes. | |
| 848 | + * | |
| 849 | + * Stop is implemented by setting "low_frequency_rumble" to "0" and | |
| 850 | + * "high_frequency_rumble" ">0" Rumble is both at any arbitrary value, | |
| 851 | + * StopHard is implemented by setting both "low_frequency_rumble" and | |
| 852 | + * "high_frequency_rumble" to "0" | |
| 853 | + * | |
| 854 | + * This variable can be set to the following values: | |
| 855 | + * | |
| 856 | + * - "0": Normal rumble behavior is behavior is used (default) | |
| 857 | + * - "1": Proper GameCube controller rumble behavior is used | |
| 858 | + */ | |
| 859 | +#define SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE "SDL_JOYSTICK_GAMECUBE_RUMBLE_BRAKE" | |
| 860 | + | |
| 861 | +/** | |
| 862 | + * A variable controlling whether the HIDAPI driver for Nintendo Switch | |
| 863 | + * Joy-Cons should be used. | |
| 864 | + * | |
| 865 | + * This variable can be set to the following values: | |
| 866 | + * | |
| 867 | + * - "0": HIDAPI driver is not used | |
| 868 | + * - "1": HIDAPI driver is used | |
| 869 | + * | |
| 870 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI | |
| 871 | + */ | |
| 872 | +#define SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS "SDL_JOYSTICK_HIDAPI_JOY_CONS" | |
| 873 | + | |
| 874 | +/** | |
| 875 | + * A variable controlling whether Nintendo Switch Joy-Con controllers will be | |
| 876 | + * combined into a single Pro-like controller when using the HIDAPI driver | |
| 877 | + * | |
| 878 | + * This variable can be set to the following values: | |
| 879 | + * | |
| 880 | + * - "0": Left and right Joy-Con controllers will not be combined and each | |
| 881 | + * will be a mini-gamepad | |
| 882 | + * - "1": Left and right Joy-Con controllers will be combined into a single | |
| 883 | + * controller (the default) | |
| 884 | + */ | |
| 885 | +#define SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS "SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS" | |
| 886 | + | |
| 887 | +/** | |
| 888 | + * A variable controlling whether Nintendo Switch Joy-Con controllers will be | |
| 889 | + * in vertical mode when using the HIDAPI driver | |
| 890 | + * | |
| 891 | + * This variable can be set to the following values: | |
| 892 | + * | |
| 893 | + * - "0": Left and right Joy-Con controllers will not be in vertical mode (the | |
| 894 | + * default) | |
| 895 | + * - "1": Left and right Joy-Con controllers will be in vertical mode | |
| 896 | + * | |
| 897 | + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) | |
| 898 | + */ | |
| 899 | +#define SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS" | |
| 900 | + | |
| 901 | +/** | |
| 902 | + * A variable controlling whether the HIDAPI driver for Amazon Luna | |
| 903 | + * controllers connected via Bluetooth should be used. | |
| 904 | + * | |
| 905 | + * This variable can be set to the following values: | |
| 906 | + * | |
| 907 | + * - "0": HIDAPI driver is not used | |
| 908 | + * - "1": HIDAPI driver is used | |
| 909 | + * | |
| 910 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI | |
| 911 | + */ | |
| 912 | +#define SDL_HINT_JOYSTICK_HIDAPI_LUNA "SDL_JOYSTICK_HIDAPI_LUNA" | |
| 913 | + | |
| 914 | +/** | |
| 915 | + * A variable controlling whether the HIDAPI driver for Nintendo Online | |
| 916 | + * classic controllers should be used. | |
| 917 | + * | |
| 918 | + * This variable can be set to the following values: | |
| 919 | + * | |
| 920 | + * - "0": HIDAPI driver is not used | |
| 921 | + * - "1": HIDAPI driver is used | |
| 922 | + * | |
| 923 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI | |
| 924 | + */ | |
| 925 | +#define SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC "SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC" | |
| 926 | + | |
| 927 | +/** | |
| 928 | + * A variable controlling whether the HIDAPI driver for NVIDIA SHIELD | |
| 929 | + * controllers should be used. | |
| 930 | + * | |
| 931 | + * This variable can be set to the following values: | |
| 932 | + * | |
| 933 | + * - "0": HIDAPI driver is not used | |
| 934 | + * - "1": HIDAPI driver is used | |
| 935 | + * | |
| 936 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI | |
| 937 | + */ | |
| 938 | +#define SDL_HINT_JOYSTICK_HIDAPI_SHIELD "SDL_JOYSTICK_HIDAPI_SHIELD" | |
| 939 | + | |
| 940 | +/** | |
| 941 | + * A variable controlling whether the HIDAPI driver for PS3 controllers should | |
| 942 | + * be used. | |
| 943 | + * | |
| 944 | + * This variable can be set to the following values: | |
| 945 | + * | |
| 946 | + * - "0": HIDAPI driver is not used | |
| 947 | + * - "1": HIDAPI driver is used | |
| 948 | + * | |
| 949 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI on macOS, and "0" on | |
| 950 | + * other platforms. | |
| 951 | + * | |
| 952 | + * It is not possible to use this driver on Windows, due to limitations in the | |
| 953 | + * default drivers installed. See https://github.com/ViGEm/DsHidMini for an | |
| 954 | + * alternative driver on Windows. | |
| 955 | + */ | |
| 956 | +#define SDL_HINT_JOYSTICK_HIDAPI_PS3 "SDL_JOYSTICK_HIDAPI_PS3" | |
| 957 | + | |
| 958 | +/** | |
| 959 | + * A variable controlling whether the HIDAPI driver for PS4 controllers should | |
| 960 | + * be used. | |
| 961 | + * | |
| 962 | + * This variable can be set to the following values: | |
| 963 | + * | |
| 964 | + * - "0": HIDAPI driver is not used | |
| 965 | + * - "1": HIDAPI driver is used | |
| 966 | + * | |
| 967 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI | |
| 968 | + */ | |
| 969 | +#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4" | |
| 970 | + | |
| 971 | +/** | |
| 972 | + * A variable controlling whether extended input reports should be used for | |
| 973 | + * PS4 controllers when using the HIDAPI driver. | |
| 974 | + * | |
| 975 | + * This variable can be set to the following values: | |
| 976 | + * | |
| 977 | + * - "0": extended reports are not enabled (the default) | |
| 978 | + * - "1": extended reports | |
| 979 | + * | |
| 980 | + * Extended input reports allow rumble on Bluetooth PS4 controllers, but break | |
| 981 | + * DirectInput handling for applications that don't use SDL. | |
| 982 | + * | |
| 983 | + * Once extended reports are enabled, they can not be disabled without power | |
| 984 | + * cycling the controller. | |
| 985 | + * | |
| 986 | + * For compatibility with applications written for versions of SDL prior to | |
| 987 | + * the introduction of PS5 controller support, this value will also control | |
| 988 | + * the state of extended reports on PS5 controllers when the | |
| 989 | + * SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE hint is not explicitly set. | |
| 990 | + */ | |
| 991 | +#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE" | |
| 992 | + | |
| 993 | +/** | |
| 994 | + * A variable controlling whether the HIDAPI driver for PS5 controllers should | |
| 995 | + * be used. | |
| 996 | + * | |
| 997 | + * This variable can be set to the following values: | |
| 998 | + * | |
| 999 | + * - "0": HIDAPI driver is not used | |
| 1000 | + * - "1": HIDAPI driver is used | |
| 1001 | + * | |
| 1002 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI | |
| 1003 | + */ | |
| 1004 | +#define SDL_HINT_JOYSTICK_HIDAPI_PS5 "SDL_JOYSTICK_HIDAPI_PS5" | |
| 1005 | + | |
| 1006 | +/** | |
| 1007 | + * A variable controlling whether the player LEDs should be lit to indicate | |
| 1008 | + * which player is associated with a PS5 controller. | |
| 1009 | + * | |
| 1010 | + * This variable can be set to the following values: | |
| 1011 | + * | |
| 1012 | + * - "0": player LEDs are not enabled | |
| 1013 | + * - "1": player LEDs are enabled (the default) | |
| 1014 | + */ | |
| 1015 | +#define SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED" | |
| 1016 | + | |
| 1017 | +/** | |
| 1018 | + * A variable controlling whether extended input reports should be used for | |
| 1019 | + * PS5 controllers when using the HIDAPI driver. | |
| 1020 | + * | |
| 1021 | + * This variable can be set to the following values: | |
| 1022 | + * | |
| 1023 | + * - "0": extended reports are not enabled (the default) | |
| 1024 | + * - "1": extended reports | |
| 1025 | + * | |
| 1026 | + * Extended input reports allow rumble on Bluetooth PS5 controllers, but break | |
| 1027 | + * DirectInput handling for applications that don't use SDL. | |
| 1028 | + * | |
| 1029 | + * Once extended reports are enabled, they can not be disabled without power | |
| 1030 | + * cycling the controller. | |
| 1031 | + * | |
| 1032 | + * For compatibility with applications written for versions of SDL prior to | |
| 1033 | + * the introduction of PS5 controller support, this value defaults to the | |
| 1034 | + * value of SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE. | |
| 1035 | + */ | |
| 1036 | +#define SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE "SDL_JOYSTICK_HIDAPI_PS5_RUMBLE" | |
| 1037 | + | |
| 1038 | +/** | |
| 1039 | + * A variable controlling whether the HIDAPI driver for Google Stadia | |
| 1040 | + * controllers should be used. | |
| 1041 | + * | |
| 1042 | + * This variable can be set to the following values: | |
| 1043 | + * | |
| 1044 | + * - "0": HIDAPI driver is not used | |
| 1045 | + * - "1": HIDAPI driver is used | |
| 1046 | + * | |
| 1047 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI | |
| 1048 | + */ | |
| 1049 | +#define SDL_HINT_JOYSTICK_HIDAPI_STADIA "SDL_JOYSTICK_HIDAPI_STADIA" | |
| 1050 | + | |
| 1051 | +/** | |
| 1052 | + * A variable controlling whether the HIDAPI driver for Bluetooth Steam | |
| 1053 | + * Controllers should be used. | |
| 1054 | + * | |
| 1055 | + * This variable can be set to the following values: | |
| 1056 | + * | |
| 1057 | + * - "0": HIDAPI driver is not used | |
| 1058 | + * - "1": HIDAPI driver is used for Steam Controllers, which requires | |
| 1059 | + * Bluetooth access and may prompt the user for permission on iOS and | |
| 1060 | + * Android. | |
| 1061 | + * | |
| 1062 | + * The default is "0" | |
| 1063 | + */ | |
| 1064 | +#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" | |
| 1065 | + | |
| 1066 | +/** | |
| 1067 | + * A variable controlling whether the HIDAPI driver for the Steam Deck builtin | |
| 1068 | + * controller should be used. | |
| 1069 | + * | |
| 1070 | + * This variable can be set to the following values: | |
| 1071 | + * | |
| 1072 | + * - "0": HIDAPI driver is not used | |
| 1073 | + * - "1": HIDAPI driver is used | |
| 1074 | + * | |
| 1075 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI | |
| 1076 | + */ | |
| 1077 | +#define SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK "SDL_JOYSTICK_HIDAPI_STEAMDECK" | |
| 1078 | + | |
| 1079 | +/** | |
| 1080 | + * A variable controlling whether the HIDAPI driver for Nintendo Switch | |
| 1081 | + * controllers should be used. | |
| 1082 | + * | |
| 1083 | + * This variable can be set to the following values: | |
| 1084 | + * | |
| 1085 | + * - "0": HIDAPI driver is not used | |
| 1086 | + * - "1": HIDAPI driver is used | |
| 1087 | + * | |
| 1088 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI | |
| 1089 | + */ | |
| 1090 | +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH" | |
| 1091 | + | |
| 1092 | +/** | |
| 1093 | + * A variable controlling whether the Home button LED should be turned on when | |
| 1094 | + * a Nintendo Switch Pro controller is opened | |
| 1095 | + * | |
| 1096 | + * This variable can be set to the following values: | |
| 1097 | + * | |
| 1098 | + * - "0": home button LED is turned off | |
| 1099 | + * - "1": home button LED is turned on | |
| 1100 | + * | |
| 1101 | + * By default the Home button LED state is not changed. This hint can also be | |
| 1102 | + * set to a floating point value between 0.0 and 1.0 which controls the | |
| 1103 | + * brightness of the Home button LED. | |
| 1104 | + */ | |
| 1105 | +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED" | |
| 1106 | + | |
| 1107 | +/** | |
| 1108 | + * A variable controlling whether the Home button LED should be turned on when | |
| 1109 | + * a Nintendo Switch Joy-Con controller is opened | |
| 1110 | + * | |
| 1111 | + * This variable can be set to the following values: | |
| 1112 | + * | |
| 1113 | + * - "0": home button LED is turned off | |
| 1114 | + * - "1": home button LED is turned on | |
| 1115 | + * | |
| 1116 | + * By default the Home button LED state is not changed. This hint can also be | |
| 1117 | + * set to a floating point value between 0.0 and 1.0 which controls the | |
| 1118 | + * brightness of the Home button LED. | |
| 1119 | + */ | |
| 1120 | +#define SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED "SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED" | |
| 1121 | + | |
| 1122 | +/** | |
| 1123 | + * A variable controlling whether the player LEDs should be lit to indicate | |
| 1124 | + * which player is associated with a Nintendo Switch controller. | |
| 1125 | + * | |
| 1126 | + * This variable can be set to the following values: | |
| 1127 | + * | |
| 1128 | + * - "0": player LEDs are not enabled | |
| 1129 | + * - "1": player LEDs are enabled (the default) | |
| 1130 | + */ | |
| 1131 | +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED "SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED" | |
| 1132 | + | |
| 1133 | +/** | |
| 1134 | + * A variable controlling whether the HIDAPI driver for Nintendo Wii and Wii U | |
| 1135 | + * controllers should be used. | |
| 1136 | + * | |
| 1137 | + * This variable can be set to the following values: | |
| 1138 | + * | |
| 1139 | + * - "0": HIDAPI driver is not used | |
| 1140 | + * - "1": HIDAPI driver is used | |
| 1141 | + * | |
| 1142 | + * This driver doesn't work with the dolphinbar, so the default is SDL_FALSE | |
| 1143 | + * for now. | |
| 1144 | + */ | |
| 1145 | +#define SDL_HINT_JOYSTICK_HIDAPI_WII "SDL_JOYSTICK_HIDAPI_WII" | |
| 1146 | + | |
| 1147 | +/** | |
| 1148 | + * A variable controlling whether the player LEDs should be lit to indicate | |
| 1149 | + * which player is associated with a Wii controller. | |
| 1150 | + * | |
| 1151 | + * This variable can be set to the following values: | |
| 1152 | + * | |
| 1153 | + * - "0": player LEDs are not enabled | |
| 1154 | + * - "1": player LEDs are enabled (the default) | |
| 1155 | + */ | |
| 1156 | +#define SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED "SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED" | |
| 1157 | + | |
| 1158 | +/** | |
| 1159 | + * A variable controlling whether the HIDAPI driver for XBox controllers | |
| 1160 | + * should be used. | |
| 1161 | + * | |
| 1162 | + * This variable can be set to the following values: | |
| 1163 | + * | |
| 1164 | + * - "0": HIDAPI driver is not used | |
| 1165 | + * - "1": HIDAPI driver is used | |
| 1166 | + * | |
| 1167 | + * The default is "0" on Windows, otherwise the value of | |
| 1168 | + * SDL_HINT_JOYSTICK_HIDAPI | |
| 1169 | + */ | |
| 1170 | +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" | |
| 1171 | + | |
| 1172 | +/** | |
| 1173 | + * A variable controlling whether the HIDAPI driver for XBox 360 controllers | |
| 1174 | + * should be used. | |
| 1175 | + * | |
| 1176 | + * This variable can be set to the following values: | |
| 1177 | + * | |
| 1178 | + * - "0": HIDAPI driver is not used | |
| 1179 | + * - "1": HIDAPI driver is used | |
| 1180 | + * | |
| 1181 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX | |
| 1182 | + */ | |
| 1183 | +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 "SDL_JOYSTICK_HIDAPI_XBOX_360" | |
| 1184 | + | |
| 1185 | +/** | |
| 1186 | + * A variable controlling whether the player LEDs should be lit to indicate | |
| 1187 | + * which player is associated with an Xbox 360 controller. | |
| 1188 | + * | |
| 1189 | + * This variable can be set to the following values: | |
| 1190 | + * | |
| 1191 | + * - "0": player LEDs are not enabled | |
| 1192 | + * - "1": player LEDs are enabled (the default) | |
| 1193 | + */ | |
| 1194 | +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED "SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED" | |
| 1195 | + | |
| 1196 | +/** | |
| 1197 | + * A variable controlling whether the HIDAPI driver for XBox 360 wireless | |
| 1198 | + * controllers should be used. | |
| 1199 | + * | |
| 1200 | + * This variable can be set to the following values: | |
| 1201 | + * | |
| 1202 | + * - "0": HIDAPI driver is not used | |
| 1203 | + * - "1": HIDAPI driver is used | |
| 1204 | + * | |
| 1205 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 | |
| 1206 | + */ | |
| 1207 | +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS "SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS" | |
| 1208 | + | |
| 1209 | +/** | |
| 1210 | + * A variable controlling whether the HIDAPI driver for XBox One controllers | |
| 1211 | + * should be used. | |
| 1212 | + * | |
| 1213 | + * This variable can be set to the following values: | |
| 1214 | + * | |
| 1215 | + * - "0": HIDAPI driver is not used | |
| 1216 | + * - "1": HIDAPI driver is used | |
| 1217 | + * | |
| 1218 | + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX | |
| 1219 | + */ | |
| 1220 | +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE "SDL_JOYSTICK_HIDAPI_XBOX_ONE" | |
| 1221 | + | |
| 1222 | +/** | |
| 1223 | + * A variable controlling whether the Home button LED should be turned on when | |
| 1224 | + * an Xbox One controller is opened | |
| 1225 | + * | |
| 1226 | + * This variable can be set to the following values: | |
| 1227 | + * | |
| 1228 | + * - "0": home button LED is turned off | |
| 1229 | + * - "1": home button LED is turned on | |
| 1230 | + * | |
| 1231 | + * By default the Home button LED state is not changed. This hint can also be | |
| 1232 | + * set to a floating point value between 0.0 and 1.0 which controls the | |
| 1233 | + * brightness of the Home button LED. The default brightness is 0.4. | |
| 1234 | + */ | |
| 1235 | +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED" | |
| 1236 | + | |
| 1237 | +/** | |
| 1238 | + * A variable controlling whether IOKit should be used for controller | |
| 1239 | + * handling. | |
| 1240 | + * | |
| 1241 | + * This variable can be set to the following values: | |
| 1242 | + * | |
| 1243 | + * - "0": IOKit is not used | |
| 1244 | + * - "1": IOKit is used (the default) | |
| 1245 | + */ | |
| 1246 | +#define SDL_HINT_JOYSTICK_IOKIT "SDL_JOYSTICK_IOKIT" | |
| 1247 | + | |
| 1248 | +/** | |
| 1249 | + * A variable controlling whether GCController should be used for controller | |
| 1250 | + * handling. | |
| 1251 | + * | |
| 1252 | + * This variable can be set to the following values: | |
| 1253 | + * | |
| 1254 | + * - "0": GCController is not used | |
| 1255 | + * - "1": GCController is used (the default) | |
| 1256 | + */ | |
| 1257 | +#define SDL_HINT_JOYSTICK_MFI "SDL_JOYSTICK_MFI" | |
| 1258 | + | |
| 1259 | +/** | |
| 1260 | + * A variable controlling whether the RAWINPUT joystick drivers should be used | |
| 1261 | + * for better handling XInput-capable devices. | |
| 1262 | + * | |
| 1263 | + * This variable can be set to the following values: | |
| 1264 | + * | |
| 1265 | + * - "0": RAWINPUT drivers are not used | |
| 1266 | + * - "1": RAWINPUT drivers are used (the default) | |
| 1267 | + */ | |
| 1268 | +#define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT" | |
| 1269 | + | |
| 1270 | +/** | |
| 1271 | + * A variable controlling whether the RAWINPUT driver should pull correlated | |
| 1272 | + * data from XInput. | |
| 1273 | + * | |
| 1274 | + * This variable can be set to the following values: | |
| 1275 | + * | |
| 1276 | + * - "0": RAWINPUT driver will only use data from raw input APIs | |
| 1277 | + * - "1": RAWINPUT driver will also pull data from XInput, providing better | |
| 1278 | + * trigger axes, guide button presses, and rumble support for Xbox | |
| 1279 | + * controllers | |
| 1280 | + * | |
| 1281 | + * The default is "1". This hint applies to any joysticks opened after setting | |
| 1282 | + * the hint. | |
| 1283 | + */ | |
| 1284 | +#define SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT "SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT" | |
| 1285 | + | |
| 1286 | +/** | |
| 1287 | + * A variable controlling whether the ROG Chakram mice should show up as | |
| 1288 | + * joysticks | |
| 1289 | + * | |
| 1290 | + * This variable can be set to the following values: | |
| 1291 | + * | |
| 1292 | + * - "0": ROG Chakram mice do not show up as joysticks (the default) | |
| 1293 | + * - "1": ROG Chakram mice show up as joysticks | |
| 1294 | + */ | |
| 1295 | +#define SDL_HINT_JOYSTICK_ROG_CHAKRAM "SDL_JOYSTICK_ROG_CHAKRAM" | |
| 1296 | + | |
| 1297 | +/** | |
| 1298 | + * A variable controlling whether a separate thread should be used for | |
| 1299 | + * handling joystick detection and raw input messages on Windows | |
| 1300 | + * | |
| 1301 | + * This variable can be set to the following values: | |
| 1302 | + * | |
| 1303 | + * - "0": A separate thread is not used (the default) | |
| 1304 | + * - "1": A separate thread is used for handling raw input messages | |
| 1305 | + */ | |
| 1306 | +#define SDL_HINT_JOYSTICK_THREAD "SDL_JOYSTICK_THREAD" | |
| 1307 | + | |
| 1308 | +/** | |
| 1309 | + * A variable containing a list of throttle style controllers. | |
| 1310 | + * | |
| 1311 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 1312 | + * hexadecimal form, e.g. | |
| 1313 | + * | |
| 1314 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 1315 | + * | |
| 1316 | + * The variable can also take the form of @file, in which case the named file | |
| 1317 | + * will be loaded and interpreted as the value of the variable. | |
| 1318 | + */ | |
| 1319 | +#define SDL_HINT_JOYSTICK_THROTTLE_DEVICES "SDL_JOYSTICK_THROTTLE_DEVICES" | |
| 1320 | + | |
| 1321 | +/** | |
| 1322 | + * A variable containing a list of devices that are not throttle style | |
| 1323 | + * controllers. | |
| 1324 | + * | |
| 1325 | + * This will override SDL_HINT_JOYSTICK_THROTTLE_DEVICES and the built in | |
| 1326 | + * device list. | |
| 1327 | + * | |
| 1328 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 1329 | + * hexadecimal form, e.g. | |
| 1330 | + * | |
| 1331 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 1332 | + * | |
| 1333 | + * The variable can also take the form of @file, in which case the named file | |
| 1334 | + * will be loaded and interpreted as the value of the variable. | |
| 1335 | + */ | |
| 1336 | +#define SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED "SDL_JOYSTICK_THROTTLE_DEVICES_EXCLUDED" | |
| 1337 | + | |
| 1338 | +/** | |
| 1339 | + * A variable controlling whether Windows.Gaming.Input should be used for | |
| 1340 | + * controller handling. | |
| 1341 | + * | |
| 1342 | + * This variable can be set to the following values: | |
| 1343 | + * | |
| 1344 | + * - "0": WGI is not used | |
| 1345 | + * - "1": WGI is used (the default) | |
| 1346 | + */ | |
| 1347 | +#define SDL_HINT_JOYSTICK_WGI "SDL_JOYSTICK_WGI" | |
| 1348 | + | |
| 1349 | +/** | |
| 1350 | + * A variable containing a list of wheel style controllers. | |
| 1351 | + * | |
| 1352 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 1353 | + * hexadecimal form, e.g. | |
| 1354 | + * | |
| 1355 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 1356 | + * | |
| 1357 | + * The variable can also take the form of @file, in which case the named file | |
| 1358 | + * will be loaded and interpreted as the value of the variable. | |
| 1359 | + */ | |
| 1360 | +#define SDL_HINT_JOYSTICK_WHEEL_DEVICES "SDL_JOYSTICK_WHEEL_DEVICES" | |
| 1361 | + | |
| 1362 | +/** | |
| 1363 | + * A variable containing a list of devices that are not wheel style | |
| 1364 | + * controllers. | |
| 1365 | + * | |
| 1366 | + * This will override SDL_HINT_JOYSTICK_WHEEL_DEVICES and the built in device | |
| 1367 | + * list. | |
| 1368 | + * | |
| 1369 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 1370 | + * hexadecimal form, e.g. | |
| 1371 | + * | |
| 1372 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 1373 | + * | |
| 1374 | + * The variable can also take the form of @file, in which case the named file | |
| 1375 | + * will be loaded and interpreted as the value of the variable. | |
| 1376 | + */ | |
| 1377 | +#define SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED "SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED" | |
| 1378 | + | |
| 1379 | +/** | |
| 1380 | + * A variable containing a list of devices known to have all axes centered at | |
| 1381 | + * zero. | |
| 1382 | + * | |
| 1383 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 1384 | + * hexadecimal form, e.g. | |
| 1385 | + * | |
| 1386 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 1387 | + * | |
| 1388 | + * The variable can also take the form of @file, in which case the named file | |
| 1389 | + * will be loaded and interpreted as the value of the variable. | |
| 1390 | + */ | |
| 1391 | +#define SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES "SDL_JOYSTICK_ZERO_CENTERED_DEVICES" | |
| 1392 | + | |
| 1393 | +/** | |
| 1394 | + * Determines whether SDL enforces that DRM master is required in order to | |
| 1395 | + * initialize the KMSDRM video backend. | |
| 1396 | + * | |
| 1397 | + * The DRM subsystem has a concept of a "DRM master" which is a DRM client | |
| 1398 | + * that has the ability to set planes, set cursor, etc. When SDL is DRM | |
| 1399 | + * master, it can draw to the screen using the SDL rendering APIs. Without DRM | |
| 1400 | + * master, SDL is still able to process input and query attributes of attached | |
| 1401 | + * displays, but it cannot change display state or draw to the screen | |
| 1402 | + * directly. | |
| 1403 | + * | |
| 1404 | + * In some cases, it can be useful to have the KMSDRM backend even if it | |
| 1405 | + * cannot be used for rendering. An app may want to use SDL for input | |
| 1406 | + * processing while using another rendering API (such as an MMAL overlay on | |
| 1407 | + * Raspberry Pi) or using its own code to render to DRM overlays that SDL | |
| 1408 | + * doesn't support. | |
| 1409 | + * | |
| 1410 | + * This hint must be set before initializing the video subsystem. | |
| 1411 | + * | |
| 1412 | + * This variable can be set to the following values: | |
| 1413 | + * | |
| 1414 | + * - "0": SDL will allow usage of the KMSDRM backend without DRM master | |
| 1415 | + * - "1": SDL Will require DRM master to use the KMSDRM backend (default) | |
| 1416 | + */ | |
| 1417 | +#define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER "SDL_KMSDRM_REQUIRE_DRM_MASTER" | |
| 1418 | + | |
| 1419 | +/** | |
| 1420 | + * A comma separated list of devices to open as joysticks | |
| 1421 | + * | |
| 1422 | + * This variable is currently only used by the Linux joystick driver. | |
| 1423 | + */ | |
| 1424 | +#define SDL_HINT_JOYSTICK_DEVICE "SDL_JOYSTICK_DEVICE" | |
| 1425 | + | |
| 1426 | + | |
| 1427 | +/** | |
| 1428 | + * A variable containing a list of devices and their desired number of haptic | |
| 1429 | + * (force feedback) enabled axis. | |
| 1430 | + * | |
| 1431 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 1432 | + * hexadecimal form plus the number of desired axes, e.g. | |
| 1433 | + * | |
| 1434 | + * `0xAAAA/0xBBBB/1,0xCCCC/0xDDDD/3` | |
| 1435 | + * | |
| 1436 | + * This hint supports a "wildcard" device that will set the number of haptic | |
| 1437 | + * axes on all initialized haptic devices which were not defined explicitly in | |
| 1438 | + * this hint. | |
| 1439 | + * | |
| 1440 | + * `0xFFFF/0xFFFF/1` | |
| 1441 | + * | |
| 1442 | + * This hint should be set before a controller is opened. The number of haptic | |
| 1443 | + * axes won't exceed the number of real axes found on the device. | |
| 1444 | + */ | |
| 1445 | +#define SDL_HINT_JOYSTICK_HAPTIC_AXES "SDL_JOYSTICK_HAPTIC_AXES" | |
| 1446 | + | |
| 1447 | +/** | |
| 1448 | + * A variable controlling whether joysticks on Linux will always treat 'hat' | |
| 1449 | + * axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking | |
| 1450 | + * whether they may be analog. | |
| 1451 | + * | |
| 1452 | + * This variable can be set to the following values: | |
| 1453 | + * | |
| 1454 | + * - "0": Only map hat axis inputs to digital hat outputs if the input axes | |
| 1455 | + * appear to actually be digital (the default) | |
| 1456 | + * - "1": Always handle the input axes numbered ABS_HAT0X to ABS_HAT3Y as | |
| 1457 | + * digital hats | |
| 1458 | + */ | |
| 1459 | +#define SDL_HINT_LINUX_DIGITAL_HATS "SDL_LINUX_DIGITAL_HATS" | |
| 1460 | + | |
| 1461 | +/** | |
| 1462 | + * A variable controlling whether digital hats on Linux will apply deadzones | |
| 1463 | + * to their underlying input axes or use unfiltered values. | |
| 1464 | + * | |
| 1465 | + * This variable can be set to the following values: | |
| 1466 | + * | |
| 1467 | + * - "0": Return digital hat values based on unfiltered input axis values | |
| 1468 | + * - "1": Return digital hat values with deadzones on the input axes taken | |
| 1469 | + * into account (the default) | |
| 1470 | + */ | |
| 1471 | +#define SDL_HINT_LINUX_HAT_DEADZONES "SDL_LINUX_HAT_DEADZONES" | |
| 1472 | + | |
| 1473 | +/** | |
| 1474 | + * A variable controlling whether to use the classic /dev/input/js* joystick | |
| 1475 | + * interface or the newer /dev/input/event* joystick interface on Linux | |
| 1476 | + * | |
| 1477 | + * This variable can be set to the following values: | |
| 1478 | + * | |
| 1479 | + * - "0": Use /dev/input/event* | |
| 1480 | + * - "1": Use /dev/input/js* | |
| 1481 | + * | |
| 1482 | + * By default the /dev/input/event* interfaces are used | |
| 1483 | + */ | |
| 1484 | +#define SDL_HINT_LINUX_JOYSTICK_CLASSIC "SDL_LINUX_JOYSTICK_CLASSIC" | |
| 1485 | + | |
| 1486 | +/** | |
| 1487 | + * A variable controlling whether joysticks on Linux adhere to their | |
| 1488 | + * HID-defined deadzones or return unfiltered values. | |
| 1489 | + * | |
| 1490 | + * This variable can be set to the following values: | |
| 1491 | + * | |
| 1492 | + * - "0": Return unfiltered joystick axis values (the default) | |
| 1493 | + * - "1": Return axis values with deadzones taken into account | |
| 1494 | + */ | |
| 1495 | +#define SDL_HINT_LINUX_JOYSTICK_DEADZONES "SDL_LINUX_JOYSTICK_DEADZONES" | |
| 1496 | + | |
| 1497 | +/** | |
| 1498 | + * A variable controlling the default SDL log levels. | |
| 1499 | + * | |
| 1500 | + * This variable is a comma separated set of category=level tokens that define | |
| 1501 | + * the default logging levels for SDL applications. | |
| 1502 | + * | |
| 1503 | + * The category can be a numeric category, one of "app", "error", "assert", | |
| 1504 | + * "system", "audio", "video", "render", "input", "test", or `*` for any | |
| 1505 | + * unspecified category. | |
| 1506 | + * | |
| 1507 | + * The level can be a numeric level, one of "verbose", "debug", "info", | |
| 1508 | + * "warn", "error", "critical", or "quiet" to disable that category. | |
| 1509 | + * | |
| 1510 | + * You can omit the category if you want to set the logging level for all | |
| 1511 | + * categories. | |
| 1512 | + * | |
| 1513 | + * If this hint isn't set, the default log levels are equivalent to: | |
| 1514 | + * "app=info,assert=warn,test=verbose,*=error" | |
| 1515 | + */ | |
| 1516 | +#define SDL_HINT_LOGGING "SDL_LOGGING" | |
| 1517 | + | |
| 1518 | +/** | |
| 1519 | + * When set don't force the SDL app to become a foreground process | |
| 1520 | + * | |
| 1521 | + * This hint only applies to Mac OS X. | |
| 1522 | + */ | |
| 1523 | +#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP" | |
| 1524 | + | |
| 1525 | +/** | |
| 1526 | + * A variable that determines whether ctrl+click should generate a right-click | |
| 1527 | + * event on Mac | |
| 1528 | + * | |
| 1529 | + * If present, holding ctrl while left clicking will generate a right click | |
| 1530 | + * event when on Mac. | |
| 1531 | + */ | |
| 1532 | +#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK" | |
| 1533 | + | |
| 1534 | +/** | |
| 1535 | + * A variable controlling whether dispatching OpenGL context updates should | |
| 1536 | + * block the dispatching thread until the main thread finishes processing | |
| 1537 | + * | |
| 1538 | + * This variable can be set to the following values: | |
| 1539 | + * | |
| 1540 | + * - "0": Dispatching OpenGL context updates will block the dispatching thread | |
| 1541 | + * until the main thread finishes processing (default). | |
| 1542 | + * - "1": Dispatching OpenGL context updates will allow the dispatching thread | |
| 1543 | + * to continue execution. | |
| 1544 | + * | |
| 1545 | + * Generally you want the default, but if you have OpenGL code in a background | |
| 1546 | + * thread on a Mac, and the main thread hangs because it's waiting for that | |
| 1547 | + * background thread, but that background thread is also hanging because it's | |
| 1548 | + * waiting for the main thread to do an update, this might fix your issue. | |
| 1549 | + * | |
| 1550 | + * This hint only applies to macOS. | |
| 1551 | + * | |
| 1552 | + * This hint is available since SDL 2.24.0. | |
| 1553 | + */ | |
| 1554 | +#define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH "SDL_MAC_OPENGL_ASYNC_DISPATCH" | |
| 1555 | + | |
| 1556 | +/** | |
| 1557 | + * A variable setting the double click radius, in pixels. | |
| 1558 | + */ | |
| 1559 | +#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS" | |
| 1560 | + | |
| 1561 | +/** | |
| 1562 | + * A variable setting the double click time, in milliseconds. | |
| 1563 | + */ | |
| 1564 | +#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME" | |
| 1565 | + | |
| 1566 | +/** | |
| 1567 | + * Allow mouse click events when clicking to focus an SDL window | |
| 1568 | + * | |
| 1569 | + * This variable can be set to the following values: | |
| 1570 | + * | |
| 1571 | + * - "0": Ignore mouse clicks that activate a window | |
| 1572 | + * - "1": Generate events for mouse clicks that activate a window | |
| 1573 | + * | |
| 1574 | + * By default SDL will ignore mouse clicks that activate a window | |
| 1575 | + */ | |
| 1576 | +#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH" | |
| 1577 | + | |
| 1578 | +/** | |
| 1579 | + * A variable setting the speed scale for mouse motion, in floating point, | |
| 1580 | + * when the mouse is not in relative mode | |
| 1581 | + */ | |
| 1582 | +#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE" | |
| 1583 | + | |
| 1584 | +/** | |
| 1585 | + * A variable controlling whether relative mouse mode constrains the mouse to | |
| 1586 | + * the center of the window | |
| 1587 | + * | |
| 1588 | + * This variable can be set to the following values: | |
| 1589 | + * | |
| 1590 | + * - "0": Relative mouse mode constrains the mouse to the window | |
| 1591 | + * - "1": Relative mouse mode constrains the mouse to the center of the window | |
| 1592 | + * | |
| 1593 | + * Constraining to the center of the window works better for FPS games and | |
| 1594 | + * when the application is running over RDP. Constraining to the whole window | |
| 1595 | + * works better for 2D games and increases the chance that the mouse will be | |
| 1596 | + * in the correct position when using high DPI mice. | |
| 1597 | + * | |
| 1598 | + * By default SDL will constrain the mouse to the center of the window | |
| 1599 | + */ | |
| 1600 | +#define SDL_HINT_MOUSE_RELATIVE_MODE_CENTER "SDL_MOUSE_RELATIVE_MODE_CENTER" | |
| 1601 | + | |
| 1602 | +/** | |
| 1603 | + * A variable controlling whether relative mouse mode is implemented using | |
| 1604 | + * mouse warping | |
| 1605 | + * | |
| 1606 | + * This variable can be set to the following values: | |
| 1607 | + * | |
| 1608 | + * - "0": Relative mouse mode uses raw input | |
| 1609 | + * - "1": Relative mouse mode uses mouse warping | |
| 1610 | + * | |
| 1611 | + * By default SDL will use raw input for relative mouse mode | |
| 1612 | + */ | |
| 1613 | +#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP" | |
| 1614 | + | |
| 1615 | +/** | |
| 1616 | + * A variable controlling whether relative mouse motion is affected by | |
| 1617 | + * renderer scaling | |
| 1618 | + * | |
| 1619 | + * This variable can be set to the following values: | |
| 1620 | + * | |
| 1621 | + * - "0": Relative motion is unaffected by DPI or renderer's logical size | |
| 1622 | + * - "1": Relative motion is scaled according to DPI scaling and logical size | |
| 1623 | + * | |
| 1624 | + * By default relative mouse deltas are affected by DPI and renderer scaling | |
| 1625 | + */ | |
| 1626 | +#define SDL_HINT_MOUSE_RELATIVE_SCALING "SDL_MOUSE_RELATIVE_SCALING" | |
| 1627 | + | |
| 1628 | +/** | |
| 1629 | + * A variable setting the scale for mouse motion, in floating point, when the | |
| 1630 | + * mouse is in relative mode | |
| 1631 | + */ | |
| 1632 | +#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE" | |
| 1633 | + | |
| 1634 | +/** | |
| 1635 | + * A variable controlling whether the system mouse acceleration curve is used | |
| 1636 | + * for relative mouse motion. | |
| 1637 | + * | |
| 1638 | + * This variable can be set to the following values: | |
| 1639 | + * | |
| 1640 | + * - "0": Relative mouse motion will be unscaled (the default) | |
| 1641 | + * - "1": Relative mouse motion will be scaled using the system mouse | |
| 1642 | + * acceleration curve. | |
| 1643 | + * | |
| 1644 | + * If SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE is set, that will override the | |
| 1645 | + * system speed scale. | |
| 1646 | + */ | |
| 1647 | +#define SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE "SDL_MOUSE_RELATIVE_SYSTEM_SCALE" | |
| 1648 | + | |
| 1649 | +/** | |
| 1650 | + * A variable controlling whether a motion event should be generated for mouse | |
| 1651 | + * warping in relative mode. | |
| 1652 | + * | |
| 1653 | + * This variable can be set to the following values: | |
| 1654 | + * | |
| 1655 | + * - "0": Warping the mouse will not generate a motion event in relative mode | |
| 1656 | + * - "1": Warping the mouse will generate a motion event in relative mode | |
| 1657 | + * | |
| 1658 | + * By default warping the mouse will not generate motion events in relative | |
| 1659 | + * mode. This avoids the application having to filter out large relative | |
| 1660 | + * motion due to warping. | |
| 1661 | + */ | |
| 1662 | +#define SDL_HINT_MOUSE_RELATIVE_WARP_MOTION "SDL_MOUSE_RELATIVE_WARP_MOTION" | |
| 1663 | + | |
| 1664 | +/** | |
| 1665 | + * A variable controlling whether the hardware cursor stays visible when | |
| 1666 | + * relative mode is active. | |
| 1667 | + * | |
| 1668 | + * This variable can be set to the following values: "0" - The cursor will be | |
| 1669 | + * hidden while relative mode is active (default) "1" - The cursor will remain | |
| 1670 | + * visible while relative mode is active | |
| 1671 | + * | |
| 1672 | + * Note that for systems without raw hardware inputs, relative mode is | |
| 1673 | + * implemented using warping, so the hardware cursor will visibly warp between | |
| 1674 | + * frames if this is enabled on those systems. | |
| 1675 | + */ | |
| 1676 | +#define SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE "SDL_MOUSE_RELATIVE_CURSOR_VISIBLE" | |
| 1677 | + | |
| 1678 | +/** | |
| 1679 | + * A variable controlling whether mouse events should generate synthetic touch | |
| 1680 | + * events | |
| 1681 | + * | |
| 1682 | + * This variable can be set to the following values: | |
| 1683 | + * | |
| 1684 | + * - "0": Mouse events will not generate touch events (default for desktop | |
| 1685 | + * platforms) | |
| 1686 | + * - "1": Mouse events will generate touch events (default for mobile | |
| 1687 | + * platforms, such as Android and iOS) | |
| 1688 | + */ | |
| 1689 | +#define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS" | |
| 1690 | + | |
| 1691 | +/** | |
| 1692 | + * A variable controlling whether the mouse is captured while mouse buttons | |
| 1693 | + * are pressed | |
| 1694 | + * | |
| 1695 | + * This variable can be set to the following values: | |
| 1696 | + * | |
| 1697 | + * - "0": The mouse is not captured while mouse buttons are pressed | |
| 1698 | + * - "1": The mouse is captured while mouse buttons are pressed | |
| 1699 | + * | |
| 1700 | + * By default the mouse is captured while mouse buttons are pressed so if the | |
| 1701 | + * mouse is dragged outside the window, the application continues to receive | |
| 1702 | + * mouse events until the button is released. | |
| 1703 | + */ | |
| 1704 | +#define SDL_HINT_MOUSE_AUTO_CAPTURE "SDL_MOUSE_AUTO_CAPTURE" | |
| 1705 | + | |
| 1706 | +/** | |
| 1707 | + * Tell SDL not to catch the SIGINT or SIGTERM signals. | |
| 1708 | + * | |
| 1709 | + * This hint only applies to Unix-like platforms, and should set before any | |
| 1710 | + * calls to SDL_Init() | |
| 1711 | + * | |
| 1712 | + * The variable can be set to the following values: | |
| 1713 | + * | |
| 1714 | + * - "0": SDL will install a SIGINT and SIGTERM handler, and when it catches a | |
| 1715 | + * signal, convert it into an SDL_QUIT event. | |
| 1716 | + * - "1": SDL will not install a signal handler at all. | |
| 1717 | + */ | |
| 1718 | +#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS" | |
| 1719 | + | |
| 1720 | +/** | |
| 1721 | + * A variable controlling what driver to use for OpenGL ES contexts. | |
| 1722 | + * | |
| 1723 | + * On some platforms, currently Windows and X11, OpenGL drivers may support | |
| 1724 | + * creating contexts with an OpenGL ES profile. By default SDL uses these | |
| 1725 | + * profiles, when available, otherwise it attempts to load an OpenGL ES | |
| 1726 | + * library, e.g. that provided by the ANGLE project. This variable controls | |
| 1727 | + * whether SDL follows this default behaviour or will always load an OpenGL ES | |
| 1728 | + * library. | |
| 1729 | + * | |
| 1730 | + * Circumstances where this is useful include - Testing an app with a | |
| 1731 | + * particular OpenGL ES implementation, e.g ANGLE, or emulator, e.g. those | |
| 1732 | + * from ARM, Imagination or Qualcomm. - Resolving OpenGL ES function addresses | |
| 1733 | + * at link time by linking with the OpenGL ES library instead of querying them | |
| 1734 | + * at run time with SDL_GL_GetProcAddress(). | |
| 1735 | + * | |
| 1736 | + * Caution: for an application to work with the default behaviour across | |
| 1737 | + * different OpenGL drivers it must query the OpenGL ES function addresses at | |
| 1738 | + * run time using SDL_GL_GetProcAddress(). | |
| 1739 | + * | |
| 1740 | + * This variable is ignored on most platforms because OpenGL ES is native or | |
| 1741 | + * not supported. | |
| 1742 | + * | |
| 1743 | + * This variable can be set to the following values: | |
| 1744 | + * | |
| 1745 | + * - "0": Use ES profile of OpenGL, if available. (Default when not set.) | |
| 1746 | + * - "1": Load OpenGL ES library using the default library names. | |
| 1747 | + */ | |
| 1748 | +#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER" | |
| 1749 | + | |
| 1750 | +/** | |
| 1751 | + * A variable controlling which orientations are allowed on iOS/Android. | |
| 1752 | + * | |
| 1753 | + * In some circumstances it is necessary to be able to explicitly control | |
| 1754 | + * which UI orientations are allowed. | |
| 1755 | + * | |
| 1756 | + * This variable is a space delimited list of the following values: | |
| 1757 | + * | |
| 1758 | + * - "LandscapeLeft" | |
| 1759 | + * - "LandscapeRight" | |
| 1760 | + * - "Portrait" | |
| 1761 | + * - "PortraitUpsideDown" | |
| 1762 | + */ | |
| 1763 | +#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" | |
| 1764 | + | |
| 1765 | +/** | |
| 1766 | + * A variable controlling the use of a sentinel event when polling the event | |
| 1767 | + * queue | |
| 1768 | + * | |
| 1769 | + * This variable can be set to the following values: | |
| 1770 | + * | |
| 1771 | + * - "0": Disable poll sentinels | |
| 1772 | + * - "1": Enable poll sentinels | |
| 1773 | + * | |
| 1774 | + * When polling for events, SDL_PumpEvents is used to gather new events from | |
| 1775 | + * devices. If a device keeps producing new events between calls to | |
| 1776 | + * SDL_PumpEvents, a poll loop will become stuck until the new events stop. | |
| 1777 | + * This is most noticeable when moving a high frequency mouse. | |
| 1778 | + * | |
| 1779 | + * By default, poll sentinels are enabled. | |
| 1780 | + */ | |
| 1781 | +#define SDL_HINT_POLL_SENTINEL "SDL_POLL_SENTINEL" | |
| 1782 | + | |
| 1783 | +/** | |
| 1784 | + * Override for SDL_GetPreferredLocales() | |
| 1785 | + * | |
| 1786 | + * If set, this will be favored over anything the OS might report for the | |
| 1787 | + * user's preferred locales. Changing this hint at runtime will not generate a | |
| 1788 | + * SDL_LOCALECHANGED event (but if you can change the hint, you can push your | |
| 1789 | + * own event, if you want). | |
| 1790 | + * | |
| 1791 | + * The format of this hint is a comma-separated list of language and locale, | |
| 1792 | + * combined with an underscore, as is a common format: "en_GB". Locale is | |
| 1793 | + * optional: "en". So you might have a list like this: "en_GB,jp,es_PT" | |
| 1794 | + */ | |
| 1795 | +#define SDL_HINT_PREFERRED_LOCALES "SDL_PREFERRED_LOCALES" | |
| 1796 | + | |
| 1797 | +/** | |
| 1798 | + * A variable describing the content orientation on QtWayland-based platforms. | |
| 1799 | + * | |
| 1800 | + * On QtWayland platforms, windows are rotated client-side to allow for custom | |
| 1801 | + * transitions. In order to correctly position overlays (e.g. volume bar) and | |
| 1802 | + * gestures (e.g. events view, close/minimize gestures), the system needs to | |
| 1803 | + * know in which orientation the application is currently drawing its | |
| 1804 | + * contents. | |
| 1805 | + * | |
| 1806 | + * This does not cause the window to be rotated or resized, the application | |
| 1807 | + * needs to take care of drawing the content in the right orientation (the | |
| 1808 | + * framebuffer is always in portrait mode). | |
| 1809 | + * | |
| 1810 | + * This variable can be one of the following values: | |
| 1811 | + * | |
| 1812 | + * - "primary" (default) | |
| 1813 | + * - "portrait" | |
| 1814 | + * - "landscape" | |
| 1815 | + * - "inverted-portrait" | |
| 1816 | + * - "inverted-landscape" | |
| 1817 | + * | |
| 1818 | + * Since SDL 2.0.22 this variable accepts a comma-separated list of values | |
| 1819 | + * above. | |
| 1820 | + */ | |
| 1821 | +#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION" | |
| 1822 | + | |
| 1823 | +/** | |
| 1824 | + * Flags to set on QtWayland windows to integrate with the native window | |
| 1825 | + * manager. | |
| 1826 | + * | |
| 1827 | + * On QtWayland platforms, this hint controls the flags to set on the windows. | |
| 1828 | + * For example, on Sailfish OS "OverridesSystemGestures" disables swipe | |
| 1829 | + * gestures. | |
| 1830 | + * | |
| 1831 | + * This variable is a space-separated list of the following values (empty = no | |
| 1832 | + * flags): | |
| 1833 | + * | |
| 1834 | + * - "OverridesSystemGestures" | |
| 1835 | + * - "StaysOnTop" | |
| 1836 | + * - "BypassWindowManager" | |
| 1837 | + */ | |
| 1838 | +#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS" | |
| 1839 | + | |
| 1840 | +/** | |
| 1841 | + * A variable controlling whether the 2D render API is compatible or | |
| 1842 | + * efficient. | |
| 1843 | + * | |
| 1844 | + * This variable can be set to the following values: | |
| 1845 | + * | |
| 1846 | + * - "0": Don't use batching to make rendering more efficient. | |
| 1847 | + * - "1": Use batching, but might cause problems if app makes its own direct | |
| 1848 | + * OpenGL calls. | |
| 1849 | + * | |
| 1850 | + * Up to SDL 2.0.9, the render API would draw immediately when requested. Now | |
| 1851 | + * it batches up draw requests and sends them all to the GPU only when forced | |
| 1852 | + * to (during SDL_RenderPresent, when changing render targets, by updating a | |
| 1853 | + * texture that the batch needs, etc). This is significantly more efficient, | |
| 1854 | + * but it can cause problems for apps that expect to render on top of the | |
| 1855 | + * render API's output. As such, SDL will disable batching if a specific | |
| 1856 | + * render backend is requested (since this might indicate that the app is | |
| 1857 | + * planning to use the underlying graphics API directly). This hint can be | |
| 1858 | + * used to explicitly request batching in this instance. It is a contract that | |
| 1859 | + * you will either never use the underlying graphics API directly, or if you | |
| 1860 | + * do, you will call SDL_RenderFlush() before you do so any current batch goes | |
| 1861 | + * to the GPU before your work begins. Not following this contract will result | |
| 1862 | + * in undefined behavior. | |
| 1863 | + */ | |
| 1864 | +#define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING" | |
| 1865 | + | |
| 1866 | +/** | |
| 1867 | + * A variable controlling how the 2D render API renders lines | |
| 1868 | + * | |
| 1869 | + * This variable can be set to the following values: | |
| 1870 | + * | |
| 1871 | + * - "0": Use the default line drawing method (Bresenham's line algorithm as | |
| 1872 | + * of SDL 2.0.20) | |
| 1873 | + * - "1": Use the driver point API using Bresenham's line algorithm (correct, | |
| 1874 | + * draws many points) | |
| 1875 | + * - "2": Use the driver line API (occasionally misses line endpoints based on | |
| 1876 | + * hardware driver quirks, was the default before 2.0.20) | |
| 1877 | + * - "3": Use the driver geometry API (correct, draws thicker diagonal lines) | |
| 1878 | + * | |
| 1879 | + * This variable should be set when the renderer is created. | |
| 1880 | + */ | |
| 1881 | +#define SDL_HINT_RENDER_LINE_METHOD "SDL_RENDER_LINE_METHOD" | |
| 1882 | + | |
| 1883 | +/** | |
| 1884 | + * A variable controlling whether to enable Direct3D 11+'s Debug Layer. | |
| 1885 | + * | |
| 1886 | + * This variable does not have any effect on the Direct3D 9 based renderer. | |
| 1887 | + * | |
| 1888 | + * This variable can be set to the following values: | |
| 1889 | + * | |
| 1890 | + * - "0": Disable Debug Layer use | |
| 1891 | + * - "1": Enable Debug Layer use | |
| 1892 | + * | |
| 1893 | + * By default, SDL does not use Direct3D Debug Layer. | |
| 1894 | + */ | |
| 1895 | +#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG" | |
| 1896 | + | |
| 1897 | +/** | |
| 1898 | + * A variable controlling whether the Direct3D device is initialized for | |
| 1899 | + * thread-safe operations. | |
| 1900 | + * | |
| 1901 | + * This variable can be set to the following values: | |
| 1902 | + * | |
| 1903 | + * - "0": Thread-safety is not enabled (faster) | |
| 1904 | + * - "1": Thread-safety is enabled | |
| 1905 | + * | |
| 1906 | + * By default the Direct3D device is created with thread-safety disabled. | |
| 1907 | + */ | |
| 1908 | +#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE" | |
| 1909 | + | |
| 1910 | +/** | |
| 1911 | + * A variable specifying which render driver to use. | |
| 1912 | + * | |
| 1913 | + * If the application doesn't pick a specific renderer to use, this variable | |
| 1914 | + * specifies the name of the preferred renderer. If the preferred renderer | |
| 1915 | + * can't be initialized, the normal default renderer is used. | |
| 1916 | + * | |
| 1917 | + * This variable is case insensitive and can be set to the following values: | |
| 1918 | + * | |
| 1919 | + * - "direct3d" | |
| 1920 | + * - "direct3d11" | |
| 1921 | + * - "direct3d12" | |
| 1922 | + * - "opengl" | |
| 1923 | + * - "opengles2" | |
| 1924 | + * - "opengles" | |
| 1925 | + * - "metal" | |
| 1926 | + * - "software" | |
| 1927 | + * | |
| 1928 | + * The default varies by platform, but it's the first one in the list that is | |
| 1929 | + * available on the current platform. | |
| 1930 | + */ | |
| 1931 | +#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER" | |
| 1932 | + | |
| 1933 | +/** | |
| 1934 | + * A variable controlling the scaling policy for SDL_RenderSetLogicalSize. | |
| 1935 | + * | |
| 1936 | + * This variable can be set to the following values: | |
| 1937 | + * | |
| 1938 | + * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on | |
| 1939 | + * screen "1" or "overscan" - Will zoom the rendering so it fills the entire | |
| 1940 | + * screen, allowing edges to be drawn offscreen | |
| 1941 | + * | |
| 1942 | + * By default letterbox is used | |
| 1943 | + */ | |
| 1944 | +#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE" | |
| 1945 | + | |
| 1946 | +/** | |
| 1947 | + * A variable controlling whether the OpenGL render driver uses shaders if | |
| 1948 | + * they are available. | |
| 1949 | + * | |
| 1950 | + * This variable can be set to the following values: | |
| 1951 | + * | |
| 1952 | + * - "0": Disable shaders | |
| 1953 | + * - "1": Enable shaders | |
| 1954 | + * | |
| 1955 | + * By default shaders are used if OpenGL supports them. | |
| 1956 | + */ | |
| 1957 | +#define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS" | |
| 1958 | + | |
| 1959 | +/** | |
| 1960 | + * A variable controlling the scaling quality | |
| 1961 | + * | |
| 1962 | + * This variable can be set to the following values: | |
| 1963 | + * | |
| 1964 | + * - "0" or "nearest": Nearest pixel sampling | |
| 1965 | + * - "1" or "linear": Linear filtering (supported by OpenGL and Direct3D) | |
| 1966 | + * - "2" or "best": Currently this is the same as "linear" | |
| 1967 | + * | |
| 1968 | + * By default nearest pixel sampling is used | |
| 1969 | + */ | |
| 1970 | +#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY" | |
| 1971 | + | |
| 1972 | +/** | |
| 1973 | + * A variable controlling whether updates to the SDL screen surface should be | |
| 1974 | + * synchronized with the vertical refresh, to avoid tearing. | |
| 1975 | + * | |
| 1976 | + * This variable can be set to the following values: | |
| 1977 | + * | |
| 1978 | + * - "0": Disable vsync | |
| 1979 | + * - "1": Enable vsync | |
| 1980 | + * | |
| 1981 | + * By default SDL does not sync screen surface updates with vertical refresh. | |
| 1982 | + */ | |
| 1983 | +#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" | |
| 1984 | + | |
| 1985 | +/** | |
| 1986 | + * A variable controlling whether the Metal render driver select low power | |
| 1987 | + * device over default one | |
| 1988 | + * | |
| 1989 | + * This variable can be set to the following values: | |
| 1990 | + * | |
| 1991 | + * - "0": Use the prefered OS device | |
| 1992 | + * - "1": Select a low power one | |
| 1993 | + * | |
| 1994 | + * By default the prefered OS device is used. | |
| 1995 | + */ | |
| 1996 | +#define SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE "SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE" | |
| 1997 | + | |
| 1998 | +/** | |
| 1999 | + * A variable containing a list of ROG gamepad capable mice. | |
| 2000 | + * | |
| 2001 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 2002 | + * hexadecimal form, e.g. | |
| 2003 | + * | |
| 2004 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 2005 | + * | |
| 2006 | + * The variable can also take the form of @file, in which case the named file | |
| 2007 | + * will be loaded and interpreted as the value of the variable. | |
| 2008 | + */ | |
| 2009 | +#define SDL_HINT_ROG_GAMEPAD_MICE "SDL_ROG_GAMEPAD_MICE" | |
| 2010 | + | |
| 2011 | +/** | |
| 2012 | + * A variable containing a list of devices that are not ROG gamepad capable | |
| 2013 | + * mice. | |
| 2014 | + * | |
| 2015 | + * This will override SDL_HINT_ROG_GAMEPAD_MICE and the built in device list. | |
| 2016 | + * | |
| 2017 | + * The format of the string is a comma separated list of USB VID/PID pairs in | |
| 2018 | + * hexadecimal form, e.g. | |
| 2019 | + * | |
| 2020 | + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD | |
| 2021 | + * | |
| 2022 | + * The variable can also take the form of @file, in which case the named file | |
| 2023 | + * will be loaded and interpreted as the value of the variable. | |
| 2024 | + */ | |
| 2025 | +#define SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED "SDL_ROG_GAMEPAD_MICE_EXCLUDED" | |
| 2026 | + | |
| 2027 | +/** | |
| 2028 | + * A variable controlling if VSYNC is automatically disable if doesn't reach | |
| 2029 | + * the enough FPS | |
| 2030 | + * | |
| 2031 | + * This variable can be set to the following values: | |
| 2032 | + * | |
| 2033 | + * - "0": It will be using VSYNC as defined in the main flag. Default | |
| 2034 | + * - "1": If VSYNC was previously enabled, then it will disable VSYNC if | |
| 2035 | + * doesn't reach enough speed | |
| 2036 | + * | |
| 2037 | + * By default SDL does not enable the automatic VSYNC | |
| 2038 | + */ | |
| 2039 | +#define SDL_HINT_PS2_DYNAMIC_VSYNC "SDL_PS2_DYNAMIC_VSYNC" | |
| 2040 | + | |
| 2041 | +/** | |
| 2042 | + * A variable to control whether the return key on the soft keyboard should | |
| 2043 | + * hide the soft keyboard on Android and iOS. | |
| 2044 | + * | |
| 2045 | + * The variable can be set to the following values: | |
| 2046 | + * | |
| 2047 | + * - "0": The return key will be handled as a key event. This is the behaviour | |
| 2048 | + * of SDL <= 2.0.3. (default) | |
| 2049 | + * - "1": The return key will hide the keyboard. | |
| 2050 | + * | |
| 2051 | + * The value of this hint is used at runtime, so it can be changed at any | |
| 2052 | + * time. | |
| 2053 | + */ | |
| 2054 | +#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" | |
| 2055 | + | |
| 2056 | +/** | |
| 2057 | + * Tell SDL which Dispmanx layer to use on a Raspberry PI | |
| 2058 | + * | |
| 2059 | + * Also known as Z-order. The variable can take a negative or positive value. | |
| 2060 | + * The default is 10000. | |
| 2061 | + */ | |
| 2062 | +#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" | |
| 2063 | + | |
| 2064 | +/** | |
| 2065 | + * Specify an "activity name" for screensaver inhibition. | |
| 2066 | + * | |
| 2067 | + * Some platforms, notably Linux desktops, list the applications which are | |
| 2068 | + * inhibiting the screensaver or other power-saving features. | |
| 2069 | + * | |
| 2070 | + * This hint lets you specify the "activity name" sent to the OS when | |
| 2071 | + * SDL_DisableScreenSaver() is used (or the screensaver is automatically | |
| 2072 | + * disabled). The contents of this hint are used when the screensaver is | |
| 2073 | + * disabled. You should use a string that describes what your program is doing | |
| 2074 | + * (and, therefore, why the screensaver is disabled). For example, "Playing a | |
| 2075 | + * game" or "Watching a video". | |
| 2076 | + * | |
| 2077 | + * Setting this to "" or leaving it unset will have SDL use a reasonable | |
| 2078 | + * default: "Playing a game" or something similar. | |
| 2079 | + * | |
| 2080 | + * On targets where this is not supported, this hint does nothing. | |
| 2081 | + */ | |
| 2082 | +#define SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME "SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME" | |
| 2083 | + | |
| 2084 | +/** | |
| 2085 | + * Specifies whether SDL_THREAD_PRIORITY_TIME_CRITICAL should be treated as | |
| 2086 | + * realtime. | |
| 2087 | + * | |
| 2088 | + * On some platforms, like Linux, a realtime priority thread may be subject to | |
| 2089 | + * restrictions that require special handling by the application. This hint | |
| 2090 | + * exists to let SDL know that the app is prepared to handle said | |
| 2091 | + * restrictions. | |
| 2092 | + * | |
| 2093 | + * On Linux, SDL will apply the following configuration to any thread that | |
| 2094 | + * becomes realtime: | |
| 2095 | + * | |
| 2096 | + * - The SCHED_RESET_ON_FORK bit will be set on the scheduling policy. | |
| 2097 | + * - An RLIMIT_RTTIME budget will be configured to the rtkit specified limit. | |
| 2098 | + * - Exceeding this limit will result in the kernel sending SIGKILL to the | |
| 2099 | + * app. | |
| 2100 | + * | |
| 2101 | + * Refer to the man pages for more information. | |
| 2102 | + * | |
| 2103 | + * This variable can be set to the following values: | |
| 2104 | + * | |
| 2105 | + * - "0": default platform specific behaviour | |
| 2106 | + * - "1": Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling | |
| 2107 | + * policy | |
| 2108 | + */ | |
| 2109 | +#define SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL "SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL" | |
| 2110 | + | |
| 2111 | +/** | |
| 2112 | + * A string specifying additional information to use with | |
| 2113 | + * SDL_SetThreadPriority. | |
| 2114 | + * | |
| 2115 | + * By default SDL_SetThreadPriority will make appropriate system changes in | |
| 2116 | + * order to apply a thread priority. For example on systems using pthreads the | |
| 2117 | + * scheduler policy is changed automatically to a policy that works well with | |
| 2118 | + * a given priority. Code which has specific requirements can override SDL's | |
| 2119 | + * default behavior with this hint. | |
| 2120 | + * | |
| 2121 | + * pthread hint values are "current", "other", "fifo" and "rr". Currently no | |
| 2122 | + * other platform hint values are defined but may be in the future. | |
| 2123 | + */ | |
| 2124 | +#define SDL_HINT_THREAD_PRIORITY_POLICY "SDL_THREAD_PRIORITY_POLICY" | |
| 2125 | + | |
| 2126 | +/** | |
| 2127 | + * A string specifying SDL's threads stack size in bytes or "0" for the | |
| 2128 | + * backend's default size | |
| 2129 | + * | |
| 2130 | + * Use this hint in case you need to set SDL's threads stack size to other | |
| 2131 | + * than the default. This is specially useful if you build SDL against a non | |
| 2132 | + * glibc libc library (such as musl) which provides a relatively small default | |
| 2133 | + * thread stack size (a few kilobytes versus the default 8MB glibc uses). | |
| 2134 | + * Support for this hint is currently available only in the pthread, Windows, | |
| 2135 | + * and PSP backend. | |
| 2136 | + * | |
| 2137 | + * Instead of this hint, in 2.0.9 and later, you can use | |
| 2138 | + * SDL_CreateThreadWithStackSize(). This hint only works with the classic | |
| 2139 | + * SDL_CreateThread(). | |
| 2140 | + */ | |
| 2141 | +#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE" | |
| 2142 | + | |
| 2143 | +/** | |
| 2144 | + * A variable that controls the timer resolution, in milliseconds. | |
| 2145 | + * | |
| 2146 | + * The higher resolution the timer, the more frequently the CPU services timer | |
| 2147 | + * interrupts, and the more precise delays are, but this takes up power and | |
| 2148 | + * CPU time. This hint is only used on Windows. | |
| 2149 | + * | |
| 2150 | + * See this blog post for more information: | |
| 2151 | + * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/ | |
| 2152 | + * | |
| 2153 | + * If this variable is set to "0", the system timer resolution is not set. | |
| 2154 | + * | |
| 2155 | + * The default value is "1". This hint may be set at any time. | |
| 2156 | + */ | |
| 2157 | +#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" | |
| 2158 | + | |
| 2159 | +/** | |
| 2160 | + * A variable controlling whether touch events should generate synthetic mouse | |
| 2161 | + * events | |
| 2162 | + * | |
| 2163 | + * This variable can be set to the following values: | |
| 2164 | + * | |
| 2165 | + * - "0": Touch events will not generate mouse events | |
| 2166 | + * - "1": Touch events will generate mouse events | |
| 2167 | + * | |
| 2168 | + * By default SDL will generate mouse events for touch events | |
| 2169 | + */ | |
| 2170 | +#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" | |
| 2171 | + | |
| 2172 | +/** | |
| 2173 | + * A variable controlling which touchpad should generate synthetic mouse | |
| 2174 | + * events | |
| 2175 | + * | |
| 2176 | + * This variable can be set to the following values: | |
| 2177 | + * | |
| 2178 | + * - "0": Only front touchpad should generate mouse events. Default | |
| 2179 | + * - "1": Only back touchpad should generate mouse events. | |
| 2180 | + * - "2": Both touchpads should generate mouse events. | |
| 2181 | + * | |
| 2182 | + * By default SDL will generate mouse events for all touch devices | |
| 2183 | + */ | |
| 2184 | +#define SDL_HINT_VITA_TOUCH_MOUSE_DEVICE "SDL_HINT_VITA_TOUCH_MOUSE_DEVICE" | |
| 2185 | + | |
| 2186 | +/** | |
| 2187 | + * A variable controlling whether the Android / tvOS remotes should be listed | |
| 2188 | + * as joystick devices, instead of sending keyboard events. | |
| 2189 | + * | |
| 2190 | + * This variable can be set to the following values: | |
| 2191 | + * | |
| 2192 | + * - "0": Remotes send enter/escape/arrow key events | |
| 2193 | + * - "1": Remotes are available as 2 axis, 2 button joysticks (the default). | |
| 2194 | + */ | |
| 2195 | +#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" | |
| 2196 | + | |
| 2197 | +/** | |
| 2198 | + * A variable controlling whether the screensaver is enabled. | |
| 2199 | + * | |
| 2200 | + * This variable can be set to the following values: | |
| 2201 | + * | |
| 2202 | + * - "0": Disable screensaver | |
| 2203 | + * - "1": Enable screensaver | |
| 2204 | + * | |
| 2205 | + * By default SDL will disable the screensaver. | |
| 2206 | + */ | |
| 2207 | +#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER" | |
| 2208 | + | |
| 2209 | +/** | |
| 2210 | + * Tell the video driver that we only want a double buffer. | |
| 2211 | + * | |
| 2212 | + * By default, most lowlevel 2D APIs will use a triple buffer scheme that | |
| 2213 | + * wastes no CPU time on waiting for vsync after issuing a flip, but | |
| 2214 | + * introduces a frame of latency. On the other hand, using a double buffer | |
| 2215 | + * scheme instead is recommended for cases where low latency is an important | |
| 2216 | + * factor because we save a whole frame of latency. We do so by waiting for | |
| 2217 | + * vsync immediately after issuing a flip, usually just after eglSwapBuffers | |
| 2218 | + * call in the backend's *_SwapWindow function. | |
| 2219 | + * | |
| 2220 | + * Since it's driver-specific, it's only supported where possible and | |
| 2221 | + * implemented. Currently supported the following drivers: | |
| 2222 | + * | |
| 2223 | + * - Wayland (wayland) | |
| 2224 | + * - KMSDRM (kmsdrm) | |
| 2225 | + * - Raspberry Pi (raspberrypi) | |
| 2226 | + */ | |
| 2227 | +#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" | |
| 2228 | + | |
| 2229 | +/** | |
| 2230 | + * A variable controlling whether the EGL window is allowed to be composited | |
| 2231 | + * as transparent, rather than opaque. | |
| 2232 | + * | |
| 2233 | + * Most window systems will always render windows opaque, even if the surface | |
| 2234 | + * format has an alpha channel. This is not always true, however, so by | |
| 2235 | + * default SDL will try to enforce opaque composition. To override this | |
| 2236 | + * behavior, you can set this hint to "1". | |
| 2237 | + */ | |
| 2238 | +#define SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY "SDL_VIDEO_EGL_ALLOW_TRANSPARENCY" | |
| 2239 | + | |
| 2240 | +/** | |
| 2241 | + * A variable controlling whether the graphics context is externally managed. | |
| 2242 | + * | |
| 2243 | + * This variable can be set to the following values: | |
| 2244 | + * | |
| 2245 | + * - "0": SDL will manage graphics contexts that are attached to windows. | |
| 2246 | + * - "1": Disable graphics context management on windows. | |
| 2247 | + * | |
| 2248 | + * By default SDL will manage OpenGL contexts in certain situations. For | |
| 2249 | + * example, on Android the context will be automatically saved and restored | |
| 2250 | + * when pausing the application. Additionally, some platforms will assume | |
| 2251 | + * usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this | |
| 2252 | + * behavior, which is desireable when the application manages the graphics | |
| 2253 | + * context, such as an externally managed OpenGL context or attaching a Vulkan | |
| 2254 | + * surface to the window. | |
| 2255 | + */ | |
| 2256 | +#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT" | |
| 2257 | + | |
| 2258 | +/** | |
| 2259 | + * If set to 1, then do not allow high-DPI windows. | |
| 2260 | + * | |
| 2261 | + * ("Retina" on Mac and iOS) | |
| 2262 | + */ | |
| 2263 | +#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED" | |
| 2264 | + | |
| 2265 | +/** | |
| 2266 | + * A variable that dictates policy for fullscreen Spaces on Mac OS X. | |
| 2267 | + * | |
| 2268 | + * This hint only applies to Mac OS X. | |
| 2269 | + * | |
| 2270 | + * The variable can be set to the following values: | |
| 2271 | + * | |
| 2272 | + * - "0": Disable Spaces support (FULLSCREEN_DESKTOP won't use them and | |
| 2273 | + * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" button on their | |
| 2274 | + * titlebars). | |
| 2275 | + * - "1": Enable Spaces support (FULLSCREEN_DESKTOP will use them and | |
| 2276 | + * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" button on their | |
| 2277 | + * titlebars). | |
| 2278 | + * | |
| 2279 | + * The default value is "1". This hint must be set before any windows are | |
| 2280 | + * created. | |
| 2281 | + */ | |
| 2282 | +#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" | |
| 2283 | + | |
| 2284 | +/** | |
| 2285 | + * Minimize your SDL_Window if it loses key focus when in fullscreen mode. | |
| 2286 | + * | |
| 2287 | + * Defaults to false. | |
| 2288 | + */ | |
| 2289 | +#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" | |
| 2290 | + | |
| 2291 | +/** | |
| 2292 | + * A variable controlling whether the libdecor Wayland backend is allowed to | |
| 2293 | + * be used. | |
| 2294 | + * | |
| 2295 | + * This variable can be set to the following values: | |
| 2296 | + * | |
| 2297 | + * - "0": libdecor use is disabled. | |
| 2298 | + * - "1": libdecor use is enabled (default). | |
| 2299 | + * | |
| 2300 | + * libdecor is used over xdg-shell when xdg-decoration protocol is | |
| 2301 | + * unavailable. | |
| 2302 | + */ | |
| 2303 | +#define SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR "SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR" | |
| 2304 | + | |
| 2305 | +/** | |
| 2306 | + * A variable controlling whether the libdecor Wayland backend is preferred | |
| 2307 | + * over native decorations. | |
| 2308 | + * | |
| 2309 | + * When this hint is set, libdecor will be used to provide window decorations, | |
| 2310 | + * even if xdg-decoration is available. (Note that, by default, libdecor will | |
| 2311 | + * use xdg-decoration itself if available). | |
| 2312 | + * | |
| 2313 | + * This variable can be set to the following values: | |
| 2314 | + * | |
| 2315 | + * - "0": libdecor is enabled only if server-side decorations are unavailable. | |
| 2316 | + * - "1": libdecor is always enabled if available. | |
| 2317 | + * | |
| 2318 | + * libdecor is used over xdg-shell when xdg-decoration protocol is | |
| 2319 | + * unavailable. | |
| 2320 | + */ | |
| 2321 | +#define SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR "SDL_VIDEO_WAYLAND_PREFER_LIBDECOR" | |
| 2322 | + | |
| 2323 | +/** | |
| 2324 | + * A variable controlling whether video mode emulation is enabled under | |
| 2325 | + * Wayland. | |
| 2326 | + * | |
| 2327 | + * When this hint is set, a standard set of emulated CVT video modes will be | |
| 2328 | + * exposed for use by the application. If it is disabled, the only modes | |
| 2329 | + * exposed will be the logical desktop size and, in the case of a scaled | |
| 2330 | + * desktop, the native display resolution. | |
| 2331 | + * | |
| 2332 | + * This variable can be set to the following values: | |
| 2333 | + * | |
| 2334 | + * - "0": Video mode emulation is disabled. | |
| 2335 | + * - "1": Video mode emulation is enabled. | |
| 2336 | + * | |
| 2337 | + * By default video mode emulation is enabled. | |
| 2338 | + */ | |
| 2339 | +#define SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION "SDL_VIDEO_WAYLAND_MODE_EMULATION" | |
| 2340 | + | |
| 2341 | +/** | |
| 2342 | + * Enable or disable mouse pointer warp emulation, needed by some older games. | |
| 2343 | + * | |
| 2344 | + * When this hint is set, any SDL will emulate mouse warps using relative | |
| 2345 | + * mouse mode. This is required for some older games (such as Source engine | |
| 2346 | + * games), which warp the mouse to the centre of the screen rather than using | |
| 2347 | + * relative mouse motion. Note that relative mouse mode may have different | |
| 2348 | + * mouse acceleration behaviour than pointer warps. | |
| 2349 | + * | |
| 2350 | + * This variable can be set to the following values: | |
| 2351 | + * | |
| 2352 | + * - "0": All mouse warps fail, as mouse warping is not available under | |
| 2353 | + * wayland. | |
| 2354 | + * - "1": Some mouse warps will be emulated by forcing relative mouse mode. | |
| 2355 | + * | |
| 2356 | + * If not set, this is automatically enabled unless an application uses | |
| 2357 | + * relative mouse mode directly. | |
| 2358 | + */ | |
| 2359 | +#define SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP "SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP" | |
| 2360 | + | |
| 2361 | +/** | |
| 2362 | + * A variable that is the address of another SDL_Window* (as a hex string | |
| 2363 | + * formatted with "%p"). | |
| 2364 | + * | |
| 2365 | + * If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is | |
| 2366 | + * set to has SDL_WINDOW_OPENGL set (and running on WGL only, currently), then | |
| 2367 | + * two things will occur on the newly created SDL_Window: | |
| 2368 | + * | |
| 2369 | + * 1. Its pixel format will be set to the same pixel format as this | |
| 2370 | + * SDL_Window. This is needed for example when sharing an OpenGL context | |
| 2371 | + * across multiple windows. | |
| 2372 | + * | |
| 2373 | + * 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be | |
| 2374 | + * used for OpenGL rendering. | |
| 2375 | + * | |
| 2376 | + * This variable can be set to the following values: The address (as a string | |
| 2377 | + * "%p") of the SDL_Window* that new windows created with | |
| 2378 | + * SDL_CreateWindowFrom() should share a pixel format with. | |
| 2379 | + */ | |
| 2380 | +#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT" | |
| 2381 | + | |
| 2382 | +/** | |
| 2383 | + * When calling SDL_CreateWindowFrom(), make the window compatible with | |
| 2384 | + * OpenGL. | |
| 2385 | + * | |
| 2386 | + * This variable can be set to the following values: | |
| 2387 | + * | |
| 2388 | + * - "0": Don't add any graphics flags to the SDL_WindowFlags | |
| 2389 | + * - "1": Add SDL_WINDOW_OPENGL to the SDL_WindowFlags | |
| 2390 | + * | |
| 2391 | + * By default SDL will not make the foreign window compatible with OpenGL. | |
| 2392 | + */ | |
| 2393 | +#define SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL "SDL_VIDEO_FOREIGN_WINDOW_OPENGL" | |
| 2394 | + | |
| 2395 | +/** | |
| 2396 | + * When calling SDL_CreateWindowFrom(), make the window compatible with | |
| 2397 | + * Vulkan. | |
| 2398 | + * | |
| 2399 | + * This variable can be set to the following values: | |
| 2400 | + * | |
| 2401 | + * - "0": Don't add any graphics flags to the SDL_WindowFlags | |
| 2402 | + * - "1": Add SDL_WINDOW_VULKAN to the SDL_WindowFlags | |
| 2403 | + * | |
| 2404 | + * By default SDL will not make the foreign window compatible with Vulkan. | |
| 2405 | + */ | |
| 2406 | +#define SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN "SDL_VIDEO_FOREIGN_WINDOW_VULKAN" | |
| 2407 | + | |
| 2408 | +/** | |
| 2409 | + * A variable specifying which shader compiler to preload when using the | |
| 2410 | + * Chrome ANGLE binaries | |
| 2411 | + * | |
| 2412 | + * SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It can | |
| 2413 | + * use two different sets of binaries, those compiled by the user from source | |
| 2414 | + * or those provided by the Chrome browser. In the later case, these binaries | |
| 2415 | + * require that SDL loads a DLL providing the shader compiler. | |
| 2416 | + * | |
| 2417 | + * This variable can be set to the following values: | |
| 2418 | + * | |
| 2419 | + * - "d3dcompiler_46.dll: default, best for Vista or later. | |
| 2420 | + * - "d3dcompiler_43.dll: for XP support. | |
| 2421 | + * - "none": do not load any library, useful if you compiled ANGLE from source | |
| 2422 | + * and included the compiler in your binaries. | |
| 2423 | + */ | |
| 2424 | +#define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER" | |
| 2425 | + | |
| 2426 | +/** | |
| 2427 | + * A variable controlling whether X11 should use GLX or EGL by default | |
| 2428 | + * | |
| 2429 | + * This variable can be set to the following values: | |
| 2430 | + * | |
| 2431 | + * - "0": Use GLX | |
| 2432 | + * - "1": Use EGL | |
| 2433 | + * | |
| 2434 | + * By default SDL will use GLX when both are present. | |
| 2435 | + */ | |
| 2436 | +#define SDL_HINT_VIDEO_X11_FORCE_EGL "SDL_VIDEO_X11_FORCE_EGL" | |
| 2437 | + | |
| 2438 | +/** | |
| 2439 | + * A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint | |
| 2440 | + * should be used. | |
| 2441 | + * | |
| 2442 | + * This variable can be set to the following values: | |
| 2443 | + * | |
| 2444 | + * - "0": Disable _NET_WM_BYPASS_COMPOSITOR | |
| 2445 | + * - "1": Enable _NET_WM_BYPASS_COMPOSITOR | |
| 2446 | + * | |
| 2447 | + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR | |
| 2448 | + */ | |
| 2449 | +#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" | |
| 2450 | + | |
| 2451 | +/** | |
| 2452 | + * A variable controlling whether the X11 _NET_WM_PING protocol should be | |
| 2453 | + * supported. | |
| 2454 | + * | |
| 2455 | + * This variable can be set to the following values: | |
| 2456 | + * | |
| 2457 | + * - "0": Disable _NET_WM_PING | |
| 2458 | + * - "1": Enable _NET_WM_PING | |
| 2459 | + * | |
| 2460 | + * By default SDL will use _NET_WM_PING, but for applications that know they | |
| 2461 | + * will not always be able to respond to ping requests in a timely manner they | |
| 2462 | + * can turn it off to avoid the window manager thinking the app is hung. The | |
| 2463 | + * hint is checked in CreateWindow. | |
| 2464 | + */ | |
| 2465 | +#define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" | |
| 2466 | + | |
| 2467 | +/** | |
| 2468 | + * A variable forcing the visual ID chosen for new X11 windows | |
| 2469 | + */ | |
| 2470 | +#define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID" | |
| 2471 | + | |
| 2472 | +/** | |
| 2473 | + * A no-longer-used variable controlling whether the X11 Xinerama extension | |
| 2474 | + * should be used. | |
| 2475 | + * | |
| 2476 | + * Before SDL 2.0.24, this would let apps and users disable Xinerama support | |
| 2477 | + * on X11. Now SDL never uses Xinerama, and does not check for this hint at | |
| 2478 | + * all. The preprocessor define is left here for source compatibility. | |
| 2479 | + */ | |
| 2480 | +#define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA" | |
| 2481 | + | |
| 2482 | +/** | |
| 2483 | + * A variable controlling whether the X11 XRandR extension should be used. | |
| 2484 | + * | |
| 2485 | + * This variable can be set to the following values: | |
| 2486 | + * | |
| 2487 | + * - "0": Disable XRandR | |
| 2488 | + * - "1": Enable XRandR | |
| 2489 | + * | |
| 2490 | + * By default SDL will use XRandR. | |
| 2491 | + */ | |
| 2492 | +#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" | |
| 2493 | + | |
| 2494 | +/** | |
| 2495 | + * A no-longer-used variable controlling whether the X11 VidMode extension | |
| 2496 | + * should be used. | |
| 2497 | + * | |
| 2498 | + * Before SDL 2.0.24, this would let apps and users disable XVidMode support | |
| 2499 | + * on X11. Now SDL never uses XVidMode, and does not check for this hint at | |
| 2500 | + * all. The preprocessor define is left here for source compatibility. | |
| 2501 | + */ | |
| 2502 | +#define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE" | |
| 2503 | + | |
| 2504 | +/** | |
| 2505 | + * Controls how the fact chunk affects the loading of a WAVE file. | |
| 2506 | + * | |
| 2507 | + * The fact chunk stores information about the number of samples of a WAVE | |
| 2508 | + * file. The Standards Update from Microsoft notes that this value can be used | |
| 2509 | + * to 'determine the length of the data in seconds'. This is especially useful | |
| 2510 | + * for compressed formats (for which this is a mandatory chunk) if they | |
| 2511 | + * produce multiple sample frames per block and truncating the block is not | |
| 2512 | + * allowed. The fact chunk can exactly specify how many sample frames there | |
| 2513 | + * should be in this case. | |
| 2514 | + * | |
| 2515 | + * Unfortunately, most application seem to ignore the fact chunk and so SDL | |
| 2516 | + * ignores it by default as well. | |
| 2517 | + * | |
| 2518 | + * This variable can be set to the following values: | |
| 2519 | + * | |
| 2520 | + * - "truncate": Use the number of samples to truncate the wave data if the | |
| 2521 | + * fact chunk is present and valid | |
| 2522 | + * - "strict": Like "truncate", but raise an error if the fact chunk is | |
| 2523 | + * invalid, not present for non-PCM formats, or if the data chunk doesn't | |
| 2524 | + * have that many samples | |
| 2525 | + * - "ignorezero": Like "truncate", but ignore fact chunk if the number of | |
| 2526 | + * samples is zero | |
| 2527 | + * - "ignore": Ignore fact chunk entirely (default) | |
| 2528 | + */ | |
| 2529 | +#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK" | |
| 2530 | + | |
| 2531 | +/** | |
| 2532 | + * Controls how the size of the RIFF chunk affects the loading of a WAVE file. | |
| 2533 | + * | |
| 2534 | + * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE | |
| 2535 | + * file) is not always reliable. In case the size is wrong, it's possible to | |
| 2536 | + * just ignore it and step through the chunks until a fixed limit is reached. | |
| 2537 | + * | |
| 2538 | + * Note that files that have trailing data unrelated to the WAVE file or | |
| 2539 | + * corrupt files may slow down the loading process without a reliable | |
| 2540 | + * boundary. By default, SDL stops after 10000 chunks to prevent wasting time. | |
| 2541 | + * Use the environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value. | |
| 2542 | + * | |
| 2543 | + * This variable can be set to the following values: | |
| 2544 | + * | |
| 2545 | + * - "force": Always use the RIFF chunk size as a boundary for the chunk | |
| 2546 | + * search | |
| 2547 | + * - "ignorezero": Like "force", but a zero size searches up to 4 GiB | |
| 2548 | + * (default) | |
| 2549 | + * - "ignore": Ignore the RIFF chunk size and always search up to 4 GiB | |
| 2550 | + * - "maximum": Search for chunks until the end of file (not recommended) | |
| 2551 | + */ | |
| 2552 | +#define SDL_HINT_WAVE_RIFF_CHUNK_SIZE "SDL_WAVE_RIFF_CHUNK_SIZE" | |
| 2553 | + | |
| 2554 | +/** | |
| 2555 | + * Controls how a truncated WAVE file is handled. | |
| 2556 | + * | |
| 2557 | + * A WAVE file is considered truncated if any of the chunks are incomplete or | |
| 2558 | + * the data chunk size is not a multiple of the block size. By default, SDL | |
| 2559 | + * decodes until the first incomplete block, as most applications seem to do. | |
| 2560 | + * | |
| 2561 | + * This variable can be set to the following values: | |
| 2562 | + * | |
| 2563 | + * - "verystrict": Raise an error if the file is truncated | |
| 2564 | + * - "strict": Like "verystrict", but the size of the RIFF chunk is ignored | |
| 2565 | + * - "dropframe": Decode until the first incomplete sample frame | |
| 2566 | + * - "dropblock": Decode until the first incomplete block (default) | |
| 2567 | + */ | |
| 2568 | +#define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION" | |
| 2569 | + | |
| 2570 | +/** | |
| 2571 | + * Tell SDL not to name threads on Windows with the 0x406D1388 Exception. | |
| 2572 | + * | |
| 2573 | + * The 0x406D1388 Exception is a trick used to inform Visual Studio of a | |
| 2574 | + * thread's name, but it tends to cause problems with other debuggers, and the | |
| 2575 | + * .NET runtime. Note that SDL 2.0.6 and later will still use the (safer) | |
| 2576 | + * SetThreadDescription API, introduced in the Windows 10 Creators Update, if | |
| 2577 | + * available. | |
| 2578 | + * | |
| 2579 | + * The variable can be set to the following values: | |
| 2580 | + * | |
| 2581 | + * - "0": SDL will raise the 0x406D1388 Exception to name threads. This is the | |
| 2582 | + * default behavior of SDL <= 2.0.4. | |
| 2583 | + * - "1": SDL will not raise this exception, and threads will be unnamed. | |
| 2584 | + * (default) This is necessary with .NET languages or debuggers that aren't | |
| 2585 | + * Visual Studio. | |
| 2586 | + */ | |
| 2587 | +#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING" | |
| 2588 | + | |
| 2589 | +/** | |
| 2590 | + * Controls whether menus can be opened with their keyboard shortcut | |
| 2591 | + * (Alt+mnemonic). | |
| 2592 | + * | |
| 2593 | + * If the mnemonics are enabled, then menus can be opened by pressing the Alt | |
| 2594 | + * key and the corresponding mnemonic (for example, Alt+F opens the File | |
| 2595 | + * menu). However, in case an invalid mnemonic is pressed, Windows makes an | |
| 2596 | + * audible beep to convey that nothing happened. This is true even if the | |
| 2597 | + * window has no menu at all! | |
| 2598 | + * | |
| 2599 | + * Because most SDL applications don't have menus, and some want to use the | |
| 2600 | + * Alt key for other purposes, SDL disables mnemonics (and the beeping) by | |
| 2601 | + * default. | |
| 2602 | + * | |
| 2603 | + * Note: This also affects keyboard events: with mnemonics enabled, when a | |
| 2604 | + * menu is opened from the keyboard, you will not receive a KEYUP event for | |
| 2605 | + * the mnemonic key, and *might* not receive one for Alt. | |
| 2606 | + * | |
| 2607 | + * This variable can be set to the following values: | |
| 2608 | + * | |
| 2609 | + * - "0": Alt+mnemonic does nothing, no beeping. (default) | |
| 2610 | + * - "1": Alt+mnemonic opens menus, invalid mnemonics produce a beep. | |
| 2611 | + */ | |
| 2612 | +#define SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS "SDL_WINDOWS_ENABLE_MENU_MNEMONICS" | |
| 2613 | + | |
| 2614 | +/** | |
| 2615 | + * A variable controlling whether the windows message loop is processed by SDL | |
| 2616 | + * | |
| 2617 | + * This variable can be set to the following values: | |
| 2618 | + * | |
| 2619 | + * - "0": The window message loop is not run | |
| 2620 | + * - "1": The window message loop is processed in SDL_PumpEvents() | |
| 2621 | + * | |
| 2622 | + * By default SDL will process the windows message loop | |
| 2623 | + */ | |
| 2624 | +#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP" | |
| 2625 | + | |
| 2626 | +/** | |
| 2627 | + * Force SDL to use Critical Sections for mutexes on Windows. | |
| 2628 | + * | |
| 2629 | + * On Windows 7 and newer, Slim Reader/Writer Locks are available. They offer | |
| 2630 | + * better performance, allocate no kernel resources and use less memory. SDL | |
| 2631 | + * will fall back to Critical Sections on older OS versions or if forced to by | |
| 2632 | + * this hint. | |
| 2633 | + * | |
| 2634 | + * This variable can be set to the following values: | |
| 2635 | + * | |
| 2636 | + * - "0": Use SRW Locks when available. If not, fall back to Critical | |
| 2637 | + * Sections. (default) | |
| 2638 | + * - "1": Force the use of Critical Sections in all cases. | |
| 2639 | + */ | |
| 2640 | +#define SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS "SDL_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS" | |
| 2641 | + | |
| 2642 | +/** | |
| 2643 | + * Force SDL to use Kernel Semaphores on Windows. | |
| 2644 | + * | |
| 2645 | + * Kernel Semaphores are inter-process and require a context switch on every | |
| 2646 | + * interaction. On Windows 8 and newer, the WaitOnAddress API is available. | |
| 2647 | + * Using that and atomics to implement semaphores increases performance. SDL | |
| 2648 | + * will fall back to Kernel Objects on older OS versions or if forced to by | |
| 2649 | + * this hint. | |
| 2650 | + * | |
| 2651 | + * This variable can be set to the following values: | |
| 2652 | + * | |
| 2653 | + * - "0": Use Atomics and WaitOnAddress API when available. If not, fall back | |
| 2654 | + * to Kernel Objects. (default) | |
| 2655 | + * - "1": Force the use of Kernel Objects in all cases. | |
| 2656 | + */ | |
| 2657 | +#define SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL "SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL" | |
| 2658 | + | |
| 2659 | +/** | |
| 2660 | + * A variable to specify custom icon resource id from RC file on Windows | |
| 2661 | + * platform | |
| 2662 | + */ | |
| 2663 | +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON" | |
| 2664 | + | |
| 2665 | +/** | |
| 2666 | + * A variable to specify custom icon resource id from RC file on Windows | |
| 2667 | + * platform | |
| 2668 | + */ | |
| 2669 | +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL" | |
| 2670 | + | |
| 2671 | +/** | |
| 2672 | + * Tell SDL not to generate window-close events for Alt+F4 on Windows. | |
| 2673 | + * | |
| 2674 | + * The variable can be set to the following values: | |
| 2675 | + * | |
| 2676 | + * - "0": SDL will generate a window-close event when it sees Alt+F4. | |
| 2677 | + * - "1": SDL will only do normal key handling for Alt+F4. | |
| 2678 | + */ | |
| 2679 | +#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" | |
| 2680 | + | |
| 2681 | +/** | |
| 2682 | + * Use the D3D9Ex API introduced in Windows Vista, instead of normal D3D9. | |
| 2683 | + * | |
| 2684 | + * Direct3D 9Ex contains changes to state management that can eliminate device | |
| 2685 | + * loss errors during scenarios like Alt+Tab or UAC prompts. D3D9Ex may | |
| 2686 | + * require some changes to your application to cope with the new behavior, so | |
| 2687 | + * this is disabled by default. | |
| 2688 | + * | |
| 2689 | + * This hint must be set before initializing the video subsystem. | |
| 2690 | + * | |
| 2691 | + * For more information on Direct3D 9Ex, see: - | |
| 2692 | + * https://docs.microsoft.com/en-us/windows/win32/direct3darticles/graphics-apis-in-windows-vista#direct3d-9ex | |
| 2693 | + * - | |
| 2694 | + * https://docs.microsoft.com/en-us/windows/win32/direct3darticles/direct3d-9ex-improvements | |
| 2695 | + * | |
| 2696 | + * This variable can be set to the following values: | |
| 2697 | + * | |
| 2698 | + * - "0": Use the original Direct3D 9 API (default) | |
| 2699 | + * - "1": Use the Direct3D 9Ex API on Vista and later (and fall back if D3D9Ex | |
| 2700 | + * is unavailable) | |
| 2701 | + */ | |
| 2702 | +#define SDL_HINT_WINDOWS_USE_D3D9EX "SDL_WINDOWS_USE_D3D9EX" | |
| 2703 | + | |
| 2704 | +/** | |
| 2705 | + * Controls whether SDL will declare the process to be DPI aware. | |
| 2706 | + * | |
| 2707 | + * This hint must be set before initializing the video subsystem. | |
| 2708 | + * | |
| 2709 | + * The main purpose of declaring DPI awareness is to disable OS bitmap scaling | |
| 2710 | + * of SDL windows on monitors with a DPI scale factor. | |
| 2711 | + * | |
| 2712 | + * This hint is equivalent to requesting DPI awareness via external means | |
| 2713 | + * (e.g. calling SetProcessDpiAwarenessContext) and does not cause SDL to use | |
| 2714 | + * a virtualized coordinate system, so it will generally give you 1 SDL | |
| 2715 | + * coordinate = 1 pixel even on high-DPI displays. | |
| 2716 | + * | |
| 2717 | + * For more information, see: | |
| 2718 | + * https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows | |
| 2719 | + * | |
| 2720 | + * This variable can be set to the following values: | |
| 2721 | + * | |
| 2722 | + * - "": Do not change the DPI awareness (default). | |
| 2723 | + * - "unaware": Declare the process as DPI unaware. (Windows 8.1 and later). | |
| 2724 | + * - "system": Request system DPI awareness. (Vista and later). | |
| 2725 | + * - "permonitor": Request per-monitor DPI awareness. (Windows 8.1 and later). | |
| 2726 | + * - "permonitorv2": Request per-monitor V2 DPI awareness. (Windows 10, | |
| 2727 | + * version 1607 and later). The most visible difference from "permonitor" is | |
| 2728 | + * that window title bar will be scaled to the visually correct size when | |
| 2729 | + * dragging between monitors with different scale factors. This is the | |
| 2730 | + * preferred DPI awareness level. | |
| 2731 | + * | |
| 2732 | + * If the requested DPI awareness is not available on the currently running | |
| 2733 | + * OS, SDL will try to request the best available match. | |
| 2734 | + */ | |
| 2735 | +#define SDL_HINT_WINDOWS_DPI_AWARENESS "SDL_WINDOWS_DPI_AWARENESS" | |
| 2736 | + | |
| 2737 | +/** | |
| 2738 | + * Uses DPI-scaled points as the SDL coordinate system on Windows. | |
| 2739 | + * | |
| 2740 | + * This changes the SDL coordinate system units to be DPI-scaled points, | |
| 2741 | + * rather than pixels everywhere. This means windows will be appropriately | |
| 2742 | + * sized, even when created on high-DPI displays with scaling. | |
| 2743 | + * | |
| 2744 | + * e.g. requesting a 640x480 window from SDL, on a display with 125% scaling | |
| 2745 | + * in Windows display settings, will create a window with an 800x600 client | |
| 2746 | + * area (in pixels). | |
| 2747 | + * | |
| 2748 | + * Setting this to "1" implicitly requests process DPI awareness (setting | |
| 2749 | + * SDL_WINDOWS_DPI_AWARENESS is unnecessary), and forces | |
| 2750 | + * SDL_WINDOW_ALLOW_HIGHDPI on all windows. | |
| 2751 | + * | |
| 2752 | + * This variable can be set to the following values: | |
| 2753 | + * | |
| 2754 | + * - "0": SDL coordinates equal Windows coordinates. No automatic window | |
| 2755 | + * resizing when dragging between monitors with different scale factors | |
| 2756 | + * (unless this is performed by Windows itself, which is the case when the | |
| 2757 | + * process is DPI unaware). | |
| 2758 | + * - "1": SDL coordinates are in DPI-scaled points. Automatically resize | |
| 2759 | + * windows as needed on displays with non-100% scale factors. | |
| 2760 | + */ | |
| 2761 | +#define SDL_HINT_WINDOWS_DPI_SCALING "SDL_WINDOWS_DPI_SCALING" | |
| 2762 | + | |
| 2763 | +/** | |
| 2764 | + * A variable controlling whether the window frame and title bar are | |
| 2765 | + * interactive when the cursor is hidden | |
| 2766 | + * | |
| 2767 | + * This variable can be set to the following values: | |
| 2768 | + * | |
| 2769 | + * - "0": The window frame is not interactive when the cursor is hidden (no | |
| 2770 | + * move, resize, etc) | |
| 2771 | + * - "1": The window frame is interactive when the cursor is hidden | |
| 2772 | + * | |
| 2773 | + * By default SDL will allow interaction with the window frame when the cursor | |
| 2774 | + * is hidden | |
| 2775 | + */ | |
| 2776 | +#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN" | |
| 2777 | + | |
| 2778 | +/** | |
| 2779 | + * A variable controlling whether the window is activated when the | |
| 2780 | + * SDL_ShowWindow function is called | |
| 2781 | + * | |
| 2782 | + * This variable can be set to the following values: | |
| 2783 | + * | |
| 2784 | + * - "0": The window is activated when the SDL_ShowWindow function is called | |
| 2785 | + * - "1": The window is not activated when the SDL_ShowWindow function is | |
| 2786 | + * called | |
| 2787 | + * | |
| 2788 | + * By default SDL will activate the window when the SDL_ShowWindow function is | |
| 2789 | + * called | |
| 2790 | + */ | |
| 2791 | +#define SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN "SDL_WINDOW_NO_ACTIVATION_WHEN_SHOWN" | |
| 2792 | + | |
| 2793 | +/** Allows back-button-press events on Windows Phone to be marked as handled | |
| 2794 | + * | |
| 2795 | + * Windows Phone devices typically feature a Back button. When pressed, | |
| 2796 | + * the OS will emit back-button-press events, which apps are expected to | |
| 2797 | + * handle in an appropriate manner. If apps do not explicitly mark these | |
| 2798 | + * events as 'Handled', then the OS will invoke its default behavior for | |
| 2799 | + * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to | |
| 2800 | + * terminate the app (and attempt to switch to the previous app, or to the | |
| 2801 | + * device's home screen). | |
| 2802 | + * | |
| 2803 | + * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL | |
| 2804 | + * to mark back-button-press events as Handled, if and when one is sent to | |
| 2805 | + * the app. | |
| 2806 | + * | |
| 2807 | + * Internally, Windows Phone sends back button events as parameters to | |
| 2808 | + * special back-button-press callback functions. Apps that need to respond | |
| 2809 | + * to back-button-press events are expected to register one or more | |
| 2810 | + * callback functions for such, shortly after being launched (during the | |
| 2811 | + * app's initialization phase). After the back button is pressed, the OS | |
| 2812 | + * will invoke these callbacks. If the app's callback(s) do not explicitly | |
| 2813 | + * mark the event as handled by the time they return, or if the app never | |
| 2814 | + * registers one of these callback, the OS will consider the event | |
| 2815 | + * un-handled, and it will apply its default back button behavior (terminate | |
| 2816 | + * the app). | |
| 2817 | + * | |
| 2818 | + * SDL registers its own back-button-press callback with the Windows Phone | |
| 2819 | + * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN | |
| 2820 | + * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which | |
| 2821 | + * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON. | |
| 2822 | + * If the hint's value is set to "1", the back button event's Handled | |
| 2823 | + * property will get set to 'true'. If the hint's value is set to something | |
| 2824 | + * else, or if it is unset, SDL will leave the event's Handled property | |
| 2825 | + * alone. (By default, the OS sets this property to 'false', to note.) | |
| 2826 | + * | |
| 2827 | + * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a | |
| 2828 | + * back button is pressed, or can set it in direct-response to a back button | |
| 2829 | + * being pressed. | |
| 2830 | + * | |
| 2831 | + * In order to get notified when a back button is pressed, SDL apps should | |
| 2832 | + * register a callback function with SDL_AddEventWatch(), and have it listen | |
| 2833 | + * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK. | |
| 2834 | + * (Alternatively, SDL_KEYUP events can be listened-for. Listening for | |
| 2835 | + * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON | |
| 2836 | + * set by such a callback, will be applied to the OS' current | |
| 2837 | + * back-button-press event. | |
| 2838 | + * | |
| 2839 | + * More details on back button behavior in Windows Phone apps can be found | |
| 2840 | + * at the following page, on Microsoft's developer site: | |
| 2841 | + * | |
| 2842 | + * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx | |
| 2843 | + */ | |
| 2844 | +#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON" | |
| 2845 | + | |
| 2846 | +/** Label text for a WinRT app's privacy policy link | |
| 2847 | + * | |
| 2848 | + * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, | |
| 2849 | + * Microsoft mandates that this policy be available via the Windows Settings charm. | |
| 2850 | + * SDL provides code to add a link there, with its label text being set via the | |
| 2851 | + * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. | |
| 2852 | + * | |
| 2853 | + * Please note that a privacy policy's contents are not set via this hint. A separate | |
| 2854 | + * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the | |
| 2855 | + * policy. | |
| 2856 | + * | |
| 2857 | + * The contents of this hint should be encoded as a UTF8 string. | |
| 2858 | + * | |
| 2859 | + * The default value is "Privacy Policy". This hint should only be set during app | |
| 2860 | + * initialization, preferably before any calls to SDL_Init(). | |
| 2861 | + * | |
| 2862 | + * For additional information on linking to a privacy policy, see the documentation for | |
| 2863 | + * SDL_HINT_WINRT_PRIVACY_POLICY_URL. | |
| 2864 | + */ | |
| 2865 | +#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL" | |
| 2866 | + | |
| 2867 | +/** | |
| 2868 | + * A URL to a WinRT app's privacy policy | |
| 2869 | + * | |
| 2870 | + * All network-enabled WinRT apps must make a privacy policy available to its | |
| 2871 | + * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be be | |
| 2872 | + * available in the Windows Settings charm, as accessed from within the app. | |
| 2873 | + * SDL provides code to add a URL-based link there, which can point to the | |
| 2874 | + * app's privacy policy. | |
| 2875 | + * | |
| 2876 | + * To setup a URL to an app's privacy policy, set | |
| 2877 | + * SDL_HINT_WINRT_PRIVACY_POLICY_URL before calling any SDL_Init() functions. | |
| 2878 | + * The contents of the hint should be a valid URL. For example, | |
| 2879 | + * "http://www.example.com". | |
| 2880 | + * | |
| 2881 | + * The default value is "", which will prevent SDL from adding a privacy | |
| 2882 | + * policy link to the Settings charm. This hint should only be set during app | |
| 2883 | + * init. | |
| 2884 | + * | |
| 2885 | + * The label text of an app's "Privacy Policy" link may be customized via | |
| 2886 | + * another hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. | |
| 2887 | + * | |
| 2888 | + * Please note that on Windows Phone, Microsoft does not provide standard UI | |
| 2889 | + * for displaying a privacy policy link, and as such, | |
| 2890 | + * SDL_HINT_WINRT_PRIVACY_POLICY_URL will not get used on that platform. | |
| 2891 | + * Network-enabled phone apps should display their privacy policy through some | |
| 2892 | + * other, in-app means. | |
| 2893 | + */ | |
| 2894 | +#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL" | |
| 2895 | + | |
| 2896 | +/** | |
| 2897 | + * Mark X11 windows as override-redirect. | |
| 2898 | + * | |
| 2899 | + * If set, this _might_ increase framerate at the expense of the desktop not | |
| 2900 | + * working as expected. Override-redirect windows aren't noticed by the window | |
| 2901 | + * manager at all. | |
| 2902 | + * | |
| 2903 | + * You should probably only use this for fullscreen windows, and you probably | |
| 2904 | + * shouldn't even use it for that. But it's here if you want to try! | |
| 2905 | + */ | |
| 2906 | +#define SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT "SDL_X11_FORCE_OVERRIDE_REDIRECT" | |
| 2907 | + | |
| 2908 | +/** | |
| 2909 | + * A variable that lets you disable the detection and use of Xinput gamepad | |
| 2910 | + * devices | |
| 2911 | + * | |
| 2912 | + * The variable can be set to the following values: | |
| 2913 | + * | |
| 2914 | + * - "0": Disable XInput detection (only uses direct input) | |
| 2915 | + * - "1": Enable XInput detection (the default) | |
| 2916 | + */ | |
| 2917 | +#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" | |
| 2918 | + | |
| 2919 | +/** | |
| 2920 | + * A variable that lets you disable the detection and use of DirectInput | |
| 2921 | + * gamepad devices | |
| 2922 | + * | |
| 2923 | + * The variable can be set to the following values: | |
| 2924 | + * | |
| 2925 | + * - "0": Disable DirectInput detection (only uses XInput) | |
| 2926 | + * - "1": Enable DirectInput detection (the default) | |
| 2927 | + */ | |
| 2928 | +#define SDL_HINT_DIRECTINPUT_ENABLED "SDL_DIRECTINPUT_ENABLED" | |
| 2929 | + | |
| 2930 | +/** | |
| 2931 | + * A variable that causes SDL to use the old axis and button mapping for | |
| 2932 | + * XInput devices. | |
| 2933 | + * | |
| 2934 | + * This hint is for backwards compatibility only and will be removed in SDL | |
| 2935 | + * 2.1 | |
| 2936 | + * | |
| 2937 | + * The default value is "0". This hint must be set before SDL_Init() | |
| 2938 | + */ | |
| 2939 | +#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING" | |
| 2940 | + | |
| 2941 | +/** | |
| 2942 | + * A variable that causes SDL to not ignore audio "monitors" | |
| 2943 | + * | |
| 2944 | + * This is currently only used for PulseAudio and ignored elsewhere. | |
| 2945 | + * | |
| 2946 | + * By default, SDL ignores audio devices that aren't associated with physical | |
| 2947 | + * hardware. Changing this hint to "1" will expose anything SDL sees that | |
| 2948 | + * appears to be an audio source or sink. This will add "devices" to the list | |
| 2949 | + * that the user probably doesn't want or need, but it can be useful in | |
| 2950 | + * scenarios where you want to hook up SDL to some sort of virtual device, | |
| 2951 | + * etc. | |
| 2952 | + * | |
| 2953 | + * The default value is "0". This hint must be set before SDL_Init(). | |
| 2954 | + * | |
| 2955 | + * This hint is available since SDL 2.0.16. Before then, virtual devices are | |
| 2956 | + * always ignored. | |
| 2957 | + */ | |
| 2958 | +#define SDL_HINT_AUDIO_INCLUDE_MONITORS "SDL_AUDIO_INCLUDE_MONITORS" | |
| 2959 | + | |
| 2960 | +/** | |
| 2961 | + * A variable that forces X11 windows to create as a custom type. | |
| 2962 | + * | |
| 2963 | + * This is currently only used for X11 and ignored elsewhere. | |
| 2964 | + * | |
| 2965 | + * During SDL_CreateWindow, SDL uses the _NET_WM_WINDOW_TYPE X11 property to | |
| 2966 | + * report to the window manager the type of window it wants to create. This | |
| 2967 | + * might be set to various things if SDL_WINDOW_TOOLTIP or | |
| 2968 | + * SDL_WINDOW_POPUP_MENU, etc, were specified. For "normal" windows that | |
| 2969 | + * haven't set a specific type, this hint can be used to specify a custom | |
| 2970 | + * type. For example, a dock window might set this to | |
| 2971 | + * "_NET_WM_WINDOW_TYPE_DOCK". | |
| 2972 | + * | |
| 2973 | + * If not set or set to "", this hint is ignored. This hint must be set before | |
| 2974 | + * the SDL_CreateWindow() call that it is intended to affect. | |
| 2975 | + * | |
| 2976 | + * This hint is available since SDL 2.0.22. | |
| 2977 | + */ | |
| 2978 | +#define SDL_HINT_X11_WINDOW_TYPE "SDL_X11_WINDOW_TYPE" | |
| 2979 | + | |
| 2980 | +/** | |
| 2981 | + * A variable that decides whether to send SDL_QUIT when closing the final | |
| 2982 | + * window. | |
| 2983 | + * | |
| 2984 | + * By default, SDL sends an SDL_QUIT event when there is only one window and | |
| 2985 | + * it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most apps | |
| 2986 | + * would also take the loss of this window as a signal to terminate the | |
| 2987 | + * program. | |
| 2988 | + * | |
| 2989 | + * However, it's not unreasonable in some cases to have the program continue | |
| 2990 | + * to live on, perhaps to create new windows later. | |
| 2991 | + * | |
| 2992 | + * Changing this hint to "0" will cause SDL to not send an SDL_QUIT event when | |
| 2993 | + * the final window is requesting to close. Note that in this case, there are | |
| 2994 | + * still other legitimate reasons one might get an SDL_QUIT event: choosing | |
| 2995 | + * "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c) on Unix, etc. | |
| 2996 | + * | |
| 2997 | + * The default value is "1". This hint can be changed at any time. | |
| 2998 | + * | |
| 2999 | + * This hint is available since SDL 2.0.22. Before then, you always get an | |
| 3000 | + * SDL_QUIT event when closing the final window. | |
| 3001 | + */ | |
| 3002 | +#define SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE "SDL_QUIT_ON_LAST_WINDOW_CLOSE" | |
| 3003 | + | |
| 3004 | + | |
| 3005 | +/** | |
| 3006 | + * A variable that decides what video backend to use. | |
| 3007 | + * | |
| 3008 | + * By default, SDL will try all available video backends in a reasonable order | |
| 3009 | + * until it finds one that can work, but this hint allows the app or user to | |
| 3010 | + * force a specific target, such as "x11" if, say, you are on Wayland but want | |
| 3011 | + * to try talking to the X server instead. | |
| 3012 | + * | |
| 3013 | + * This functionality has existed since SDL 2.0.0 (indeed, before that) but | |
| 3014 | + * before 2.0.22 this was an environment variable only. In 2.0.22, it was | |
| 3015 | + * upgraded to a full SDL hint, so you can set the environment variable as | |
| 3016 | + * usual or programatically set the hint with SDL_SetHint, which won't | |
| 3017 | + * propagate to child processes. | |
| 3018 | + * | |
| 3019 | + * The default value is unset, in which case SDL will try to figure out the | |
| 3020 | + * best video backend on your behalf. This hint needs to be set before | |
| 3021 | + * SDL_Init() is called to be useful. | |
| 3022 | + * | |
| 3023 | + * This hint is available since SDL 2.0.22. Before then, you could set the | |
| 3024 | + * environment variable to get the same effect. | |
| 3025 | + */ | |
| 3026 | +#define SDL_HINT_VIDEODRIVER "SDL_VIDEODRIVER" | |
| 3027 | + | |
| 3028 | +/** | |
| 3029 | + * A variable that decides what audio backend to use. | |
| 3030 | + * | |
| 3031 | + * By default, SDL will try all available audio backends in a reasonable order | |
| 3032 | + * until it finds one that can work, but this hint allows the app or user to | |
| 3033 | + * force a specific target, such as "alsa" if, say, you are on PulseAudio but | |
| 3034 | + * want to try talking to the lower level instead. | |
| 3035 | + * | |
| 3036 | + * This functionality has existed since SDL 2.0.0 (indeed, before that) but | |
| 3037 | + * before 2.0.22 this was an environment variable only. In 2.0.22, it was | |
| 3038 | + * upgraded to a full SDL hint, so you can set the environment variable as | |
| 3039 | + * usual or programatically set the hint with SDL_SetHint, which won't | |
| 3040 | + * propagate to child processes. | |
| 3041 | + * | |
| 3042 | + * The default value is unset, in which case SDL will try to figure out the | |
| 3043 | + * best audio backend on your behalf. This hint needs to be set before | |
| 3044 | + * SDL_Init() is called to be useful. | |
| 3045 | + * | |
| 3046 | + * This hint is available since SDL 2.0.22. Before then, you could set the | |
| 3047 | + * environment variable to get the same effect. | |
| 3048 | + */ | |
| 3049 | +#define SDL_HINT_AUDIODRIVER "SDL_AUDIODRIVER" | |
| 3050 | + | |
| 3051 | +/** | |
| 3052 | + * A variable that decides what KMSDRM device to use. | |
| 3053 | + * | |
| 3054 | + * Internally, SDL might open something like "/dev/dri/cardNN" to access | |
| 3055 | + * KMSDRM functionality, where "NN" is a device index number. | |
| 3056 | + * | |
| 3057 | + * SDL makes a guess at the best index to use (usually zero), but the app or | |
| 3058 | + * user can set this hint to a number between 0 and 99 to force selection. | |
| 3059 | + * | |
| 3060 | + * This hint is available since SDL 2.24.0. | |
| 3061 | + */ | |
| 3062 | +#define SDL_HINT_KMSDRM_DEVICE_INDEX "SDL_KMSDRM_DEVICE_INDEX" | |
| 3063 | + | |
| 3064 | + | |
| 3065 | +/** | |
| 3066 | + * A variable that treats trackpads as touch devices. | |
| 3067 | + * | |
| 3068 | + * On macOS (and possibly other platforms in the future), SDL will report | |
| 3069 | + * touches on a trackpad as mouse input, which is generally what users expect | |
| 3070 | + * from this device; however, these are often actually full multitouch-capable | |
| 3071 | + * touch devices, so it might be preferable to some apps to treat them as | |
| 3072 | + * such. | |
| 3073 | + * | |
| 3074 | + * Setting this hint to true will make the trackpad input report as a | |
| 3075 | + * multitouch device instead of a mouse. The default is false. | |
| 3076 | + * | |
| 3077 | + * Note that most platforms don't support this hint. As of 2.24.0, it only | |
| 3078 | + * supports MacBooks' trackpads on macOS. Others may follow later. | |
| 3079 | + * | |
| 3080 | + * This hint is checked during SDL_Init and can not be changed after. | |
| 3081 | + * | |
| 3082 | + * This hint is available since SDL 2.24.0. | |
| 3083 | + */ | |
| 3084 | +#define SDL_HINT_TRACKPAD_IS_TOUCH_ONLY "SDL_TRACKPAD_IS_TOUCH_ONLY" | |
| 3085 | + | |
| 3086 | +/** | |
| 3087 | + * Cause SDL to call dbus_shutdown() on quit. | |
| 3088 | + * | |
| 3089 | + * This is useful as a debug tool to validate memory leaks, but shouldn't ever | |
| 3090 | + * be set in production applications, as other libraries used by the | |
| 3091 | + * application might use dbus under the hood and this cause cause crashes if | |
| 3092 | + * they continue after SDL_Quit(). | |
| 3093 | + * | |
| 3094 | + * This variable can be set to the following values: | |
| 3095 | + * | |
| 3096 | + * - "0": SDL will not call dbus_shutdown() on quit (default) | |
| 3097 | + * - "1": SDL will call dbus_shutdown() on quit | |
| 3098 | + * | |
| 3099 | + * This hint is available since SDL 2.30.0. | |
| 3100 | + */ | |
| 3101 | +#define SDL_HINT_SHUTDOWN_DBUS_ON_QUIT "SDL_SHUTDOWN_DBUS_ON_QUIT" | |
| 3102 | + | |
| 3103 | +/** | |
| 3104 | + * Specify if SDL_RWFromFile should use the resource dir on Apple platforms. | |
| 3105 | + * | |
| 3106 | + * SDL2 has always done this on Apple platforms, but it can be surprising to | |
| 3107 | + * try opening a path to discover that SDL adjusts the path to elsewhere, so | |
| 3108 | + * this hint allows that behavior to be disabled. | |
| 3109 | + * | |
| 3110 | + * If running from a App Bundle, this will be MyApp.app/Contents/Resources. If | |
| 3111 | + * running as a normal Unix-like process, this will be the directory where the | |
| 3112 | + * running binary lives. Setting this hint to 0 avoids this and just uses the | |
| 3113 | + * requested path as-is. | |
| 3114 | + * | |
| 3115 | + * This variable can be set to the following values: | |
| 3116 | + * | |
| 3117 | + * - "0": SDL will not use the app resource directory. | |
| 3118 | + * - "1": SDL will use the app's resource directory (default). | |
| 3119 | + * | |
| 3120 | + * This hint is available since SDL 2.32.0. | |
| 3121 | + */ | |
| 3122 | +#define SDL_HINT_APPLE_RWFROMFILE_USE_RESOURCES "SDL_APPLE_RWFROMFILE_USE_RESOURCES" | |
| 3123 | + | |
| 3124 | + | |
| 3125 | +/** | |
| 3126 | + * An enumeration of hint priorities | |
| 3127 | + */ | |
| 3128 | +typedef enum SDL_HintPriority | |
| 3129 | +{ | |
| 3130 | + SDL_HINT_DEFAULT, | |
| 3131 | + SDL_HINT_NORMAL, | |
| 3132 | + SDL_HINT_OVERRIDE | |
| 3133 | +} SDL_HintPriority; | |
| 3134 | + | |
| 3135 | + | |
| 3136 | +/** | |
| 3137 | + * Set a hint with a specific priority. | |
| 3138 | + * | |
| 3139 | + * The priority controls the behavior when setting a hint that already has a | |
| 3140 | + * value. Hints will replace existing hints of their priority and lower. | |
| 3141 | + * Environment variables are considered to have override priority. | |
| 3142 | + * | |
| 3143 | + * \param name the hint to set. | |
| 3144 | + * \param value the value of the hint variable. | |
| 3145 | + * \param priority the SDL_HintPriority level for the hint. | |
| 3146 | + * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. | |
| 3147 | + * | |
| 3148 | + * \since This function is available since SDL 2.0.0. | |
| 3149 | + * | |
| 3150 | + * \sa SDL_GetHint | |
| 3151 | + * \sa SDL_SetHint | |
| 3152 | + */ | |
| 3153 | +extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, | |
| 3154 | + const char *value, | |
| 3155 | + SDL_HintPriority priority); | |
| 3156 | + | |
| 3157 | +/** | |
| 3158 | + * Set a hint with normal priority. | |
| 3159 | + * | |
| 3160 | + * Hints will not be set if there is an existing override hint or environment | |
| 3161 | + * variable that takes precedence. You can use SDL_SetHintWithPriority() to | |
| 3162 | + * set the hint with override priority instead. | |
| 3163 | + * | |
| 3164 | + * \param name the hint to set. | |
| 3165 | + * \param value the value of the hint variable. | |
| 3166 | + * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. | |
| 3167 | + * | |
| 3168 | + * \since This function is available since SDL 2.0.0. | |
| 3169 | + * | |
| 3170 | + * \sa SDL_GetHint | |
| 3171 | + * \sa SDL_SetHintWithPriority | |
| 3172 | + */ | |
| 3173 | +extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, | |
| 3174 | + const char *value); | |
| 3175 | + | |
| 3176 | +/** | |
| 3177 | + * Reset a hint to the default value. | |
| 3178 | + * | |
| 3179 | + * This will reset a hint to the value of the environment variable, or NULL if | |
| 3180 | + * the environment isn't set. Callbacks will be called normally with this | |
| 3181 | + * change. | |
| 3182 | + * | |
| 3183 | + * \param name the hint to set. | |
| 3184 | + * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. | |
| 3185 | + * | |
| 3186 | + * \since This function is available since SDL 2.24.0. | |
| 3187 | + * | |
| 3188 | + * \sa SDL_GetHint | |
| 3189 | + * \sa SDL_SetHint | |
| 3190 | + */ | |
| 3191 | +extern DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); | |
| 3192 | + | |
| 3193 | +/** | |
| 3194 | + * Reset all hints to the default values. | |
| 3195 | + * | |
| 3196 | + * This will reset all hints to the value of the associated environment | |
| 3197 | + * variable, or NULL if the environment isn't set. Callbacks will be called | |
| 3198 | + * normally with this change. | |
| 3199 | + * | |
| 3200 | + * \since This function is available since SDL 2.26.0. | |
| 3201 | + * | |
| 3202 | + * \sa SDL_GetHint | |
| 3203 | + * \sa SDL_SetHint | |
| 3204 | + * \sa SDL_ResetHint | |
| 3205 | + */ | |
| 3206 | +extern DECLSPEC void SDLCALL SDL_ResetHints(void); | |
| 3207 | + | |
| 3208 | +/** | |
| 3209 | + * Get the value of a hint. | |
| 3210 | + * | |
| 3211 | + * \param name the hint to query. | |
| 3212 | + * \returns the string value of a hint or NULL if the hint isn't set. | |
| 3213 | + * | |
| 3214 | + * \since This function is available since SDL 2.0.0. | |
| 3215 | + * | |
| 3216 | + * \sa SDL_SetHint | |
| 3217 | + * \sa SDL_SetHintWithPriority | |
| 3218 | + */ | |
| 3219 | +extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); | |
| 3220 | + | |
| 3221 | +/** | |
| 3222 | + * Get the boolean value of a hint variable. | |
| 3223 | + * | |
| 3224 | + * \param name the name of the hint to get the boolean value from. | |
| 3225 | + * \param default_value the value to return if the hint does not exist. | |
| 3226 | + * \returns the boolean value of a hint or the provided default value if the | |
| 3227 | + * hint does not exist. | |
| 3228 | + * | |
| 3229 | + * \since This function is available since SDL 2.0.5. | |
| 3230 | + * | |
| 3231 | + * \sa SDL_GetHint | |
| 3232 | + * \sa SDL_SetHint | |
| 3233 | + */ | |
| 3234 | +extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value); | |
| 3235 | + | |
| 3236 | +/** | |
| 3237 | + * Type definition of the hint callback function. | |
| 3238 | + * | |
| 3239 | + * \param userdata what was passed as `userdata` to SDL_AddHintCallback(). | |
| 3240 | + * \param name what was passed as `name` to SDL_AddHintCallback(). | |
| 3241 | + * \param oldValue the previous hint value. | |
| 3242 | + * \param newValue the new value hint is to be set to. | |
| 3243 | + */ | |
| 3244 | +typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); | |
| 3245 | + | |
| 3246 | +/** | |
| 3247 | + * Add a function to watch a particular hint. | |
| 3248 | + * | |
| 3249 | + * \param name the hint to watch. | |
| 3250 | + * \param callback An SDL_HintCallback function that will be called when the | |
| 3251 | + * hint value changes. | |
| 3252 | + * \param userdata a pointer to pass to the callback function. | |
| 3253 | + * | |
| 3254 | + * \since This function is available since SDL 2.0.0. | |
| 3255 | + * | |
| 3256 | + * \sa SDL_DelHintCallback | |
| 3257 | + */ | |
| 3258 | +extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, | |
| 3259 | + SDL_HintCallback callback, | |
| 3260 | + void *userdata); | |
| 3261 | + | |
| 3262 | +/** | |
| 3263 | + * Remove a function watching a particular hint. | |
| 3264 | + * | |
| 3265 | + * \param name the hint being watched. | |
| 3266 | + * \param callback An SDL_HintCallback function that will be called when the | |
| 3267 | + * hint value changes. | |
| 3268 | + * \param userdata a pointer being passed to the callback function. | |
| 3269 | + * | |
| 3270 | + * \since This function is available since SDL 2.0.0. | |
| 3271 | + * | |
| 3272 | + * \sa SDL_AddHintCallback | |
| 3273 | + */ | |
| 3274 | +extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, | |
| 3275 | + SDL_HintCallback callback, | |
| 3276 | + void *userdata); | |
| 3277 | + | |
| 3278 | +/** | |
| 3279 | + * Clear all hints. | |
| 3280 | + * | |
| 3281 | + * This function is automatically called during SDL_Quit(), and deletes all | |
| 3282 | + * callbacks without calling them and frees all memory associated with hints. | |
| 3283 | + * If you're calling this from application code you probably want to call | |
| 3284 | + * SDL_ResetHints() instead. | |
| 3285 | + * | |
| 3286 | + * This function will be removed from the API the next time we rev the ABI. | |
| 3287 | + * | |
| 3288 | + * \since This function is available since SDL 2.0.0. | |
| 3289 | + * | |
| 3290 | + * \sa SDL_ResetHints | |
| 3291 | + */ | |
| 3292 | +extern DECLSPEC void SDLCALL SDL_ClearHints(void); | |
| 3293 | + | |
| 3294 | + | |
| 3295 | +/* Ends C function definitions when using C++ */ | |
| 3296 | +#ifdef __cplusplus | |
| 3297 | +} | |
| 3298 | +#endif | |
| 3299 | +#include "close_code.h" | |
| 3300 | + | |
| 3301 | +#endif /* SDL_hints_h_ */ | |
| 3302 | + | |
| 3303 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,1088 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryJoystick | |
| 24 | + * | |
| 25 | + * Include file for SDL joystick event handling | |
| 26 | + * | |
| 27 | + * The term "device_index" identifies currently plugged in joystick devices | |
| 28 | + * between 0 and SDL_NumJoysticks(), with the exact joystick behind a | |
| 29 | + * device_index changing as joysticks are plugged and unplugged. | |
| 30 | + * | |
| 31 | + * The term "instance_id" is the current instantiation of a joystick device in | |
| 32 | + * the system, if the joystick is removed and then re-inserted then it will | |
| 33 | + * get a new instance_id, instance_id's are monotonically increasing | |
| 34 | + * identifiers of a joystick plugged in. | |
| 35 | + * | |
| 36 | + * The term "player_index" is the number assigned to a player on a specific | |
| 37 | + * controller. For XInput controllers this returns the XInput user index. Many | |
| 38 | + * joysticks will not be able to supply this information. | |
| 39 | + * | |
| 40 | + * The term JoystickGUID is a stable 128-bit identifier for a joystick device | |
| 41 | + * that does not change over time, it identifies class of the device (a X360 | |
| 42 | + * wired controller for example). This identifier is platform dependent. | |
| 43 | + */ | |
| 44 | + | |
| 45 | +#ifndef SDL_joystick_h_ | |
| 46 | +#define SDL_joystick_h_ | |
| 47 | + | |
| 48 | +#include "SDL_stdinc.h" | |
| 49 | +#include "SDL_error.h" | |
| 50 | +#include "SDL_guid.h" | |
| 51 | +#include "SDL_mutex.h" | |
| 52 | + | |
| 53 | +#include "begin_code.h" | |
| 54 | +/* Set up for C function definitions, even when using C++ */ | |
| 55 | +#ifdef __cplusplus | |
| 56 | +extern "C" { | |
| 57 | +#endif | |
| 58 | + | |
| 59 | +/** | |
| 60 | + * \file SDL_joystick.h | |
| 61 | + * | |
| 62 | + * In order to use these functions, SDL_Init() must have been called | |
| 63 | + * with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system | |
| 64 | + * for joysticks, and load appropriate drivers. | |
| 65 | + * | |
| 66 | + * If you would like to receive joystick updates while the application | |
| 67 | + * is in the background, you should set the following hint before calling | |
| 68 | + * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS | |
| 69 | + */ | |
| 70 | + | |
| 71 | +/** | |
| 72 | + * The joystick structure used to identify an SDL joystick | |
| 73 | + */ | |
| 74 | +#ifdef SDL_THREAD_SAFETY_ANALYSIS | |
| 75 | +extern SDL_mutex *SDL_joystick_lock; | |
| 76 | +#endif | |
| 77 | +struct _SDL_Joystick; | |
| 78 | +typedef struct _SDL_Joystick SDL_Joystick; | |
| 79 | + | |
| 80 | +/** | |
| 81 | + * A structure that encodes the stable unique id for a joystick device. | |
| 82 | + * | |
| 83 | + * This is just a standard SDL_GUID by a different name. | |
| 84 | + */ | |
| 85 | +typedef SDL_GUID SDL_JoystickGUID; | |
| 86 | + | |
| 87 | +/** | |
| 88 | + * This is a unique ID for a joystick for the time it is connected to the | |
| 89 | + * system, and is never reused for the lifetime of the application. | |
| 90 | + * | |
| 91 | + * If the joystick is disconnected and reconnected, it will get a new ID. | |
| 92 | + * | |
| 93 | + * The ID value starts at 0 and increments from there. The value -1 is an | |
| 94 | + * invalid ID. | |
| 95 | + */ | |
| 96 | +typedef Sint32 SDL_JoystickID; | |
| 97 | + | |
| 98 | +typedef enum | |
| 99 | +{ | |
| 100 | + SDL_JOYSTICK_TYPE_UNKNOWN, | |
| 101 | + SDL_JOYSTICK_TYPE_GAMECONTROLLER, | |
| 102 | + SDL_JOYSTICK_TYPE_WHEEL, | |
| 103 | + SDL_JOYSTICK_TYPE_ARCADE_STICK, | |
| 104 | + SDL_JOYSTICK_TYPE_FLIGHT_STICK, | |
| 105 | + SDL_JOYSTICK_TYPE_DANCE_PAD, | |
| 106 | + SDL_JOYSTICK_TYPE_GUITAR, | |
| 107 | + SDL_JOYSTICK_TYPE_DRUM_KIT, | |
| 108 | + SDL_JOYSTICK_TYPE_ARCADE_PAD, | |
| 109 | + SDL_JOYSTICK_TYPE_THROTTLE | |
| 110 | +} SDL_JoystickType; | |
| 111 | + | |
| 112 | +typedef enum | |
| 113 | +{ | |
| 114 | + SDL_JOYSTICK_POWER_UNKNOWN = -1, | |
| 115 | + SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */ | |
| 116 | + SDL_JOYSTICK_POWER_LOW, /* <= 20% */ | |
| 117 | + SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */ | |
| 118 | + SDL_JOYSTICK_POWER_FULL, /* <= 100% */ | |
| 119 | + SDL_JOYSTICK_POWER_WIRED, | |
| 120 | + SDL_JOYSTICK_POWER_MAX | |
| 121 | +} SDL_JoystickPowerLevel; | |
| 122 | + | |
| 123 | +/* Set max recognized G-force from accelerometer | |
| 124 | + See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed | |
| 125 | + */ | |
| 126 | +#define SDL_IPHONE_MAX_GFORCE 5.0 | |
| 127 | + | |
| 128 | + | |
| 129 | +/* Function prototypes */ | |
| 130 | + | |
| 131 | +/** | |
| 132 | + * Locking for multi-threaded access to the joystick API | |
| 133 | + * | |
| 134 | + * If you are using the joystick API or handling events from multiple threads | |
| 135 | + * you should use these locking functions to protect access to the joysticks. | |
| 136 | + * | |
| 137 | + * In particular, you are guaranteed that the joystick list won't change, so | |
| 138 | + * the API functions that take a joystick index will be valid, and joystick | |
| 139 | + * and game controller events will not be delivered. | |
| 140 | + * | |
| 141 | + * As of SDL 2.26.0, you can take the joystick lock around reinitializing the | |
| 142 | + * joystick subsystem, to prevent other threads from seeing joysticks in an | |
| 143 | + * uninitialized state. However, all open joysticks will be closed and SDL | |
| 144 | + * functions called with them will fail. | |
| 145 | + * | |
| 146 | + * \since This function is available since SDL 2.0.7. | |
| 147 | + */ | |
| 148 | +extern DECLSPEC void SDLCALL SDL_LockJoysticks(void) SDL_ACQUIRE(SDL_joystick_lock); | |
| 149 | + | |
| 150 | + | |
| 151 | +/** | |
| 152 | + * Unlocking for multi-threaded access to the joystick API | |
| 153 | + * | |
| 154 | + * If you are using the joystick API or handling events from multiple threads | |
| 155 | + * you should use these locking functions to protect access to the joysticks. | |
| 156 | + * | |
| 157 | + * In particular, you are guaranteed that the joystick list won't change, so | |
| 158 | + * the API functions that take a joystick index will be valid, and joystick | |
| 159 | + * and game controller events will not be delivered. | |
| 160 | + * | |
| 161 | + * \since This function is available since SDL 2.0.7. | |
| 162 | + */ | |
| 163 | +extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void) SDL_RELEASE(SDL_joystick_lock); | |
| 164 | + | |
| 165 | +/** | |
| 166 | + * Count the number of joysticks attached to the system. | |
| 167 | + * | |
| 168 | + * \returns the number of attached joysticks on success or a negative error | |
| 169 | + * code on failure; call SDL_GetError() for more information. | |
| 170 | + * | |
| 171 | + * \since This function is available since SDL 2.0.0. | |
| 172 | + * | |
| 173 | + * \sa SDL_JoystickName | |
| 174 | + * \sa SDL_JoystickPath | |
| 175 | + * \sa SDL_JoystickOpen | |
| 176 | + */ | |
| 177 | +extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); | |
| 178 | + | |
| 179 | +/** | |
| 180 | + * Get the implementation dependent name of a joystick. | |
| 181 | + * | |
| 182 | + * This can be called before any joysticks are opened. | |
| 183 | + * | |
| 184 | + * \param device_index the index of the joystick to query (the N'th joystick | |
| 185 | + * on the system). | |
| 186 | + * \returns the name of the selected joystick. If no name can be found, this | |
| 187 | + * function returns NULL; call SDL_GetError() for more information. | |
| 188 | + * | |
| 189 | + * \since This function is available since SDL 2.0.0. | |
| 190 | + * | |
| 191 | + * \sa SDL_JoystickName | |
| 192 | + * \sa SDL_JoystickOpen | |
| 193 | + */ | |
| 194 | +extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); | |
| 195 | + | |
| 196 | +/** | |
| 197 | + * Get the implementation dependent path of a joystick. | |
| 198 | + * | |
| 199 | + * This can be called before any joysticks are opened. | |
| 200 | + * | |
| 201 | + * \param device_index the index of the joystick to query (the N'th joystick | |
| 202 | + * on the system). | |
| 203 | + * \returns the path of the selected joystick. If no path can be found, this | |
| 204 | + * function returns NULL; call SDL_GetError() for more information. | |
| 205 | + * | |
| 206 | + * \since This function is available since SDL 2.24.0. | |
| 207 | + * | |
| 208 | + * \sa SDL_JoystickPath | |
| 209 | + * \sa SDL_JoystickOpen | |
| 210 | + */ | |
| 211 | +extern DECLSPEC const char *SDLCALL SDL_JoystickPathForIndex(int device_index); | |
| 212 | + | |
| 213 | +/** | |
| 214 | + * Get the player index of a joystick, or -1 if it's not available This can be | |
| 215 | + * called before any joysticks are opened. | |
| 216 | + * | |
| 217 | + * \since This function is available since SDL 2.0.9. | |
| 218 | + */ | |
| 219 | +extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); | |
| 220 | + | |
| 221 | +/** | |
| 222 | + * Get the implementation-dependent GUID for the joystick at a given device | |
| 223 | + * index. | |
| 224 | + * | |
| 225 | + * This function can be called before any joysticks are opened. | |
| 226 | + * | |
| 227 | + * \param device_index the index of the joystick to query (the N'th joystick | |
| 228 | + * on the system. | |
| 229 | + * \returns the GUID of the selected joystick. If called on an invalid index, | |
| 230 | + * this function returns a zero GUID. | |
| 231 | + * | |
| 232 | + * \since This function is available since SDL 2.0.0. | |
| 233 | + * | |
| 234 | + * \sa SDL_JoystickGetGUID | |
| 235 | + * \sa SDL_JoystickGetGUIDString | |
| 236 | + */ | |
| 237 | +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); | |
| 238 | + | |
| 239 | +/** | |
| 240 | + * Get the USB vendor ID of a joystick, if available. | |
| 241 | + * | |
| 242 | + * This can be called before any joysticks are opened. If the vendor ID isn't | |
| 243 | + * available this function returns 0. | |
| 244 | + * | |
| 245 | + * \param device_index the index of the joystick to query (the N'th joystick | |
| 246 | + * on the system. | |
| 247 | + * \returns the USB vendor ID of the selected joystick. If called on an | |
| 248 | + * invalid index, this function returns zero. | |
| 249 | + * | |
| 250 | + * \since This function is available since SDL 2.0.6. | |
| 251 | + */ | |
| 252 | +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index); | |
| 253 | + | |
| 254 | +/** | |
| 255 | + * Get the USB product ID of a joystick, if available. | |
| 256 | + * | |
| 257 | + * This can be called before any joysticks are opened. If the product ID isn't | |
| 258 | + * available this function returns 0. | |
| 259 | + * | |
| 260 | + * \param device_index the index of the joystick to query (the N'th joystick | |
| 261 | + * on the system. | |
| 262 | + * \returns the USB product ID of the selected joystick. If called on an | |
| 263 | + * invalid index, this function returns zero. | |
| 264 | + * | |
| 265 | + * \since This function is available since SDL 2.0.6. | |
| 266 | + */ | |
| 267 | +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index); | |
| 268 | + | |
| 269 | +/** | |
| 270 | + * Get the product version of a joystick, if available. | |
| 271 | + * | |
| 272 | + * This can be called before any joysticks are opened. If the product version | |
| 273 | + * isn't available this function returns 0. | |
| 274 | + * | |
| 275 | + * \param device_index the index of the joystick to query (the N'th joystick | |
| 276 | + * on the system. | |
| 277 | + * \returns the product version of the selected joystick. If called on an | |
| 278 | + * invalid index, this function returns zero. | |
| 279 | + * | |
| 280 | + * \since This function is available since SDL 2.0.6. | |
| 281 | + */ | |
| 282 | +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index); | |
| 283 | + | |
| 284 | +/** | |
| 285 | + * Get the type of a joystick, if available. | |
| 286 | + * | |
| 287 | + * This can be called before any joysticks are opened. | |
| 288 | + * | |
| 289 | + * \param device_index the index of the joystick to query (the N'th joystick | |
| 290 | + * on the system. | |
| 291 | + * \returns the SDL_JoystickType of the selected joystick. If called on an | |
| 292 | + * invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN`. | |
| 293 | + * | |
| 294 | + * \since This function is available since SDL 2.0.6. | |
| 295 | + */ | |
| 296 | +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index); | |
| 297 | + | |
| 298 | +/** | |
| 299 | + * Get the instance ID of a joystick. | |
| 300 | + * | |
| 301 | + * This can be called before any joysticks are opened. | |
| 302 | + * | |
| 303 | + * \param device_index the index of the joystick to query (the N'th joystick | |
| 304 | + * on the system. | |
| 305 | + * \returns the instance id of the selected joystick. If called on an invalid | |
| 306 | + * index, this function returns -1. | |
| 307 | + * | |
| 308 | + * \since This function is available since SDL 2.0.6. | |
| 309 | + */ | |
| 310 | +extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index); | |
| 311 | + | |
| 312 | +/** | |
| 313 | + * Open a joystick for use. | |
| 314 | + * | |
| 315 | + * The `device_index` argument refers to the N'th joystick presently | |
| 316 | + * recognized by SDL on the system. It is **NOT** the same as the instance ID | |
| 317 | + * used to identify the joystick in future events. See | |
| 318 | + * SDL_JoystickInstanceID() for more details about instance IDs. | |
| 319 | + * | |
| 320 | + * The joystick subsystem must be initialized before a joystick can be opened | |
| 321 | + * for use. | |
| 322 | + * | |
| 323 | + * \param device_index the index of the joystick to query. | |
| 324 | + * \returns a joystick identifier or NULL if an error occurred; call | |
| 325 | + * SDL_GetError() for more information. | |
| 326 | + * | |
| 327 | + * \since This function is available since SDL 2.0.0. | |
| 328 | + * | |
| 329 | + * \sa SDL_JoystickClose | |
| 330 | + * \sa SDL_JoystickInstanceID | |
| 331 | + */ | |
| 332 | +extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); | |
| 333 | + | |
| 334 | +/** | |
| 335 | + * Get the SDL_Joystick associated with an instance id. | |
| 336 | + * | |
| 337 | + * \param instance_id the instance id to get the SDL_Joystick for. | |
| 338 | + * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() | |
| 339 | + * for more information. | |
| 340 | + * | |
| 341 | + * \since This function is available since SDL 2.0.4. | |
| 342 | + */ | |
| 343 | +extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id); | |
| 344 | + | |
| 345 | +/** | |
| 346 | + * Get the SDL_Joystick associated with a player index. | |
| 347 | + * | |
| 348 | + * \param player_index the player index to get the SDL_Joystick for. | |
| 349 | + * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() | |
| 350 | + * for more information. | |
| 351 | + * | |
| 352 | + * \since This function is available since SDL 2.0.12. | |
| 353 | + */ | |
| 354 | +extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index); | |
| 355 | + | |
| 356 | +/** | |
| 357 | + * Attach a new virtual joystick. | |
| 358 | + * | |
| 359 | + * \returns the joystick's device index, or -1 if an error occurred. | |
| 360 | + * | |
| 361 | + * \since This function is available since SDL 2.0.14. | |
| 362 | + */ | |
| 363 | +extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, | |
| 364 | + int naxes, | |
| 365 | + int nbuttons, | |
| 366 | + int nhats); | |
| 367 | + | |
| 368 | +/** | |
| 369 | + * The structure that defines an extended virtual joystick description | |
| 370 | + * | |
| 371 | + * The caller must zero the structure and then initialize the version with | |
| 372 | + * `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to | |
| 373 | + * SDL_JoystickAttachVirtualEx() All other elements of this structure are | |
| 374 | + * optional and can be left 0. | |
| 375 | + * | |
| 376 | + * \sa SDL_JoystickAttachVirtualEx | |
| 377 | + */ | |
| 378 | +typedef struct SDL_VirtualJoystickDesc | |
| 379 | +{ | |
| 380 | + Uint16 version; /**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` */ | |
| 381 | + Uint16 type; /**< `SDL_JoystickType` */ | |
| 382 | + Uint16 naxes; /**< the number of axes on this joystick */ | |
| 383 | + Uint16 nbuttons; /**< the number of buttons on this joystick */ | |
| 384 | + Uint16 nhats; /**< the number of hats on this joystick */ | |
| 385 | + Uint16 vendor_id; /**< the USB vendor ID of this joystick */ | |
| 386 | + Uint16 product_id; /**< the USB product ID of this joystick */ | |
| 387 | + Uint16 padding; /**< unused */ | |
| 388 | + Uint32 button_mask; /**< A mask of which buttons are valid for this controller | |
| 389 | + e.g. (1 << SDL_CONTROLLER_BUTTON_A) */ | |
| 390 | + Uint32 axis_mask; /**< A mask of which axes are valid for this controller | |
| 391 | + e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) */ | |
| 392 | + const char *name; /**< the name of the joystick */ | |
| 393 | + | |
| 394 | + void *userdata; /**< User data pointer passed to callbacks */ | |
| 395 | + void (SDLCALL *Update)(void *userdata); /**< Called when the joystick state should be updated */ | |
| 396 | + void (SDLCALL *SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */ | |
| 397 | + int (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_JoystickRumble() */ | |
| 398 | + int (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_JoystickRumbleTriggers() */ | |
| 399 | + int (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_JoystickSetLED() */ | |
| 400 | + int (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_JoystickSendEffect() */ | |
| 401 | + | |
| 402 | +} SDL_VirtualJoystickDesc; | |
| 403 | + | |
| 404 | +/** | |
| 405 | + * The current version of the SDL_VirtualJoystickDesc structure | |
| 406 | + */ | |
| 407 | +#define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1 | |
| 408 | + | |
| 409 | +/** | |
| 410 | + * Attach a new virtual joystick with extended properties. | |
| 411 | + * | |
| 412 | + * \returns the joystick's device index, or -1 if an error occurred. | |
| 413 | + * | |
| 414 | + * \since This function is available since SDL 2.24.0. | |
| 415 | + */ | |
| 416 | +extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc); | |
| 417 | + | |
| 418 | +/** | |
| 419 | + * Detach a virtual joystick. | |
| 420 | + * | |
| 421 | + * \param device_index a value previously returned from | |
| 422 | + * SDL_JoystickAttachVirtual(). | |
| 423 | + * \returns 0 on success, or -1 if an error occurred. | |
| 424 | + * | |
| 425 | + * \since This function is available since SDL 2.0.14. | |
| 426 | + */ | |
| 427 | +extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index); | |
| 428 | + | |
| 429 | +/** | |
| 430 | + * Query whether or not the joystick at a given device index is virtual. | |
| 431 | + * | |
| 432 | + * \param device_index a joystick device index. | |
| 433 | + * \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise. | |
| 434 | + * | |
| 435 | + * \since This function is available since SDL 2.0.14. | |
| 436 | + */ | |
| 437 | +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index); | |
| 438 | + | |
| 439 | +/** | |
| 440 | + * Set values on an opened, virtual-joystick's axis. | |
| 441 | + * | |
| 442 | + * Please note that values set here will not be applied until the next call to | |
| 443 | + * SDL_JoystickUpdate, which can either be called directly, or can be called | |
| 444 | + * indirectly through various other SDL APIs, including, but not limited to | |
| 445 | + * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, | |
| 446 | + * SDL_WaitEvent. | |
| 447 | + * | |
| 448 | + * Note that when sending trigger axes, you should scale the value to the full | |
| 449 | + * range of Sint16. For example, a trigger at rest would have the value of | |
| 450 | + * `SDL_JOYSTICK_AXIS_MIN`. | |
| 451 | + * | |
| 452 | + * \param joystick the virtual joystick on which to set state. | |
| 453 | + * \param axis the specific axis on the virtual joystick to set. | |
| 454 | + * \param value the new value for the specified axis. | |
| 455 | + * \returns 0 on success, -1 on error. | |
| 456 | + * | |
| 457 | + * \since This function is available since SDL 2.0.14. | |
| 458 | + */ | |
| 459 | +extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value); | |
| 460 | + | |
| 461 | +/** | |
| 462 | + * Set values on an opened, virtual-joystick's button. | |
| 463 | + * | |
| 464 | + * Please note that values set here will not be applied until the next call to | |
| 465 | + * SDL_JoystickUpdate, which can either be called directly, or can be called | |
| 466 | + * indirectly through various other SDL APIs, including, but not limited to | |
| 467 | + * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, | |
| 468 | + * SDL_WaitEvent. | |
| 469 | + * | |
| 470 | + * \param joystick the virtual joystick on which to set state. | |
| 471 | + * \param button the specific button on the virtual joystick to set. | |
| 472 | + * \param value the new value for the specified button. | |
| 473 | + * \returns 0 on success, -1 on error. | |
| 474 | + * | |
| 475 | + * \since This function is available since SDL 2.0.14. | |
| 476 | + */ | |
| 477 | +extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value); | |
| 478 | + | |
| 479 | +/** | |
| 480 | + * Set values on an opened, virtual-joystick's hat. | |
| 481 | + * | |
| 482 | + * Please note that values set here will not be applied until the next call to | |
| 483 | + * SDL_JoystickUpdate, which can either be called directly, or can be called | |
| 484 | + * indirectly through various other SDL APIs, including, but not limited to | |
| 485 | + * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, | |
| 486 | + * SDL_WaitEvent. | |
| 487 | + * | |
| 488 | + * \param joystick the virtual joystick on which to set state. | |
| 489 | + * \param hat the specific hat on the virtual joystick to set. | |
| 490 | + * \param value the new value for the specified hat. | |
| 491 | + * \returns 0 on success, -1 on error. | |
| 492 | + * | |
| 493 | + * \since This function is available since SDL 2.0.14. | |
| 494 | + */ | |
| 495 | +extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value); | |
| 496 | + | |
| 497 | +/** | |
| 498 | + * Get the implementation dependent name of a joystick. | |
| 499 | + * | |
| 500 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 501 | + * \returns the name of the selected joystick. If no name can be found, this | |
| 502 | + * function returns NULL; call SDL_GetError() for more information. | |
| 503 | + * | |
| 504 | + * \since This function is available since SDL 2.0.0. | |
| 505 | + * | |
| 506 | + * \sa SDL_JoystickNameForIndex | |
| 507 | + * \sa SDL_JoystickOpen | |
| 508 | + */ | |
| 509 | +extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick); | |
| 510 | + | |
| 511 | +/** | |
| 512 | + * Get the implementation dependent path of a joystick. | |
| 513 | + * | |
| 514 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 515 | + * \returns the path of the selected joystick. If no path can be found, this | |
| 516 | + * function returns NULL; call SDL_GetError() for more information. | |
| 517 | + * | |
| 518 | + * \since This function is available since SDL 2.24.0. | |
| 519 | + * | |
| 520 | + * \sa SDL_JoystickPathForIndex | |
| 521 | + */ | |
| 522 | +extern DECLSPEC const char *SDLCALL SDL_JoystickPath(SDL_Joystick *joystick); | |
| 523 | + | |
| 524 | +/** | |
| 525 | + * Get the player index of an opened joystick. | |
| 526 | + * | |
| 527 | + * For XInput controllers this returns the XInput user index. Many joysticks | |
| 528 | + * will not be able to supply this information. | |
| 529 | + * | |
| 530 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 531 | + * \returns the player index, or -1 if it's not available. | |
| 532 | + * | |
| 533 | + * \since This function is available since SDL 2.0.9. | |
| 534 | + */ | |
| 535 | +extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick); | |
| 536 | + | |
| 537 | +/** | |
| 538 | + * Set the player index of an opened joystick. | |
| 539 | + * | |
| 540 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 541 | + * \param player_index Player index to assign to this joystick, or -1 to clear | |
| 542 | + * the player index and turn off player LEDs. | |
| 543 | + * | |
| 544 | + * \since This function is available since SDL 2.0.12. | |
| 545 | + */ | |
| 546 | +extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick, int player_index); | |
| 547 | + | |
| 548 | +/** | |
| 549 | + * Get the implementation-dependent GUID for the joystick. | |
| 550 | + * | |
| 551 | + * This function requires an open joystick. | |
| 552 | + * | |
| 553 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 554 | + * \returns the GUID of the given joystick. If called on an invalid index, | |
| 555 | + * this function returns a zero GUID; call SDL_GetError() for more | |
| 556 | + * information. | |
| 557 | + * | |
| 558 | + * \since This function is available since SDL 2.0.0. | |
| 559 | + * | |
| 560 | + * \sa SDL_JoystickGetDeviceGUID | |
| 561 | + * \sa SDL_JoystickGetGUIDString | |
| 562 | + */ | |
| 563 | +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *joystick); | |
| 564 | + | |
| 565 | +/** | |
| 566 | + * Get the USB vendor ID of an opened joystick, if available. | |
| 567 | + * | |
| 568 | + * If the vendor ID isn't available this function returns 0. | |
| 569 | + * | |
| 570 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 571 | + * \returns the USB vendor ID of the selected joystick, or 0 if unavailable. | |
| 572 | + * | |
| 573 | + * \since This function is available since SDL 2.0.6. | |
| 574 | + */ | |
| 575 | +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick); | |
| 576 | + | |
| 577 | +/** | |
| 578 | + * Get the USB product ID of an opened joystick, if available. | |
| 579 | + * | |
| 580 | + * If the product ID isn't available this function returns 0. | |
| 581 | + * | |
| 582 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 583 | + * \returns the USB product ID of the selected joystick, or 0 if unavailable. | |
| 584 | + * | |
| 585 | + * \since This function is available since SDL 2.0.6. | |
| 586 | + */ | |
| 587 | +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick); | |
| 588 | + | |
| 589 | +/** | |
| 590 | + * Get the product version of an opened joystick, if available. | |
| 591 | + * | |
| 592 | + * If the product version isn't available this function returns 0. | |
| 593 | + * | |
| 594 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 595 | + * \returns the product version of the selected joystick, or 0 if unavailable. | |
| 596 | + * | |
| 597 | + * \since This function is available since SDL 2.0.6. | |
| 598 | + */ | |
| 599 | +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick); | |
| 600 | + | |
| 601 | +/** | |
| 602 | + * Get the firmware version of an opened joystick, if available. | |
| 603 | + * | |
| 604 | + * If the firmware version isn't available this function returns 0. | |
| 605 | + * | |
| 606 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 607 | + * \returns the firmware version of the selected joystick, or 0 if | |
| 608 | + * unavailable. | |
| 609 | + * | |
| 610 | + * \since This function is available since SDL 2.24.0. | |
| 611 | + */ | |
| 612 | +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetFirmwareVersion(SDL_Joystick *joystick); | |
| 613 | + | |
| 614 | +/** | |
| 615 | + * Get the serial number of an opened joystick, if available. | |
| 616 | + * | |
| 617 | + * Returns the serial number of the joystick, or NULL if it is not available. | |
| 618 | + * | |
| 619 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 620 | + * \returns the serial number of the selected joystick, or NULL if | |
| 621 | + * unavailable. | |
| 622 | + * | |
| 623 | + * \since This function is available since SDL 2.0.14. | |
| 624 | + */ | |
| 625 | +extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystick); | |
| 626 | + | |
| 627 | +/** | |
| 628 | + * Get the type of an opened joystick. | |
| 629 | + * | |
| 630 | + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). | |
| 631 | + * \returns the SDL_JoystickType of the selected joystick. | |
| 632 | + * | |
| 633 | + * \since This function is available since SDL 2.0.6. | |
| 634 | + */ | |
| 635 | +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joystick); | |
| 636 | + | |
| 637 | +/** | |
| 638 | + * Get an ASCII string representation for a given SDL_JoystickGUID. | |
| 639 | + * | |
| 640 | + * You should supply at least 33 bytes for pszGUID. | |
| 641 | + * | |
| 642 | + * \param guid the SDL_JoystickGUID you wish to convert to string. | |
| 643 | + * \param pszGUID buffer in which to write the ASCII string. | |
| 644 | + * \param cbGUID the size of pszGUID. | |
| 645 | + * | |
| 646 | + * \since This function is available since SDL 2.0.0. | |
| 647 | + * | |
| 648 | + * \sa SDL_JoystickGetDeviceGUID | |
| 649 | + * \sa SDL_JoystickGetGUID | |
| 650 | + * \sa SDL_JoystickGetGUIDFromString | |
| 651 | + */ | |
| 652 | +extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); | |
| 653 | + | |
| 654 | +/** | |
| 655 | + * Convert a GUID string into a SDL_JoystickGUID structure. | |
| 656 | + * | |
| 657 | + * Performs no error checking. If this function is given a string containing | |
| 658 | + * an invalid GUID, the function will silently succeed, but the GUID generated | |
| 659 | + * will not be useful. | |
| 660 | + * | |
| 661 | + * \param pchGUID string containing an ASCII representation of a GUID. | |
| 662 | + * \returns a SDL_JoystickGUID structure. | |
| 663 | + * | |
| 664 | + * \since This function is available since SDL 2.0.0. | |
| 665 | + * | |
| 666 | + * \sa SDL_JoystickGetGUIDString | |
| 667 | + */ | |
| 668 | +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); | |
| 669 | + | |
| 670 | +/** | |
| 671 | + * Get the device information encoded in a SDL_JoystickGUID structure | |
| 672 | + * | |
| 673 | + * \param guid the SDL_JoystickGUID you wish to get info about. | |
| 674 | + * \param vendor A pointer filled in with the device VID, or 0 if not | |
| 675 | + * available. | |
| 676 | + * \param product A pointer filled in with the device PID, or 0 if not | |
| 677 | + * available. | |
| 678 | + * \param version A pointer filled in with the device version, or 0 if not | |
| 679 | + * available. | |
| 680 | + * \param crc16 A pointer filled in with a CRC used to distinguish different | |
| 681 | + * products with the same VID/PID, or 0 if not available. | |
| 682 | + * | |
| 683 | + * \since This function is available since SDL 2.26.0. | |
| 684 | + * | |
| 685 | + * \sa SDL_JoystickGetDeviceGUID | |
| 686 | + */ | |
| 687 | +extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version, Uint16 *crc16); | |
| 688 | + | |
| 689 | +/** | |
| 690 | + * Get the status of a specified joystick. | |
| 691 | + * | |
| 692 | + * \param joystick the joystick to query. | |
| 693 | + * \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not; | |
| 694 | + * call SDL_GetError() for more information. | |
| 695 | + * | |
| 696 | + * \since This function is available since SDL 2.0.0. | |
| 697 | + * | |
| 698 | + * \sa SDL_JoystickClose | |
| 699 | + * \sa SDL_JoystickOpen | |
| 700 | + */ | |
| 701 | +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *joystick); | |
| 702 | + | |
| 703 | +/** | |
| 704 | + * Get the instance ID of an opened joystick. | |
| 705 | + * | |
| 706 | + * \param joystick an SDL_Joystick structure containing joystick information. | |
| 707 | + * \returns the instance ID of the specified joystick on success or a negative | |
| 708 | + * error code on failure; call SDL_GetError() for more information. | |
| 709 | + * | |
| 710 | + * \since This function is available since SDL 2.0.0. | |
| 711 | + * | |
| 712 | + * \sa SDL_JoystickOpen | |
| 713 | + */ | |
| 714 | +extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joystick); | |
| 715 | + | |
| 716 | +/** | |
| 717 | + * Get the number of general axis controls on a joystick. | |
| 718 | + * | |
| 719 | + * Often, the directional pad on a game controller will either look like 4 | |
| 720 | + * separate buttons or a POV hat, and not axes, but all of this is up to the | |
| 721 | + * device and platform. | |
| 722 | + * | |
| 723 | + * \param joystick an SDL_Joystick structure containing joystick information. | |
| 724 | + * \returns the number of axis controls/number of axes on success or a | |
| 725 | + * negative error code on failure; call SDL_GetError() for more | |
| 726 | + * information. | |
| 727 | + * | |
| 728 | + * \since This function is available since SDL 2.0.0. | |
| 729 | + * | |
| 730 | + * \sa SDL_JoystickGetAxis | |
| 731 | + * \sa SDL_JoystickOpen | |
| 732 | + */ | |
| 733 | +extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick); | |
| 734 | + | |
| 735 | +/** | |
| 736 | + * Get the number of trackballs on a joystick. | |
| 737 | + * | |
| 738 | + * Joystick trackballs have only relative motion events associated with them | |
| 739 | + * and their state cannot be polled. | |
| 740 | + * | |
| 741 | + * Most joysticks do not have trackballs. | |
| 742 | + * | |
| 743 | + * \param joystick an SDL_Joystick structure containing joystick information. | |
| 744 | + * \returns the number of trackballs on success or a negative error code on | |
| 745 | + * failure; call SDL_GetError() for more information. | |
| 746 | + * | |
| 747 | + * \since This function is available since SDL 2.0.0. | |
| 748 | + * | |
| 749 | + * \sa SDL_JoystickGetBall | |
| 750 | + */ | |
| 751 | +extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick); | |
| 752 | + | |
| 753 | +/** | |
| 754 | + * Get the number of POV hats on a joystick. | |
| 755 | + * | |
| 756 | + * \param joystick an SDL_Joystick structure containing joystick information. | |
| 757 | + * \returns the number of POV hats on success or a negative error code on | |
| 758 | + * failure; call SDL_GetError() for more information. | |
| 759 | + * | |
| 760 | + * \since This function is available since SDL 2.0.0. | |
| 761 | + * | |
| 762 | + * \sa SDL_JoystickGetHat | |
| 763 | + * \sa SDL_JoystickOpen | |
| 764 | + */ | |
| 765 | +extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick); | |
| 766 | + | |
| 767 | +/** | |
| 768 | + * Get the number of buttons on a joystick. | |
| 769 | + * | |
| 770 | + * \param joystick an SDL_Joystick structure containing joystick information. | |
| 771 | + * \returns the number of buttons on success or a negative error code on | |
| 772 | + * failure; call SDL_GetError() for more information. | |
| 773 | + * | |
| 774 | + * \since This function is available since SDL 2.0.0. | |
| 775 | + * | |
| 776 | + * \sa SDL_JoystickGetButton | |
| 777 | + * \sa SDL_JoystickOpen | |
| 778 | + */ | |
| 779 | +extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick); | |
| 780 | + | |
| 781 | +/** | |
| 782 | + * Update the current state of the open joysticks. | |
| 783 | + * | |
| 784 | + * This is called automatically by the event loop if any joystick events are | |
| 785 | + * enabled. | |
| 786 | + * | |
| 787 | + * \since This function is available since SDL 2.0.0. | |
| 788 | + * | |
| 789 | + * \sa SDL_JoystickEventState | |
| 790 | + */ | |
| 791 | +extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); | |
| 792 | + | |
| 793 | +/** | |
| 794 | + * Enable/disable joystick event polling. | |
| 795 | + * | |
| 796 | + * If joystick events are disabled, you must call SDL_JoystickUpdate() | |
| 797 | + * yourself and manually check the state of the joystick when you want | |
| 798 | + * joystick information. | |
| 799 | + * | |
| 800 | + * It is recommended that you leave joystick event handling enabled. | |
| 801 | + * | |
| 802 | + * **WARNING**: Calling this function may delete all events currently in SDL's | |
| 803 | + * event queue. | |
| 804 | + * | |
| 805 | + * While `param` is meant to be one of `SDL_QUERY`, `SDL_IGNORE`, or | |
| 806 | + * `SDL_ENABLE`, this function accepts any value, with any non-zero value that | |
| 807 | + * isn't `SDL_QUERY` being treated as `SDL_ENABLE`. | |
| 808 | + * | |
| 809 | + * If SDL was built with events disabled (extremely uncommon!), this will do | |
| 810 | + * nothing and always return `SDL_IGNORE`. | |
| 811 | + * | |
| 812 | + * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`. | |
| 813 | + * \returns If `state` is `SDL_QUERY` then the current state is returned, | |
| 814 | + * otherwise `state` is returned (even if it was not one of the | |
| 815 | + * allowed values). | |
| 816 | + * | |
| 817 | + * \since This function is available since SDL 2.0.0. | |
| 818 | + * | |
| 819 | + * \sa SDL_GameControllerEventState | |
| 820 | + */ | |
| 821 | +extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); | |
| 822 | + | |
| 823 | +/* Limits for joystick axes... */ | |
| 824 | +#define SDL_JOYSTICK_AXIS_MAX 32767 | |
| 825 | +#define SDL_JOYSTICK_AXIS_MIN -32768 | |
| 826 | + | |
| 827 | +/** | |
| 828 | + * Get the current state of an axis control on a joystick. | |
| 829 | + * | |
| 830 | + * SDL makes no promises about what part of the joystick any given axis refers | |
| 831 | + * to. Your game should have some sort of configuration UI to let users | |
| 832 | + * specify what each axis should be bound to. Alternately, SDL's higher-level | |
| 833 | + * Game Controller API makes a great effort to apply order to this lower-level | |
| 834 | + * interface, so you know that a specific axis is the "left thumb stick," etc. | |
| 835 | + * | |
| 836 | + * The value returned by SDL_JoystickGetAxis() is a signed integer (-32768 to | |
| 837 | + * 32767) representing the current position of the axis. It may be necessary | |
| 838 | + * to impose certain tolerances on these values to account for jitter. | |
| 839 | + * | |
| 840 | + * \param joystick an SDL_Joystick structure containing joystick information. | |
| 841 | + * \param axis the axis to query; the axis indices start at index 0. | |
| 842 | + * \returns a 16-bit signed integer representing the current position of the | |
| 843 | + * axis or 0 on failure; call SDL_GetError() for more information. | |
| 844 | + * | |
| 845 | + * \since This function is available since SDL 2.0.0. | |
| 846 | + * | |
| 847 | + * \sa SDL_JoystickNumAxes | |
| 848 | + */ | |
| 849 | +extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, | |
| 850 | + int axis); | |
| 851 | + | |
| 852 | +/** | |
| 853 | + * Get the initial state of an axis control on a joystick. | |
| 854 | + * | |
| 855 | + * The state is a value ranging from -32768 to 32767. | |
| 856 | + * | |
| 857 | + * The axis indices start at index 0. | |
| 858 | + * | |
| 859 | + * \param joystick an SDL_Joystick structure containing joystick information. | |
| 860 | + * \param axis the axis to query; the axis indices start at index 0. | |
| 861 | + * \param state Upon return, the initial value is supplied here. | |
| 862 | + * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. | |
| 863 | + * | |
| 864 | + * \since This function is available since SDL 2.0.6. | |
| 865 | + */ | |
| 866 | +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick, | |
| 867 | + int axis, Sint16 *state); | |
| 868 | + | |
| 869 | +/** | |
| 870 | + * \name Hat positions | |
| 871 | + */ | |
| 872 | +/* @{ */ | |
| 873 | +#define SDL_HAT_CENTERED 0x00 | |
| 874 | +#define SDL_HAT_UP 0x01 | |
| 875 | +#define SDL_HAT_RIGHT 0x02 | |
| 876 | +#define SDL_HAT_DOWN 0x04 | |
| 877 | +#define SDL_HAT_LEFT 0x08 | |
| 878 | +#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) | |
| 879 | +#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) | |
| 880 | +#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) | |
| 881 | +#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) | |
| 882 | +/* @} */ | |
| 883 | + | |
| 884 | +/** | |
| 885 | + * Get the current state of a POV hat on a joystick. | |
| 886 | + * | |
| 887 | + * The returned value will be one of the following positions: | |
| 888 | + * | |
| 889 | + * - `SDL_HAT_CENTERED` | |
| 890 | + * - `SDL_HAT_UP` | |
| 891 | + * - `SDL_HAT_RIGHT` | |
| 892 | + * - `SDL_HAT_DOWN` | |
| 893 | + * - `SDL_HAT_LEFT` | |
| 894 | + * - `SDL_HAT_RIGHTUP` | |
| 895 | + * - `SDL_HAT_RIGHTDOWN` | |
| 896 | + * - `SDL_HAT_LEFTUP` | |
| 897 | + * - `SDL_HAT_LEFTDOWN` | |
| 898 | + * | |
| 899 | + * \param joystick an SDL_Joystick structure containing joystick information. | |
| 900 | + * \param hat the hat index to get the state from; indices start at index 0. | |
| 901 | + * \returns the current hat position. | |
| 902 | + * | |
| 903 | + * \since This function is available since SDL 2.0.0. | |
| 904 | + * | |
| 905 | + * \sa SDL_JoystickNumHats | |
| 906 | + */ | |
| 907 | +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, | |
| 908 | + int hat); | |
| 909 | + | |
| 910 | +/** | |
| 911 | + * Get the ball axis change since the last poll. | |
| 912 | + * | |
| 913 | + * Trackballs can only return relative motion since the last call to | |
| 914 | + * SDL_JoystickGetBall(), these motion deltas are placed into `dx` and `dy`. | |
| 915 | + * | |
| 916 | + * Most joysticks do not have trackballs. | |
| 917 | + * | |
| 918 | + * \param joystick the SDL_Joystick to query. | |
| 919 | + * \param ball the ball index to query; ball indices start at index 0. | |
| 920 | + * \param dx stores the difference in the x axis position since the last poll. | |
| 921 | + * \param dy stores the difference in the y axis position since the last poll. | |
| 922 | + * \returns 0 on success or a negative error code on failure; call | |
| 923 | + * SDL_GetError() for more information. | |
| 924 | + * | |
| 925 | + * \since This function is available since SDL 2.0.0. | |
| 926 | + * | |
| 927 | + * \sa SDL_JoystickNumBalls | |
| 928 | + */ | |
| 929 | +extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, | |
| 930 | + int ball, int *dx, int *dy); | |
| 931 | + | |
| 932 | +/** | |
| 933 | + * Get the current state of a button on a joystick. | |
| 934 | + * | |
| 935 | + * \param joystick an SDL_Joystick structure containing joystick information. | |
| 936 | + * \param button the button index to get the state from; indices start at | |
| 937 | + * index 0. | |
| 938 | + * \returns 1 if the specified button is pressed, 0 otherwise. | |
| 939 | + * | |
| 940 | + * \since This function is available since SDL 2.0.0. | |
| 941 | + * | |
| 942 | + * \sa SDL_JoystickNumButtons | |
| 943 | + */ | |
| 944 | +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, | |
| 945 | + int button); | |
| 946 | + | |
| 947 | +/** | |
| 948 | + * Start a rumble effect. | |
| 949 | + * | |
| 950 | + * Each call to this function cancels any previous rumble effect, and calling | |
| 951 | + * it with 0 intensity stops any rumbling. | |
| 952 | + * | |
| 953 | + * \param joystick The joystick to vibrate. | |
| 954 | + * \param low_frequency_rumble The intensity of the low frequency (left) | |
| 955 | + * rumble motor, from 0 to 0xFFFF. | |
| 956 | + * \param high_frequency_rumble The intensity of the high frequency (right) | |
| 957 | + * rumble motor, from 0 to 0xFFFF. | |
| 958 | + * \param duration_ms The duration of the rumble effect, in milliseconds. | |
| 959 | + * \returns 0, or -1 if rumble isn't supported on this joystick. | |
| 960 | + * | |
| 961 | + * \since This function is available since SDL 2.0.9. | |
| 962 | + * | |
| 963 | + * \sa SDL_JoystickHasRumble | |
| 964 | + */ | |
| 965 | +extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); | |
| 966 | + | |
| 967 | +/** | |
| 968 | + * Start a rumble effect in the joystick's triggers | |
| 969 | + * | |
| 970 | + * Each call to this function cancels any previous trigger rumble effect, and | |
| 971 | + * calling it with 0 intensity stops any rumbling. | |
| 972 | + * | |
| 973 | + * Note that this is rumbling of the _triggers_ and not the game controller as | |
| 974 | + * a whole. This is currently only supported on Xbox One controllers. If you | |
| 975 | + * want the (more common) whole-controller rumble, use SDL_JoystickRumble() | |
| 976 | + * instead. | |
| 977 | + * | |
| 978 | + * \param joystick The joystick to vibrate. | |
| 979 | + * \param left_rumble The intensity of the left trigger rumble motor, from 0 | |
| 980 | + * to 0xFFFF. | |
| 981 | + * \param right_rumble The intensity of the right trigger rumble motor, from 0 | |
| 982 | + * to 0xFFFF. | |
| 983 | + * \param duration_ms The duration of the rumble effect, in milliseconds. | |
| 984 | + * \returns 0, or -1 if trigger rumble isn't supported on this joystick. | |
| 985 | + * | |
| 986 | + * \since This function is available since SDL 2.0.14. | |
| 987 | + * | |
| 988 | + * \sa SDL_JoystickHasRumbleTriggers | |
| 989 | + */ | |
| 990 | +extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); | |
| 991 | + | |
| 992 | +/** | |
| 993 | + * Query whether a joystick has an LED. | |
| 994 | + * | |
| 995 | + * An example of a joystick LED is the light on the back of a PlayStation 4's | |
| 996 | + * DualShock 4 controller. | |
| 997 | + * | |
| 998 | + * \param joystick The joystick to query. | |
| 999 | + * \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise. | |
| 1000 | + * | |
| 1001 | + * \since This function is available since SDL 2.0.14. | |
| 1002 | + */ | |
| 1003 | +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick); | |
| 1004 | + | |
| 1005 | +/** | |
| 1006 | + * Query whether a joystick has rumble support. | |
| 1007 | + * | |
| 1008 | + * \param joystick The joystick to query. | |
| 1009 | + * \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise. | |
| 1010 | + * | |
| 1011 | + * \since This function is available since SDL 2.0.18. | |
| 1012 | + * | |
| 1013 | + * \sa SDL_JoystickRumble | |
| 1014 | + */ | |
| 1015 | +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumble(SDL_Joystick *joystick); | |
| 1016 | + | |
| 1017 | +/** | |
| 1018 | + * Query whether a joystick has rumble support on triggers. | |
| 1019 | + * | |
| 1020 | + * \param joystick The joystick to query. | |
| 1021 | + * \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise. | |
| 1022 | + * | |
| 1023 | + * \since This function is available since SDL 2.0.18. | |
| 1024 | + * | |
| 1025 | + * \sa SDL_JoystickRumbleTriggers | |
| 1026 | + */ | |
| 1027 | +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumbleTriggers(SDL_Joystick *joystick); | |
| 1028 | + | |
| 1029 | +/** | |
| 1030 | + * Update a joystick's LED color. | |
| 1031 | + * | |
| 1032 | + * An example of a joystick LED is the light on the back of a PlayStation 4's | |
| 1033 | + * DualShock 4 controller. | |
| 1034 | + * | |
| 1035 | + * \param joystick The joystick to update. | |
| 1036 | + * \param red The intensity of the red LED. | |
| 1037 | + * \param green The intensity of the green LED. | |
| 1038 | + * \param blue The intensity of the blue LED. | |
| 1039 | + * \returns 0 on success, -1 if this joystick does not have a modifiable LED. | |
| 1040 | + * | |
| 1041 | + * \since This function is available since SDL 2.0.14. | |
| 1042 | + */ | |
| 1043 | +extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue); | |
| 1044 | + | |
| 1045 | +/** | |
| 1046 | + * Send a joystick specific effect packet | |
| 1047 | + * | |
| 1048 | + * \param joystick The joystick to affect. | |
| 1049 | + * \param data The data to send to the joystick. | |
| 1050 | + * \param size The size of the data to send to the joystick. | |
| 1051 | + * \returns 0, or -1 if this joystick or driver doesn't support effect | |
| 1052 | + * packets. | |
| 1053 | + * | |
| 1054 | + * \since This function is available since SDL 2.0.16. | |
| 1055 | + */ | |
| 1056 | +extern DECLSPEC int SDLCALL SDL_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size); | |
| 1057 | + | |
| 1058 | +/** | |
| 1059 | + * Close a joystick previously opened with SDL_JoystickOpen(). | |
| 1060 | + * | |
| 1061 | + * \param joystick The joystick device to close. | |
| 1062 | + * | |
| 1063 | + * \since This function is available since SDL 2.0.0. | |
| 1064 | + * | |
| 1065 | + * \sa SDL_JoystickOpen | |
| 1066 | + */ | |
| 1067 | +extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick); | |
| 1068 | + | |
| 1069 | +/** | |
| 1070 | + * Get the battery level of a joystick as SDL_JoystickPowerLevel. | |
| 1071 | + * | |
| 1072 | + * \param joystick the SDL_Joystick to query. | |
| 1073 | + * \returns the current battery level as SDL_JoystickPowerLevel on success or | |
| 1074 | + * `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown. | |
| 1075 | + * | |
| 1076 | + * \since This function is available since SDL 2.0.4. | |
| 1077 | + */ | |
| 1078 | +extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick *joystick); | |
| 1079 | + | |
| 1080 | +/* Ends C function definitions when using C++ */ | |
| 1081 | +#ifdef __cplusplus | |
| 1082 | +} | |
| 1083 | +#endif | |
| 1084 | +#include "close_code.h" | |
| 1085 | + | |
| 1086 | +#endif /* SDL_joystick_h_ */ | |
| 1087 | + | |
| 1088 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,361 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryKeyboard | |
| 24 | + * | |
| 25 | + * Include file for SDL keyboard event handling | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_keyboard_h_ | |
| 29 | +#define SDL_keyboard_h_ | |
| 30 | + | |
| 31 | +#include "SDL_stdinc.h" | |
| 32 | +#include "SDL_error.h" | |
| 33 | +#include "SDL_keycode.h" | |
| 34 | +#include "SDL_video.h" | |
| 35 | + | |
| 36 | +#include "begin_code.h" | |
| 37 | +/* Set up for C function definitions, even when using C++ */ | |
| 38 | +#ifdef __cplusplus | |
| 39 | +extern "C" { | |
| 40 | +#endif | |
| 41 | + | |
| 42 | +/** | |
| 43 | + * The SDL keysym structure, used in key events. | |
| 44 | + * | |
| 45 | + * If you are looking for translated character input, see the SDL_TEXTINPUT | |
| 46 | + * event. | |
| 47 | + */ | |
| 48 | +typedef struct SDL_Keysym | |
| 49 | +{ | |
| 50 | + SDL_Scancode scancode; /**< SDL physical key code - see SDL_Scancode for details */ | |
| 51 | + SDL_Keycode sym; /**< SDL virtual key code - see SDL_Keycode for details */ | |
| 52 | + Uint16 mod; /**< current key modifiers - see SDL_Keymod for details */ | |
| 53 | + Uint32 unused; | |
| 54 | +} SDL_Keysym; | |
| 55 | + | |
| 56 | +/* Function prototypes */ | |
| 57 | + | |
| 58 | +/** | |
| 59 | + * Query the window which currently has keyboard focus. | |
| 60 | + * | |
| 61 | + * \returns the window with keyboard focus. | |
| 62 | + * | |
| 63 | + * \since This function is available since SDL 2.0.0. | |
| 64 | + */ | |
| 65 | +extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); | |
| 66 | + | |
| 67 | +/** | |
| 68 | + * Get a snapshot of the current state of the keyboard. | |
| 69 | + * | |
| 70 | + * The pointer returned is a pointer to an internal SDL array. It will be | |
| 71 | + * valid for the whole lifetime of the application and should not be freed by | |
| 72 | + * the caller. | |
| 73 | + * | |
| 74 | + * A array element with a value of 1 means that the key is pressed and a value | |
| 75 | + * of 0 means that it is not. Indexes into this array are obtained by using | |
| 76 | + * SDL_Scancode values. | |
| 77 | + * | |
| 78 | + * Use SDL_PumpEvents() to update the state array. | |
| 79 | + * | |
| 80 | + * This function gives you the current state after all events have been | |
| 81 | + * processed, so if a key or button has been pressed and released before you | |
| 82 | + * process events, then the pressed state will never show up in the | |
| 83 | + * SDL_GetKeyboardState() calls. | |
| 84 | + * | |
| 85 | + * Note: This function doesn't take into account whether shift has been | |
| 86 | + * pressed or not. | |
| 87 | + * | |
| 88 | + * \param numkeys if non-NULL, receives the length of the returned array. | |
| 89 | + * \returns a pointer to an array of key states. | |
| 90 | + * | |
| 91 | + * \since This function is available since SDL 2.0.0. | |
| 92 | + * | |
| 93 | + * \sa SDL_PumpEvents | |
| 94 | + * \sa SDL_ResetKeyboard | |
| 95 | + */ | |
| 96 | +extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); | |
| 97 | + | |
| 98 | +/** | |
| 99 | + * Clear the state of the keyboard | |
| 100 | + * | |
| 101 | + * This function will generate key up events for all pressed keys. | |
| 102 | + * | |
| 103 | + * \since This function is available since SDL 2.24.0. | |
| 104 | + * | |
| 105 | + * \sa SDL_GetKeyboardState | |
| 106 | + */ | |
| 107 | +extern DECLSPEC void SDLCALL SDL_ResetKeyboard(void); | |
| 108 | + | |
| 109 | +/** | |
| 110 | + * Get the current key modifier state for the keyboard. | |
| 111 | + * | |
| 112 | + * \returns an OR'd combination of the modifier keys for the keyboard. See | |
| 113 | + * SDL_Keymod for details. | |
| 114 | + * | |
| 115 | + * \since This function is available since SDL 2.0.0. | |
| 116 | + * | |
| 117 | + * \sa SDL_GetKeyboardState | |
| 118 | + * \sa SDL_SetModState | |
| 119 | + */ | |
| 120 | +extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); | |
| 121 | + | |
| 122 | +/** | |
| 123 | + * Set the current key modifier state for the keyboard. | |
| 124 | + * | |
| 125 | + * The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose | |
| 126 | + * modifier key states on your application. Simply pass your desired modifier | |
| 127 | + * states into `modstate`. This value may be a bitwise, OR'd combination of | |
| 128 | + * SDL_Keymod values. | |
| 129 | + * | |
| 130 | + * This does not change the keyboard state, only the key modifier flags that | |
| 131 | + * SDL reports. | |
| 132 | + * | |
| 133 | + * \param modstate the desired SDL_Keymod for the keyboard. | |
| 134 | + * | |
| 135 | + * \since This function is available since SDL 2.0.0. | |
| 136 | + * | |
| 137 | + * \sa SDL_GetModState | |
| 138 | + */ | |
| 139 | +extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); | |
| 140 | + | |
| 141 | +/** | |
| 142 | + * Get the key code corresponding to the given scancode according to the | |
| 143 | + * current keyboard layout. | |
| 144 | + * | |
| 145 | + * See SDL_Keycode for details. | |
| 146 | + * | |
| 147 | + * \param scancode the desired SDL_Scancode to query. | |
| 148 | + * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. | |
| 149 | + * | |
| 150 | + * \since This function is available since SDL 2.0.0. | |
| 151 | + * | |
| 152 | + * \sa SDL_GetKeyName | |
| 153 | + * \sa SDL_GetScancodeFromKey | |
| 154 | + */ | |
| 155 | +extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode); | |
| 156 | + | |
| 157 | +/** | |
| 158 | + * Get the scancode corresponding to the given key code according to the | |
| 159 | + * current keyboard layout. | |
| 160 | + * | |
| 161 | + * See SDL_Scancode for details. | |
| 162 | + * | |
| 163 | + * \param key the desired SDL_Keycode to query. | |
| 164 | + * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. | |
| 165 | + * | |
| 166 | + * \since This function is available since SDL 2.0.0. | |
| 167 | + * | |
| 168 | + * \sa SDL_GetKeyFromScancode | |
| 169 | + * \sa SDL_GetScancodeName | |
| 170 | + */ | |
| 171 | +extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key); | |
| 172 | + | |
| 173 | +/** | |
| 174 | + * Get a human-readable name for a scancode. | |
| 175 | + * | |
| 176 | + * See SDL_Scancode for details. | |
| 177 | + * | |
| 178 | + * **Warning**: The returned name is by design not stable across platforms, | |
| 179 | + * e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left | |
| 180 | + * Windows" under Microsoft Windows, and some scancodes like | |
| 181 | + * `SDL_SCANCODE_NONUSBACKSLASH` don't have any name at all. There are even | |
| 182 | + * scancodes that share names, e.g. `SDL_SCANCODE_RETURN` and | |
| 183 | + * `SDL_SCANCODE_RETURN2` (both called "Return"). This function is therefore | |
| 184 | + * unsuitable for creating a stable cross-platform two-way mapping between | |
| 185 | + * strings and scancodes. | |
| 186 | + * | |
| 187 | + * \param scancode the desired SDL_Scancode to query. | |
| 188 | + * \returns a pointer to the name for the scancode. If the scancode doesn't | |
| 189 | + * have a name this function returns an empty string (""). | |
| 190 | + * | |
| 191 | + * \since This function is available since SDL 2.0.0. | |
| 192 | + * | |
| 193 | + * \sa SDL_GetScancodeFromKey | |
| 194 | + * \sa SDL_GetScancodeFromName | |
| 195 | + */ | |
| 196 | +extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); | |
| 197 | + | |
| 198 | +/** | |
| 199 | + * Get a scancode from a human-readable name. | |
| 200 | + * | |
| 201 | + * \param name the human-readable scancode name. | |
| 202 | + * \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't | |
| 203 | + * recognized; call SDL_GetError() for more information. | |
| 204 | + * | |
| 205 | + * \since This function is available since SDL 2.0.0. | |
| 206 | + * | |
| 207 | + * \sa SDL_GetKeyFromName | |
| 208 | + * \sa SDL_GetScancodeFromKey | |
| 209 | + * \sa SDL_GetScancodeName | |
| 210 | + */ | |
| 211 | +extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name); | |
| 212 | + | |
| 213 | +/** | |
| 214 | + * Get a human-readable name for a key. | |
| 215 | + * | |
| 216 | + * See SDL_Scancode and SDL_Keycode for details. | |
| 217 | + * | |
| 218 | + * \param key the desired SDL_Keycode to query. | |
| 219 | + * \returns a pointer to a UTF-8 string that stays valid at least until the | |
| 220 | + * next call to this function. If you need it around any longer, you | |
| 221 | + * must copy it. If the key doesn't have a name, this function | |
| 222 | + * returns an empty string (""). | |
| 223 | + * | |
| 224 | + * \since This function is available since SDL 2.0.0. | |
| 225 | + * | |
| 226 | + * \sa SDL_GetKeyFromName | |
| 227 | + * \sa SDL_GetKeyFromScancode | |
| 228 | + * \sa SDL_GetScancodeFromKey | |
| 229 | + */ | |
| 230 | +extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); | |
| 231 | + | |
| 232 | +/** | |
| 233 | + * Get a key code from a human-readable name. | |
| 234 | + * | |
| 235 | + * \param name the human-readable key name. | |
| 236 | + * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call | |
| 237 | + * SDL_GetError() for more information. | |
| 238 | + * | |
| 239 | + * \since This function is available since SDL 2.0.0. | |
| 240 | + * | |
| 241 | + * \sa SDL_GetKeyFromScancode | |
| 242 | + * \sa SDL_GetKeyName | |
| 243 | + * \sa SDL_GetScancodeFromName | |
| 244 | + */ | |
| 245 | +extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); | |
| 246 | + | |
| 247 | +/** | |
| 248 | + * Start accepting Unicode text input events. | |
| 249 | + * | |
| 250 | + * This function will start accepting Unicode text input events in the focused | |
| 251 | + * SDL window, and start emitting SDL_TextInputEvent (SDL_TEXTINPUT) and | |
| 252 | + * SDL_TextEditingEvent (SDL_TEXTEDITING) events. Please use this function in | |
| 253 | + * pair with SDL_StopTextInput(). | |
| 254 | + * | |
| 255 | + * On some platforms using this function activates the screen keyboard. | |
| 256 | + * | |
| 257 | + * On desktop platforms, SDL_StartTextInput() is implicitly called on SDL | |
| 258 | + * video subsystem initialization which will cause SDL_TextInputEvent and | |
| 259 | + * SDL_TextEditingEvent to begin emitting. | |
| 260 | + * | |
| 261 | + * \since This function is available since SDL 2.0.0. | |
| 262 | + * | |
| 263 | + * \sa SDL_SetTextInputRect | |
| 264 | + * \sa SDL_StopTextInput | |
| 265 | + */ | |
| 266 | +extern DECLSPEC void SDLCALL SDL_StartTextInput(void); | |
| 267 | + | |
| 268 | +/** | |
| 269 | + * Check whether or not Unicode text input events are enabled. | |
| 270 | + * | |
| 271 | + * \returns SDL_TRUE if text input events are enabled else SDL_FALSE. | |
| 272 | + * | |
| 273 | + * \since This function is available since SDL 2.0.0. | |
| 274 | + * | |
| 275 | + * \sa SDL_StartTextInput | |
| 276 | + */ | |
| 277 | +extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void); | |
| 278 | + | |
| 279 | +/** | |
| 280 | + * Stop receiving any text input events. | |
| 281 | + * | |
| 282 | + * \since This function is available since SDL 2.0.0. | |
| 283 | + * | |
| 284 | + * \sa SDL_StartTextInput | |
| 285 | + */ | |
| 286 | +extern DECLSPEC void SDLCALL SDL_StopTextInput(void); | |
| 287 | + | |
| 288 | +/** | |
| 289 | + * Dismiss the composition window/IME without disabling the subsystem. | |
| 290 | + * | |
| 291 | + * \since This function is available since SDL 2.0.22. | |
| 292 | + * | |
| 293 | + * \sa SDL_StartTextInput | |
| 294 | + * \sa SDL_StopTextInput | |
| 295 | + */ | |
| 296 | +extern DECLSPEC void SDLCALL SDL_ClearComposition(void); | |
| 297 | + | |
| 298 | +/** | |
| 299 | + * Returns if an IME Composite or Candidate window is currently shown. | |
| 300 | + * | |
| 301 | + * \since This function is available since SDL 2.0.22. | |
| 302 | + */ | |
| 303 | +extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void); | |
| 304 | + | |
| 305 | +/** | |
| 306 | + * Set the rectangle used to type Unicode text inputs. | |
| 307 | + * | |
| 308 | + * Native input methods will place a window with word suggestions near it, | |
| 309 | + * without covering the text being inputted. | |
| 310 | + * | |
| 311 | + * To start text input in a given location, this function is intended to be | |
| 312 | + * called before SDL_StartTextInput, although some platforms support moving | |
| 313 | + * the rectangle even while text input (and a composition) is active. | |
| 314 | + * | |
| 315 | + * Note: If you want to use the system native IME window, try setting hint | |
| 316 | + * **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you | |
| 317 | + * any feedback. | |
| 318 | + * | |
| 319 | + * \param rect the SDL_Rect structure representing the rectangle to receive | |
| 320 | + * text (ignored if NULL). | |
| 321 | + * | |
| 322 | + * \since This function is available since SDL 2.0.0. | |
| 323 | + * | |
| 324 | + * \sa SDL_StartTextInput | |
| 325 | + */ | |
| 326 | +extern DECLSPEC void SDLCALL SDL_SetTextInputRect(const SDL_Rect *rect); | |
| 327 | + | |
| 328 | +/** | |
| 329 | + * Check whether the platform has screen keyboard support. | |
| 330 | + * | |
| 331 | + * \returns SDL_TRUE if the platform has some screen keyboard support or | |
| 332 | + * SDL_FALSE if not. | |
| 333 | + * | |
| 334 | + * \since This function is available since SDL 2.0.0. | |
| 335 | + * | |
| 336 | + * \sa SDL_StartTextInput | |
| 337 | + * \sa SDL_IsScreenKeyboardShown | |
| 338 | + */ | |
| 339 | +extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void); | |
| 340 | + | |
| 341 | +/** | |
| 342 | + * Check whether the screen keyboard is shown for given window. | |
| 343 | + * | |
| 344 | + * \param window the window for which screen keyboard should be queried. | |
| 345 | + * \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not. | |
| 346 | + * | |
| 347 | + * \since This function is available since SDL 2.0.0. | |
| 348 | + * | |
| 349 | + * \sa SDL_HasScreenKeyboardSupport | |
| 350 | + */ | |
| 351 | +extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); | |
| 352 | + | |
| 353 | +/* Ends C function definitions when using C++ */ | |
| 354 | +#ifdef __cplusplus | |
| 355 | +} | |
| 356 | +#endif | |
| 357 | +#include "close_code.h" | |
| 358 | + | |
| 359 | +#endif /* SDL_keyboard_h_ */ | |
| 360 | + | |
| 361 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,358 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryKeycode | |
| 24 | + * | |
| 25 | + * Defines constants which identify keyboard keys and modifiers. | |
| 26 | + */ | |
| 27 | + | |
| 28 | +#ifndef SDL_keycode_h_ | |
| 29 | +#define SDL_keycode_h_ | |
| 30 | + | |
| 31 | +#include "SDL_stdinc.h" | |
| 32 | +#include "SDL_scancode.h" | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * The SDL virtual key representation. | |
| 36 | + * | |
| 37 | + * Values of this type are used to represent keyboard keys using the current | |
| 38 | + * layout of the keyboard. These values include Unicode values representing | |
| 39 | + * the unmodified character that would be generated by pressing the key, or an | |
| 40 | + * SDLK_* constant for those keys that do not generate characters. | |
| 41 | + * | |
| 42 | + * A special exception is the number keys at the top of the keyboard which map | |
| 43 | + * to SDLK_0...SDLK_9 on AZERTY layouts. | |
| 44 | + */ | |
| 45 | +typedef Sint32 SDL_Keycode; | |
| 46 | + | |
| 47 | +#define SDLK_SCANCODE_MASK (1<<30) | |
| 48 | +#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) | |
| 49 | + | |
| 50 | +typedef enum SDL_KeyCode | |
| 51 | +{ | |
| 52 | + SDLK_UNKNOWN = 0, | |
| 53 | + | |
| 54 | + SDLK_RETURN = '\r', | |
| 55 | + SDLK_ESCAPE = '\x1B', | |
| 56 | + SDLK_BACKSPACE = '\b', | |
| 57 | + SDLK_TAB = '\t', | |
| 58 | + SDLK_SPACE = ' ', | |
| 59 | + SDLK_EXCLAIM = '!', | |
| 60 | + SDLK_QUOTEDBL = '"', | |
| 61 | + SDLK_HASH = '#', | |
| 62 | + SDLK_PERCENT = '%', | |
| 63 | + SDLK_DOLLAR = '$', | |
| 64 | + SDLK_AMPERSAND = '&', | |
| 65 | + SDLK_QUOTE = '\'', | |
| 66 | + SDLK_LEFTPAREN = '(', | |
| 67 | + SDLK_RIGHTPAREN = ')', | |
| 68 | + SDLK_ASTERISK = '*', | |
| 69 | + SDLK_PLUS = '+', | |
| 70 | + SDLK_COMMA = ',', | |
| 71 | + SDLK_MINUS = '-', | |
| 72 | + SDLK_PERIOD = '.', | |
| 73 | + SDLK_SLASH = '/', | |
| 74 | + SDLK_0 = '0', | |
| 75 | + SDLK_1 = '1', | |
| 76 | + SDLK_2 = '2', | |
| 77 | + SDLK_3 = '3', | |
| 78 | + SDLK_4 = '4', | |
| 79 | + SDLK_5 = '5', | |
| 80 | + SDLK_6 = '6', | |
| 81 | + SDLK_7 = '7', | |
| 82 | + SDLK_8 = '8', | |
| 83 | + SDLK_9 = '9', | |
| 84 | + SDLK_COLON = ':', | |
| 85 | + SDLK_SEMICOLON = ';', | |
| 86 | + SDLK_LESS = '<', | |
| 87 | + SDLK_EQUALS = '=', | |
| 88 | + SDLK_GREATER = '>', | |
| 89 | + SDLK_QUESTION = '?', | |
| 90 | + SDLK_AT = '@', | |
| 91 | + | |
| 92 | + /* | |
| 93 | + Skip uppercase letters | |
| 94 | + */ | |
| 95 | + | |
| 96 | + SDLK_LEFTBRACKET = '[', | |
| 97 | + SDLK_BACKSLASH = '\\', | |
| 98 | + SDLK_RIGHTBRACKET = ']', | |
| 99 | + SDLK_CARET = '^', | |
| 100 | + SDLK_UNDERSCORE = '_', | |
| 101 | + SDLK_BACKQUOTE = '`', | |
| 102 | + SDLK_a = 'a', | |
| 103 | + SDLK_b = 'b', | |
| 104 | + SDLK_c = 'c', | |
| 105 | + SDLK_d = 'd', | |
| 106 | + SDLK_e = 'e', | |
| 107 | + SDLK_f = 'f', | |
| 108 | + SDLK_g = 'g', | |
| 109 | + SDLK_h = 'h', | |
| 110 | + SDLK_i = 'i', | |
| 111 | + SDLK_j = 'j', | |
| 112 | + SDLK_k = 'k', | |
| 113 | + SDLK_l = 'l', | |
| 114 | + SDLK_m = 'm', | |
| 115 | + SDLK_n = 'n', | |
| 116 | + SDLK_o = 'o', | |
| 117 | + SDLK_p = 'p', | |
| 118 | + SDLK_q = 'q', | |
| 119 | + SDLK_r = 'r', | |
| 120 | + SDLK_s = 's', | |
| 121 | + SDLK_t = 't', | |
| 122 | + SDLK_u = 'u', | |
| 123 | + SDLK_v = 'v', | |
| 124 | + SDLK_w = 'w', | |
| 125 | + SDLK_x = 'x', | |
| 126 | + SDLK_y = 'y', | |
| 127 | + SDLK_z = 'z', | |
| 128 | + | |
| 129 | + SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK), | |
| 130 | + | |
| 131 | + SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1), | |
| 132 | + SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2), | |
| 133 | + SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3), | |
| 134 | + SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4), | |
| 135 | + SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5), | |
| 136 | + SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6), | |
| 137 | + SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7), | |
| 138 | + SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8), | |
| 139 | + SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9), | |
| 140 | + SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10), | |
| 141 | + SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11), | |
| 142 | + SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12), | |
| 143 | + | |
| 144 | + SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN), | |
| 145 | + SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK), | |
| 146 | + SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE), | |
| 147 | + SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT), | |
| 148 | + SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME), | |
| 149 | + SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP), | |
| 150 | + SDLK_DELETE = '\x7F', | |
| 151 | + SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END), | |
| 152 | + SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN), | |
| 153 | + SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT), | |
| 154 | + SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT), | |
| 155 | + SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN), | |
| 156 | + SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP), | |
| 157 | + | |
| 158 | + SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR), | |
| 159 | + SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE), | |
| 160 | + SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY), | |
| 161 | + SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS), | |
| 162 | + SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS), | |
| 163 | + SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER), | |
| 164 | + SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1), | |
| 165 | + SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2), | |
| 166 | + SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3), | |
| 167 | + SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4), | |
| 168 | + SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5), | |
| 169 | + SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6), | |
| 170 | + SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7), | |
| 171 | + SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8), | |
| 172 | + SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9), | |
| 173 | + SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0), | |
| 174 | + SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD), | |
| 175 | + | |
| 176 | + SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION), | |
| 177 | + SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER), | |
| 178 | + SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS), | |
| 179 | + SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13), | |
| 180 | + SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14), | |
| 181 | + SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15), | |
| 182 | + SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16), | |
| 183 | + SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17), | |
| 184 | + SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18), | |
| 185 | + SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19), | |
| 186 | + SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20), | |
| 187 | + SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21), | |
| 188 | + SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22), | |
| 189 | + SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23), | |
| 190 | + SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24), | |
| 191 | + SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE), | |
| 192 | + SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP), | |
| 193 | + SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU), | |
| 194 | + SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT), | |
| 195 | + SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP), | |
| 196 | + SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN), | |
| 197 | + SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO), | |
| 198 | + SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT), | |
| 199 | + SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY), | |
| 200 | + SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE), | |
| 201 | + SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND), | |
| 202 | + SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE), | |
| 203 | + SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP), | |
| 204 | + SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN), | |
| 205 | + SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA), | |
| 206 | + SDLK_KP_EQUALSAS400 = | |
| 207 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400), | |
| 208 | + | |
| 209 | + SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE), | |
| 210 | + SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ), | |
| 211 | + SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL), | |
| 212 | + SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR), | |
| 213 | + SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR), | |
| 214 | + SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2), | |
| 215 | + SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR), | |
| 216 | + SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT), | |
| 217 | + SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER), | |
| 218 | + SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN), | |
| 219 | + SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL), | |
| 220 | + SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL), | |
| 221 | + | |
| 222 | + SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00), | |
| 223 | + SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000), | |
| 224 | + SDLK_THOUSANDSSEPARATOR = | |
| 225 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR), | |
| 226 | + SDLK_DECIMALSEPARATOR = | |
| 227 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR), | |
| 228 | + SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT), | |
| 229 | + SDLK_CURRENCYSUBUNIT = | |
| 230 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT), | |
| 231 | + SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN), | |
| 232 | + SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN), | |
| 233 | + SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE), | |
| 234 | + SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE), | |
| 235 | + SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB), | |
| 236 | + SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE), | |
| 237 | + SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A), | |
| 238 | + SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B), | |
| 239 | + SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C), | |
| 240 | + SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D), | |
| 241 | + SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E), | |
| 242 | + SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F), | |
| 243 | + SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR), | |
| 244 | + SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER), | |
| 245 | + SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT), | |
| 246 | + SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS), | |
| 247 | + SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER), | |
| 248 | + SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND), | |
| 249 | + SDLK_KP_DBLAMPERSAND = | |
| 250 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND), | |
| 251 | + SDLK_KP_VERTICALBAR = | |
| 252 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR), | |
| 253 | + SDLK_KP_DBLVERTICALBAR = | |
| 254 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR), | |
| 255 | + SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON), | |
| 256 | + SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH), | |
| 257 | + SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE), | |
| 258 | + SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT), | |
| 259 | + SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM), | |
| 260 | + SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE), | |
| 261 | + SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL), | |
| 262 | + SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR), | |
| 263 | + SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD), | |
| 264 | + SDLK_KP_MEMSUBTRACT = | |
| 265 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT), | |
| 266 | + SDLK_KP_MEMMULTIPLY = | |
| 267 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY), | |
| 268 | + SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE), | |
| 269 | + SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS), | |
| 270 | + SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR), | |
| 271 | + SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY), | |
| 272 | + SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY), | |
| 273 | + SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL), | |
| 274 | + SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL), | |
| 275 | + SDLK_KP_HEXADECIMAL = | |
| 276 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL), | |
| 277 | + | |
| 278 | + SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL), | |
| 279 | + SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT), | |
| 280 | + SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT), | |
| 281 | + SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI), | |
| 282 | + SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL), | |
| 283 | + SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT), | |
| 284 | + SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT), | |
| 285 | + SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI), | |
| 286 | + | |
| 287 | + SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE), | |
| 288 | + | |
| 289 | + SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT), | |
| 290 | + SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV), | |
| 291 | + SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP), | |
| 292 | + SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY), | |
| 293 | + SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE), | |
| 294 | + SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT), | |
| 295 | + SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW), | |
| 296 | + SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL), | |
| 297 | + SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR), | |
| 298 | + SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER), | |
| 299 | + SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH), | |
| 300 | + SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME), | |
| 301 | + SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK), | |
| 302 | + SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD), | |
| 303 | + SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP), | |
| 304 | + SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH), | |
| 305 | + SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS), | |
| 306 | + | |
| 307 | + SDLK_BRIGHTNESSDOWN = | |
| 308 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN), | |
| 309 | + SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP), | |
| 310 | + SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH), | |
| 311 | + SDLK_KBDILLUMTOGGLE = | |
| 312 | + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE), | |
| 313 | + SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), | |
| 314 | + SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), | |
| 315 | + SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), | |
| 316 | + SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP), | |
| 317 | + SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1), | |
| 318 | + SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2), | |
| 319 | + | |
| 320 | + SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND), | |
| 321 | + SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD), | |
| 322 | + | |
| 323 | + SDLK_SOFTLEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTLEFT), | |
| 324 | + SDLK_SOFTRIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT), | |
| 325 | + SDLK_CALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL), | |
| 326 | + SDLK_ENDCALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL) | |
| 327 | +} SDL_KeyCode; | |
| 328 | + | |
| 329 | +/** | |
| 330 | + * Enumeration of valid key mods (possibly OR'd together). | |
| 331 | + */ | |
| 332 | +typedef enum SDL_Keymod | |
| 333 | +{ | |
| 334 | + KMOD_NONE = 0x0000, | |
| 335 | + KMOD_LSHIFT = 0x0001, | |
| 336 | + KMOD_RSHIFT = 0x0002, | |
| 337 | + KMOD_LCTRL = 0x0040, | |
| 338 | + KMOD_RCTRL = 0x0080, | |
| 339 | + KMOD_LALT = 0x0100, | |
| 340 | + KMOD_RALT = 0x0200, | |
| 341 | + KMOD_LGUI = 0x0400, | |
| 342 | + KMOD_RGUI = 0x0800, | |
| 343 | + KMOD_NUM = 0x1000, | |
| 344 | + KMOD_CAPS = 0x2000, | |
| 345 | + KMOD_MODE = 0x4000, | |
| 346 | + KMOD_SCROLL = 0x8000, | |
| 347 | + | |
| 348 | + KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL, | |
| 349 | + KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT, | |
| 350 | + KMOD_ALT = KMOD_LALT | KMOD_RALT, | |
| 351 | + KMOD_GUI = KMOD_LGUI | KMOD_RGUI, | |
| 352 | + | |
| 353 | + KMOD_RESERVED = KMOD_SCROLL /* This is for source-level compatibility with SDL 2.0.0. */ | |
| 354 | +} SDL_Keymod; | |
| 355 | + | |
| 356 | +#endif /* SDL_keycode_h_ */ | |
| 357 | + | |
| 358 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,117 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | +/* WIKI CATEGORY: LoadSO */ | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * # CategoryLoadSO | |
| 26 | + * | |
| 27 | + * System-dependent library loading routines. | |
| 28 | + * | |
| 29 | + * Some things to keep in mind: | |
| 30 | + * | |
| 31 | + * - These functions only work on C function names. Other languages may have | |
| 32 | + * name mangling and intrinsic language support that varies from compiler to | |
| 33 | + * compiler. | |
| 34 | + * - Make sure you declare your function pointers with the same calling | |
| 35 | + * convention as the actual library function. Your code will crash | |
| 36 | + * mysteriously if you do not do this. | |
| 37 | + * - Avoid namespace collisions. If you load a symbol from the library, it is | |
| 38 | + * not defined whether or not it goes into the global symbol namespace for | |
| 39 | + * the application. If it does and it conflicts with symbols in your code or | |
| 40 | + * other shared libraries, you will not get the results you expect. :) | |
| 41 | + */ | |
| 42 | + | |
| 43 | +#ifndef SDL_loadso_h_ | |
| 44 | +#define SDL_loadso_h_ | |
| 45 | + | |
| 46 | +#include "SDL_stdinc.h" | |
| 47 | +#include "SDL_error.h" | |
| 48 | + | |
| 49 | +#include "begin_code.h" | |
| 50 | +/* Set up for C function definitions, even when using C++ */ | |
| 51 | +#ifdef __cplusplus | |
| 52 | +extern "C" { | |
| 53 | +#endif | |
| 54 | + | |
| 55 | +/** | |
| 56 | + * Dynamically load a shared object. | |
| 57 | + * | |
| 58 | + * \param sofile a system-dependent name of the object file. | |
| 59 | + * \returns an opaque pointer to the object handle or NULL if there was an | |
| 60 | + * error; call SDL_GetError() for more information. | |
| 61 | + * | |
| 62 | + * \since This function is available since SDL 2.0.0. | |
| 63 | + * | |
| 64 | + * \sa SDL_LoadFunction | |
| 65 | + * \sa SDL_UnloadObject | |
| 66 | + */ | |
| 67 | +extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); | |
| 68 | + | |
| 69 | +/** | |
| 70 | + * Look up the address of the named function in a shared object. | |
| 71 | + * | |
| 72 | + * This function pointer is no longer valid after calling SDL_UnloadObject(). | |
| 73 | + * | |
| 74 | + * This function can only look up C function names. Other languages may have | |
| 75 | + * name mangling and intrinsic language support that varies from compiler to | |
| 76 | + * compiler. | |
| 77 | + * | |
| 78 | + * Make sure you declare your function pointers with the same calling | |
| 79 | + * convention as the actual library function. Your code will crash | |
| 80 | + * mysteriously if you do not do this. | |
| 81 | + * | |
| 82 | + * If the requested function doesn't exist, NULL is returned. | |
| 83 | + * | |
| 84 | + * \param handle a valid shared object handle returned by SDL_LoadObject(). | |
| 85 | + * \param name the name of the function to look up. | |
| 86 | + * \returns a pointer to the function or NULL if there was an error; call | |
| 87 | + * SDL_GetError() for more information. | |
| 88 | + * | |
| 89 | + * \since This function is available since SDL 2.0.0. | |
| 90 | + * | |
| 91 | + * \sa SDL_LoadObject | |
| 92 | + * \sa SDL_UnloadObject | |
| 93 | + */ | |
| 94 | +extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, | |
| 95 | + const char *name); | |
| 96 | + | |
| 97 | +/** | |
| 98 | + * Unload a shared object from memory. | |
| 99 | + * | |
| 100 | + * \param handle a valid shared object handle returned by SDL_LoadObject(). | |
| 101 | + * | |
| 102 | + * \since This function is available since SDL 2.0.0. | |
| 103 | + * | |
| 104 | + * \sa SDL_LoadFunction | |
| 105 | + * \sa SDL_LoadObject | |
| 106 | + */ | |
| 107 | +extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); | |
| 108 | + | |
| 109 | +/* Ends C function definitions when using C++ */ | |
| 110 | +#ifdef __cplusplus | |
| 111 | +} | |
| 112 | +#endif | |
| 113 | +#include "close_code.h" | |
| 114 | + | |
| 115 | +#endif /* SDL_loadso_h_ */ | |
| 116 | + | |
| 117 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,103 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryLocale | |
| 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 | + * 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 the | |
| 54 | + * returned value; all the memory involved is allocated in a single block, so | |
| 55 | + * 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 three | |
| 67 | + * or more. | |
| 68 | + * | |
| 69 | + * The returned list of locales are in the order of the user's preference. For | |
| 70 | + * example, a German citizen that is fluent in US English and knows enough | |
| 71 | + * Japanese to navigate around Tokyo might have a list like: { "de", "en_US", | |
| 72 | + * "jp", NULL }. Someone from England might prefer British English (where | |
| 73 | + * "color" is spelled "colour", etc), but will settle for anything like it: { | |
| 74 | + * "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 of | |
| 82 | + * your program; SDL will send an SDL_LOCALECHANGED event in this case, if | |
| 83 | + * possible, and you can call this function again to get an updated copy of | |
| 84 | + * 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 | + * \since This function is available since SDL 2.0.14. | |
| 90 | + */ | |
| 91 | +extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void); | |
| 92 | + | |
| 93 | +/* Ends C function definitions when using C++ */ | |
| 94 | +#ifdef __cplusplus | |
| 95 | +/* *INDENT-OFF* */ | |
| 96 | +} | |
| 97 | +/* *INDENT-ON* */ | |
| 98 | +#endif | |
| 99 | +#include "close_code.h" | |
| 100 | + | |
| 101 | +#endif /* _SDL_locale_h */ | |
| 102 | + | |
| 103 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,405 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryLog | |
| 24 | + * | |
| 25 | + * Simple log messages with categories and priorities. | |
| 26 | + * | |
| 27 | + * By default logs are quiet, but if you're debugging SDL you might want: | |
| 28 | + * | |
| 29 | + * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); | |
| 30 | + * | |
| 31 | + * Here's where the messages go on different platforms: | |
| 32 | + * | |
| 33 | + * - Windows: debug output stream | |
| 34 | + * - Android: log output | |
| 35 | + * - Others: standard error output (stderr) | |
| 36 | + */ | |
| 37 | + | |
| 38 | +#ifndef SDL_log_h_ | |
| 39 | +#define SDL_log_h_ | |
| 40 | + | |
| 41 | +#include "SDL_stdinc.h" | |
| 42 | + | |
| 43 | +#include "begin_code.h" | |
| 44 | +/* Set up for C function definitions, even when using C++ */ | |
| 45 | +#ifdef __cplusplus | |
| 46 | +extern "C" { | |
| 47 | +#endif | |
| 48 | + | |
| 49 | + | |
| 50 | +/** | |
| 51 | + * The maximum size of a log message prior to SDL 2.0.24 | |
| 52 | + * | |
| 53 | + * As of 2.0.24 there is no limit to the length of SDL log messages. | |
| 54 | + */ | |
| 55 | +#define SDL_MAX_LOG_MESSAGE 4096 | |
| 56 | + | |
| 57 | +/** | |
| 58 | + * The predefined log categories | |
| 59 | + * | |
| 60 | + * By default the application category is enabled at the INFO level, the | |
| 61 | + * assert category is enabled at the WARN level, test is enabled at the | |
| 62 | + * VERBOSE level and all other categories are enabled at the ERROR level. | |
| 63 | + */ | |
| 64 | +typedef enum SDL_LogCategory | |
| 65 | +{ | |
| 66 | + SDL_LOG_CATEGORY_APPLICATION, | |
| 67 | + SDL_LOG_CATEGORY_ERROR, | |
| 68 | + SDL_LOG_CATEGORY_ASSERT, | |
| 69 | + SDL_LOG_CATEGORY_SYSTEM, | |
| 70 | + SDL_LOG_CATEGORY_AUDIO, | |
| 71 | + SDL_LOG_CATEGORY_VIDEO, | |
| 72 | + SDL_LOG_CATEGORY_RENDER, | |
| 73 | + SDL_LOG_CATEGORY_INPUT, | |
| 74 | + SDL_LOG_CATEGORY_TEST, | |
| 75 | + | |
| 76 | + /* Reserved for future SDL library use */ | |
| 77 | + SDL_LOG_CATEGORY_RESERVED1, | |
| 78 | + SDL_LOG_CATEGORY_RESERVED2, | |
| 79 | + SDL_LOG_CATEGORY_RESERVED3, | |
| 80 | + SDL_LOG_CATEGORY_RESERVED4, | |
| 81 | + SDL_LOG_CATEGORY_RESERVED5, | |
| 82 | + SDL_LOG_CATEGORY_RESERVED6, | |
| 83 | + SDL_LOG_CATEGORY_RESERVED7, | |
| 84 | + SDL_LOG_CATEGORY_RESERVED8, | |
| 85 | + SDL_LOG_CATEGORY_RESERVED9, | |
| 86 | + SDL_LOG_CATEGORY_RESERVED10, | |
| 87 | + | |
| 88 | + /* Beyond this point is reserved for application use, e.g. | |
| 89 | + enum { | |
| 90 | + MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM, | |
| 91 | + MYAPP_CATEGORY_AWESOME2, | |
| 92 | + MYAPP_CATEGORY_AWESOME3, | |
| 93 | + ... | |
| 94 | + }; | |
| 95 | + */ | |
| 96 | + SDL_LOG_CATEGORY_CUSTOM | |
| 97 | +} SDL_LogCategory; | |
| 98 | + | |
| 99 | +/** | |
| 100 | + * The predefined log priorities | |
| 101 | + */ | |
| 102 | +typedef enum SDL_LogPriority | |
| 103 | +{ | |
| 104 | + SDL_LOG_PRIORITY_VERBOSE = 1, | |
| 105 | + SDL_LOG_PRIORITY_DEBUG, | |
| 106 | + SDL_LOG_PRIORITY_INFO, | |
| 107 | + SDL_LOG_PRIORITY_WARN, | |
| 108 | + SDL_LOG_PRIORITY_ERROR, | |
| 109 | + SDL_LOG_PRIORITY_CRITICAL, | |
| 110 | + SDL_NUM_LOG_PRIORITIES | |
| 111 | +} SDL_LogPriority; | |
| 112 | + | |
| 113 | + | |
| 114 | +/** | |
| 115 | + * Set the priority of all log categories. | |
| 116 | + * | |
| 117 | + * \param priority the SDL_LogPriority to assign. | |
| 118 | + * | |
| 119 | + * \since This function is available since SDL 2.0.0. | |
| 120 | + * | |
| 121 | + * \sa SDL_LogSetPriority | |
| 122 | + */ | |
| 123 | +extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); | |
| 124 | + | |
| 125 | +/** | |
| 126 | + * Set the priority of a particular log category. | |
| 127 | + * | |
| 128 | + * \param category the category to assign a priority to. | |
| 129 | + * \param priority the SDL_LogPriority to assign. | |
| 130 | + * | |
| 131 | + * \since This function is available since SDL 2.0.0. | |
| 132 | + * | |
| 133 | + * \sa SDL_LogGetPriority | |
| 134 | + * \sa SDL_LogSetAllPriority | |
| 135 | + */ | |
| 136 | +extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, | |
| 137 | + SDL_LogPriority priority); | |
| 138 | + | |
| 139 | +/** | |
| 140 | + * Get the priority of a particular log category. | |
| 141 | + * | |
| 142 | + * \param category the category to query. | |
| 143 | + * \returns the SDL_LogPriority for the requested category. | |
| 144 | + * | |
| 145 | + * \since This function is available since SDL 2.0.0. | |
| 146 | + * | |
| 147 | + * \sa SDL_LogSetPriority | |
| 148 | + */ | |
| 149 | +extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); | |
| 150 | + | |
| 151 | +/** | |
| 152 | + * Reset all priorities to default. | |
| 153 | + * | |
| 154 | + * This is called by SDL_Quit(). | |
| 155 | + * | |
| 156 | + * \since This function is available since SDL 2.0.0. | |
| 157 | + * | |
| 158 | + * \sa SDL_LogSetAllPriority | |
| 159 | + * \sa SDL_LogSetPriority | |
| 160 | + */ | |
| 161 | +extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void); | |
| 162 | + | |
| 163 | +/** | |
| 164 | + * Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO. | |
| 165 | + * | |
| 166 | + * = * \param fmt a printf() style message format string | |
| 167 | + * | |
| 168 | + * \param ... additional parameters matching % tokens in the `fmt` string, if | |
| 169 | + * any. | |
| 170 | + * | |
| 171 | + * \since This function is available since SDL 2.0.0. | |
| 172 | + * | |
| 173 | + * \sa SDL_LogCritical | |
| 174 | + * \sa SDL_LogDebug | |
| 175 | + * \sa SDL_LogError | |
| 176 | + * \sa SDL_LogInfo | |
| 177 | + * \sa SDL_LogMessage | |
| 178 | + * \sa SDL_LogMessageV | |
| 179 | + * \sa SDL_LogVerbose | |
| 180 | + * \sa SDL_LogWarn | |
| 181 | + */ | |
| 182 | +extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); | |
| 183 | + | |
| 184 | +/** | |
| 185 | + * Log a message with SDL_LOG_PRIORITY_VERBOSE. | |
| 186 | + * | |
| 187 | + * \param category the category of the message. | |
| 188 | + * \param fmt a printf() style message format string. | |
| 189 | + * \param ... additional parameters matching % tokens in the **fmt** string, | |
| 190 | + * if any. | |
| 191 | + * | |
| 192 | + * \since This function is available since SDL 2.0.0. | |
| 193 | + * | |
| 194 | + * \sa SDL_Log | |
| 195 | + * \sa SDL_LogCritical | |
| 196 | + * \sa SDL_LogDebug | |
| 197 | + * \sa SDL_LogError | |
| 198 | + * \sa SDL_LogInfo | |
| 199 | + * \sa SDL_LogMessage | |
| 200 | + * \sa SDL_LogMessageV | |
| 201 | + * \sa SDL_LogWarn | |
| 202 | + */ | |
| 203 | +extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | |
| 204 | + | |
| 205 | +/** | |
| 206 | + * Log a message with SDL_LOG_PRIORITY_DEBUG. | |
| 207 | + * | |
| 208 | + * \param category the category of the message. | |
| 209 | + * \param fmt a printf() style message format string. | |
| 210 | + * \param ... additional parameters matching % tokens in the **fmt** string, | |
| 211 | + * if any. | |
| 212 | + * | |
| 213 | + * \since This function is available since SDL 2.0.0. | |
| 214 | + * | |
| 215 | + * \sa SDL_Log | |
| 216 | + * \sa SDL_LogCritical | |
| 217 | + * \sa SDL_LogError | |
| 218 | + * \sa SDL_LogInfo | |
| 219 | + * \sa SDL_LogMessage | |
| 220 | + * \sa SDL_LogMessageV | |
| 221 | + * \sa SDL_LogVerbose | |
| 222 | + * \sa SDL_LogWarn | |
| 223 | + */ | |
| 224 | +extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | |
| 225 | + | |
| 226 | +/** | |
| 227 | + * Log a message with SDL_LOG_PRIORITY_INFO. | |
| 228 | + * | |
| 229 | + * \param category the category of the message. | |
| 230 | + * \param fmt a printf() style message format string. | |
| 231 | + * \param ... additional parameters matching % tokens in the **fmt** string, | |
| 232 | + * if any. | |
| 233 | + * | |
| 234 | + * \since This function is available since SDL 2.0.0. | |
| 235 | + * | |
| 236 | + * \sa SDL_Log | |
| 237 | + * \sa SDL_LogCritical | |
| 238 | + * \sa SDL_LogDebug | |
| 239 | + * \sa SDL_LogError | |
| 240 | + * \sa SDL_LogMessage | |
| 241 | + * \sa SDL_LogMessageV | |
| 242 | + * \sa SDL_LogVerbose | |
| 243 | + * \sa SDL_LogWarn | |
| 244 | + */ | |
| 245 | +extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | |
| 246 | + | |
| 247 | +/** | |
| 248 | + * Log a message with SDL_LOG_PRIORITY_WARN. | |
| 249 | + * | |
| 250 | + * \param category the category of the message. | |
| 251 | + * \param fmt a printf() style message format string. | |
| 252 | + * \param ... additional parameters matching % tokens in the **fmt** string, | |
| 253 | + * if any. | |
| 254 | + * | |
| 255 | + * \since This function is available since SDL 2.0.0. | |
| 256 | + * | |
| 257 | + * \sa SDL_Log | |
| 258 | + * \sa SDL_LogCritical | |
| 259 | + * \sa SDL_LogDebug | |
| 260 | + * \sa SDL_LogError | |
| 261 | + * \sa SDL_LogInfo | |
| 262 | + * \sa SDL_LogMessage | |
| 263 | + * \sa SDL_LogMessageV | |
| 264 | + * \sa SDL_LogVerbose | |
| 265 | + */ | |
| 266 | +extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | |
| 267 | + | |
| 268 | +/** | |
| 269 | + * Log a message with SDL_LOG_PRIORITY_ERROR. | |
| 270 | + * | |
| 271 | + * \param category the category of the message. | |
| 272 | + * \param fmt a printf() style message format string. | |
| 273 | + * \param ... additional parameters matching % tokens in the **fmt** string, | |
| 274 | + * if any. | |
| 275 | + * | |
| 276 | + * \since This function is available since SDL 2.0.0. | |
| 277 | + * | |
| 278 | + * \sa SDL_Log | |
| 279 | + * \sa SDL_LogCritical | |
| 280 | + * \sa SDL_LogDebug | |
| 281 | + * \sa SDL_LogInfo | |
| 282 | + * \sa SDL_LogMessage | |
| 283 | + * \sa SDL_LogMessageV | |
| 284 | + * \sa SDL_LogVerbose | |
| 285 | + * \sa SDL_LogWarn | |
| 286 | + */ | |
| 287 | +extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | |
| 288 | + | |
| 289 | +/** | |
| 290 | + * Log a message with SDL_LOG_PRIORITY_CRITICAL. | |
| 291 | + * | |
| 292 | + * \param category the category of the message. | |
| 293 | + * \param fmt a printf() style message format string. | |
| 294 | + * \param ... additional parameters matching % tokens in the **fmt** string, | |
| 295 | + * if any. | |
| 296 | + * | |
| 297 | + * \since This function is available since SDL 2.0.0. | |
| 298 | + * | |
| 299 | + * \sa SDL_Log | |
| 300 | + * \sa SDL_LogDebug | |
| 301 | + * \sa SDL_LogError | |
| 302 | + * \sa SDL_LogInfo | |
| 303 | + * \sa SDL_LogMessage | |
| 304 | + * \sa SDL_LogMessageV | |
| 305 | + * \sa SDL_LogVerbose | |
| 306 | + * \sa SDL_LogWarn | |
| 307 | + */ | |
| 308 | +extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); | |
| 309 | + | |
| 310 | +/** | |
| 311 | + * Log a message with the specified category and priority. | |
| 312 | + * | |
| 313 | + * \param category the category of the message. | |
| 314 | + * \param priority the priority of the message. | |
| 315 | + * \param fmt a printf() style message format string. | |
| 316 | + * \param ... additional parameters matching % tokens in the **fmt** string, | |
| 317 | + * if any. | |
| 318 | + * | |
| 319 | + * \since This function is available since SDL 2.0.0. | |
| 320 | + * | |
| 321 | + * \sa SDL_Log | |
| 322 | + * \sa SDL_LogCritical | |
| 323 | + * \sa SDL_LogDebug | |
| 324 | + * \sa SDL_LogError | |
| 325 | + * \sa SDL_LogInfo | |
| 326 | + * \sa SDL_LogMessageV | |
| 327 | + * \sa SDL_LogVerbose | |
| 328 | + * \sa SDL_LogWarn | |
| 329 | + */ | |
| 330 | +extern DECLSPEC void SDLCALL SDL_LogMessage(int category, | |
| 331 | + SDL_LogPriority priority, | |
| 332 | + SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3); | |
| 333 | + | |
| 334 | +/** | |
| 335 | + * Log a message with the specified category and priority. | |
| 336 | + * | |
| 337 | + * \param category the category of the message. | |
| 338 | + * \param priority the priority of the message. | |
| 339 | + * \param fmt a printf() style message format string. | |
| 340 | + * \param ap a variable argument list. | |
| 341 | + * | |
| 342 | + * \since This function is available since SDL 2.0.0. | |
| 343 | + * | |
| 344 | + * \sa SDL_Log | |
| 345 | + * \sa SDL_LogCritical | |
| 346 | + * \sa SDL_LogDebug | |
| 347 | + * \sa SDL_LogError | |
| 348 | + * \sa SDL_LogInfo | |
| 349 | + * \sa SDL_LogMessage | |
| 350 | + * \sa SDL_LogVerbose | |
| 351 | + * \sa SDL_LogWarn | |
| 352 | + */ | |
| 353 | +extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, | |
| 354 | + SDL_LogPriority priority, | |
| 355 | + SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); | |
| 356 | + | |
| 357 | +/** | |
| 358 | + * The prototype for the log output callback function. | |
| 359 | + * | |
| 360 | + * This function is called by SDL when there is new text to be logged. | |
| 361 | + * | |
| 362 | + * \param userdata what was passed as `userdata` to | |
| 363 | + * SDL_LogSetOutputFunction(). | |
| 364 | + * \param category the category of the message. | |
| 365 | + * \param priority the priority of the message. | |
| 366 | + * \param message the message being output. | |
| 367 | + */ | |
| 368 | +typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); | |
| 369 | + | |
| 370 | +/** | |
| 371 | + * Get the current log output function. | |
| 372 | + * | |
| 373 | + * \param callback an SDL_LogOutputFunction filled in with the current log | |
| 374 | + * callback. | |
| 375 | + * \param userdata a pointer filled in with the pointer that is passed to | |
| 376 | + * `callback`. | |
| 377 | + * | |
| 378 | + * \since This function is available since SDL 2.0.0. | |
| 379 | + * | |
| 380 | + * \sa SDL_LogSetOutputFunction | |
| 381 | + */ | |
| 382 | +extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata); | |
| 383 | + | |
| 384 | +/** | |
| 385 | + * Replace the default log output function with one of your own. | |
| 386 | + * | |
| 387 | + * \param callback an SDL_LogOutputFunction to call instead of the default. | |
| 388 | + * \param userdata a pointer that is passed to `callback`. | |
| 389 | + * | |
| 390 | + * \since This function is available since SDL 2.0.0. | |
| 391 | + * | |
| 392 | + * \sa SDL_LogGetOutputFunction | |
| 393 | + */ | |
| 394 | +extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata); | |
| 395 | + | |
| 396 | + | |
| 397 | +/* Ends C function definitions when using C++ */ | |
| 398 | +#ifdef __cplusplus | |
| 399 | +} | |
| 400 | +#endif | |
| 401 | +#include "close_code.h" | |
| 402 | + | |
| 403 | +#endif /* SDL_log_h_ */ | |
| 404 | + | |
| 405 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,282 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_main_h_ | |
| 23 | +#define SDL_main_h_ | |
| 24 | + | |
| 25 | +#include "SDL_stdinc.h" | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * # CategoryMain | |
| 29 | + * | |
| 30 | + * Redefine main() on some platforms so that it is called by SDL. | |
| 31 | + */ | |
| 32 | + | |
| 33 | +#ifndef SDL_MAIN_HANDLED | |
| 34 | +#if defined(__WIN32__) | |
| 35 | +/* On Windows SDL provides WinMain(), which parses the command line and passes | |
| 36 | + the arguments to your main function. | |
| 37 | + | |
| 38 | + If you provide your own WinMain(), you may define SDL_MAIN_HANDLED | |
| 39 | + */ | |
| 40 | +#define SDL_MAIN_AVAILABLE | |
| 41 | + | |
| 42 | +#elif defined(__WINRT__) | |
| 43 | +/* On WinRT, SDL provides a main function that initializes CoreApplication, | |
| 44 | + creating an instance of IFrameworkView in the process. | |
| 45 | + | |
| 46 | + Please note that #include'ing SDL_main.h is not enough to get a main() | |
| 47 | + function working. In non-XAML apps, the file, | |
| 48 | + src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled | |
| 49 | + into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be | |
| 50 | + called, with a pointer to the Direct3D-hosted XAML control passed in. | |
| 51 | +*/ | |
| 52 | +#define SDL_MAIN_NEEDED | |
| 53 | + | |
| 54 | +#elif defined(__GDK__) | |
| 55 | +/* On GDK, SDL provides a main function that initializes the game runtime. | |
| 56 | + | |
| 57 | + Please note that #include'ing SDL_main.h is not enough to get a main() | |
| 58 | + function working. You must either link against SDL2main or, if not possible, | |
| 59 | + call the SDL_GDKRunApp function from your entry point. | |
| 60 | +*/ | |
| 61 | +#define SDL_MAIN_NEEDED | |
| 62 | + | |
| 63 | +#elif defined(__IPHONEOS__) | |
| 64 | +/* On iOS SDL provides a main function that creates an application delegate | |
| 65 | + and starts the iOS application run loop. | |
| 66 | + | |
| 67 | + If you link with SDL dynamically on iOS, the main function can't be in a | |
| 68 | + shared library, so you need to link with libSDLmain.a, which includes a | |
| 69 | + stub main function that calls into the shared library to start execution. | |
| 70 | + | |
| 71 | + See src/video/uikit/SDL_uikitappdelegate.m for more details. | |
| 72 | + */ | |
| 73 | +#define SDL_MAIN_NEEDED | |
| 74 | + | |
| 75 | +#elif defined(__ANDROID__) | |
| 76 | +/* On Android SDL provides a Java class in SDLActivity.java that is the | |
| 77 | + main activity entry point. | |
| 78 | + | |
| 79 | + See docs/README-android.md for more details on extending that class. | |
| 80 | + */ | |
| 81 | +#define SDL_MAIN_NEEDED | |
| 82 | + | |
| 83 | +/* We need to export SDL_main so it can be launched from Java */ | |
| 84 | +#define SDLMAIN_DECLSPEC DECLSPEC | |
| 85 | + | |
| 86 | +#elif defined(__NACL__) | |
| 87 | +/* On NACL we use ppapi_simple to set up the application helper code, | |
| 88 | + then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before | |
| 89 | + starting the user main function. | |
| 90 | + All user code is run in a separate thread by ppapi_simple, thus | |
| 91 | + allowing for blocking io to take place via nacl_io | |
| 92 | +*/ | |
| 93 | +#define SDL_MAIN_NEEDED | |
| 94 | + | |
| 95 | +#elif defined(__PSP__) | |
| 96 | +/* On PSP SDL provides a main function that sets the module info, | |
| 97 | + activates the GPU and starts the thread required to be able to exit | |
| 98 | + the software. | |
| 99 | + | |
| 100 | + If you provide this yourself, you may define SDL_MAIN_HANDLED | |
| 101 | + */ | |
| 102 | +#define SDL_MAIN_AVAILABLE | |
| 103 | + | |
| 104 | +#elif defined(__PS2__) | |
| 105 | +#define SDL_MAIN_AVAILABLE | |
| 106 | + | |
| 107 | +#define SDL_PS2_SKIP_IOP_RESET() \ | |
| 108 | + void reset_IOP(); \ | |
| 109 | + void reset_IOP() {} | |
| 110 | + | |
| 111 | +#elif defined(__3DS__) | |
| 112 | +/* | |
| 113 | + On N3DS, SDL provides a main function that sets up the screens | |
| 114 | + and storage. | |
| 115 | + | |
| 116 | + If you provide this yourself, you may define SDL_MAIN_HANDLED | |
| 117 | +*/ | |
| 118 | +#define SDL_MAIN_AVAILABLE | |
| 119 | + | |
| 120 | +#endif | |
| 121 | +#endif /* SDL_MAIN_HANDLED */ | |
| 122 | + | |
| 123 | +#ifndef SDLMAIN_DECLSPEC | |
| 124 | +#define SDLMAIN_DECLSPEC | |
| 125 | +#endif | |
| 126 | + | |
| 127 | +/** | |
| 128 | + * \file SDL_main.h | |
| 129 | + * | |
| 130 | + * The application's main() function must be called with C linkage, | |
| 131 | + * and should be declared like this: | |
| 132 | + * ```c | |
| 133 | + * #ifdef __cplusplus | |
| 134 | + * extern "C" | |
| 135 | + * #endif | |
| 136 | + * int main(int argc, char *argv[]) | |
| 137 | + * { | |
| 138 | + * } | |
| 139 | + * ``` | |
| 140 | + */ | |
| 141 | + | |
| 142 | +#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) | |
| 143 | +#define main SDL_main | |
| 144 | +#endif | |
| 145 | + | |
| 146 | +#include "begin_code.h" | |
| 147 | +#ifdef __cplusplus | |
| 148 | +extern "C" { | |
| 149 | +#endif | |
| 150 | + | |
| 151 | +/** | |
| 152 | + * The prototype for the application's main() function | |
| 153 | + */ | |
| 154 | +typedef int (*SDL_main_func)(int argc, char *argv[]); | |
| 155 | +extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); | |
| 156 | + | |
| 157 | + | |
| 158 | +/** | |
| 159 | + * Circumvent failure of SDL_Init() when not using SDL_main() as an entry | |
| 160 | + * point. | |
| 161 | + * | |
| 162 | + * This function is defined in SDL_main.h, along with the preprocessor rule to | |
| 163 | + * redefine main() as SDL_main(). Thus to ensure that your main() function | |
| 164 | + * will not be changed it is necessary to define SDL_MAIN_HANDLED before | |
| 165 | + * including SDL.h. | |
| 166 | + * | |
| 167 | + * \since This function is available since SDL 2.0.0. | |
| 168 | + * | |
| 169 | + * \sa SDL_Init | |
| 170 | + */ | |
| 171 | +extern DECLSPEC void SDLCALL SDL_SetMainReady(void); | |
| 172 | + | |
| 173 | +#if defined(__WIN32__) || defined(__GDK__) | |
| 174 | + | |
| 175 | +/** | |
| 176 | + * Register a win32 window class for SDL's use. | |
| 177 | + * | |
| 178 | + * This can be called to set the application window class at startup. It is | |
| 179 | + * safe to call this multiple times, as long as every call is eventually | |
| 180 | + * paired with a call to SDL_UnregisterApp, but a second registration attempt | |
| 181 | + * while a previous registration is still active will be ignored, other than | |
| 182 | + * to increment a counter. | |
| 183 | + * | |
| 184 | + * Most applications do not need to, and should not, call this directly; SDL | |
| 185 | + * will call it when initializing the video subsystem. | |
| 186 | + * | |
| 187 | + * \param name the window class name, in UTF-8 encoding. If NULL, SDL | |
| 188 | + * currently uses "SDL_app" but this isn't guaranteed. | |
| 189 | + * \param style the value to use in WNDCLASSEX::style. If `name` is NULL, SDL | |
| 190 | + * currently uses `(CS_BYTEALIGNCLIENT | CS_OWNDC)` regardless of | |
| 191 | + * what is specified here. | |
| 192 | + * \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL | |
| 193 | + * will use `GetModuleHandle(NULL)` instead. | |
| 194 | + * \returns 0 on success, -1 on error. SDL_GetError() may have details. | |
| 195 | + * | |
| 196 | + * \since This function is available since SDL 2.0.2. | |
| 197 | + */ | |
| 198 | +extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); | |
| 199 | + | |
| 200 | +/** | |
| 201 | + * Deregister the win32 window class from an SDL_RegisterApp call. | |
| 202 | + * | |
| 203 | + * This can be called to undo the effects of SDL_RegisterApp. | |
| 204 | + * | |
| 205 | + * Most applications do not need to, and should not, call this directly; SDL | |
| 206 | + * will call it when deinitializing the video subsystem. | |
| 207 | + * | |
| 208 | + * It is safe to call this multiple times, as long as every call is eventually | |
| 209 | + * paired with a prior call to SDL_RegisterApp. The window class will only be | |
| 210 | + * deregistered when the registration counter in SDL_RegisterApp decrements to | |
| 211 | + * zero through calls to this function. | |
| 212 | + * | |
| 213 | + * \since This function is available since SDL 2.0.2. | |
| 214 | + */ | |
| 215 | +extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); | |
| 216 | + | |
| 217 | +#endif /* defined(__WIN32__) || defined(__GDK__) */ | |
| 218 | + | |
| 219 | + | |
| 220 | +#ifdef __WINRT__ | |
| 221 | + | |
| 222 | +/** | |
| 223 | + * Initialize and launch an SDL/WinRT application. | |
| 224 | + * | |
| 225 | + * \param mainFunction the SDL app's C-style main(), an SDL_main_func. | |
| 226 | + * \param reserved reserved for future use; should be NULL. | |
| 227 | + * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve | |
| 228 | + * more information on the failure. | |
| 229 | + * | |
| 230 | + * \since This function is available since SDL 2.0.3. | |
| 231 | + */ | |
| 232 | +extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved); | |
| 233 | + | |
| 234 | +#endif /* __WINRT__ */ | |
| 235 | + | |
| 236 | +#if defined(__IPHONEOS__) | |
| 237 | + | |
| 238 | +/** | |
| 239 | + * Initializes and launches an SDL application. | |
| 240 | + * | |
| 241 | + * \param argc The argc parameter from the application's main() function. | |
| 242 | + * \param argv The argv parameter from the application's main() function. | |
| 243 | + * \param mainFunction The SDL app's C-style main(), an SDL_main_func. | |
| 244 | + * \return the return value from mainFunction. | |
| 245 | + * | |
| 246 | + * \since This function is available since SDL 2.0.10. | |
| 247 | + */ | |
| 248 | +extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction); | |
| 249 | + | |
| 250 | +#endif /* __IPHONEOS__ */ | |
| 251 | + | |
| 252 | +#ifdef __GDK__ | |
| 253 | + | |
| 254 | +/** | |
| 255 | + * Initialize and launch an SDL GDK application. | |
| 256 | + * | |
| 257 | + * \param mainFunction the SDL app's C-style main(), an SDL_main_func. | |
| 258 | + * \param reserved reserved for future use; should be NULL. | |
| 259 | + * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve | |
| 260 | + * more information on the failure. | |
| 261 | + * | |
| 262 | + * \since This function is available since SDL 2.24.0. | |
| 263 | + */ | |
| 264 | +extern DECLSPEC int SDLCALL SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved); | |
| 265 | + | |
| 266 | +/** | |
| 267 | + * Callback from the application to let the suspend continue. | |
| 268 | + * | |
| 269 | + * \since This function is available since SDL 2.28.0. | |
| 270 | + */ | |
| 271 | +extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); | |
| 272 | + | |
| 273 | +#endif /* __GDK__ */ | |
| 274 | + | |
| 275 | +#ifdef __cplusplus | |
| 276 | +} | |
| 277 | +#endif | |
| 278 | +#include "close_code.h" | |
| 279 | + | |
| 280 | +#endif /* SDL_main_h_ */ | |
| 281 | + | |
| 282 | +/* vi: set ts=4 sw=4 expandtab: */ |
| @@ -0,0 +1,196 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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_messagebox_h_ | |
| 23 | +#define SDL_messagebox_h_ | |
| 24 | + | |
| 25 | +#include "SDL_stdinc.h" | |
| 26 | +#include "SDL_video.h" /* For SDL_Window */ | |
| 27 | + | |
| 28 | +#include "begin_code.h" | |
| 29 | +/* Set up for C function definitions, even when using C++ */ | |
| 30 | +#ifdef __cplusplus | |
| 31 | +extern "C" { | |
| 32 | +#endif | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * SDL_MessageBox flags. | |
| 36 | + * | |
| 37 | + * If supported will display warning icon, etc. | |
| 38 | + */ | |
| 39 | +typedef enum SDL_MessageBoxFlags | |
| 40 | +{ | |
| 41 | + SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ | |
| 42 | + SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ | |
| 43 | + SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */ | |
| 44 | + SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */ | |
| 45 | + SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */ | |
| 46 | +} SDL_MessageBoxFlags; | |
| 47 | + | |
| 48 | +/** | |
| 49 | + * Flags for SDL_MessageBoxButtonData. | |
| 50 | + */ | |
| 51 | +typedef enum SDL_MessageBoxButtonFlags | |
| 52 | +{ | |
| 53 | + SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ | |
| 54 | + SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ | |
| 55 | +} SDL_MessageBoxButtonFlags; | |
| 56 | + | |
| 57 | +/** | |
| 58 | + * Individual button data. | |
| 59 | + */ | |
| 60 | +typedef struct SDL_MessageBoxButtonData | |
| 61 | +{ | |
| 62 | + Uint32 flags; /**< SDL_MessageBoxButtonFlags */ | |
| 63 | + int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ | |
| 64 | + const char * text; /**< The UTF-8 button text */ | |
| 65 | +} SDL_MessageBoxButtonData; | |
| 66 | + | |
| 67 | +/** | |
| 68 | + * RGB value used in a message box color scheme | |
| 69 | + */ | |
| 70 | +typedef struct SDL_MessageBoxColor | |
| 71 | +{ | |
| 72 | + Uint8 r, g, b; | |
| 73 | +} SDL_MessageBoxColor; | |
| 74 | + | |
| 75 | +typedef enum SDL_MessageBoxColorType | |
| 76 | +{ | |
| 77 | + SDL_MESSAGEBOX_COLOR_BACKGROUND, | |
| 78 | + SDL_MESSAGEBOX_COLOR_TEXT, | |
| 79 | + SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, | |
| 80 | + SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, | |
| 81 | + SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, | |
| 82 | + SDL_MESSAGEBOX_COLOR_MAX | |
| 83 | +} SDL_MessageBoxColorType; | |
| 84 | + | |
| 85 | +/** | |
| 86 | + * A set of colors to use for message box dialogs | |
| 87 | + */ | |
| 88 | +typedef struct SDL_MessageBoxColorScheme | |
| 89 | +{ | |
| 90 | + SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; | |
| 91 | +} SDL_MessageBoxColorScheme; | |
| 92 | + | |
| 93 | +/** | |
| 94 | + * MessageBox structure containing title, text, window, etc. | |
| 95 | + */ | |
| 96 | +typedef struct SDL_MessageBoxData | |
| 97 | +{ | |
| 98 | + Uint32 flags; /**< SDL_MessageBoxFlags */ | |
| 99 | + SDL_Window *window; /**< Parent window, can be NULL */ | |
| 100 | + const char *title; /**< UTF-8 title */ | |
| 101 | + const char *message; /**< UTF-8 message text */ | |
| 102 | + | |
| 103 | + int numbuttons; | |
| 104 | + const SDL_MessageBoxButtonData *buttons; | |
| 105 | + | |
| 106 | + const SDL_MessageBoxColorScheme *colorScheme; /**< SDL_MessageBoxColorScheme, can be NULL to use system settings */ | |
| 107 | +} SDL_MessageBoxData; | |
| 108 | + | |
| 109 | +/** | |
| 110 | + * Create a modal message box. | |
| 111 | + * | |
| 112 | + * If your needs aren't complex, it might be easier to use | |
| 113 | + * SDL_ShowSimpleMessageBox. | |
| 114 | + * | |
| 115 | + * This function should be called on the thread that created the parent | |
| 116 | + * window, or on the main thread if the messagebox has no parent. It will | |
| 117 | + * block execution of that thread until the user clicks a button or closes the | |
| 118 | + * messagebox. | |
| 119 | + * | |
| 120 | + * This function may be called at any time, even before SDL_Init(). This makes | |
| 121 | + * it useful for reporting errors like a failure to create a renderer or | |
| 122 | + * OpenGL context. | |
| 123 | + * | |
| 124 | + * On X11, SDL rolls its own dialog box with X11 primitives instead of a | |
| 125 | + * formal toolkit like GTK+ or Qt. | |
| 126 | + * | |
| 127 | + * Note that if SDL_Init() would fail because there isn't any available video | |
| 128 | + * target, this function is likely to fail for the same reasons. If this is a | |
| 129 | + * concern, check the return value from this function and fall back to writing | |
| 130 | + * to stderr if you can. | |
| 131 | + * | |
| 132 | + * \param messageboxdata the SDL_MessageBoxData structure with title, text and | |
| 133 | + * other options. | |
| 134 | + * \param buttonid the pointer to which user id of hit button should be | |
| 135 | + * copied. | |
| 136 | + * \returns 0 on success or a negative error code on failure; call | |
| 137 | + * SDL_GetError() for more information. | |
| 138 | + * | |
| 139 | + * \since This function is available since SDL 2.0.0. | |
| 140 | + * | |
| 141 | + * \sa SDL_ShowSimpleMessageBox | |
| 142 | + */ | |
| 143 | +extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); | |
| 144 | + | |
| 145 | +/** | |
| 146 | + * Display a simple modal message box. | |
| 147 | + * | |
| 148 | + * If your needs aren't complex, this function is preferred over | |
| 149 | + * SDL_ShowMessageBox. | |
| 150 | + * | |
| 151 | + * `flags` may be any of the following: | |
| 152 | + * | |
| 153 | + * - `SDL_MESSAGEBOX_ERROR`: error dialog | |
| 154 | + * - `SDL_MESSAGEBOX_WARNING`: warning dialog | |
| 155 | + * - `SDL_MESSAGEBOX_INFORMATION`: informational dialog | |
| 156 | + * | |
| 157 | + * This function should be called on the thread that created the parent | |
| 158 | + * window, or on the main thread if the messagebox has no parent. It will | |
| 159 | + * block execution of that thread until the user clicks a button or closes the | |
| 160 | + * messagebox. | |
| 161 | + * | |
| 162 | + * This function may be called at any time, even before SDL_Init(). This makes | |
| 163 | + * it useful for reporting errors like a failure to create a renderer or | |
| 164 | + * OpenGL context. | |
| 165 | + * | |
| 166 | + * On X11, SDL rolls its own dialog box with X11 primitives instead of a | |
| 167 | + * formal toolkit like GTK+ or Qt. | |
| 168 | + * | |
| 169 | + * Note that if SDL_Init() would fail because there isn't any available video | |
| 170 | + * target, this function is likely to fail for the same reasons. If this is a | |
| 171 | + * concern, check the return value from this function and fall back to writing | |
| 172 | + * to stderr if you can. | |
| 173 | + * | |
| 174 | + * \param flags an SDL_MessageBoxFlags value. | |
| 175 | + * \param title UTF-8 title text. | |
| 176 | + * \param message UTF-8 message text. | |
| 177 | + * \param window the parent window, or NULL for no parent. | |
| 178 | + * \returns 0 on success or a negative error code on failure; call | |
| 179 | + * SDL_GetError() for more information. | |
| 180 | + * | |
| 181 | + * \since This function is available since SDL 2.0.0. | |
| 182 | + * | |
| 183 | + * \sa SDL_ShowMessageBox | |
| 184 | + */ | |
| 185 | +extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); | |
| 186 | + | |
| 187 | + | |
| 188 | +/* Ends C function definitions when using C++ */ | |
| 189 | +#ifdef __cplusplus | |
| 190 | +} | |
| 191 | +#endif | |
| 192 | +#include "close_code.h" | |
| 193 | + | |
| 194 | +#endif /* SDL_messagebox_h_ */ | |
| 195 | + | |
| 196 | +/* vi: set ts=4 sw=4 expandtab: */ |
長いので途中までです
| @@ -0,0 +1,114 @@ | ||
| 1 | +/* | |
| 2 | + Simple DirectMedia Layer | |
| 3 | + Copyright (C) 1997-2025 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 | + * # CategoryMetal | |
| 24 | + * | |
| 25 | + * Header file for functions to creating Metal layers and views on SDL | |
| 26 | + * windows. | |
| 27 | + */ | |
| 28 | + | |
| 29 | +#ifndef SDL_metal_h_ | |
| 30 | +#define SDL_metal_h_ | |
| 31 | + | |
| 32 | +#include "SDL_video.h" | |
| 33 | + | |
| 34 | +#include "begin_code.h" | |
| 35 | +/* Set up for C function definitions, even when using C++ */ | |
| 36 | +#ifdef __cplusplus | |
| 37 | +extern "C" { | |
| 38 | +#endif | |
| 39 | + | |
| 40 | +/** | |
| 41 | + * A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). | |
| 42 | + * | |
| 43 | + * This can be cast directly to an NSView or UIView. | |
| 44 | + */ | |
| 45 | +typedef void *SDL_MetalView; | |
| 46 | + | |
| 47 | +/** | |
| 48 | + * \name Metal support functions | |
| 49 | + */ | |
| 50 | +/* @{ */ | |
| 51 | + | |
| 52 | +/** | |
| 53 | + * Create a CAMetalLayer-backed NSView/UIView and attach it to the specified | |
| 54 | + * window. | |
| 55 | + * | |
| 56 | + * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on | |
| 57 | + * its own. It is up to user code to do that. | |
| 58 | + * | |
| 59 | + * The returned handle can be casted directly to a NSView or UIView. To access | |
| 60 | + * the backing CAMetalLayer, call SDL_Metal_GetLayer(). | |
| 61 | + * | |
| 62 | + * \since This function is available since SDL 2.0.12. | |
| 63 | + * | |
| 64 | + * \sa SDL_Metal_DestroyView | |
| 65 | + * \sa SDL_Metal_GetLayer | |
| 66 | + */ | |
| 67 | +extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window); | |
| 68 | + | |
| 69 | +/** | |
| 70 | + * Destroy an existing SDL_MetalView object. | |
| 71 | + * | |
| 72 | + * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was | |
| 73 | + * called after SDL_CreateWindow. | |
| 74 | + * | |
| 75 | + * \since This function is available since SDL 2.0.12. | |
| 76 | + * | |
| 77 | + * \sa SDL_Metal_CreateView | |
| 78 | + */ | |
| 79 | +extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); | |
| 80 | + | |
| 81 | +/** | |
| 82 | + * Get a pointer to the backing CAMetalLayer for the given view. | |
| 83 | + * | |
| 84 | + * \since This function is available since SDL 2.0.14. | |
| 85 | + * | |
| 86 | + * \sa SDL_Metal_CreateView | |
| 87 | + */ | |
| 88 | +extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); | |
| 89 | + | |
| 90 | +/** | |
| 91 | + * Get the size of a window's underlying drawable in pixels (for use with | |
| 92 | + * setting viewport, scissor & etc). | |
| 93 | + * | |
| 94 | + * \param window SDL_Window from which the drawable size should be queried. | |
| 95 | + * \param w Pointer to variable for storing the width in pixels, may be NULL. | |
| 96 | + * \param h Pointer to variable for storing the height in pixels, may be NULL. | |
| 97 | + * | |
| 98 | + * \since This function is available since SDL 2.0.14. | |
| 99 | + * | |
| 100 | + * \sa SDL_GetWindowSize | |
| 101 | + * \sa SDL_CreateWindow | |
| 102 | + */ | |
| 103 | +extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w, | |
| 104 | + int *h); | |
| 105 | + | |
| 106 | +/* @} *//* Metal support functions */ | |
| 107 | + | |
| 108 | +/* Ends C function definitions when using C++ */ | |
| 109 | +#ifdef __cplusplus | |
| 110 | +} | |
| 111 | +#endif | |
| 112 | +#include "close_code.h" | |
| 113 | + | |
| 114 | +#endif /* SDL_metal_h_ */ |
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
バイナリファイル
バイナリファイル
バイナリファイル
バイナリファイル
バイナリファイル
バイナリファイル
バイナリファイル
バイナリファイル
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません
差分が多過ぎるので表示しません