├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ ├── generate_docs.yml │ ├── pypi_deploy.yml │ └── run_tests.yml ├── .gitignore ├── .readthedocs.yml ├── LICENSE ├── Makefile ├── README.md ├── TODO.md ├── callback.py ├── docs ├── conf.py ├── index.rst ├── install.rst ├── modules │ ├── index.rst │ ├── sdl3.rst │ ├── sdl3_image.rst │ ├── sdl3_mixer.rst │ ├── sdl3_net.rst │ ├── sdl3_rtf.rst │ ├── sdl3_shadercross.rst │ └── sdl3_ttf.rst └── requirements.txt ├── example.py ├── gpu.py ├── opengl.py ├── pyproject.toml ├── res ├── example.png ├── example.ttf ├── logo.png ├── snippet.png └── voice │ ├── apu_fire.wav │ ├── engine_fire_left.wav │ └── engine_fire_right.wav ├── sdl3 ├── SDL.py ├── SDL_assert.py ├── SDL_asyncio.py ├── SDL_atomic.py ├── SDL_audio.py ├── SDL_bits.py ├── SDL_blendmode.py ├── SDL_camera.py ├── SDL_clipboard.py ├── SDL_cpuinfo.py ├── SDL_dialog.py ├── SDL_endian.py ├── SDL_error.py ├── SDL_events.py ├── SDL_filesystem.py ├── SDL_gamepad.py ├── SDL_gpu.py ├── SDL_guid.py ├── SDL_haptic.py ├── SDL_hidapi.py ├── SDL_hints.py ├── SDL_image.py ├── SDL_init.py ├── SDL_iostream.py ├── SDL_joystick.py ├── SDL_keyboard.py ├── SDL_keycode.py ├── SDL_loadso.py ├── SDL_locale.py ├── SDL_log.py ├── SDL_main.py ├── SDL_main_impl.py ├── SDL_messagebox.py ├── SDL_metal.py ├── SDL_misc.py ├── SDL_mixer.py ├── SDL_mouse.py ├── SDL_mutex.py ├── SDL_net.py ├── SDL_pen.py ├── SDL_pixels.py ├── SDL_platform.py ├── SDL_power.py ├── SDL_process.py ├── SDL_properties.py ├── SDL_rect.py ├── SDL_render.py ├── SDL_rtf.py ├── SDL_scancode.py ├── SDL_sensor.py ├── SDL_shadercross.py ├── SDL_stdinc.py ├── SDL_storage.py ├── SDL_surface.py ├── SDL_system.py ├── SDL_textengine.py ├── SDL_thread.py ├── SDL_time.py ├── SDL_timer.py ├── SDL_touch.py ├── SDL_tray.py ├── SDL_ttf.py ├── SDL_version.py ├── SDL_video.py ├── SDL_vulkan.py └── __init__.py ├── shader.py └── tests ├── TEST_init.py ├── TEST_locale.py ├── TEST_version.py ├── TEST_video.py └── __init__.py /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: ausreich 2 | buy_me_a_coffee: aermoss 3 | -------------------------------------------------------------------------------- /.github/workflows/generate_docs.yml: -------------------------------------------------------------------------------- 1 | name: Generate Docs 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | build: 9 | runs-on: ${{matrix.os}} 10 | 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | system: [Linux, Darwin, Windows] 15 | 16 | include: 17 | - system: Linux 18 | os: ubuntu-latest 19 | 20 | - system: Darwin 21 | os: macos-latest 22 | 23 | - system: Windows 24 | os: windows-latest 25 | 26 | steps: 27 | - name: Checkout code. 28 | uses: actions/checkout@v4 29 | 30 | - name: Set up python. 31 | uses: actions/setup-python@v5 32 | with: 33 | python-version: "3.13" 34 | 35 | - name: Install dependencies. 36 | shell: bash 37 | run: python -m pip install . 38 | 39 | - name: Generate docs. 40 | shell: bash 41 | run: python -c "import sdl3" 42 | env: 43 | SDL_GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}} 44 | SDL_CTYPES_ALIAS_FIX: "1" 45 | 46 | - name: Upload asset. 47 | uses: actions/upload-release-asset@v1 48 | with: 49 | upload_url: ${{github.event.release.upload_url}} 50 | asset_path: sdl3/__doc__.py 51 | asset_name: ${{matrix.system}}-Docs.py 52 | asset_content_type: text/plain 53 | env: 54 | GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}} -------------------------------------------------------------------------------- /.github/workflows/pypi_deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy 2 | 3 | on: 4 | workflow_run: 5 | workflows: ["Generate Docs"] 6 | types: [completed] 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | deploy: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Check workflow run conclusion. 17 | if: github.event.workflow_run.conclusion != 'success' 18 | run: exit 1 19 | 20 | - name: Checkout code. 21 | uses: actions/checkout@v4 22 | 23 | - name: Set up Python. 24 | uses: actions/setup-python@v5 25 | with: 26 | python-version: "3.13" 27 | 28 | - name: Install dependencies. 29 | run: python -m pip install --upgrade pip build 30 | 31 | - name: Build package. 32 | run: python -m build 33 | 34 | - name: Publish package. 35 | uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 36 | with: 37 | user: __token__ 38 | password: ${{secrets.PYPI_API_TOKEN}} -------------------------------------------------------------------------------- /.github/workflows/run_tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | workflow_run: 5 | workflows: ["Generate Docs"] 6 | types: [completed] 7 | 8 | pull_request: 9 | branches: [main] 10 | 11 | push: 12 | branches: [main] 13 | 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | tests: 19 | runs-on: ${{matrix.os}} 20 | 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | os: [ubuntu-24.04, ubuntu-24.04-arm, macos-13, macos-15, windows-2025] 25 | version: ["3.10", "3.11", "3.12", "3.13"] 26 | 27 | steps: 28 | - name: Checkout code. 29 | uses: actions/checkout@v4 30 | 31 | - name: Set up Python ${{matrix.version}}. 32 | uses: actions/setup-python@v5 33 | with: 34 | python-version: ${{matrix.version}} 35 | 36 | - name: Install dependencies. 37 | shell: bash 38 | run: python -m pip install . 39 | 40 | - name: Run tests. 41 | shell: bash 42 | run: python -c "import tests" 43 | env: 44 | SDL_DOC_GENERATOR: ${{github.event_name == 'workflow_run' && '1' || '0'}} 45 | SDL_GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | shaders/ 2 | sdl3/bin/ 3 | docs/temp/ 4 | docs/build/ 5 | sdl3/__doc__.py 6 | sdl3/__pycache__/ 7 | tests/__pycache__/ 8 | __pycache__/ 9 | embed.py 10 | *.pyc 11 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | build: 4 | os: ubuntu-24.04 5 | tools: 6 | python: "3.13" 7 | 8 | sphinx: 9 | configuration: docs/conf.py 10 | 11 | python: 12 | install: 13 | - requirements: docs/requirements.txt -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024-2025 Yusuf Rençber 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | sourceDir := docs 2 | buildDir := docs/build 3 | 4 | help: 5 | @sphinx-build -M help "$(sourceDir)" "$(buildDir)" 6 | 7 | .PHONY: help Makefile 8 | 9 | %: Makefile 10 | @sphinx-build -M $@ "$(sourceDir)" "$(buildDir)" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PySDL3 2 | 3 | [![Logo](https://github.com/Aermoss/PySDL3/blob/main/res/logo.png?raw=true)](https://github.com/Aermoss/PySDL3) 4 | 5 | [![Tests](https://github.com/Aermoss/PySDL3/actions/workflows/run_tests.yml/badge.svg)](https://github.com/Aermoss/PySDL3/actions/workflows/run_tests.yml) 6 | [![PyPI Python Versions](https://img.shields.io/pypi/pyversions/PySDL3)](https://pypi.org/project/PySDL3) 7 | [![PyPI Version](https://img.shields.io/pypi/v/PySDL3.svg)](https://pypi.org/project/PySDL3) 8 | [![PyPI Downloads](https://img.shields.io/pypi/dm/PySDL3.svg)](https://pypi.org/project/PySDL3) 9 | [![PyPI Status](https://img.shields.io/pypi/status/PySDL3.svg)](https://pypi.org/project/PySDL3) 10 | 11 | PySDL3 is a pure Python wrapper around the SDL3, SDL3\_image, SDL3\_mixer, SDL3\_ttf, SDL3\_rtf, SDL3\_net and SDL3\_shadercross libraries. 12 | It uses the built-in ctypes library to interface with SDL3 while providing an **understandable** function definition with docstrings, argument names and type hints, like this: 13 | 14 | [![Screenshot](https://github.com/Aermoss/PySDL3/blob/main/res/snippet.png?raw=true)](https://github.com/Aermoss/PySDL3/blob/main/gpu.py) 15 | 16 | ## Getting Started 17 | Just run one of the following commands in a terminal: 18 | ```bash 19 | # To install the latest stable version from PyPI: 20 | pip install --upgrade PySDL3 21 | 22 | # To install the latest development version from GitHub: 23 | pip install --upgrade git+https://github.com/Aermoss/PySDL3.git 24 | ``` 25 | 26 | ## Requirements 27 | There are no additional requirements since PySDL3 will download all the necessary binaries for you on the first run. 28 | 29 | *SDL3 binaries will be downloaded from [PySDL3-Build](https://github.com/Aermoss/PySDL3-Build) repository, if you want to use your own binaries please read the [documentation](https://pysdl3.readthedocs.io/en/latest/install.html#custom-binaries).* 30 | 31 | ### Supported Platforms: 32 | * **Linux** (AMD64, ARM64) 33 | * **Windows** (AMD64, ARM64) 34 | * **Darwin** (AMD64, ARM64) 35 | 36 | ## Documentation 37 | The [documentation of PySDL3](https://pysdl3.readthedocs.io) can be found at: https://pysdl3.readthedocs.io. 38 | 39 | *If you can't find what you are looking for there, it is highly recommended to look at the [official documentation of SDL3](https://wiki.libsdl.org/SDL3) since everything is defined exactly the same.* 40 | 41 | ## License 42 | PySDL3 is available under the MIT license, see the [LICENSE](https://github.com/Aermoss/PySDL3/blob/main/LICENSE) file for more information. -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | - [x] Add 'SDL_shadercross' implementation. -------------------------------------------------------------------------------- /callback.py: -------------------------------------------------------------------------------- 1 | import os, ctypes, time 2 | 3 | os.environ["SDL_MAIN_USE_CALLBACKS"] = "1" 4 | 5 | import sdl3, colorsys 6 | 7 | class AppState(ctypes.Structure): 8 | _fields_ = [ 9 | ("window", sdl3.LP_SDL_Window), 10 | ("renderer", sdl3.LP_SDL_Renderer) 11 | ] 12 | 13 | def SDL_AppInit(appstate: sdl3.LP_c_void_p, argc: ctypes.c_int, argv: sdl3.LP_c_char_p) -> sdl3.SDL_AppResult: 14 | appstate[0] = ctypes.cast(ctypes.pointer(state := AppState()), ctypes.c_void_p) 15 | 16 | if not sdl3.SDL_Init(sdl3.SDL_INIT_VIDEO): 17 | sdl3.SDL_Log("Couldn't initialize SDL: %s.".encode(), sdl3.SDL_GetError()) 18 | return sdl3.SDL_APP_FAILURE 19 | 20 | if not sdl3.SDL_CreateWindowAndRenderer("Aermoss".encode(), 1600, 900, 0, ctypes.byref(state.window), ctypes.byref(state.renderer)): 21 | sdl3.SDL_Log("Couldn't create window/renderer: %s.".encode(), sdl3.SDL_GetError()) 22 | return sdl3.SDL_APP_FAILURE 23 | 24 | return sdl3.SDL_APP_CONTINUE 25 | 26 | def SDL_AppEvent(appstate: ctypes.c_void_p, event: sdl3.LP_SDL_Event) -> sdl3.SDL_AppResult: 27 | if sdl3.SDL_DEREFERENCE(event).type == sdl3.SDL_EVENT_QUIT: 28 | return sdl3.SDL_APP_SUCCESS 29 | 30 | return sdl3.SDL_APP_CONTINUE 31 | 32 | def SDL_AppIterate(appstate: ctypes.c_void_p) -> sdl3.SDL_AppResult: 33 | state: AppState = sdl3.SDL_DEREFERENCE(ctypes.cast(appstate, sdl3.SDL_POINTER[AppState])) 34 | sdl3.SDL_SetRenderDrawColorFloat(state.renderer, *colorsys.hsv_to_rgb(time.time() / 3.0 % 1.0, 1.0, 0.1), sdl3.SDL_ALPHA_OPAQUE_FLOAT) 35 | sdl3.SDL_RenderClear(state.renderer) 36 | sdl3.SDL_RenderPresent(state.renderer) 37 | return sdl3.SDL_APP_CONTINUE 38 | 39 | def SDL_AppQuit(appstate: ctypes.c_void_p, result: sdl3.SDL_AppResult) -> None: 40 | ... -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | import os, sys 2 | 3 | sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "temp"))) 4 | sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) 5 | 6 | os.environ["SDL_DOC_GENERATOR"] = "0" 7 | os.environ["SDL_CTYPES_ALIAS_FIX"] = "1" 8 | os.environ["SDL_DISABLE_METADATA"] = "1" 9 | os.environ["SDL_PLATFORM_AGNOSTIC"] = "1" 10 | os.environ["SDL_IGNORE_MISSING_FUNCTIONS"] = "1" 11 | os.environ["SDL_CHECK_BINARY_VERSION"] = "0" 12 | os.environ["SDL_DOWNLOAD_BINARIES"] = "0" 13 | os.environ["SDL_FIND_BINARIES"] = "0" 14 | os.makedirs("temp", exist_ok = True) 15 | 16 | import sdl3 17 | 18 | for i in list(sdl3.SDL_BINARY_VAR_MAP_INV.keys()): 19 | with open(f"temp/{i}.py", "w") as file: 20 | file.write(sdl3.SDL_GENERATE_DOCS([i], rst = True)) 21 | 22 | project = "PySDL3" 23 | copyright = "2025, Yusuf Rençber" 24 | author = "Yusuf Rençber" 25 | release = sdl3.__version__ 26 | 27 | extensions = [ 28 | "sphinx.ext.autodoc", 29 | "sphinx.ext.autosummary", 30 | "sphinx.ext.inheritance_diagram", 31 | "sphinx.ext.intersphinx", 32 | "sphinx.ext.viewcode", 33 | "sphinx.ext.napoleon", 34 | "sphinx.ext.todo" 35 | ] 36 | 37 | templates_path = [] 38 | exclude_patterns = ["build"] 39 | 40 | language = "en" 41 | pygments_style = None 42 | 43 | html_theme = "sphinx_rtd_theme" 44 | html_static_path = [] -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | PySDL3 Documentation 2 | ==================== 3 | PySDL3 is a pure Python wrapper around the SDL3, SDL3_image, SDL3_mixer, SDL3_ttf, SDL3_rtf, SDL3_net and SDL3_shadercross libraries. 4 | It uses the built-in ctypes library to interface with SDL3 while providing an **understandable** function definition with docstrings, argument names and type hints, like this: 5 | 6 | .. image:: ../res/snippet.png 7 | 8 | Getting Started 9 | =============== 10 | 11 | .. toctree:: 12 | :maxdepth: 3 13 | 14 | install.rst 15 | 16 | API Reference 17 | ============= 18 | 19 | .. toctree:: 20 | :maxdepth: 2 21 | 22 | modules/index.rst -------------------------------------------------------------------------------- /docs/install.rst: -------------------------------------------------------------------------------- 1 | Installing PySDL3 2 | ================= 3 | This page shows how to install PySDL3 and how to use your own binaries with it. 4 | 5 | From PyPI 6 | --------- 7 | You can download the latest stable version of PySDL3 from PyPI_ using the following command: :: 8 | 9 | pip install --upgrade PySDL3 10 | 11 | *Please note that PySDL3 may not yet be available for your platform, please read the prerequisites section below.* 12 | 13 | From GitHub 14 | ----------- 15 | You can download the latest development version of PySDL3 from GitHub_ with the following command: :: 16 | 17 | pip install --upgrade git+https://github.com/Aermoss/PySDL3.git 18 | 19 | *Please note that downloading the latest development version may cause PySDL3 to have unexpected bugs.* 20 | 21 | Prerequisites 22 | ------------- 23 | For PySDL3 to run properly, you must be using at least **Python 3.10** and one of the following platforms: 24 | 25 | * **Linux** (AMD64, ARM64) 26 | * **Windows** (AMD64, ARM64) 27 | * **Darwin** (AMD64, ARM64) 28 | 29 | PySDL3 will download all the necessary binaries for you on the first run, if you want to use your own binaries read the following section. 30 | 31 | Custom Binaries 32 | --------------- 33 | There are two methods to use your own binaries with PySDL3, the metadata method and the environment variable method. 34 | 35 | .. highlight:: json 36 | 37 | The Metadata Method 38 | ~~~~~~~~~~~~~~~~~~~ 39 | The metadata method was developed to allow PySDL3 to automatically download and manage its own binaries. 40 | To use this method, you need to create a file named ``metadata.json`` in the binary path, as follows: :: 41 | 42 | { 43 | "system": "Darwin", 44 | "arch": "ARM64", 45 | "target": "v0.9.4b5", 46 | "files": [ 47 | "./libSDL3.dylib", 48 | "./libSDL3_image.dylib", 49 | "./libSDL3_mixer.dylib", 50 | "./libSDL3_ttf.dylib" 51 | ], 52 | "repair": true, 53 | "find": true 54 | } 55 | 56 | The ``files`` list must contain the names of the binaries **you want to use** and the ``system`` and ``arch`` fields must match your platform. 57 | The ``repair`` field allows files to be downloaded if they are missing (with ``SDL_DOWNLOAD_BINARIES``, enabled by default), and the ``find`` field allows 58 | missing files to be searched in the system libraries (with ``SDL_FIND_BINARIES``, enabled by default), ``files`` list can be empty while using ``find`` feature. 59 | The ``target`` field is optional and can be used to specify the target PySDL3 version for the binaries. 60 | 61 | PySDL3 will automatically start downloading new binaries if the current version is higher from the specified target version or 62 | if it cannot find the ``metadata.json`` file **or the binaries specified by it** (when repair enabled) in the binary path ("sdl3/bin" by default). 63 | 64 | *Please note that PySDL3 will download all 6 binaries (when repair mode enabled) and overwrite any existing ones.* 65 | 66 | You can disable this behavior also by setting the ``SDL_DOWNLOAD_BINARIES`` environment variable to "0" 67 | but still make sure you have all binaries specified in the ``metadata.json`` file installed, otherwise some modules will be disabled. 68 | 69 | .. highlight:: python 70 | 71 | The Environment Variable Method 72 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | The environment variable method is the easiest and recommended way to use your own binaries with PySDL3. 74 | In order to use this method, you just need to set ``SDL_DISABLE_METADATA`` to "1" as follows: :: 75 | 76 | import os 77 | 78 | os.environ["SDL_DISABLE_METADATA"] = "1" # Disable metadata method, "0" by default. 79 | os.environ["SDL_BINARY_PATH"] = "/path/to/your/binaries" # Set the path to your binaries, "sdl3/bin" by default. 80 | os.environ["SDL_CHECK_BINARY_VERSION"] = "0" # Disable binary version checking, "1" by default. 81 | os.environ["SDL_IGNORE_MISSING_FUNCTIONS"] = "1" # Disable missing function warnings, "1" by default. 82 | os.environ["SDL_FIND_BINARIES"] = "1" # Search for binaries in the system libraries, "1" by default. 83 | 84 | import sdl3 85 | 86 | ... 87 | 88 | PySDL3 will search for the binaries in the binary path and (if ``SDL_FIND_BINARIES`` is set to "1") in the system libraries. 89 | If a binary is missing, the corresponding module will be automatically disabled (binaries will not be downloaded automatically in this method). 90 | 91 | *Please note that using an older binary version may cause unexpected behavior.* 92 | 93 | .. _PyPI: https://pypi.org/project/PySDL3 94 | .. _GitHub: https://github.com/Aermoss/PySDL3 -------------------------------------------------------------------------------- /docs/modules/index.rst: -------------------------------------------------------------------------------- 1 | API Reference 2 | ============= 3 | This page is under development. 4 | 5 | .. toctree:: 6 | :maxdepth: 1 7 | 8 | sdl3.rst 9 | sdl3_image.rst 10 | sdl3_mixer.rst 11 | sdl3_ttf.rst 12 | sdl3_rtf.rst 13 | sdl3_net.rst 14 | sdl3_shadercross.rst -------------------------------------------------------------------------------- /docs/modules/sdl3.rst: -------------------------------------------------------------------------------- 1 | SDL3 2 | ==== 3 | This page is under development. 4 | 5 | .. automodule:: SDL3 6 | :members: 7 | :undoc-members: -------------------------------------------------------------------------------- /docs/modules/sdl3_image.rst: -------------------------------------------------------------------------------- 1 | SDL3_image 2 | ========== 3 | This page is under development. 4 | 5 | .. automodule:: SDL3_image 6 | :members: 7 | :undoc-members: -------------------------------------------------------------------------------- /docs/modules/sdl3_mixer.rst: -------------------------------------------------------------------------------- 1 | SDL3_mixer 2 | ========== 3 | This page is under development. 4 | 5 | .. automodule:: SDL3_mixer 6 | :members: 7 | :undoc-members: -------------------------------------------------------------------------------- /docs/modules/sdl3_net.rst: -------------------------------------------------------------------------------- 1 | SDL3_net 2 | ======== 3 | This page is under development. 4 | 5 | .. automodule:: SDL3_net 6 | :members: 7 | :undoc-members: -------------------------------------------------------------------------------- /docs/modules/sdl3_rtf.rst: -------------------------------------------------------------------------------- 1 | SDL3_rtf 2 | ======== 3 | This page is under development. 4 | 5 | .. automodule:: SDL3_rtf 6 | :members: 7 | :undoc-members: -------------------------------------------------------------------------------- /docs/modules/sdl3_shadercross.rst: -------------------------------------------------------------------------------- 1 | SDL3_shadercross 2 | ================ 3 | This page is under development. 4 | 5 | .. automodule:: SDL3_shadercross 6 | :members: 7 | :undoc-members: -------------------------------------------------------------------------------- /docs/modules/sdl3_ttf.rst: -------------------------------------------------------------------------------- 1 | SDL3_ttf 2 | ======== 3 | This page is under development. 4 | 5 | .. automodule:: SDL3_ttf 6 | :members: 7 | :undoc-members: -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx-rtd-theme 2 | requests 3 | aiohttp 4 | packaging -------------------------------------------------------------------------------- /example.py: -------------------------------------------------------------------------------- 1 | import os, sdl3, ctypes, colorsys, time 2 | 3 | @sdl3.SDL_main_func 4 | def main(argc: ctypes.c_int, argv: sdl3.LP_c_char_p) -> ctypes.c_int: 5 | print(f"Total lines of code: {sum([len(open(f'sdl3/{i}', 'r').readlines()) for i in os.listdir('sdl3') if i.endswith('.py')])}.") 6 | print(f"Loaded {sum(len(v) for k, v in sdl3.functions.items())} functions.") 7 | 8 | if not sdl3.SDL_Init(sdl3.SDL_INIT_VIDEO | sdl3.SDL_INIT_EVENTS | sdl3.SDL_INIT_AUDIO): 9 | print(f"Failed to initialize library: {sdl3.SDL_GetError().decode()}.") 10 | return -1 11 | 12 | window = sdl3.SDL_CreateWindow("Aermoss".encode(), 1600, 900, sdl3.SDL_WINDOW_RESIZABLE) 13 | 14 | renderDrivers = [sdl3.SDL_GetRenderDriver(i).decode() for i in range(sdl3.SDL_GetNumRenderDrivers())] 15 | tryGetDriver, tryUseVulkan = lambda order, drivers: next((i for i in order if i in drivers), None), False 16 | renderDriver = tryGetDriver((["vulkan"] if tryUseVulkan else []) + ["opengl", "software"], renderDrivers) 17 | print(f"Available render drivers: {', '.join(renderDrivers)} (current: {renderDriver}).") 18 | 19 | if not (renderer := sdl3.SDL_CreateRenderer(window, renderDriver.encode())): 20 | print(f"Failed to create renderer: {sdl3.SDL_GetError().decode()}.") 21 | return -1 22 | 23 | audioDrivers = [sdl3.SDL_GetAudioDriver(i).decode() for i in range(sdl3.SDL_GetNumAudioDrivers())] 24 | print(f"Available audio drivers: {', '.join(audioDrivers)} (current: {sdl3.SDL_GetCurrentAudioDriver().decode()}).") 25 | 26 | if currentAudioDevice := sdl3.SDL_OpenAudioDevice(sdl3.SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, None): 27 | sdl3.Mix_Init(sdl3.MIX_INIT_WAVPACK) 28 | sdl3.Mix_OpenAudio(currentAudioDevice, ctypes.byref(audioSpec := sdl3.SDL_AudioSpec())) 29 | print(f"Current audio device: {sdl3.SDL_GetAudioDeviceName(currentAudioDevice).decode()}.") 30 | chunks = [sdl3.Mix_LoadWAV(f"res/voice/{i}".encode()) for i in os.listdir("res/voice")] 31 | currentIndex, channel = 0, 0 32 | 33 | else: 34 | print(f"Failed to open audio device: {sdl3.SDL_GetAudioDeviceName(sdl3.SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK).decode()}, error: {sdl3.SDL_GetError().decode()}.") 35 | 36 | surface = sdl3.IMG_Load("res/example.png".encode()) 37 | texture = sdl3.SDL_CreateTextureFromSurface(renderer, surface) 38 | 39 | rect = sdl3.SDL_Rect() 40 | sdl3.SDL_GetSurfaceClipRect(surface, ctypes.byref(rect)) 41 | 42 | frect = sdl3.SDL_FRect() 43 | sdl3.SDL_RectToFRect(ctypes.byref(rect), ctypes.byref(frect)) 44 | running, hue, lastTime, scale = True, 0.0, time.time(), 0.75 45 | 46 | sdl3.TTF_Init() 47 | font = sdl3.TTF_OpenFont("res/example.ttf".encode(), 32.0) 48 | 49 | frames, frameCooldown = 0.0, 1.0 50 | textTexture, textFRect = None, sdl3.SDL_FRect() 51 | sinceLastFrame = frameCooldown 52 | event = sdl3.SDL_Event() 53 | 54 | while running: 55 | while sdl3.SDL_PollEvent(ctypes.byref(event)): 56 | match event.type: 57 | case sdl3.SDL_EVENT_QUIT: 58 | running = False 59 | 60 | case sdl3.SDL_EVENT_KEY_DOWN: 61 | if event.key.key in [sdl3.SDLK_ESCAPE]: 62 | running = False 63 | 64 | width, height = ctypes.c_int(), ctypes.c_int() 65 | sdl3.SDL_GetWindowSize(window, width, height) 66 | 67 | frect.w, frect.h = frect.w * width.value / frect.w * scale, frect.h * width.value / frect.w * scale 68 | frect.x, frect.y = width.value / 2 - frect.w / 2, height.value / 2 - frect.h / 2 69 | 70 | if currentAudioDevice and not sdl3.Mix_Playing(channel): 71 | channel = sdl3.Mix_PlayChannel(-1, chunks[currentIndex], 1) 72 | if (currentIndex := currentIndex + 1) >= len(chunks): currentIndex = 0 73 | 74 | lastTime, deltaTime = time.time(), time.time() - lastTime 75 | hue, frames = (hue + 0.5 * deltaTime) % 1.0, frames + 1.0 76 | sdl3.SDL_SetRenderDrawColorFloat(renderer, *colorsys.hsv_to_rgb(hue, 1.0, 0.1), 1.0) 77 | sdl3.SDL_RenderClear(renderer) 78 | sdl3.SDL_RenderTexture(renderer, texture, None, ctypes.byref(frect)) 79 | sinceLastFrame += deltaTime 80 | 81 | if sinceLastFrame >= frameCooldown: 82 | framesPerSecond = int(frames / sinceLastFrame) 83 | sinceLastFrame, frames = 0.0, 0.0 84 | 85 | if textTexture is not None: 86 | sdl3.SDL_DestroySurface(textSurface) 87 | sdl3.SDL_DestroyTexture(textTexture) 88 | 89 | textSurface = sdl3.TTF_RenderText_Blended(font, f"FPS: {framesPerSecond}".encode(), 0, sdl3.SDL_Color(255, 255, 255, 255)) 90 | textTexture = sdl3.SDL_CreateTextureFromSurface(renderer, textSurface) 91 | 92 | textRect = sdl3.SDL_Rect() 93 | sdl3.SDL_GetSurfaceClipRect(textSurface, ctypes.byref(textRect)) 94 | sdl3.SDL_RectToFRect(ctypes.byref(textRect), ctypes.byref(textFRect)) 95 | 96 | if error := sdl3.SDL_GetError(): 97 | print(f"Error: {error.decode()}.") 98 | return -1 99 | 100 | if textTexture is not None: 101 | sdl3.SDL_RenderTexture(renderer, textTexture, None, ctypes.byref(textFRect)) 102 | 103 | sdl3.SDL_RenderPresent(renderer) 104 | 105 | if textTexture is not None: 106 | sdl3.SDL_DestroySurface(textSurface) 107 | sdl3.SDL_DestroyTexture(textTexture) 108 | 109 | if currentAudioDevice: 110 | for i in chunks: 111 | sdl3.Mix_FreeChunk(i) 112 | 113 | sdl3.Mix_CloseAudio() 114 | sdl3.Mix_Quit() 115 | 116 | sdl3.TTF_CloseFont(font) 117 | sdl3.TTF_Quit() 118 | 119 | sdl3.SDL_DestroySurface(surface) 120 | sdl3.SDL_DestroyTexture(texture) 121 | 122 | sdl3.SDL_DestroyRenderer(renderer) 123 | sdl3.SDL_DestroyWindow(window) 124 | sdl3.SDL_Quit() 125 | return 0 -------------------------------------------------------------------------------- /gpu.py: -------------------------------------------------------------------------------- 1 | import sys, os, subprocess 2 | 3 | try: __import__("embed").main(sys.argv) 4 | except ModuleNotFoundError: ... 5 | 6 | import sdl3, shader, ctypes, time, colorsys 7 | 8 | def compileShader(name, size = ctypes.c_size_t()): 9 | subprocess.run(["glslc", f"{name}.glsl", "-o", f"{name}.spv"]) 10 | data = sdl3.SDL_LoadFile(f"{name}.spv".encode(), ctypes.byref(size)) 11 | return size.value, ctypes.cast(data, sdl3.SDL_POINTER[ctypes.c_uint8]) 12 | 13 | class Vertex(ctypes.Structure): 14 | _fields_ = [ 15 | ("position", ctypes.c_float * 3), 16 | ("color", ctypes.c_float * 3) 17 | ] 18 | 19 | class UniformData(ctypes.Structure): 20 | _fields_ = [ 21 | ("color0", ctypes.c_float * 4), 22 | ("color1", ctypes.c_float * 4), 23 | ("color2", ctypes.c_float * 4) 24 | ] 25 | 26 | @sdl3.SDL_main_func 27 | def main(argc: ctypes.c_int, argv: sdl3.LP_c_char_p) -> ctypes.c_int: 28 | if not sdl3.SDL_Init(sdl3.SDL_INIT_VIDEO | sdl3.SDL_INIT_EVENTS | sdl3.SDL_INIT_AUDIO): 29 | print(f"Failed to initialize library: {sdl3.SDL_GetError().decode()}.") 30 | return -1 31 | 32 | window = sdl3.SDL_CreateWindow("Aermoss".encode(), 1600, 900, sdl3.SDL_WINDOW_RESIZABLE) 33 | event, running = sdl3.SDL_Event(), True 34 | 35 | gpuDrivers = [sdl3.SDL_GetGPUDriver(i).decode() for i in range(sdl3.SDL_GetNumGPUDrivers())] 36 | tryGetDriver, tryUseVulkan = lambda order, drivers: next((i for i in order if i in drivers), None), True 37 | gpuDriver = tryGetDriver(["vulkan"] if tryUseVulkan else [], gpuDrivers) 38 | print(f"Available GPU drivers: {', '.join(gpuDrivers)} (current: {gpuDriver}).") 39 | 40 | if not (device := sdl3.SDL_CreateGPUDevice(sdl3.SDL_GPU_SHADERFORMAT_SPIRV, True, gpuDriver.encode())): 41 | print(f"Failed to create GPU device: {sdl3.SDL_GetError().decode()}.") 42 | return -1 43 | 44 | if not sdl3.SDL_ClaimWindowForGPUDevice(device, window): 45 | print(f"Failed to claim window for GPU device: {sdl3.SDL_GetError().decode()}") 46 | return -1 47 | 48 | vertexShader = sdl3.SDL_CreateGPUShader(device, sdl3.SDL_GPUShaderCreateInfo(*shader.vertexData, entrypoint = "main".encode(), format = sdl3.SDL_GPU_SHADERFORMAT_SPIRV, stage = sdl3.SDL_GPU_SHADERSTAGE_VERTEX, num_uniform_buffers = 1)) 49 | fragmentShader = sdl3.SDL_CreateGPUShader(device, sdl3.SDL_GPUShaderCreateInfo(*shader.fragmentData, entrypoint = "main".encode(), format = sdl3.SDL_GPU_SHADERFORMAT_SPIRV, stage = sdl3.SDL_GPU_SHADERSTAGE_FRAGMENT)) 50 | 51 | pipeline = sdl3.SDL_CreateGPUGraphicsPipeline(device, sdl3.SDL_GPUGraphicsPipelineCreateInfo(vertexShader, fragmentShader, primitive_type = sdl3.SDL_GPU_PRIMITIVETYPE_TRIANGLELIST, 52 | target_info = sdl3.SDL_GPUGraphicsPipelineTargetInfo(*sdl3.SDL_ARRAY(sdl3.SDL_GPUColorTargetDescription(sdl3.SDL_GetGPUSwapchainTextureFormat(device, window)))), 53 | vertex_input_state = sdl3.SDL_GPUVertexInputState(*sdl3.SDL_ARRAY(sdl3.SDL_GPUVertexBufferDescription(0, ctypes.sizeof(Vertex), sdl3.SDL_GPU_VERTEXINPUTRATE_VERTEX, 0)), 54 | *sdl3.SDL_ARRAY(sdl3.SDL_GPUVertexAttribute(0, 0, sdl3.SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3, 0))) 55 | )) 56 | 57 | sdl3.SDL_ReleaseGPUShader(device, fragmentShader) 58 | sdl3.SDL_ReleaseGPUShader(device, vertexShader) 59 | 60 | if not pipeline: 61 | print(f"Failed to create GPU pipeline: {sdl3.SDL_GetError().decode()}.") 62 | return -1 63 | 64 | vertexBuffer = sdl3.SDL_CreateGPUBuffer(device, sdl3.SDL_GPUBufferCreateInfo(sdl3.SDL_GPU_BUFFERUSAGE_VERTEX, ctypes.sizeof(Vertex) * 3)) 65 | transferBuffer = sdl3.SDL_CreateGPUTransferBuffer(device, sdl3.SDL_GPUTransferBufferCreateInfo(sdl3.SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD, ctypes.sizeof(Vertex) * 3)) 66 | 67 | transferData = ctypes.cast(sdl3.SDL_MapGPUTransferBuffer(device, transferBuffer, False), sdl3.SDL_POINTER[Vertex]) 68 | transferData[0] = Vertex(sdl3.SDL_ARRAY(-0.5, -0.5, 0.0, type = ctypes.c_float)[0]) 69 | transferData[1] = Vertex(sdl3.SDL_ARRAY( 0.5, -0.5, 0.0, type = ctypes.c_float)[0]) 70 | transferData[2] = Vertex(sdl3.SDL_ARRAY( 0.0, 0.5, 0.0, type = ctypes.c_float)[0]) 71 | sdl3.SDL_UnmapGPUTransferBuffer(device, transferBuffer) 72 | 73 | commandBuffer = sdl3.SDL_AcquireGPUCommandBuffer(device) 74 | copyPass = sdl3.SDL_BeginGPUCopyPass(commandBuffer) 75 | sdl3.SDL_UploadToGPUBuffer(copyPass, sdl3.SDL_GPUTransferBufferLocation(transferBuffer, 0), sdl3.SDL_GPUBufferRegion(vertexBuffer, 0, ctypes.sizeof(Vertex) * 3), False) 76 | sdl3.SDL_EndGPUCopyPass(copyPass) 77 | 78 | sdl3.SDL_SubmitGPUCommandBuffer(commandBuffer) 79 | sdl3.SDL_ReleaseGPUTransferBuffer(device, transferBuffer) 80 | uniformData, lastTime, hue = UniformData(), time.time(), 0.0 81 | 82 | while running: 83 | while sdl3.SDL_PollEvent(ctypes.byref(event)): 84 | match event.type: 85 | case sdl3.SDL_EVENT_QUIT: 86 | running = False 87 | 88 | case sdl3.SDL_EVENT_KEY_DOWN: 89 | if event.key.key == sdl3.SDLK_ESCAPE: 90 | running = False 91 | 92 | commandBuffer = sdl3.SDL_AcquireGPUCommandBuffer(device) 93 | 94 | if not commandBuffer: 95 | print(f"Failed to acquire GPU command buffer: {sdl3.SDL_GetError().decode()}.") 96 | return -1 97 | 98 | swapChainTexture = sdl3.LP_SDL_GPUTexture() 99 | sdl3.SDL_WaitAndAcquireGPUSwapchainTexture(commandBuffer, window, ctypes.byref(swapChainTexture), None, None) 100 | 101 | if not swapChainTexture: 102 | print(f"Failed to acquire GPU swapchain texture: {sdl3.SDL_GetError().decode()}.") 103 | return -1 104 | 105 | lastTime, deltaTime = \ 106 | time.time(), time.time() - lastTime 107 | 108 | colorTargetInfo = sdl3.SDL_GPUColorTargetInfo(swapChainTexture, load_op = sdl3.SDL_GPU_LOADOP_CLEAR, 109 | clear_color = sdl3.SDL_FColor(*colorsys.hsv_to_rgb(hue := (hue + 0.25 * deltaTime) % 1, 1.0, 0.0), 1.0)) 110 | 111 | uniformData.color0 = sdl3.SDL_ARRAY(*colorsys.hsv_to_rgb(hue + 0.48, 1.0, 1.0), 1.0, type = ctypes.c_float)[0] 112 | uniformData.color1 = sdl3.SDL_ARRAY(*colorsys.hsv_to_rgb(hue + 0.32, 1.0, 1.0), 1.0, type = ctypes.c_float)[0] 113 | uniformData.color2 = sdl3.SDL_ARRAY(*colorsys.hsv_to_rgb(hue + 0.64, 1.0, 1.0), 1.0, type = ctypes.c_float)[0] 114 | 115 | renderPass = sdl3.SDL_BeginGPURenderPass(commandBuffer, ctypes.byref(colorTargetInfo), 1, None) 116 | sdl3.SDL_BindGPUGraphicsPipeline(renderPass, pipeline) 117 | sdl3.SDL_BindGPUVertexBuffers(renderPass, 0, sdl3.SDL_GPUBufferBinding(vertexBuffer, 0), 1) 118 | sdl3.SDL_PushGPUVertexUniformData(commandBuffer, 0, ctypes.byref(uniformData), ctypes.sizeof(uniformData)) 119 | sdl3.SDL_DrawGPUPrimitives(renderPass, 3, 1, 0, 0) 120 | sdl3.SDL_EndGPURenderPass(renderPass) 121 | 122 | sdl3.SDL_SubmitGPUCommandBuffer(commandBuffer) 123 | 124 | sdl3.SDL_ReleaseGPUBuffer(device, vertexBuffer) 125 | sdl3.SDL_ReleaseGPUGraphicsPipeline(device, pipeline) 126 | sdl3.SDL_DestroyGPUDevice(device) 127 | 128 | sdl3.SDL_DestroyWindow(window) 129 | sdl3.SDL_Quit() 130 | return 0 -------------------------------------------------------------------------------- /opengl.py: -------------------------------------------------------------------------------- 1 | import ctypes, colorsys, time, sdl3, OpenGL.GL as gl 2 | 3 | from imgui_bundle.python_backends.sdl3_backend import imgui, SDL3Renderer 4 | 5 | @sdl3.SDL_main_func 6 | def main(argc: ctypes.c_int, argv: sdl3.LP_c_char_p) -> ctypes.c_int: 7 | if not sdl3.SDL_Init(sdl3.SDL_INIT_VIDEO | sdl3.SDL_INIT_EVENTS): 8 | print(f"Failed to initialize library: {sdl3.SDL_GetError().decode()}.") 9 | return -1 10 | 11 | sdl3.SDL_GL_SetAttribute(sdl3.SDL_GL_CONTEXT_MAJOR_VERSION, 4) 12 | sdl3.SDL_GL_SetAttribute(sdl3.SDL_GL_CONTEXT_MINOR_VERSION, 6) 13 | sdl3.SDL_GL_SetAttribute(sdl3.SDL_GL_CONTEXT_PROFILE_MASK, sdl3.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY) 14 | sdl3.SDL_GL_SetAttribute(sdl3.SDL_GL_CONTEXT_FLAGS, sdl3.SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG) 15 | window = sdl3.SDL_CreateWindow("Aermoss".encode(), 1600, 900, sdl3.SDL_WINDOW_OPENGL | sdl3.SDL_WINDOW_RESIZABLE) 16 | 17 | if not window: 18 | print(f"Failed to create window: {sdl3.SDL_GetError().decode()}.", flush = True) 19 | return -1 20 | 21 | context = sdl3.SDL_GL_CreateContext(window) 22 | sdl3.SDL_GL_MakeCurrent(window, context) 23 | 24 | if not context: 25 | print(f"Failed to create context: {sdl3.SDL_GetError().decode()}.", flush = True) 26 | return -1 27 | 28 | imgui.create_context() 29 | imgui.get_io().set_ini_filename("") 30 | 31 | renderer = SDL3Renderer(window) 32 | running, hue, lastTime = True, 0.0, time.time() 33 | event = sdl3.SDL_Event() 34 | 35 | while running: 36 | renderer.process_inputs() 37 | 38 | while sdl3.SDL_PollEvent(ctypes.byref(event)): 39 | renderer.process_event(event) 40 | 41 | match event.type: 42 | case sdl3.SDL_EVENT_QUIT: 43 | running = False 44 | 45 | case sdl3.SDL_EVENT_KEY_DOWN: 46 | if event.key.key in [sdl3.SDLK_ESCAPE]: 47 | running = False 48 | 49 | lastTime, deltaTime = \ 50 | time.time(), time.time() - lastTime 51 | 52 | hue = (hue + 0.5 * deltaTime) % 360.0 53 | gl.glClearColor(*colorsys.hsv_to_rgb(hue, 1.0, 0.1), 1.0) 54 | gl.glClear(gl.GL_COLOR_BUFFER_BIT) 55 | 56 | imgui.new_frame() 57 | imgui.show_demo_window() 58 | imgui.end_frame() 59 | 60 | imgui.render() 61 | renderer.render(imgui.get_draw_data()) 62 | sdl3.SDL_GL_SwapWindow(window) 63 | 64 | renderer.shutdown() 65 | imgui.destroy_context() 66 | 67 | sdl3.SDL_GL_MakeCurrent(window, None) 68 | sdl3.SDL_GL_DestroyContext(context) 69 | sdl3.SDL_DestroyWindow(window) 70 | sdl3.SDL_Quit() 71 | return 0 -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "setuptools-scm"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | [project] 6 | name = "PySDL3" 7 | description = "A pure Python wrapper for SDL3." 8 | readme = {file = "README.md", content-type = "text/markdown"} 9 | authors = [ 10 | {name = "Yusuf Rençber", email = "aermoss.0@gmail.com"} 11 | ] 12 | dependencies = ["requests", "aiohttp", "packaging"] 13 | dynamic = ["version"] 14 | classifiers = [ 15 | "Development Status :: 4 - Beta", 16 | "Intended Audience :: Developers", 17 | "Operating System :: POSIX :: Linux", 18 | "Operating System :: MacOS :: MacOS X", 19 | "Operating System :: Microsoft :: Windows", 20 | "License :: OSI Approved :: MIT License", 21 | "Programming Language :: Python :: 3.10", 22 | "Programming Language :: Python :: 3.11", 23 | "Programming Language :: Python :: 3.12", 24 | "Programming Language :: Python :: 3.13", 25 | "Programming Language :: Python :: 3.14" 26 | ] 27 | 28 | [project.urls] 29 | Repository = "https://github.com/Aermoss/PySDL3" 30 | Issues = "https://github.com/Aermoss/PySDL3/issues" 31 | 32 | [tool.setuptools] 33 | packages = ["sdl3"] 34 | include-package-data = true 35 | 36 | [tool.setuptools.package-data] 37 | "sdl3" = ["*.py"] 38 | 39 | [tool.setuptools.dynamic] 40 | version = {attr = "sdl3.__version__"} -------------------------------------------------------------------------------- /res/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aermoss/PySDL3/21ae8ced8695bacf034a43a087a3d716dd48feee/res/example.png -------------------------------------------------------------------------------- /res/example.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aermoss/PySDL3/21ae8ced8695bacf034a43a087a3d716dd48feee/res/example.ttf -------------------------------------------------------------------------------- /res/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aermoss/PySDL3/21ae8ced8695bacf034a43a087a3d716dd48feee/res/logo.png -------------------------------------------------------------------------------- /res/snippet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aermoss/PySDL3/21ae8ced8695bacf034a43a087a3d716dd48feee/res/snippet.png -------------------------------------------------------------------------------- /res/voice/apu_fire.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aermoss/PySDL3/21ae8ced8695bacf034a43a087a3d716dd48feee/res/voice/apu_fire.wav -------------------------------------------------------------------------------- /res/voice/engine_fire_left.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aermoss/PySDL3/21ae8ced8695bacf034a43a087a3d716dd48feee/res/voice/engine_fire_left.wav -------------------------------------------------------------------------------- /res/voice/engine_fire_right.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aermoss/PySDL3/21ae8ced8695bacf034a43a087a3d716dd48feee/res/voice/engine_fire_right.wav -------------------------------------------------------------------------------- /sdl3/SDL.py: -------------------------------------------------------------------------------- 1 | from .SDL_assert import * 2 | from .SDL_asyncio import * 3 | from .SDL_atomic import * 4 | from .SDL_audio import * 5 | from .SDL_bits import * 6 | from .SDL_blendmode import * 7 | from .SDL_camera import * 8 | from .SDL_clipboard import * 9 | from .SDL_cpuinfo import * 10 | from .SDL_dialog import * 11 | from .SDL_endian import * 12 | from .SDL_error import * 13 | from .SDL_events import * 14 | from .SDL_filesystem import * 15 | from .SDL_gamepad import * 16 | from .SDL_gpu import * 17 | from .SDL_guid import * 18 | from .SDL_haptic import * 19 | from .SDL_hidapi import * 20 | from .SDL_hints import * 21 | from .SDL_image import * 22 | from .SDL_init import * 23 | from .SDL_iostream import * 24 | from .SDL_joystick import * 25 | from .SDL_keyboard import * 26 | from .SDL_keycode import * 27 | from .SDL_loadso import * 28 | from .SDL_locale import * 29 | from .SDL_log import * 30 | from .SDL_main import * 31 | from .SDL_main_impl import * 32 | from .SDL_messagebox import * 33 | from .SDL_metal import * 34 | from .SDL_misc import * 35 | from .SDL_mixer import * 36 | from .SDL_mouse import * 37 | from .SDL_mutex import * 38 | from .SDL_net import * 39 | from .SDL_pen import * 40 | from .SDL_pixels import * 41 | from .SDL_platform import * 42 | from .SDL_power import * 43 | from .SDL_process import * 44 | from .SDL_properties import * 45 | from .SDL_rect import * 46 | from .SDL_render import * 47 | from .SDL_rtf import * 48 | from .SDL_scancode import * 49 | from .SDL_sensor import * 50 | from .SDL_shadercross import * 51 | from .SDL_stdinc import * 52 | from .SDL_storage import * 53 | from .SDL_surface import * 54 | from .SDL_system import * 55 | from .SDL_textengine import * 56 | from .SDL_thread import * 57 | from .SDL_time import * 58 | from .SDL_timer import * 59 | from .SDL_touch import * 60 | from .SDL_tray import * 61 | from .SDL_ttf import * 62 | from .SDL_version import * 63 | from .SDL_video import * 64 | from .SDL_vulkan import * -------------------------------------------------------------------------------- /sdl3/SDL_assert.py: -------------------------------------------------------------------------------- 1 | from .__init__ import os, inspect, ctypes, typing, abc, re, \ 2 | SDL_FUNC_TYPE, SDL_POINTER, SDL_FUNC, SDL_TYPE, SDL_BINARY, SDL_ENUM 3 | 4 | SDL_ASSERT_LEVEL: int = 2 5 | SDL_NULL_WHILE_LOOP_CONDITION: int = 0 6 | 7 | SDL_AssertState: typing.TypeAlias = SDL_TYPE["SDL_AssertState", SDL_ENUM] 8 | 9 | SDL_ASSERTION_RETRY, SDL_ASSERTION_BREAK, SDL_ASSERTION_ABORT, \ 10 | SDL_ASSERTION_IGNORE, SDL_ASSERTION_ALWAYS_IGNORE = range(5) 11 | 12 | SDL_AssertData: typing.TypeAlias = SDL_TYPE["SDL_AssertData", ctypes.c_void_p] 13 | 14 | class SDL_AssertData(ctypes.Structure): 15 | _fields_ = [ 16 | ("always_ignore", ctypes.c_bool), 17 | ("trigger_count", ctypes.c_uint), 18 | ("condition", ctypes.c_char_p), 19 | ("filename", ctypes.c_char_p), 20 | ("linenum", ctypes.c_int), 21 | ("function", ctypes.c_char_p), 22 | ("next", SDL_POINTER[SDL_AssertData]) 23 | ] 24 | 25 | SDL_ReportAssertion: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReportAssertion", SDL_AssertState, [SDL_POINTER[SDL_AssertData], ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int], SDL_BINARY] 26 | 27 | SDL_TriggerBreakpoint: abc.Callable[[], None] = lambda: breakpoint() 28 | SDL_AssertBreakpoint: abc.Callable[[], None] = lambda: SDL_TriggerBreakpoint() 29 | 30 | def SDL_disabled_assert(condition: bool) -> None: 31 | """Do not call this function directly.""" 32 | 33 | def SDL_enabled_assert(condition: bool) -> None: 34 | """Do not call this function directly.""" 35 | 36 | while not condition: 37 | data = SDL_AssertData() 38 | module = current = inspect.currentframe().f_back.f_back 39 | while module.f_code.co_name != "": module = module.f_back 40 | match = re.search(r"\((.*?)\)", inspect.getsource(module).split("\n")[current.f_lineno - 1]) 41 | data.condition = (match.group(1) if match else "").encode() 42 | state = SDL_ReportAssertion(ctypes.byref(data), current.f_code.co_name.encode(), os.path.split(current.f_code.co_filename)[-1].encode(), current.f_lineno) 43 | 44 | if state in [SDL_ASSERTION_RETRY]: 45 | continue 46 | 47 | if state in [SDL_ASSERTION_BREAK]: 48 | return SDL_AssertBreakpoint() 49 | 50 | match SDL_ASSERT_LEVEL: 51 | case 0: 52 | SDL_assert: abc.Callable[[bool], None] = lambda condition: SDL_disabled_assert(condition) 53 | SDL_assert_release: abc.Callable[[bool], None] = lambda condition: SDL_disabled_assert(condition) 54 | SDL_assert_paranoid: abc.Callable[[bool], None] = lambda condition: SDL_disabled_assert(condition) 55 | 56 | case 1: 57 | SDL_assert: abc.Callable[[bool], None] = lambda condition: SDL_disabled_assert(condition) 58 | SDL_assert_release: abc.Callable[[bool], None] = lambda condition: SDL_enabled_assert(condition) 59 | SDL_assert_paranoid: abc.Callable[[bool], None] = lambda condition: SDL_disabled_assert(condition) 60 | 61 | case 2: 62 | SDL_assert: abc.Callable[[bool], None] = lambda condition: SDL_enabled_assert(condition) 63 | SDL_assert_release: abc.Callable[[bool], None] = lambda condition: SDL_enabled_assert(condition) 64 | SDL_assert_paranoid: abc.Callable[[bool], None] = lambda condition: SDL_disabled_assert(condition) 65 | 66 | case 3: 67 | SDL_assert: abc.Callable[[bool], None] = lambda condition: SDL_enabled_assert(condition) 68 | SDL_assert_release: abc.Callable[[bool], None] = lambda condition: SDL_enabled_assert(condition) 69 | SDL_assert_paranoid: abc.Callable[[bool], None] = lambda condition: SDL_enabled_assert(condition) 70 | 71 | case _: 72 | SDL_enabled_assert(False) 73 | 74 | SDL_assert_always: abc.Callable[[bool], None] = lambda condition: SDL_enabled_assert(condition) 75 | SDL_AssertionHandler: typing.TypeAlias = SDL_FUNC_TYPE["SDL_AssertionHandler", SDL_AssertState, [SDL_POINTER[SDL_AssertData], ctypes.c_void_p]] 76 | 77 | SDL_SetAssertionHandler: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAssertionHandler", None, [SDL_AssertionHandler, ctypes.c_void_p], SDL_BINARY] 78 | SDL_GetDefaultAssertionHandler: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetDefaultAssertionHandler", SDL_AssertionHandler, [], SDL_BINARY] 79 | SDL_GetAssertionHandler: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAssertionHandler", SDL_AssertionHandler, [SDL_POINTER[ctypes.c_void_p]], SDL_BINARY] 80 | SDL_GetAssertionReport: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAssertionReport", SDL_POINTER[SDL_AssertData], [], SDL_BINARY] 81 | SDL_ResetAssertionReport: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ResetAssertionReport", None, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_asyncio.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | class SDL_AsyncIO(ctypes.c_void_p): 5 | ... 6 | 7 | SDL_AsyncIOTaskType: typing.TypeAlias = SDL_TYPE["SDL_AsyncIOTaskType", SDL_ENUM] 8 | 9 | SDL_ASYNCIO_TASK_READ, SDL_ASYNCIO_TASK_WRITE, SDL_ASYNCIO_TASK_CLOSE = range(3) 10 | 11 | SDL_AsyncIOResult: typing.TypeAlias = SDL_TYPE["SDL_AsyncIOResult", SDL_ENUM] 12 | 13 | SDL_ASYNCIO_COMPLETE, SDL_ASYNCIO_FAILURE, SDL_ASYNCIO_CANCELED = range(3) 14 | 15 | class SDL_AsyncIOOutcome(ctypes.Structure): 16 | _fields_ = [ 17 | ("asyncio", SDL_POINTER[SDL_AsyncIO]), 18 | ("type", SDL_AsyncIOTaskType), 19 | ("result", SDL_AsyncIOResult), 20 | ("buffer", ctypes.c_void_p), 21 | ("offset", ctypes.c_uint64), 22 | ("bytes_requested", ctypes.c_uint64), 23 | ("bytes_transferred", ctypes.c_uint64), 24 | ("userdata", ctypes.c_void_p) 25 | ] 26 | 27 | class SDL_AsyncIOQueue(ctypes.c_void_p): 28 | ... 29 | 30 | SDL_AsyncIOFromFile: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_AsyncIOFromFile", SDL_POINTER[SDL_AsyncIO], [ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 31 | SDL_GetAsyncIOSize: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAsyncIOSize", ctypes.c_int64, [SDL_POINTER[SDL_AsyncIO]], SDL_BINARY] 32 | 33 | SDL_ReadAsyncIO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadAsyncIO", ctypes.c_bool, [SDL_POINTER[SDL_AsyncIO], ctypes.c_void_p, ctypes.c_uint64, ctypes.c_uint64, SDL_POINTER[SDL_AsyncIOQueue], ctypes.c_void_p], SDL_BINARY] 34 | SDL_WriteAsyncIO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteAsyncIO", ctypes.c_bool, [SDL_POINTER[SDL_AsyncIO], ctypes.c_void_p, ctypes.c_uint64, ctypes.c_uint64, SDL_POINTER[SDL_AsyncIOQueue], ctypes.c_void_p], SDL_BINARY] 35 | SDL_CloseAsyncIO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CloseAsyncIO", ctypes.c_bool, [SDL_POINTER[SDL_AsyncIO], ctypes.c_bool, SDL_POINTER[SDL_AsyncIOQueue], ctypes.c_void_p], SDL_BINARY] 36 | 37 | SDL_CreateAsyncIOQueue: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateAsyncIOQueue", SDL_POINTER[SDL_AsyncIOQueue], [], SDL_BINARY] 38 | SDL_DestroyAsyncIOQueue: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroyAsyncIOQueue", None, [SDL_POINTER[SDL_AsyncIOQueue]], SDL_BINARY] 39 | SDL_GetAsyncIOResult: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAsyncIOResult", ctypes.c_bool, [SDL_POINTER[SDL_AsyncIOQueue], SDL_POINTER[SDL_AsyncIOOutcome]], SDL_BINARY] 40 | SDL_WaitAsyncIOResult: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WaitAsyncIOResult", ctypes.c_bool, [SDL_POINTER[SDL_AsyncIOQueue], SDL_POINTER[SDL_AsyncIOOutcome], ctypes.c_int32], SDL_BINARY] 41 | SDL_SignalAsyncIOQueue: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SignalAsyncIOQueue", None, [SDL_POINTER[SDL_AsyncIOQueue]], SDL_BINARY] 42 | 43 | SDL_LoadFileAsync: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LoadFileAsync", ctypes.c_bool, [ctypes.c_char_p, SDL_POINTER[SDL_AsyncIOQueue], ctypes.c_void_p], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_atomic.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | SDL_SpinLock: typing.TypeAlias = SDL_TYPE["SDL_SpinLock", ctypes.c_int] 5 | 6 | SDL_TryLockSpinlock: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_TryLockSpinlock", ctypes.c_bool, [SDL_POINTER[SDL_SpinLock]], SDL_BINARY] 7 | SDL_LockSpinlock: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LockSpinlock", None, [SDL_POINTER[SDL_SpinLock]], SDL_BINARY] 8 | SDL_UnlockSpinlock: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UnlockSpinlock", None, [SDL_POINTER[SDL_SpinLock]], SDL_BINARY] 9 | 10 | SDL_MemoryBarrierReleaseFunction: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_MemoryBarrierReleaseFunction", None, [], SDL_BINARY] 11 | SDL_MemoryBarrierAcquireFunction: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_MemoryBarrierAcquireFunction", None, [], SDL_BINARY] 12 | 13 | class SDL_AtomicInt(ctypes.Structure): 14 | _fields_ = [ 15 | ("value", ctypes.c_int) 16 | ] 17 | 18 | SDL_CompareAndSwapAtomicInt: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CompareAndSwapAtomicInt", ctypes.c_bool, [SDL_POINTER[SDL_AtomicInt], ctypes.c_int, ctypes.c_int], SDL_BINARY] 19 | SDL_SetAtomicInt: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAtomicInt", ctypes.c_int, [SDL_POINTER[SDL_AtomicInt], ctypes.c_int], SDL_BINARY] 20 | SDL_GetAtomicInt: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAtomicInt", ctypes.c_int, [SDL_POINTER[SDL_AtomicInt]], SDL_BINARY] 21 | SDL_AddAtomicInt: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_AddAtomicInt", ctypes.c_int, [SDL_POINTER[SDL_AtomicInt], ctypes.c_int], SDL_BINARY] 22 | 23 | class LP_SDL_AtomicInt(ctypes._Pointer): 24 | ... 25 | 26 | SDL_AtomicIncRef: abc.Callable[[SDL_POINTER[SDL_AtomicInt]], ctypes.c_int] = lambda a: SDL_AddAtomicInt(a, 1) 27 | SDL_AtomicDecRef: abc.Callable[[SDL_POINTER[SDL_AtomicInt]], bool] = lambda a: SDL_AddAtomicInt(a, -1) == 1 28 | 29 | class SDL_AtomicU32(ctypes.Structure): 30 | _fields_ = [ 31 | ("value", ctypes.c_uint32) 32 | ] 33 | 34 | SDL_CompareAndSwapAtomicU32: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CompareAndSwapAtomicU32", ctypes.c_bool, [SDL_POINTER[SDL_AtomicU32], ctypes.c_uint32, ctypes.c_uint32], SDL_BINARY] 35 | SDL_SetAtomicU32: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAtomicU32", ctypes.c_uint32, [SDL_POINTER[SDL_AtomicU32], ctypes.c_uint32], SDL_BINARY] 36 | SDL_GetAtomicU32: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAtomicU32", ctypes.c_uint32, [SDL_POINTER[SDL_AtomicU32]], SDL_BINARY] 37 | 38 | SDL_CompareAndSwapAtomicPointer: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CompareAndSwapAtomicPointer", ctypes.c_bool, [SDL_POINTER[ctypes.c_void_p], ctypes.c_void_p, ctypes.c_void_p], SDL_BINARY] 39 | SDL_SetAtomicPointer: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAtomicPointer", ctypes.c_void_p, [SDL_POINTER[ctypes.c_void_p], ctypes.c_void_p], SDL_BINARY] 40 | SDL_GetAtomicPointer: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAtomicPointer", ctypes.c_void_p, [SDL_POINTER[ctypes.c_void_p]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_audio.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_FUNC_TYPE, \ 2 | SDL_POINTER, SDL_FUNC, SDL_TYPE, SDL_BINARY, SDL_ENUM 3 | 4 | from .SDL_properties import SDL_PropertiesID 5 | from .SDL_endian import SDL_BYTEORDER, SDL_LIL_ENDIAN 6 | from .SDL_iostream import SDL_IOStream 7 | 8 | SDL_AUDIO_MASK_BITSIZE: int = 0xFF 9 | SDL_AUDIO_MASK_FLOAT: int = 1 << 8 10 | SDL_AUDIO_MASK_BIG_ENDIAN: int = 1 << 12 11 | SDL_AUDIO_MASK_SIGNED: int = 1 << 15 12 | 13 | SDL_DEFINE_AUDIO_FORMAT: abc.Callable[[int, int, int, int], int] = lambda signed, bigendian, _float, size: \ 14 | (signed << 15) | (bigendian << 12) | (_float << 8) | (size & SDL_AUDIO_MASK_BITSIZE) 15 | 16 | SDL_AudioFormat: typing.TypeAlias = SDL_TYPE["SDL_AudioFormat", SDL_ENUM] 17 | 18 | SDL_AUDIO_UNKNOWN: int = 0x0000 19 | SDL_AUDIO_U8: int = 0x0008 20 | SDL_AUDIO_S8: int = 0x8008 21 | SDL_AUDIO_S16LE: int = 0x8010 22 | SDL_AUDIO_S16BE: int = 0x9010 23 | SDL_AUDIO_S32LE: int = 0x8020 24 | SDL_AUDIO_S32BE: int = 0x9020 25 | SDL_AUDIO_F32LE: int = 0x8120 26 | SDL_AUDIO_F32BE: int = 0x9120 27 | 28 | if SDL_BYTEORDER == SDL_LIL_ENDIAN: 29 | SDL_AUDIO_S16, SDL_AUDIO_S32, SDL_AUDIO_F32 = SDL_AUDIO_S16LE, SDL_AUDIO_S32LE, SDL_AUDIO_F32LE 30 | 31 | else: 32 | SDL_AUDIO_S16, SDL_AUDIO_S32, SDL_AUDIO_F32 = SDL_AUDIO_S16BE, SDL_AUDIO_S32BE, SDL_AUDIO_F32BE 33 | 34 | SDL_AUDIO_BITSIZE: abc.Callable[[SDL_AudioFormat], int] = lambda x: x & SDL_AUDIO_MASK_BITSIZE 35 | SDL_AUDIO_BYTESIZE: abc.Callable[[SDL_AudioFormat], int] = lambda x: SDL_AUDIO_BITSIZE(x) / 8 36 | 37 | SDL_AUDIO_ISFLOAT: abc.Callable[[SDL_AudioFormat], int] = lambda x: x & SDL_AUDIO_MASK_FLOAT 38 | SDL_AUDIO_ISBIGENDIAN: abc.Callable[[SDL_AudioFormat], int] = lambda x: x & SDL_AUDIO_MASK_BIG_ENDIAN 39 | SDL_AUDIO_ISLITTLEENDIAN: abc.Callable[[SDL_AudioFormat], bool] = lambda x: not SDL_AUDIO_ISBIGENDIAN(x) 40 | SDL_AUDIO_ISSIGNED: abc.Callable[[SDL_AudioFormat], int] = lambda x: x & SDL_AUDIO_MASK_SIGNED 41 | SDL_AUDIO_ISINT: abc.Callable[[SDL_AudioFormat], bool] = lambda x: not SDL_AUDIO_ISFLOAT(x) 42 | SDL_AUDIO_ISUNSIGNED: abc.Callable[[SDL_AudioFormat], bool] = lambda x: not SDL_AUDIO_ISSIGNED(x) 43 | 44 | SDL_AudioDeviceID: typing.TypeAlias = SDL_TYPE["SDL_AudioDeviceID", ctypes.c_uint32] 45 | 46 | SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK: int = 0xFFFFFFFF 47 | SDL_AUDIO_DEVICE_DEFAULT_RECORDING: int = 0xFFFFFFFE 48 | 49 | class SDL_AudioSpec(ctypes.Structure): 50 | _fields_ = [ 51 | ("format", SDL_AudioFormat), 52 | ("channels", ctypes.c_int), 53 | ("freq", ctypes.c_int) 54 | ] 55 | 56 | SDL_AUDIO_FRAMESIZE: abc.Callable[[SDL_AudioSpec], int] = lambda x: SDL_AUDIO_BYTESIZE(x.format) * x.channels 57 | 58 | class SDL_AudioStream(ctypes.c_void_p): 59 | ... 60 | 61 | SDL_GetNumAudioDrivers: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetNumAudioDrivers", ctypes.c_int, [], SDL_BINARY] 62 | SDL_GetAudioDriver: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioDriver", ctypes.c_char_p, [ctypes.c_int], SDL_BINARY] 63 | SDL_GetCurrentAudioDriver: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCurrentAudioDriver", ctypes.c_char_p, [], SDL_BINARY] 64 | 65 | SDL_GetAudioPlaybackDevices: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioPlaybackDevices", SDL_POINTER[SDL_AudioDeviceID], [SDL_POINTER[ctypes.c_int]], SDL_BINARY] 66 | SDL_GetAudioRecordingDevices: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioRecordingDevices", SDL_POINTER[SDL_AudioDeviceID], [SDL_POINTER[ctypes.c_int]], SDL_BINARY] 67 | 68 | SDL_GetAudioDeviceName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioDeviceName", ctypes.c_char_p, [SDL_AudioDeviceID], SDL_BINARY] 69 | SDL_GetAudioDeviceFormat: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioDeviceFormat", ctypes.c_bool, [SDL_AudioDeviceID, SDL_POINTER[SDL_AudioSpec], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 70 | SDL_GetAudioDeviceChannelMap: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioDeviceChannelMap", SDL_POINTER[ctypes.c_int], [SDL_AudioDeviceID, SDL_POINTER[ctypes.c_int]], SDL_BINARY] 71 | 72 | SDL_OpenAudioDevice: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenAudioDevice", SDL_AudioDeviceID, [SDL_AudioDeviceID, SDL_POINTER[SDL_AudioSpec]], SDL_BINARY] 73 | SDL_IsAudioDevicePhysical: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IsAudioDevicePhysical", ctypes.c_bool, [SDL_AudioDeviceID], SDL_BINARY] 74 | SDL_IsAudioDevicePlayback: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IsAudioDevicePlayback", ctypes.c_bool, [SDL_AudioDeviceID], SDL_BINARY] 75 | SDL_PauseAudioDevice: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_PauseAudioDevice", ctypes.c_bool, [SDL_AudioDeviceID], SDL_BINARY] 76 | SDL_ResumeAudioDevice: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ResumeAudioDevice", ctypes.c_bool, [SDL_AudioDeviceID], SDL_BINARY] 77 | SDL_AudioDevicePaused: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_AudioDevicePaused", ctypes.c_bool, [SDL_AudioDeviceID], SDL_BINARY] 78 | SDL_GetAudioDeviceGain: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioDeviceGain", ctypes.c_float, [SDL_AudioDeviceID], SDL_BINARY] 79 | SDL_SetAudioDeviceGain: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAudioDeviceGain", ctypes.c_bool, [SDL_AudioDeviceID, ctypes.c_float], SDL_BINARY] 80 | SDL_CloseAudioDevice: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CloseAudioDevice", None, [SDL_AudioDeviceID], SDL_BINARY] 81 | 82 | SDL_BindAudioStreams: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_BindAudioStreams", ctypes.c_bool, [SDL_AudioDeviceID, SDL_POINTER[SDL_POINTER[SDL_AudioStream]], ctypes.c_int], SDL_BINARY] 83 | SDL_BindAudioStream: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_BindAudioStream", ctypes.c_bool, [SDL_AudioDeviceID, SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 84 | SDL_UnbindAudioStreams: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UnbindAudioStreams", None, [SDL_POINTER[SDL_POINTER[SDL_AudioStream]], ctypes.c_int], SDL_BINARY] 85 | SDL_UnbindAudioStream: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UnbindAudioStream", None, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 86 | SDL_GetAudioStreamDevice: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioStreamDevice", SDL_AudioDeviceID, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 87 | SDL_CreateAudioStream: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateAudioStream", SDL_POINTER[SDL_AudioStream], [SDL_POINTER[SDL_AudioSpec], SDL_POINTER[SDL_AudioSpec]], SDL_BINARY] 88 | SDL_GetAudioStreamProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioStreamProperties", SDL_PropertiesID, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 89 | SDL_GetAudioStreamFormat: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioStreamFormat", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream], SDL_POINTER[SDL_AudioSpec], SDL_POINTER[SDL_AudioSpec]], SDL_BINARY] 90 | SDL_SetAudioStreamFormat: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAudioStreamFormat", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream], SDL_POINTER[SDL_AudioSpec], SDL_POINTER[SDL_AudioSpec]], SDL_BINARY] 91 | SDL_GetAudioStreamFrequencyRatio: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioStreamFrequencyRatio", ctypes.c_float, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 92 | SDL_SetAudioStreamFrequencyRatio: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAudioStreamFrequencyRatio", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream], ctypes.c_float], SDL_BINARY] 93 | SDL_GetAudioStreamGain: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioStreamGain", ctypes.c_float, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 94 | SDL_SetAudioStreamGain: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAudioStreamGain", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream], ctypes.c_float], SDL_BINARY] 95 | SDL_GetAudioStreamInputChannelMap: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioStreamInputChannelMap", SDL_POINTER[ctypes.c_int], [SDL_POINTER[SDL_AudioStream], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 96 | SDL_GetAudioStreamOutputChannelMap: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioStreamOutputChannelMap", SDL_POINTER[ctypes.c_int], [SDL_POINTER[SDL_AudioStream], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 97 | SDL_SetAudioStreamInputChannelMap: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAudioStreamInputChannelMap", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream], SDL_POINTER[ctypes.c_int], ctypes.c_int], SDL_BINARY] 98 | SDL_SetAudioStreamOutputChannelMap: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAudioStreamOutputChannelMap", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream], SDL_POINTER[ctypes.c_int], ctypes.c_int], SDL_BINARY] 99 | SDL_PutAudioStreamData: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_PutAudioStreamData", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream], ctypes.c_void_p, ctypes.c_int], SDL_BINARY] 100 | SDL_GetAudioStreamData: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioStreamData", ctypes.c_int, [SDL_POINTER[SDL_AudioStream], ctypes.c_void_p, ctypes.c_int], SDL_BINARY] 101 | SDL_GetAudioStreamAvailable: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioStreamAvailable", ctypes.c_int, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 102 | SDL_GetAudioStreamQueued: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioStreamQueued", ctypes.c_int, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 103 | SDL_FlushAudioStream: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_FlushAudioStream", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 104 | SDL_ClearAudioStream: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ClearAudioStream", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 105 | SDL_PauseAudioStreamDevice: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_PauseAudioStreamDevice", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 106 | SDL_ResumeAudioStreamDevice: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ResumeAudioStreamDevice", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 107 | SDL_AudioStreamDevicePaused: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_AudioStreamDevicePaused", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 108 | SDL_LockAudioStream: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LockAudioStream", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 109 | SDL_UnlockAudioStream: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UnlockAudioStream", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 110 | 111 | SDL_AudioStreamCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_AudioStreamCallback", None, [ctypes.c_void_p, SDL_POINTER[SDL_AudioStream], ctypes.c_int, ctypes.c_int]] 112 | 113 | SDL_SetAudioStreamGetCallback: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAudioStreamGetCallback", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream], SDL_AudioStreamCallback, ctypes.c_void_p], SDL_BINARY] 114 | SDL_SetAudioStreamPutCallback: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAudioStreamPutCallback", ctypes.c_bool, [SDL_POINTER[SDL_AudioStream], SDL_AudioStreamCallback, ctypes.c_void_p], SDL_BINARY] 115 | SDL_DestroyAudioStream: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroyAudioStream", None, [SDL_POINTER[SDL_AudioStream]], SDL_BINARY] 116 | SDL_OpenAudioDeviceStream: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenAudioDeviceStream", SDL_POINTER[SDL_AudioStream], [SDL_AudioDeviceID, SDL_POINTER[SDL_AudioSpec], SDL_AudioStreamCallback, ctypes.c_void_p], SDL_BINARY] 117 | 118 | SDL_AudioPostmixCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_AudioPostmixCallback", None, [ctypes.c_void_p, SDL_POINTER[SDL_AudioSpec], SDL_POINTER[ctypes.c_float], ctypes.c_int]] 119 | 120 | SDL_SetAudioPostmixCallback: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAudioPostmixCallback", ctypes.c_bool, [SDL_AudioDeviceID, SDL_AudioPostmixCallback, ctypes.c_void_p], SDL_BINARY] 121 | 122 | SDL_LoadWAV_IO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LoadWAV_IO", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_bool, SDL_POINTER[SDL_AudioSpec], SDL_POINTER[SDL_POINTER[ctypes.c_uint8]], SDL_POINTER[ctypes.c_uint32]], SDL_BINARY] 123 | SDL_LoadWAV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LoadWAV", ctypes.c_bool, [ctypes.c_char_p, SDL_POINTER[SDL_AudioSpec], SDL_POINTER[SDL_POINTER[ctypes.c_uint8]], SDL_POINTER[ctypes.c_uint32]], SDL_BINARY] 124 | SDL_MixAudio: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_MixAudio", ctypes.c_bool, [SDL_POINTER[ctypes.c_uint8], SDL_POINTER[ctypes.c_uint8], SDL_AudioFormat, ctypes.c_uint32, ctypes.c_float], SDL_BINARY] 125 | SDL_ConvertAudioSamples: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ConvertAudioSamples", ctypes.c_bool, [SDL_POINTER[SDL_AudioSpec], SDL_POINTER[ctypes.c_uint8], ctypes.c_int, SDL_POINTER[SDL_AudioSpec], SDL_POINTER[SDL_POINTER[ctypes.c_uint8]], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 126 | SDL_GetAudioFormatName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAudioFormatName", ctypes.c_char_p, [SDL_AudioFormat], SDL_BINARY] 127 | SDL_GetSilenceValueForFormat: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSilenceValueForFormat", ctypes.c_int, [SDL_AudioFormat], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_bits.py: -------------------------------------------------------------------------------- 1 | from .__init__ import * 2 | 3 | def SDL_MostSignificantBitIndex32(x: int) -> int: 4 | if x == 0: return -1 5 | b: list[int] = [0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000] 6 | S: list[int] = [1, 2, 4, 8, 16] 7 | msbIndex: int = 0 8 | 9 | for i in range(4, -1, -1): 10 | if x & b[i]: 11 | x >>= S[i] 12 | msbIndex |= S[i] 13 | 14 | return msbIndex 15 | 16 | def SDL_HasExactlyOneBitSet32(x: int) -> bool: 17 | if x and not (x & (x - 1)): return True 18 | else: return False -------------------------------------------------------------------------------- /sdl3/SDL_blendmode.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | SDL_BlendMode: typing.TypeAlias = SDL_TYPE["SDL_BlendMode", ctypes.c_uint32] 5 | 6 | SDL_BLENDMODE_NONE: int = 0x00000000 7 | SDL_BLENDMODE_BLEND: int = 0x00000001 8 | SDL_BLENDMODE_BLEND_PREMULTIPLIED: int = 0x00000010 9 | SDL_BLENDMODE_ADD: int = 0x00000002 10 | SDL_BLENDMODE_ADD_PREMULTIPLIED: int = 0x00000020 11 | SDL_BLENDMODE_MOD: int = 0x00000004 12 | SDL_BLENDMODE_MUL: int = 0x00000008 13 | SDL_BLENDMODE_INVALID: int = 0x7FFFFFFF 14 | 15 | SDL_BlendOperation: typing.TypeAlias = SDL_TYPE["SDL_BlendOperation", SDL_ENUM] 16 | 17 | SDL_BLENDOPERATION_ADD, SDL_BLENDOPERATION_SUBTRACT, SDL_BLENDOPERATION_REV_SUBTRACT, \ 18 | SDL_BLENDOPERATION_MINIMUM, SDL_BLENDOPERATION_MAXIMUM = range(1, 6) 19 | 20 | SDL_BlendFactor: typing.TypeAlias = SDL_TYPE["SDL_BlendFactor", SDL_ENUM] 21 | 22 | SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_SRC_COLOR, SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR, \ 23 | SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDFACTOR_DST_COLOR, SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR, \ 24 | SDL_BLENDFACTOR_DST_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = range(1, 11) 25 | 26 | SDL_ComposeCustomBlendMode: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ComposeCustomBlendMode", SDL_BlendMode, [SDL_BlendFactor, SDL_BlendFactor, SDL_BlendOperation, SDL_BlendFactor, SDL_BlendFactor, SDL_BlendOperation], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_camera.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_pixels import SDL_PixelFormat, SDL_Colorspace 5 | from .SDL_properties import SDL_PropertiesID 6 | from .SDL_surface import SDL_Surface 7 | 8 | SDL_CameraID: typing.TypeAlias = SDL_TYPE["SDL_CameraID", ctypes.c_uint32] 9 | 10 | class SDL_Camera(ctypes.c_void_p): 11 | ... 12 | 13 | class SDL_CameraSpec(ctypes.Structure): 14 | _fields_ = [ 15 | ("format", SDL_PixelFormat), 16 | ("colorspace", SDL_Colorspace), 17 | ("width", ctypes.c_int), 18 | ("height", ctypes.c_int), 19 | ("framerate_numerator", ctypes.c_int), 20 | ("framerate_denominator", ctypes.c_int) 21 | ] 22 | 23 | SDL_CameraPosition: typing.TypeAlias = SDL_TYPE["SDL_CameraPosition", SDL_ENUM] 24 | 25 | SDL_CAMERA_POSITION_UNKNOWN, SDL_CAMERA_POSITION_FRONT_FACING, SDL_CAMERA_POSITION_BACK_FACING = range(3) 26 | 27 | SDL_GetNumCameraDrivers: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetNumCameraDrivers", ctypes.c_int, [], SDL_BINARY] 28 | SDL_GetCameraDriver: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCameraDriver", ctypes.c_char_p, [ctypes.c_int], SDL_BINARY] 29 | SDL_GetCurrentCameraDriver: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCurrentCameraDriver", ctypes.c_char_p, [], SDL_BINARY] 30 | SDL_GetCameras: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCameras", SDL_POINTER[SDL_CameraID], [SDL_POINTER[ctypes.c_int]], SDL_BINARY] 31 | SDL_GetCameraSupportedFormats: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCameraSupportedFormats", SDL_POINTER[SDL_POINTER[SDL_CameraSpec]], [SDL_CameraID, SDL_POINTER[ctypes.c_int]], SDL_BINARY] 32 | SDL_GetCameraName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCameraName", ctypes.c_char_p, [SDL_CameraID], SDL_BINARY] 33 | SDL_GetCameraPosition: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCameraPosition", SDL_CameraPosition, [SDL_CameraID], SDL_BINARY] 34 | SDL_OpenCamera: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenCamera", SDL_POINTER[SDL_Camera], [SDL_CameraID, SDL_POINTER[SDL_CameraSpec]], SDL_BINARY] 35 | SDL_GetCameraPermissionState: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCameraPermissionState", ctypes.c_int, [SDL_POINTER[SDL_Camera]], SDL_BINARY] 36 | SDL_GetCameraID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCameraID", SDL_CameraID, [SDL_POINTER[SDL_Camera]], SDL_BINARY] 37 | SDL_GetCameraProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCameraProperties", SDL_PropertiesID, [SDL_POINTER[SDL_Camera]], SDL_BINARY] 38 | SDL_GetCameraFormat: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCameraFormat", ctypes.c_bool, [SDL_POINTER[SDL_Camera], SDL_POINTER[SDL_CameraSpec]], SDL_BINARY] 39 | SDL_AcquireCameraFrame: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_AcquireCameraFrame", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_Camera], SDL_POINTER[ctypes.c_uint64]], SDL_BINARY] 40 | SDL_ReleaseCameraFrame: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReleaseCameraFrame", None, [SDL_POINTER[SDL_Camera], SDL_POINTER[SDL_Surface]], SDL_BINARY] 41 | SDL_CloseCamera: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CloseCamera", None, [SDL_POINTER[SDL_Camera]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_clipboard.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC_TYPE, SDL_FUNC, SDL_BINARY 3 | 4 | SDL_SetClipboardText: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetClipboardText", ctypes.c_bool, [ctypes.c_char_p], SDL_BINARY] 5 | SDL_GetClipboardText: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetClipboardText", ctypes.c_char_p, [], SDL_BINARY] 6 | SDL_HasClipboardText: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasClipboardText", ctypes.c_bool, [], SDL_BINARY] 7 | 8 | SDL_SetPrimarySelectionText: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetPrimarySelectionText", ctypes.c_bool, [ctypes.c_char_p], SDL_BINARY] 9 | SDL_GetPrimarySelectionText: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetPrimarySelectionText", ctypes.c_char_p, [], SDL_BINARY] 10 | SDL_HasPrimarySelectionText: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasPrimarySelectionText", ctypes.c_bool, [], SDL_BINARY] 11 | 12 | SDL_ClipboardDataCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_ClipboardDataCallback", ctypes.c_void_p, [ctypes.c_char_p, SDL_POINTER[ctypes.c_size_t]]] 13 | SDL_ClipboardCleanupCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_ClipboardCleanupCallback", None, [ctypes.c_void_p]] 14 | 15 | SDL_SetClipboardData: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetClipboardData", ctypes.c_bool, [SDL_ClipboardDataCallback, SDL_ClipboardCleanupCallback, ctypes.c_void_p, SDL_POINTER[ctypes.c_char_p], ctypes.c_size_t], SDL_BINARY] 16 | SDL_ClearClipboardData: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ClearClipboardData", ctypes.c_bool, [], SDL_BINARY] 17 | SDL_GetClipboardData: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetClipboardData", ctypes.c_void_p, [ctypes.c_char_p, SDL_POINTER[ctypes.c_size_t]], SDL_BINARY] 18 | SDL_HasClipboardData: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasClipboardData", ctypes.c_bool, [ctypes.c_char_p], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_cpuinfo.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_FUNC, SDL_BINARY 2 | 3 | SDL_CACHELINE_SIZE: int = 128 4 | 5 | SDL_GetNumLogicalCPUCores: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetNumLogicalCPUCores", ctypes.c_int, [], SDL_BINARY] 6 | SDL_GetCPUCacheLineSize: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCPUCacheLineSize", ctypes.c_int, [], SDL_BINARY] 7 | 8 | SDL_HasAltiVec: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasAltiVec", ctypes.c_bool, [], SDL_BINARY] 9 | SDL_HasMMX: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasMMX", ctypes.c_bool, [], SDL_BINARY] 10 | SDL_HasSSE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasSSE", ctypes.c_bool, [], SDL_BINARY] 11 | SDL_HasSSE2: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasSSE2", ctypes.c_bool, [], SDL_BINARY] 12 | SDL_HasSSE3: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasSSE3", ctypes.c_bool, [], SDL_BINARY] 13 | SDL_HasSSE41: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasSSE41", ctypes.c_bool, [], SDL_BINARY] 14 | SDL_HasSSE42: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasSSE42", ctypes.c_bool, [], SDL_BINARY] 15 | SDL_HasAVX: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasAVX", ctypes.c_bool, [], SDL_BINARY] 16 | SDL_HasAVX2: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasAVX2", ctypes.c_bool, [], SDL_BINARY] 17 | SDL_HasAVX512F: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasAVX512F", ctypes.c_bool, [], SDL_BINARY] 18 | SDL_HasARMSIMD: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasARMSIMD", ctypes.c_bool, [], SDL_BINARY] 19 | SDL_HasNEON: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasNEON", ctypes.c_bool, [], SDL_BINARY] 20 | SDL_HasLSX: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasLSX", ctypes.c_bool, [], SDL_BINARY] 21 | SDL_HasLASX: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasLASX", ctypes.c_bool, [], SDL_BINARY] 22 | 23 | SDL_GetSystemRAM: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSystemRAM", ctypes.c_int, [], SDL_BINARY] 24 | SDL_GetSIMDAlignment: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSIMDAlignment", ctypes.c_size_t, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_dialog.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_POINTER, \ 2 | SDL_FUNC_TYPE, SDL_FUNC, SDL_TYPE, SDL_BINARY, SDL_ENUM 3 | 4 | from .SDL_video import SDL_Window 5 | from .SDL_properties import SDL_PropertiesID 6 | 7 | class SDL_DialogFileFilter(ctypes.Structure): 8 | _fields_ = [ 9 | ("name", ctypes.c_char_p), 10 | ("pattern", ctypes.c_char_p) 11 | ] 12 | 13 | SDL_DialogFileCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_DialogFileCallback", None, [ctypes.c_void_p, SDL_POINTER[ctypes.c_char_p], ctypes.c_int]] 14 | 15 | SDL_ShowOpenFileDialog: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShowOpenFileDialog", None, [SDL_DialogFileCallback, ctypes.c_void_p, SDL_POINTER[SDL_Window], SDL_POINTER[SDL_DialogFileFilter], ctypes.c_int, ctypes.c_char_p, ctypes.c_bool], SDL_BINARY] 16 | SDL_ShowSaveFileDialog: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShowSaveFileDialog", None, [SDL_DialogFileCallback, ctypes.c_void_p, SDL_POINTER[SDL_Window], SDL_POINTER[SDL_DialogFileFilter], ctypes.c_int, ctypes.c_char_p], SDL_BINARY] 17 | SDL_ShowOpenFolderDialog: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShowOpenFolderDialog", None, [SDL_DialogFileCallback, ctypes.c_void_p, SDL_POINTER[SDL_Window], ctypes.c_char_p, ctypes.c_bool], SDL_BINARY] 18 | 19 | SDL_FileDialogType: typing.TypeAlias = SDL_TYPE["SDL_FileDialogType", SDL_ENUM] 20 | 21 | SDL_FILEDIALOG_OPENFILE, SDL_FILEDIALOG_SAVEFILE, SDL_FILEDIALOG_OPENFOLDER = range(3) 22 | 23 | SDL_ShowFileDialogWithProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShowFileDialogWithProperties", None, [SDL_FileDialogType, SDL_DialogFileCallback, ctypes.c_void_p, SDL_PropertiesID], SDL_BINARY] 24 | 25 | SDL_PROP_FILE_DIALOG_FILTERS_POINTER: bytes = "SDL.filedialog.filters".encode() 26 | SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER: bytes = "SDL.filedialog.nfilters".encode() 27 | SDL_PROP_FILE_DIALOG_WINDOW_POINTER: bytes = "SDL.filedialog.window".encode() 28 | SDL_PROP_FILE_DIALOG_LOCATION_STRING: bytes = "SDL.filedialog.location".encode() 29 | SDL_PROP_FILE_DIALOG_MANY_BOOLEAN: bytes = "SDL.filedialog.many".encode() 30 | SDL_PROP_FILE_DIALOG_TITLE_STRING: bytes = "SDL.filedialog.title".encode() 31 | SDL_PROP_FILE_DIALOG_ACCEPT_STRING: bytes = "SDL.filedialog.accept".encode() 32 | SDL_PROP_FILE_DIALOG_CANCEL_STRING: bytes = "SDL.filedialog.cancel".encode() -------------------------------------------------------------------------------- /sdl3/SDL_endian.py: -------------------------------------------------------------------------------- 1 | from .__init__ import sys, array 2 | 3 | SDL_LIL_ENDIAN, SDL_BIG_ENDIAN = 1234, 4321 4 | SDL_BYTEORDER: int = {"little": SDL_LIL_ENDIAN, "big": SDL_BIG_ENDIAN}[sys.byteorder] 5 | 6 | def SDL_Swap16(x: int) -> int: 7 | return ((x << 8) & 0xFF00) | ((x >> 8) & 0x00FF) 8 | 9 | def SDL_Swap32(x: int) -> int: 10 | return ((x << 24) & 0xFF000000) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | ((x >> 24) & 0x000000FF) 11 | 12 | def SDL_Swap64(x: int) -> int: 13 | return (SDL_Swap32(x & 0xFFFFFFFF) << 32) | (SDL_Swap32(x >> 32 & 0xFFFFFFFF)) 14 | 15 | def SDL_SwapFloat(x: float) -> float: 16 | y = array.array("d", (x, )) 17 | y.byteswap(); return y[0] 18 | 19 | if SDL_BYTEORDER == SDL_LIL_ENDIAN: 20 | SDL_SwapBE16, SDL_SwapBE32, SDL_SwapBE64, SDL_SwapFloatBE = SDL_Swap16, SDL_Swap32, SDL_Swap64, SDL_SwapFloat 21 | SDL_SwapLE16 = SDL_SwapLE32 = SDL_SwapLE64 = SDL_SwapFloatLE = lambda x: x 22 | 23 | else: 24 | SDL_SwapLE16, SDL_SwapLE32, SDL_SwapLE64, SDL_SwapFloatLE = SDL_Swap16, SDL_Swap32, SDL_Swap64, SDL_SwapFloat 25 | SDL_SwapBE16 = SDL_SwapBE32 = SDL_SwapBE64 = SDL_SwapFloatBE = lambda x: x -------------------------------------------------------------------------------- /sdl3/SDL_error.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_VA_LIST, SDL_FUNC, SDL_BINARY 2 | 3 | SDL_SetError: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetError", ctypes.c_bool, [ctypes.c_char_p, ...], SDL_BINARY] 4 | SDL_SetErrorV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetErrorV", ctypes.c_bool, [ctypes.c_char_p, SDL_VA_LIST], SDL_BINARY] 5 | SDL_OutOfMemory: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OutOfMemory", ctypes.c_bool, [], SDL_BINARY] 6 | SDL_GetError: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetError", ctypes.c_char_p, [], SDL_BINARY] 7 | SDL_ClearError: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ClearError", ctypes.c_bool, [], SDL_BINARY] 8 | 9 | def SDL_Unsupported() -> ctypes.c_int: 10 | return SDL_SetError("That operation is not supported".encode()) 11 | 12 | def SDL_InvalidParamError(param: ctypes.c_char_p) -> ctypes.c_int: 13 | return SDL_SetError("Parameter '%s' is invalid".encode(), param) -------------------------------------------------------------------------------- /sdl3/SDL_filesystem.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_POINTER, \ 2 | SDL_FUNC_TYPE, SDL_FUNC, SDL_TYPE, SDL_BINARY, SDL_ENUM 3 | 4 | from .SDL_stdinc import SDL_Time 5 | 6 | SDL_GetBasePath: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetBasePath", ctypes.c_char_p, [], SDL_BINARY] 7 | SDL_GetPrefPath: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetPrefPath", ctypes.c_char_p, [ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 8 | 9 | SDL_Folder: typing.TypeAlias = SDL_TYPE["SDL_Folder", SDL_ENUM] 10 | 11 | SDL_FOLDER_HOME, SDL_FOLDER_DESKTOP, SDL_FOLDER_DOCUMENTS, SDL_FOLDER_DOWNLOADS, SDL_FOLDER_MUSIC, SDL_FOLDER_PICTURES, SDL_FOLDER_PUBLICSHARE, \ 12 | SDL_FOLDER_SAVEDGAMES, SDL_FOLDER_SCREENSHOTS, SDL_FOLDER_TEMPLATES, SDL_FOLDER_VIDEOS , SDL_FOLDER_COUNT = range(12) 13 | 14 | SDL_GetUserFolder: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetUserFolder", ctypes.c_char_p, [SDL_Folder], SDL_BINARY] 15 | 16 | SDL_PathType: typing.TypeAlias = SDL_TYPE["SDL_PathType", SDL_ENUM] 17 | 18 | SDL_PATHTYPE_NONE, SDL_PATHTYPE_FILE, SDL_PATHTYPE_DIRECTORY, SDL_PATHTYPE_OTHER = range(4) 19 | 20 | class SDL_PathInfo(ctypes.Structure): 21 | _fields_ = [ 22 | ("type", SDL_PathType), 23 | ("size", ctypes.c_uint64), 24 | ("create_time", SDL_Time), 25 | ("modify_time", SDL_Time), 26 | ("access_time", SDL_Time) 27 | ] 28 | 29 | SDL_GlobFlags: typing.TypeAlias = SDL_TYPE["SDL_GlobFlags", ctypes.c_uint32] 30 | 31 | SDL_GLOB_CASEINSENSITIVE: int = 1 << 0 32 | 33 | SDL_CreateDirectory: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateDirectory", ctypes.c_bool, [ctypes.c_char_p], SDL_BINARY] 34 | 35 | SDL_EnumerationResult: typing.TypeAlias = SDL_TYPE["SDL_EnumerationResult", SDL_ENUM] 36 | 37 | SDL_ENUM_CONTINUE, SDL_ENUM_SUCCESS, SDL_ENUM_FAILURE = range(3) 38 | 39 | SDL_EnumerateDirectoryCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_EnumerateDirectoryCallback", SDL_EnumerationResult, [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p]] 40 | 41 | SDL_EnumerateDirectory: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_EnumerateDirectory", ctypes.c_bool, [ctypes.c_char_p, SDL_EnumerateDirectoryCallback, ctypes.c_void_p], SDL_BINARY] 42 | SDL_RemovePath: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_RemovePath", ctypes.c_bool, [ctypes.c_char_p], SDL_BINARY] 43 | SDL_RenamePath: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_RenamePath", ctypes.c_bool, [ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 44 | SDL_CopyFile: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CopyFile", ctypes.c_bool, [ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 45 | SDL_GetPathInfo: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetPathInfo", ctypes.c_bool, [ctypes.c_char_p, SDL_POINTER[SDL_PathInfo]], SDL_BINARY] 46 | SDL_GlobDirectory: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GlobDirectory", SDL_POINTER[ctypes.c_char_p], [ctypes.c_char_p, ctypes.c_char_p, SDL_GlobFlags, SDL_POINTER[ctypes.c_int]], SDL_BINARY] 47 | SDL_GetCurrentDirectory: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCurrentDirectory", ctypes.c_char_p, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_guid.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_FUNC, SDL_BINARY 2 | 3 | class SDL_GUID(ctypes.Structure): 4 | _fields_ = [ 5 | ("data", ctypes.c_uint8 * 16) 6 | ] 7 | 8 | SDL_GUIDToString: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GUIDToString", None, [SDL_GUID, ctypes.c_char_p, ctypes.c_int], SDL_BINARY] 9 | SDL_StringToGUID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_StringToGUID", SDL_GUID, [ctypes.c_char_p], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_haptic.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_joystick import SDL_Joystick 5 | 6 | class SDL_Haptic(ctypes.c_void_p): 7 | ... 8 | 9 | SDL_HAPTIC_CONSTANT: int = 1 << 0 10 | SDL_HAPTIC_SINE: int = 1 << 1 11 | SDL_HAPTIC_SQUARE: int = 1 << 2 12 | SDL_HAPTIC_TRIANGLE: int = 1 << 3 13 | SDL_HAPTIC_SAWTOOTHUP: int = 1 << 4 14 | SDL_HAPTIC_SAWTOOTHDOWN: int = 1 << 5 15 | SDL_HAPTIC_RAMP: int = 1 << 6 16 | SDL_HAPTIC_SPRING: int = 1 << 7 17 | SDL_HAPTIC_DAMPER: int = 1 << 8 18 | SDL_HAPTIC_INERTIA: int = 1 << 9 19 | SDL_HAPTIC_FRICTION: int = 1 << 10 20 | SDL_HAPTIC_LEFTRIGHT: int = 1 << 11 21 | SDL_HAPTIC_RESERVED1: int = 1 << 12 22 | SDL_HAPTIC_RESERVED2: int = 1 << 13 23 | SDL_HAPTIC_RESERVED3: int = 1 << 14 24 | SDL_HAPTIC_CUSTOM: int = 1 << 15 25 | SDL_HAPTIC_GAIN: int = 1 << 16 26 | SDL_HAPTIC_AUTOCENTER: int = 1 << 17 27 | SDL_HAPTIC_STATUS: int = 1 << 18 28 | SDL_HAPTIC_PAUSE: int = 1 << 19 29 | 30 | SDL_HAPTIC_POLAR, SDL_HAPTIC_CARTESIAN, \ 31 | SDL_HAPTIC_SPHERICAL, SDL_HAPTIC_STEERING_AXIS = range(4) 32 | 33 | SDL_HAPTIC_INFINITY: int = 4294967295 34 | 35 | class SDL_HapticDirection(ctypes.Structure): 36 | _fields_ = [ 37 | ("type", ctypes.c_uint8), 38 | ("dir", ctypes.c_int32 * 3) 39 | ] 40 | 41 | class SDL_HapticConstant(ctypes.Structure): 42 | _fields_ = [ 43 | ("type", ctypes.c_uint16), 44 | ("direction", SDL_HapticDirection), 45 | ("length", ctypes.c_uint32), 46 | ("delay", ctypes.c_uint16), 47 | ("button", ctypes.c_uint16), 48 | ("interval", ctypes.c_uint16), 49 | ("level", ctypes.c_int16), 50 | ("attack_length", ctypes.c_uint16), 51 | ("attack_level", ctypes.c_uint16), 52 | ("fade_length", ctypes.c_uint16), 53 | ("fade_level", ctypes.c_uint16) 54 | ] 55 | 56 | class SDL_HapticPeriodic(ctypes.Structure): 57 | _fields_ = [ 58 | ("type", ctypes.c_uint16), 59 | ("direction", SDL_HapticDirection), 60 | ("length", ctypes.c_uint32), 61 | ("delay", ctypes.c_uint16), 62 | ("button", ctypes.c_uint16), 63 | ("interval", ctypes.c_uint16), 64 | ("period", ctypes.c_uint16), 65 | ("magnitude", ctypes.c_int16), 66 | ("offset", ctypes.c_int16), 67 | ("phase", ctypes.c_uint16), 68 | ("attack_length", ctypes.c_uint16), 69 | ("attack_level", ctypes.c_uint16), 70 | ("fade_length", ctypes.c_uint16), 71 | ("fade_level", ctypes.c_uint16) 72 | ] 73 | 74 | class SDL_HapticCondition(ctypes.Structure): 75 | _fields_ = [ 76 | ("type", ctypes.c_uint16), 77 | ("direction", SDL_HapticDirection), 78 | ("length", ctypes.c_uint32), 79 | ("delay", ctypes.c_uint16), 80 | ("button", ctypes.c_uint16), 81 | ("interval", ctypes.c_uint16), 82 | ("right_sat", ctypes.c_uint16 * 3), 83 | ("left_sat", ctypes.c_uint16 * 3), 84 | ("right_coeff", ctypes.c_int16 * 3), 85 | ("left_coeff", ctypes.c_int16 * 3), 86 | ("deadband", ctypes.c_uint16 * 3), 87 | ("center", ctypes.c_int16 * 3) 88 | ] 89 | 90 | class SDL_HapticRamp(ctypes.Structure): 91 | _fields_ = [ 92 | ("type", ctypes.c_uint16), 93 | ("direction", SDL_HapticDirection), 94 | ("length", ctypes.c_uint32), 95 | ("delay", ctypes.c_uint16), 96 | ("button", ctypes.c_uint16), 97 | ("interval", ctypes.c_uint16), 98 | ("start", ctypes.c_int16), 99 | ("end", ctypes.c_int16), 100 | ("attack_length", ctypes.c_uint16), 101 | ("attack_level", ctypes.c_uint16), 102 | ("fade_length", ctypes.c_uint16), 103 | ("fade_level", ctypes.c_uint16) 104 | ] 105 | 106 | class SDL_HapticLeftRight(ctypes.Structure): 107 | _fields_ = [ 108 | ("type", ctypes.c_uint16), 109 | ("length", ctypes.c_uint32), 110 | ("large_magnitude", ctypes.c_uint16), 111 | ("small_magnitude", ctypes.c_uint16) 112 | ] 113 | 114 | class SDL_HapticCustom(ctypes.Structure): 115 | _fields_ = [ 116 | ("type", ctypes.c_uint16), 117 | ("direction", SDL_HapticDirection), 118 | ("length", ctypes.c_uint32), 119 | ("delay", ctypes.c_uint16), 120 | ("button", ctypes.c_uint16), 121 | ("interval", ctypes.c_uint16), 122 | ("channels", ctypes.c_uint8), 123 | ("period", ctypes.c_uint16), 124 | ("samples", ctypes.c_uint16), 125 | ("data", SDL_POINTER[ctypes.c_uint16]), 126 | ("attack_length", ctypes.c_uint16), 127 | ("attack_level", ctypes.c_uint16), 128 | ("fade_length", ctypes.c_uint16), 129 | ("fade_level", ctypes.c_uint16) 130 | ] 131 | 132 | class SDL_HapticEffect(ctypes.Union): 133 | _fields_ = [ 134 | ("type", ctypes.c_uint16), 135 | ("constant", SDL_HapticConstant), 136 | ("periodic", SDL_HapticPeriodic), 137 | ("condition", SDL_HapticCondition), 138 | ("ramp", SDL_HapticRamp), 139 | ("leftright", SDL_HapticLeftRight), 140 | ("custom", SDL_HapticCustom) 141 | ] 142 | 143 | SDL_HapticID: typing.TypeAlias = SDL_TYPE["SDL_HapticID", ctypes.c_uint32] 144 | 145 | SDL_GetHaptics: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetHaptics", SDL_POINTER[SDL_HapticID], [SDL_POINTER[ctypes.c_int]], SDL_BINARY] 146 | SDL_GetHapticNameForID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetHapticNameForID", ctypes.c_char_p, [SDL_HapticID], SDL_BINARY] 147 | SDL_OpenHaptic: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenHaptic", SDL_POINTER[SDL_Haptic], [SDL_HapticID], SDL_BINARY] 148 | SDL_GetHapticFromID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetHapticFromID", SDL_POINTER[SDL_Haptic], [SDL_HapticID], SDL_BINARY] 149 | SDL_GetHapticID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetHapticID", SDL_HapticID, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 150 | SDL_GetHapticName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetHapticName", ctypes.c_char_p, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 151 | SDL_IsMouseHaptic: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IsMouseHaptic", ctypes.c_bool, [], SDL_BINARY] 152 | SDL_OpenHapticFromMouse: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenHapticFromMouse", SDL_POINTER[SDL_Haptic], [], SDL_BINARY] 153 | SDL_IsJoystickHaptic: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IsJoystickHaptic", ctypes.c_bool, [SDL_POINTER[SDL_Joystick]], SDL_BINARY] 154 | SDL_OpenHapticFromJoystick: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenHapticFromJoystick", SDL_POINTER[SDL_Haptic], [SDL_POINTER[SDL_Joystick]], SDL_BINARY] 155 | SDL_CloseHaptic: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CloseHaptic", None, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 156 | SDL_GetMaxHapticEffects: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetMaxHapticEffects", ctypes.c_int, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 157 | SDL_GetMaxHapticEffectsPlaying: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetMaxHapticEffectsPlaying", ctypes.c_int, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 158 | SDL_GetHapticFeatures: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetHapticFeatures", ctypes.c_uint32, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 159 | SDL_GetNumHapticAxes: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetNumHapticAxes", ctypes.c_int, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 160 | SDL_HapticEffectSupported: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HapticEffectSupported", ctypes.c_bool, [SDL_POINTER[SDL_Haptic], SDL_POINTER[SDL_HapticEffect]], SDL_BINARY] 161 | SDL_CreateHapticEffect: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateHapticEffect", ctypes.c_int, [SDL_POINTER[SDL_Haptic], SDL_POINTER[SDL_HapticEffect]], SDL_BINARY] 162 | SDL_UpdateHapticEffect: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UpdateHapticEffect", ctypes.c_bool, [SDL_POINTER[SDL_Haptic], ctypes.c_int, SDL_POINTER[SDL_HapticEffect]], SDL_BINARY] 163 | SDL_RunHapticEffect: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_RunHapticEffect", ctypes.c_bool, [SDL_POINTER[SDL_Haptic], ctypes.c_int, ctypes.c_uint32], SDL_BINARY] 164 | SDL_StopHapticEffect: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_StopHapticEffect", ctypes.c_bool, [SDL_POINTER[SDL_Haptic], ctypes.c_int], SDL_BINARY] 165 | SDL_DestroyHapticEffect: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroyHapticEffect", None, [SDL_POINTER[SDL_Haptic], ctypes.c_int], SDL_BINARY] 166 | SDL_GetHapticEffectStatus: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetHapticEffectStatus", ctypes.c_bool, [SDL_POINTER[SDL_Haptic], ctypes.c_int], SDL_BINARY] 167 | SDL_SetHapticGain: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetHapticGain", ctypes.c_bool, [SDL_POINTER[SDL_Haptic], ctypes.c_int], SDL_BINARY] 168 | SDL_SetHapticAutocenter: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetHapticAutocenter", ctypes.c_bool, [SDL_POINTER[SDL_Haptic], ctypes.c_int], SDL_BINARY] 169 | SDL_PauseHaptic: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_PauseHaptic", ctypes.c_bool, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 170 | SDL_ResumeHaptic: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ResumeHaptic", ctypes.c_bool, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 171 | SDL_StopHapticEffects: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_StopHapticEffects", ctypes.c_bool, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 172 | SDL_HapticRumbleSupported: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HapticRumbleSupported", ctypes.c_bool, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 173 | SDL_InitHapticRumble: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_InitHapticRumble", ctypes.c_bool, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] 174 | SDL_PlayHapticRumble: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_PlayHapticRumble", ctypes.c_bool, [SDL_POINTER[SDL_Haptic], ctypes.c_float, ctypes.c_uint32], SDL_BINARY] 175 | SDL_StopHapticRumble: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_StopHapticRumble", ctypes.c_bool, [SDL_POINTER[SDL_Haptic]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_hidapi.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | class SDL_hid_device(ctypes.c_void_p): 5 | ... 6 | 7 | SDL_hid_bus_type: typing.TypeAlias = SDL_TYPE["SDL_hid_bus_type", SDL_ENUM] 8 | 9 | SDL_HID_API_BUS_UNKNOWN, SDL_HID_API_BUS_USB, SDL_HID_API_BUS_BLUETOOTH, \ 10 | SDL_HID_API_BUS_I2C, SDL_HID_API_BUS_SPI = range(5) 11 | 12 | SDL_hid_device_info: typing.TypeAlias = SDL_TYPE["SDL_hid_device_info", ctypes.c_void_p] 13 | 14 | class SDL_hid_device_info(ctypes.Structure): 15 | _fields_ = [ 16 | ("path", ctypes.c_char_p), 17 | ("vendor_id", ctypes.c_ushort), 18 | ("product_id", ctypes.c_ushort), 19 | ("serial_number", ctypes.c_wchar_p), 20 | ("release_number", ctypes.c_ushort), 21 | ("manufacturer_string", ctypes.c_wchar_p), 22 | ("product_string", ctypes.c_wchar_p), 23 | ("usage_page", ctypes.c_ushort), 24 | ("usage", ctypes.c_ushort), 25 | ("interface_number", ctypes.c_int), 26 | ("interface_class", ctypes.c_int), 27 | ("interface_subclass", ctypes.c_int), 28 | ("interface_protocol", ctypes.c_int), 29 | ("bus_type", SDL_hid_bus_type), 30 | ("next", SDL_POINTER[SDL_hid_device_info]) 31 | ] 32 | 33 | SDL_hid_init: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_init", ctypes.c_int, [], SDL_BINARY] 34 | SDL_hid_exit: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_exit", ctypes.c_int, [], SDL_BINARY] 35 | SDL_hid_device_change_count: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_device_change_count", ctypes.c_uint32, [], SDL_BINARY] 36 | SDL_hid_enumerate: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_enumerate", SDL_POINTER[SDL_hid_device_info], [ctypes.c_ushort, ctypes.c_ushort], SDL_BINARY] 37 | SDL_hid_free_enumeration: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_free_enumeration", None, [SDL_POINTER[SDL_hid_device_info]], SDL_BINARY] 38 | SDL_hid_open: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_open", SDL_POINTER[SDL_hid_device], [ctypes.c_ushort, ctypes.c_ushort, ctypes.c_wchar_p], SDL_BINARY] 39 | SDL_hid_open_path: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_open_path", SDL_POINTER[SDL_hid_device], [ctypes.c_char_p], SDL_BINARY] 40 | SDL_hid_write: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_write", ctypes.c_int, [SDL_POINTER[SDL_hid_device], SDL_POINTER[ctypes.c_ubyte], ctypes.c_size_t], SDL_BINARY] 41 | SDL_hid_read_timeout: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_read_timeout", ctypes.c_int, [SDL_POINTER[SDL_hid_device], SDL_POINTER[ctypes.c_ubyte], ctypes.c_size_t, ctypes.c_int], SDL_BINARY] 42 | SDL_hid_read: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_read", ctypes.c_int, [SDL_POINTER[SDL_hid_device], SDL_POINTER[ctypes.c_ubyte], ctypes.c_size_t], SDL_BINARY] 43 | SDL_hid_set_nonblocking: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_set_nonblocking", ctypes.c_int, [SDL_POINTER[SDL_hid_device], ctypes.c_int], SDL_BINARY] 44 | SDL_hid_send_feature_report: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_send_feature_report", ctypes.c_int, [SDL_POINTER[SDL_hid_device], SDL_POINTER[ctypes.c_ubyte], ctypes.c_size_t], SDL_BINARY] 45 | SDL_hid_get_feature_report: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_get_feature_report", ctypes.c_int, [SDL_POINTER[SDL_hid_device], SDL_POINTER[ctypes.c_ubyte], ctypes.c_size_t], SDL_BINARY] 46 | SDL_hid_get_input_report: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_get_input_report", ctypes.c_int, [SDL_POINTER[SDL_hid_device], SDL_POINTER[ctypes.c_ubyte], ctypes.c_size_t], SDL_BINARY] 47 | SDL_hid_close: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_close", ctypes.c_int, [SDL_POINTER[SDL_hid_device]], SDL_BINARY] 48 | SDL_hid_get_manufacturer_string: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_get_manufacturer_string", ctypes.c_int, [SDL_POINTER[SDL_hid_device], ctypes.c_wchar_p, ctypes.c_size_t], SDL_BINARY] 49 | SDL_hid_get_product_string: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_get_product_string", ctypes.c_int, [SDL_POINTER[SDL_hid_device], ctypes.c_wchar_p, ctypes.c_size_t], SDL_BINARY] 50 | SDL_hid_get_serial_number_string: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_get_serial_number_string", ctypes.c_int, [SDL_POINTER[SDL_hid_device], ctypes.c_wchar_p, ctypes.c_size_t], SDL_BINARY] 51 | SDL_hid_get_indexed_string: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_get_indexed_string", ctypes.c_int, [SDL_POINTER[SDL_hid_device], ctypes.c_int, ctypes.c_wchar_p, ctypes.c_size_t], SDL_BINARY] 52 | SDL_hid_get_device_info: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_get_device_info", SDL_POINTER[SDL_hid_device_info], [SDL_POINTER[SDL_hid_device]], SDL_BINARY] 53 | SDL_hid_get_report_descriptor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_get_report_descriptor", ctypes.c_int, [SDL_POINTER[SDL_hid_device], SDL_POINTER[ctypes.c_ubyte], ctypes.c_size_t], SDL_BINARY] 54 | SDL_hid_ble_scan: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_hid_ble_scan", None, [ctypes.c_bool], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_image.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC, SDL_IMAGE_BINARY 3 | 4 | from .SDL_surface import SDL_Surface 5 | from .SDL_render import SDL_Texture, SDL_Renderer 6 | from .SDL_iostream import SDL_IOStream 7 | from .SDL_version import SDL_VERSIONNUM 8 | 9 | SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_MICRO_VERSION = 3, 2, 4 10 | SDL_IMAGE_VERSION: int = SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_MICRO_VERSION) 11 | 12 | SDL_IMAGE_VERSION_ATLEAST: abc.Callable[[int, int, int], bool] = lambda x, y, z: \ 13 | (SDL_IMAGE_MAJOR_VERSION >= x) and (SDL_IMAGE_MAJOR_VERSION > x or SDL_IMAGE_MINOR_VERSION >= y) and \ 14 | (SDL_IMAGE_MAJOR_VERSION > x or SDL_IMAGE_MINOR_VERSION > y or SDL_IMAGE_MICRO_VERSION >= z) 15 | 16 | IMG_Version: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_Version", ctypes.c_int, [], SDL_IMAGE_BINARY] 17 | 18 | IMG_LoadTyped_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadTyped_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream], ctypes.c_bool, ctypes.c_char_p], SDL_IMAGE_BINARY] 19 | IMG_Load: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_Load", SDL_POINTER[SDL_Surface], [ctypes.c_char_p], SDL_IMAGE_BINARY] 20 | IMG_Load_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_Load_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream], ctypes.c_bool], SDL_IMAGE_BINARY] 21 | 22 | IMG_LoadTexture: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadTexture", SDL_POINTER[SDL_Texture], [SDL_POINTER[SDL_Renderer], ctypes.c_char_p], SDL_IMAGE_BINARY] 23 | IMG_LoadTexture_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadTexture_IO", SDL_POINTER[SDL_Texture], [SDL_POINTER[SDL_Renderer], SDL_POINTER[SDL_IOStream], ctypes.c_bool], SDL_IMAGE_BINARY] 24 | IMG_LoadTextureTyped_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadTextureTyped_IO", SDL_POINTER[SDL_Texture], [SDL_POINTER[SDL_Renderer], SDL_POINTER[SDL_IOStream], ctypes.c_bool, ctypes.c_char_p], SDL_IMAGE_BINARY] 25 | 26 | IMG_isAVIF: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isAVIF", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 27 | IMG_isICO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isICO", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 28 | IMG_isCUR: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isCUR", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 29 | IMG_isBMP: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isBMP", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 30 | IMG_isGIF: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isGIF", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 31 | IMG_isJPG: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isJPG", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 32 | IMG_isJXL: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isJXL", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 33 | IMG_isLBM: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isLBM", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 34 | IMG_isPCX: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isPCX", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 35 | IMG_isPNG: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isPNG", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 36 | IMG_isPNM: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isPNM", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 37 | IMG_isSVG: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isSVG", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 38 | IMG_isQOI: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isQOI", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 39 | IMG_isTIF: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isTIF", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 40 | IMG_isXCF: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isXCF", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 41 | IMG_isXPM: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isXPM", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 42 | IMG_isXV: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isXV", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 43 | IMG_isWEBP: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_isWEBP", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 44 | 45 | IMG_LoadAVIF_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadAVIF_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 46 | IMG_LoadICO_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadICO_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 47 | IMG_LoadCUR_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadCUR_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 48 | IMG_LoadBMP_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadBMP_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 49 | IMG_LoadGIF_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadGIF_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 50 | IMG_LoadJPG_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadJPG_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 51 | IMG_LoadJXL_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadJXL_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 52 | IMG_LoadLBM_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadLBM_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 53 | IMG_LoadPCX_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadPCX_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 54 | IMG_LoadPNG_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadPNG_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 55 | IMG_LoadPNM_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadPNM_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 56 | IMG_LoadSVG_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadSVG_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 57 | IMG_LoadQOI_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadQOI_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 58 | IMG_LoadTGA_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadTGA_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 59 | IMG_LoadTIF_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadTIF_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 60 | IMG_LoadXCF_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadXCF_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 61 | IMG_LoadXPM_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadXPM_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 62 | IMG_LoadXV_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadXV_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 63 | IMG_LoadWEBP_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadWEBP_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 64 | IMG_LoadSizedSVG_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadSizedSVG_IO", SDL_POINTER[SDL_Surface], [SDL_POINTER[SDL_IOStream], ctypes.c_int, ctypes.c_int], SDL_IMAGE_BINARY] 65 | 66 | IMG_ReadXPMFromArray: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_ReadXPMFromArray", SDL_POINTER[SDL_Surface], [SDL_POINTER[ctypes.c_char_p]], SDL_IMAGE_BINARY] 67 | IMG_ReadXPMFromArrayToRGB888: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_ReadXPMFromArrayToRGB888", SDL_POINTER[SDL_Surface], [SDL_POINTER[ctypes.c_char_p]], SDL_IMAGE_BINARY] 68 | 69 | IMG_SaveAVIF: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_SaveAVIF", ctypes.c_bool, [SDL_POINTER[SDL_Surface], ctypes.c_char_p, ctypes.c_int], SDL_IMAGE_BINARY] 70 | IMG_SaveAVIF_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_SaveAVIF_IO", ctypes.c_bool, [SDL_POINTER[SDL_Surface], SDL_POINTER[SDL_IOStream], ctypes.c_bool, ctypes.c_int], SDL_IMAGE_BINARY] 71 | IMG_SavePNG: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_SavePNG", ctypes.c_bool, [SDL_POINTER[SDL_Surface], ctypes.c_char_p], SDL_IMAGE_BINARY] 72 | IMG_SavePNG_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_SavePNG_IO", ctypes.c_bool, [SDL_POINTER[SDL_Surface], SDL_POINTER[SDL_IOStream], ctypes.c_bool], SDL_IMAGE_BINARY] 73 | IMG_SaveJPG: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_SaveJPG", ctypes.c_bool, [SDL_POINTER[SDL_Surface], ctypes.c_char_p, ctypes.c_int], SDL_IMAGE_BINARY] 74 | IMG_SaveJPG_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_SaveJPG_IO", ctypes.c_bool, [SDL_POINTER[SDL_Surface], SDL_POINTER[SDL_IOStream], ctypes.c_bool, ctypes.c_int], SDL_IMAGE_BINARY] 75 | 76 | class IMG_Animation(ctypes.Structure): 77 | _fields_ = [ 78 | ("w", ctypes.c_int), 79 | ("h", ctypes.c_int), 80 | ("count", ctypes.c_int), 81 | ("frames", SDL_POINTER[SDL_POINTER[SDL_Surface]]), 82 | ("delays", SDL_POINTER[ctypes.c_int]) 83 | ] 84 | 85 | IMG_LoadAnimation: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadAnimation", SDL_POINTER[IMG_Animation], [ctypes.c_char_p], SDL_IMAGE_BINARY] 86 | IMG_LoadAnimation_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadAnimation_IO", SDL_POINTER[IMG_Animation], [SDL_POINTER[SDL_IOStream], ctypes.c_bool], SDL_IMAGE_BINARY] 87 | IMG_LoadAnimationTyped_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadAnimationTyped_IO", SDL_POINTER[IMG_Animation], [SDL_POINTER[SDL_IOStream], ctypes.c_bool, ctypes.c_char_p], SDL_IMAGE_BINARY] 88 | IMG_FreeAnimation: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_FreeAnimation", None, [SDL_POINTER[IMG_Animation]], SDL_IMAGE_BINARY] 89 | IMG_LoadGIFAnimation_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadGIFAnimation_IO", SDL_POINTER[IMG_Animation], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] 90 | IMG_LoadWEBPAnimation_IO: abc.Callable[..., typing.Any] = SDL_FUNC["IMG_LoadWEBPAnimation_IO", SDL_POINTER[IMG_Animation], [SDL_POINTER[SDL_IOStream]], SDL_IMAGE_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_init.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_POINTER, \ 2 | SDL_FUNC_TYPE, SDL_FUNC, SDL_TYPE, SDL_BINARY, SDL_ENUM 3 | 4 | from .SDL_events import SDL_Event 5 | 6 | SDL_InitFlags: typing.TypeAlias = SDL_TYPE["SDL_InitFlags", ctypes.c_uint32] 7 | 8 | SDL_INIT_AUDIO: int = 0x00000010 9 | SDL_INIT_VIDEO: int = 0x00000020 10 | SDL_INIT_JOYSTICK: int = 0x00000200 11 | SDL_INIT_HAPTIC: int = 0x00001000 12 | SDL_INIT_GAMEPAD: int= 0x00002000 13 | SDL_INIT_EVENTS: int = 0x00004000 14 | SDL_INIT_SENSOR: int = 0x00008000 15 | SDL_INIT_CAMERA: int = 0x00010000 16 | 17 | SDL_AppResult: typing.TypeAlias = SDL_TYPE["SDL_AppResult", SDL_ENUM] 18 | 19 | SDL_APP_CONTINUE, SDL_APP_SUCCESS, SDL_APP_FAILURE = range(3) 20 | 21 | SDL_AppInit_func: typing.TypeAlias = SDL_FUNC_TYPE["SDL_AppInit_func", SDL_AppResult, [SDL_POINTER[ctypes.c_void_p], ctypes.c_int, SDL_POINTER[ctypes.c_char_p]]] 22 | SDL_AppIterate_func: typing.TypeAlias = SDL_FUNC_TYPE["SDL_AppIterate_func", SDL_AppResult, [ctypes.c_void_p]] 23 | SDL_AppEvent_func: typing.TypeAlias = SDL_FUNC_TYPE["SDL_AppEvent_func", SDL_AppResult, [ctypes.c_void_p, SDL_POINTER[SDL_Event]]] 24 | SDL_AppQuit_func: typing.TypeAlias = SDL_FUNC_TYPE["SDL_AppQuit_func", None, [ctypes.c_void_p, SDL_AppResult]] 25 | 26 | SDL_Init: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Init", ctypes.c_bool, [SDL_InitFlags], SDL_BINARY] 27 | SDL_InitSubSystem: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_InitSubSystem", ctypes.c_bool, [SDL_InitFlags], SDL_BINARY] 28 | SDL_QuitSubSystem: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_QuitSubSystem", None, [SDL_InitFlags], SDL_BINARY] 29 | SDL_WasInit: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WasInit", SDL_InitFlags, [SDL_InitFlags], SDL_BINARY] 30 | SDL_Quit: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Quit", None, [], SDL_BINARY] 31 | 32 | SDL_IsMainThread: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IsMainThread", ctypes.c_bool, [], SDL_BINARY] 33 | SDL_MainThreadCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_MainThreadCallback", None, [ctypes.c_void_p]] 34 | SDL_RunOnMainThread: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_RunOnMainThread", ctypes.c_bool, [SDL_MainThreadCallback, ctypes.c_void_p, ctypes.c_bool], SDL_BINARY] 35 | 36 | SDL_SetAppMetadata: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAppMetadata", ctypes.c_bool, [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 37 | SDL_SetAppMetadataProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetAppMetadataProperty", ctypes.c_bool, [ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 38 | 39 | SDL_PROP_APP_METADATA_NAME_STRING: bytes = "SDL.app.metadata.name".encode() 40 | SDL_PROP_APP_METADATA_VERSION_STRING: bytes = "SDL.app.metadata.version".encode() 41 | SDL_PROP_APP_METADATA_IDENTIFIER_STRING: bytes = "SDL.app.metadata.identifier".encode() 42 | SDL_PROP_APP_METADATA_CREATOR_STRING: bytes = "SDL.app.metadata.creator".encode() 43 | SDL_PROP_APP_METADATA_COPYRIGHT_STRING: bytes = "SDL.app.metadata.copyright".encode() 44 | SDL_PROP_APP_METADATA_URL_STRING: bytes = "SDL.app.metadata.url".encode() 45 | SDL_PROP_APP_METADATA_TYPE_STRING: bytes = "SDL.app.metadata.type".encode() 46 | 47 | SDL_GetAppMetadataProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetAppMetadataProperty", ctypes.c_char_p, [ctypes.c_char_p], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_iostream.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_POINTER, SDL_VA_LIST, \ 2 | SDL_FUNC_TYPE, SDL_FUNC, SDL_TYPE, SDL_BINARY, SDL_ENUM 3 | 4 | from .SDL_properties import SDL_PropertiesID 5 | 6 | SDL_IOStatus: typing.TypeAlias = SDL_TYPE["SDL_IOStatus", SDL_ENUM] 7 | 8 | SDL_IO_STATUS_READY, SDL_IO_STATUS_ERROR, SDL_IO_STATUS_EOF, SDL_IO_STATUS_NOT_READY, \ 9 | SDL_IO_STATUS_READONLY, SDL_IO_STATUS_WRITEONLY = range(6) 10 | 11 | SDL_IOWhence: typing.TypeAlias = SDL_TYPE["SDL_IOWhence", SDL_ENUM] 12 | 13 | SDL_IO_SEEK_SET, SDL_IO_SEEK_CUR, SDL_IO_SEEK_END = range(3) 14 | 15 | class SDL_IOStreamInterface(ctypes.Structure): 16 | _fields_ = [ 17 | ("version", ctypes.c_uint32), 18 | ("size", SDL_FUNC_TYPE["SDL_IOStreamInterface.size", ctypes.c_int64, [ctypes.c_void_p]]), 19 | ("seek", SDL_FUNC_TYPE["SDL_IOStreamInterface.seek", ctypes.c_int64, [ctypes.c_void_p, ctypes.c_int64, SDL_IOWhence]]), 20 | ("read", SDL_FUNC_TYPE["SDL_IOStreamInterface.read", ctypes.c_size_t, [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t, SDL_POINTER[SDL_IOStatus]]]), 21 | ("write", SDL_FUNC_TYPE["SDL_IOStreamInterface.write", ctypes.c_size_t, [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t, SDL_POINTER[SDL_IOStatus]]]), 22 | ("flush", SDL_FUNC_TYPE["SDL_IOStreamInterface.flush", ctypes.c_bool, [ctypes.c_void_p, SDL_POINTER[SDL_IOStatus]]]), 23 | ("close", SDL_FUNC_TYPE["SDL_IOStreamInterface.close", ctypes.c_bool, [ctypes.c_void_p]]) 24 | ] 25 | 26 | class SDL_IOStream(ctypes.c_void_p): 27 | ... 28 | 29 | SDL_IOFromFile: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IOFromFile", SDL_POINTER[SDL_IOStream], [ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 30 | 31 | SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER: bytes = "SDL.iostream.windows.handle".encode() 32 | SDL_PROP_IOSTREAM_STDIO_FILE_POINTER: bytes = "SDL.iostream.stdio.file".encode() 33 | SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER: bytes = "SDL.iostream.file_descriptor".encode() 34 | SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER: bytes = "SDL.iostream.android.aasset".encode() 35 | 36 | SDL_IOFromMem: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IOFromMem", SDL_POINTER[SDL_IOStream], [ctypes.c_void_p, ctypes.c_size_t], SDL_BINARY] 37 | 38 | SDL_PROP_IOSTREAM_MEMORY_POINTER: bytes = "SDL.iostream.memory.base".encode() 39 | SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER: bytes = "SDL.iostream.memory.size".encode() 40 | 41 | SDL_IOFromConstMem: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IOFromConstMem", SDL_POINTER[SDL_IOStream], [ctypes.c_void_p, ctypes.c_size_t], SDL_BINARY] 42 | SDL_IOFromDynamicMem: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IOFromDynamicMem", SDL_POINTER[SDL_IOStream], [], SDL_BINARY] 43 | 44 | SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER: bytes = "SDL.iostream.dynamic.memory".encode() 45 | SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER: bytes = "SDL.iostream.dynamic.chunksize".encode() 46 | 47 | SDL_OpenIO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenIO", SDL_POINTER[SDL_IOStream], [SDL_POINTER[SDL_IOStreamInterface], ctypes.c_void_p], SDL_BINARY] 48 | SDL_CloseIO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CloseIO", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_BINARY] 49 | 50 | SDL_GetIOProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetIOProperties", SDL_PropertiesID, [SDL_POINTER[SDL_IOStream]], SDL_BINARY] 51 | SDL_GetIOStatus: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetIOStatus", SDL_IOStatus, [SDL_POINTER[SDL_IOStream]], SDL_BINARY] 52 | SDL_GetIOSize: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetIOSize", ctypes.c_int64, [SDL_POINTER[SDL_IOStream]], SDL_BINARY] 53 | 54 | SDL_SeekIO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SeekIO", ctypes.c_int64, [SDL_POINTER[SDL_IOStream], ctypes.c_int64, SDL_IOWhence], SDL_BINARY] 55 | SDL_TellIO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_TellIO", ctypes.c_int64, [SDL_POINTER[SDL_IOStream]], SDL_BINARY] 56 | SDL_ReadIO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadIO", ctypes.c_size_t, [SDL_POINTER[SDL_IOStream], ctypes.c_void_p, ctypes.c_size_t], SDL_BINARY] 57 | SDL_WriteIO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteIO", ctypes.c_size_t, [SDL_POINTER[SDL_IOStream], ctypes.c_void_p, ctypes.c_size_t], SDL_BINARY] 58 | 59 | SDL_IOprintf: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IOprintf", ctypes.c_size_t, [SDL_POINTER[SDL_IOStream], ctypes.c_char_p, ...], SDL_BINARY] 60 | SDL_IOvprintf: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IOvprintf", ctypes.c_size_t, [SDL_POINTER[SDL_IOStream], ctypes.c_char_p, SDL_VA_LIST], SDL_BINARY] 61 | 62 | SDL_FlushIO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_FlushIO", ctypes.c_bool, [SDL_POINTER[SDL_IOStream]], SDL_BINARY] 63 | 64 | SDL_LoadFile_IO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LoadFile_IO", ctypes.c_void_p, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_size_t], ctypes.c_bool], SDL_BINARY] 65 | SDL_LoadFile: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LoadFile", ctypes.c_void_p, [ctypes.c_char_p, SDL_POINTER[ctypes.c_size_t]], SDL_BINARY] 66 | 67 | SDL_SaveFile_IO: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SaveFile_IO", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_void_p, ctypes.c_size_t, ctypes.c_bool], SDL_BINARY] 68 | SDL_SaveFile: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SaveFile", ctypes.c_bool, [ctypes.c_char_p, ctypes.c_void_p, ctypes.c_size_t], SDL_BINARY] 69 | 70 | SDL_ReadU8: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadU8", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_uint8]], SDL_BINARY] 71 | SDL_ReadS8: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadS8", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_int8]], SDL_BINARY] 72 | SDL_ReadU16LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadU16LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_uint16]], SDL_BINARY] 73 | SDL_ReadS16LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadS16LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_int16]], SDL_BINARY] 74 | SDL_ReadU16BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadU16BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_uint16]], SDL_BINARY] 75 | SDL_ReadS16BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadS16BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_int16]], SDL_BINARY] 76 | SDL_ReadU32LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadU32LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_uint32]], SDL_BINARY] 77 | SDL_ReadS32LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadS32LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_int32]], SDL_BINARY] 78 | SDL_ReadU32BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadU32BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_uint32]], SDL_BINARY] 79 | SDL_ReadS32BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadS32BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_int32]], SDL_BINARY] 80 | SDL_ReadU64LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadU64LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_uint64]], SDL_BINARY] 81 | SDL_ReadS64LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadS64LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_int64]], SDL_BINARY] 82 | SDL_ReadU64BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadU64BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_uint64]], SDL_BINARY] 83 | SDL_ReadS64BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadS64BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], SDL_POINTER[ctypes.c_int64]], SDL_BINARY] 84 | 85 | SDL_WriteU8: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteU8", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_uint8], SDL_BINARY] 86 | SDL_WriteS8: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteS8", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_int8], SDL_BINARY] 87 | SDL_WriteU16LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteU16LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_uint16], SDL_BINARY] 88 | SDL_WriteS16LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteS16LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_int16], SDL_BINARY] 89 | SDL_WriteU16BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteU16BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_uint16], SDL_BINARY] 90 | SDL_WriteS16BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteS16BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_int16], SDL_BINARY] 91 | SDL_WriteU32LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteU32LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_uint32], SDL_BINARY] 92 | SDL_WriteS32LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteS32LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_int32], SDL_BINARY] 93 | SDL_WriteU32BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteU32BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_uint32], SDL_BINARY] 94 | SDL_WriteS32BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteS32BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_int32], SDL_BINARY] 95 | SDL_WriteU64LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteU64LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_uint64], SDL_BINARY] 96 | SDL_WriteS64LE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteS64LE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_int64], SDL_BINARY] 97 | SDL_WriteU64BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteU64BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_uint64], SDL_BINARY] 98 | SDL_WriteS64BE: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteS64BE", ctypes.c_bool, [SDL_POINTER[SDL_IOStream], ctypes.c_int64], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_keyboard.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_properties import SDL_PropertiesID 5 | from .SDL_keycode import SDL_Keycode, SDL_Keymod 6 | from .SDL_scancode import SDL_Scancode 7 | from .SDL_video import SDL_Window 8 | from .SDL_rect import SDL_Rect 9 | 10 | SDL_KeyboardID: typing.TypeAlias = SDL_TYPE["SDL_KeyboardID", ctypes.c_uint32] 11 | 12 | SDL_HasKeyboard: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasKeyboard", ctypes.c_bool, [], SDL_BINARY] 13 | SDL_GetKeyboards: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetKeyboards", SDL_POINTER[SDL_KeyboardID], [SDL_POINTER[ctypes.c_int]], SDL_BINARY] 14 | SDL_GetKeyboardNameForID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetKeyboardNameForID", ctypes.c_char_p, [SDL_KeyboardID], SDL_BINARY] 15 | SDL_GetKeyboardFocus: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetKeyboardFocus", SDL_POINTER[SDL_Window], [], SDL_BINARY] 16 | SDL_GetKeyboardState: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetKeyboardState", SDL_POINTER[ctypes.c_bool], [SDL_POINTER[ctypes.c_int]], SDL_BINARY] 17 | SDL_ResetKeyboard: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ResetKeyboard", None, [], SDL_BINARY] 18 | SDL_GetModState: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetModState", SDL_Keymod, [], SDL_BINARY] 19 | SDL_SetModState: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetModState", None, [SDL_Keymod], SDL_BINARY] 20 | SDL_GetKeyFromScancode: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetKeyFromScancode", SDL_Keycode, [SDL_Scancode, SDL_Keymod, ctypes.c_bool], SDL_BINARY] 21 | SDL_GetScancodeFromKey: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetScancodeFromKey", SDL_Scancode, [SDL_Keycode, SDL_POINTER[SDL_Keymod]], SDL_BINARY] 22 | SDL_SetScancodeName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetScancodeName", ctypes.c_bool, [SDL_Scancode, ctypes.c_char_p], SDL_BINARY] 23 | SDL_GetScancodeName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetScancodeName", ctypes.c_char_p, [SDL_Scancode], SDL_BINARY] 24 | SDL_GetScancodeFromName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetScancodeFromName", SDL_Scancode, [ctypes.c_char_p], SDL_BINARY] 25 | SDL_GetKeyName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetKeyName", ctypes.c_char_p, [SDL_Keycode], SDL_BINARY] 26 | SDL_GetKeyFromName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetKeyFromName", SDL_Keycode, [ctypes.c_char_p], SDL_BINARY] 27 | 28 | SDL_StartTextInput: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_StartTextInput", ctypes.c_bool, [SDL_POINTER[SDL_Window]], SDL_BINARY] 29 | 30 | SDL_TextInputType: typing.TypeAlias = SDL_TYPE["SDL_TextInputType", SDL_ENUM] 31 | 32 | SDL_TEXTINPUT_TYPE_TEXT, SDL_TEXTINPUT_TYPE_TEXT_NAME, SDL_TEXTINPUT_TYPE_TEXT_EMAIL, SDL_TEXTINPUT_TYPE_TEXT_USERNAME, \ 33 | SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN, SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE, SDL_TEXTINPUT_TYPE_NUMBER, \ 34 | SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN, SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE = range(9) 35 | 36 | SDL_Capitalization: typing.TypeAlias = SDL_TYPE["SDL_Capitalization", SDL_ENUM] 37 | 38 | SDL_CAPITALIZE_NONE, SDL_CAPITALIZE_SENTENCES, SDL_CAPITALIZE_WORDS, SDL_CAPITALIZE_LETTERS = range(4) 39 | 40 | SDL_StartTextInputWithProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_StartTextInputWithProperties", ctypes.c_bool, [SDL_POINTER[SDL_Window], SDL_PropertiesID], SDL_BINARY] 41 | 42 | SDL_PROP_TEXTINPUT_TYPE_NUMBER: bytes = "SDL.textinput.type".encode() 43 | SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER: bytes = "SDL.textinput.capitalization".encode() 44 | SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN: bytes = "SDL.textinput.autocorrect".encode() 45 | SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN: bytes = "SDL.textinput.multiline".encode() 46 | SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER: bytes = "SDL.textinput.android.inputtype".encode() 47 | 48 | SDL_TextInputActive: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_TextInputActive", ctypes.c_bool, [SDL_POINTER[SDL_Window]], SDL_BINARY] 49 | SDL_StopTextInput: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_StopTextInput", ctypes.c_bool, [SDL_POINTER[SDL_Window]], SDL_BINARY] 50 | SDL_ClearComposition: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ClearComposition", ctypes.c_bool, [SDL_POINTER[SDL_Window]], SDL_BINARY] 51 | SDL_SetTextInputArea: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetTextInputArea", ctypes.c_bool, [SDL_POINTER[SDL_Window], SDL_POINTER[SDL_Rect], ctypes.c_int], SDL_BINARY] 52 | SDL_GetTextInputArea: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTextInputArea", ctypes.c_bool, [SDL_POINTER[SDL_Window], SDL_POINTER[SDL_Rect], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 53 | SDL_HasScreenKeyboardSupport: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasScreenKeyboardSupport", ctypes.c_bool, [], SDL_BINARY] 54 | SDL_ScreenKeyboardShown: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ScreenKeyboardShown", ctypes.c_bool, [SDL_POINTER[SDL_Window]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_keycode.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_TYPE 2 | 3 | from .SDL_scancode import SDL_Scancode 4 | 5 | SDL_Keycode: typing.TypeAlias = SDL_TYPE["SDL_Keycode", ctypes.c_uint32] 6 | 7 | SDLK_EXTENDED_MASK, SDLK_SCANCODE_MASK = 1 << 29, 1 << 30 8 | SDL_SCANCODE_TO_KEYCODE: abc.Callable[[SDL_Scancode], SDL_Keycode] = lambda x: x | SDLK_SCANCODE_MASK 9 | 10 | SDLK_UNKNOWN: int = 0x00000000 11 | SDLK_RETURN: int = 0x0000000d 12 | SDLK_ESCAPE: int = 0x0000001b 13 | SDLK_BACKSPACE: int = 0x00000008 14 | SDLK_TAB: int = 0x00000009 15 | SDLK_SPACE: int = 0x00000020 16 | SDLK_EXCLAIM: int = 0x00000021 17 | SDLK_DBLAPOSTROPHE: int = 0x00000022 18 | SDLK_HASH: int = 0x00000023 19 | SDLK_DOLLAR: int = 0x00000024 20 | SDLK_PERCENT: int = 0x00000025 21 | SDLK_AMPERSAND: int = 0x00000026 22 | SDLK_APOSTROPHE: int = 0x00000027 23 | SDLK_LEFTPAREN: int = 0x00000028 24 | SDLK_RIGHTPAREN: int = 0x00000029 25 | SDLK_ASTERISK: int = 0x0000002a 26 | SDLK_PLUS: int = 0x0000002b 27 | SDLK_COMMA: int = 0x0000002c 28 | SDLK_MINUS: int = 0x0000002d 29 | SDLK_PERIOD: int = 0x0000002e 30 | SDLK_SLASH: int = 0x0000002f 31 | SDLK_0: int = 0x00000030 32 | SDLK_1: int = 0x00000031 33 | SDLK_2: int = 0x00000032 34 | SDLK_3: int = 0x00000033 35 | SDLK_4: int = 0x00000034 36 | SDLK_5: int = 0x00000035 37 | SDLK_6: int = 0x00000036 38 | SDLK_7: int = 0x00000037 39 | SDLK_8: int = 0x00000038 40 | SDLK_9: int = 0x00000039 41 | SDLK_COLON: int = 0x0000003a 42 | SDLK_SEMICOLON: int = 0x0000003b 43 | SDLK_LESS: int = 0x0000003c 44 | SDLK_EQUALS: int = 0x0000003d 45 | SDLK_GREATER: int = 0x0000003e 46 | SDLK_QUESTION: int = 0x0000003f 47 | SDLK_AT: int = 0x00000040 48 | SDLK_LEFTBRACKET: int = 0x0000005b 49 | SDLK_BACKSLASH: int = 0x0000005c 50 | SDLK_RIGHTBRACKET: int = 0x0000005d 51 | SDLK_CARET: int = 0x0000005e 52 | SDLK_UNDERSCORE: int = 0x0000005f 53 | SDLK_GRAVE: int = 0x00000060 54 | SDLK_A: int = 0x00000061 55 | SDLK_B: int = 0x00000062 56 | SDLK_C: int = 0x00000063 57 | SDLK_D: int = 0x00000064 58 | SDLK_E: int = 0x00000065 59 | SDLK_F: int = 0x00000066 60 | SDLK_G: int = 0x00000067 61 | SDLK_H: int = 0x00000068 62 | SDLK_I: int = 0x00000069 63 | SDLK_J: int = 0x0000006a 64 | SDLK_K: int = 0x0000006b 65 | SDLK_L: int = 0x0000006c 66 | SDLK_M: int = 0x0000006d 67 | SDLK_N: int = 0x0000006e 68 | SDLK_O: int = 0x0000006f 69 | SDLK_P: int = 0x00000070 70 | SDLK_Q: int = 0x00000071 71 | SDLK_R: int = 0x00000072 72 | SDLK_S: int = 0x00000073 73 | SDLK_T: int = 0x00000074 74 | SDLK_U: int = 0x00000075 75 | SDLK_V: int = 0x00000076 76 | SDLK_W: int = 0x00000077 77 | SDLK_X: int = 0x00000078 78 | SDLK_Y: int = 0x00000079 79 | SDLK_Z: int = 0x0000007a 80 | SDLK_LEFTBRACE: int = 0x0000007b 81 | SDLK_PIPE: int = 0x0000007c 82 | SDLK_RIGHTBRACE: int = 0x0000007d 83 | SDLK_TILDE: int = 0x0000007e 84 | SDLK_DELETE: int = 0x0000007f 85 | SDLK_PLUSMINUS: int = 0x000000b1 86 | SDLK_CAPSLOCK: int = 0x40000039 87 | SDLK_F1: int = 0x4000003a 88 | SDLK_F2: int = 0x4000003b 89 | SDLK_F3: int = 0x4000003c 90 | SDLK_F4: int = 0x4000003d 91 | SDLK_F5: int = 0x4000003e 92 | SDLK_F6: int = 0x4000003f 93 | SDLK_F7: int = 0x40000040 94 | SDLK_F8: int = 0x40000041 95 | SDLK_F9: int = 0x40000042 96 | SDLK_F10: int = 0x40000043 97 | SDLK_F11: int = 0x40000044 98 | SDLK_F12: int = 0x40000045 99 | SDLK_PRINTSCREEN: int = 0x40000046 100 | SDLK_SCROLLLOCK: int = 0x40000047 101 | SDLK_PAUSE: int = 0x40000048 102 | SDLK_INSERT: int = 0x40000049 103 | SDLK_HOME: int = 0x4000004a 104 | SDLK_PAGEUP: int = 0x4000004b 105 | SDLK_END: int = 0x4000004d 106 | SDLK_PAGEDOWN: int = 0x4000004e 107 | SDLK_RIGHT: int = 0x4000004f 108 | SDLK_LEFT: int = 0x40000050 109 | SDLK_DOWN: int = 0x40000051 110 | SDLK_UP: int = 0x40000052 111 | SDLK_NUMLOCKCLEAR: int = 0x40000053 112 | SDLK_KP_DIVIDE: int = 0x40000054 113 | SDLK_KP_MULTIPLY: int = 0x40000055 114 | SDLK_KP_MINUS: int = 0x40000056 115 | SDLK_KP_PLUS: int = 0x40000057 116 | SDLK_KP_ENTER: int = 0x40000058 117 | SDLK_KP_1: int = 0x40000059 118 | SDLK_KP_2: int = 0x4000005a 119 | SDLK_KP_3: int = 0x4000005b 120 | SDLK_KP_4: int = 0x4000005c 121 | SDLK_KP_5: int = 0x4000005d 122 | SDLK_KP_6: int = 0x4000005e 123 | SDLK_KP_7: int = 0x4000005f 124 | SDLK_KP_8: int = 0x40000060 125 | SDLK_KP_9: int = 0x40000061 126 | SDLK_KP_0: int = 0x40000062 127 | SDLK_KP_PERIOD: int = 0x40000063 128 | SDLK_APPLICATION: int = 0x40000065 129 | SDLK_POWER: int = 0x40000066 130 | SDLK_KP_EQUALS: int = 0x40000067 131 | SDLK_F13: int = 0x40000068 132 | SDLK_F14: int = 0x40000069 133 | SDLK_F15: int = 0x4000006a 134 | SDLK_F16: int = 0x4000006b 135 | SDLK_F17: int = 0x4000006c 136 | SDLK_F18: int = 0x4000006d 137 | SDLK_F19: int = 0x4000006e 138 | SDLK_F20: int = 0x4000006f 139 | SDLK_F21: int = 0x40000070 140 | SDLK_F22: int = 0x40000071 141 | SDLK_F23: int = 0x40000072 142 | SDLK_F24: int = 0x40000073 143 | SDLK_EXECUTE: int = 0x40000074 144 | SDLK_HELP: int = 0x40000075 145 | SDLK_MENU: int = 0x40000076 146 | SDLK_SELECT: int = 0x40000077 147 | SDLK_STOP: int = 0x40000078 148 | SDLK_AGAIN: int = 0x40000079 149 | SDLK_UNDO: int = 0x4000007a 150 | SDLK_CUT: int = 0x4000007b 151 | SDLK_COPY: int = 0x4000007c 152 | SDLK_PASTE: int = 0x4000007d 153 | SDLK_FIND: int = 0x4000007e 154 | SDLK_MUTE: int = 0x4000007f 155 | SDLK_VOLUMEUP: int = 0x40000080 156 | SDLK_VOLUMEDOWN: int = 0x40000081 157 | SDLK_KP_COMMA: int = 0x40000085 158 | SDLK_KP_EQUALSAS400: int = 0x40000086 159 | SDLK_ALTERASE: int = 0x40000099 160 | SDLK_SYSREQ: int = 0x4000009a 161 | SDLK_CANCEL: int = 0x4000009b 162 | SDLK_CLEAR: int = 0x4000009c 163 | SDLK_PRIOR: int = 0x4000009d 164 | SDLK_RETURN2: int = 0x4000009e 165 | SDLK_SEPARATOR: int = 0x4000009f 166 | SDLK_OUT: int = 0x400000a0 167 | SDLK_OPER: int = 0x400000a1 168 | SDLK_CLEARAGAIN: int = 0x400000a2 169 | SDLK_CRSEL: int = 0x400000a3 170 | SDLK_EXSEL: int = 0x400000a4 171 | SDLK_KP_00: int = 0x400000b0 172 | SDLK_KP_000: int = 0x400000b1 173 | SDLK_THOUSANDSSEPARATOR: int = 0x400000b2 174 | SDLK_DECIMALSEPARATOR: int = 0x400000b3 175 | SDLK_CURRENCYUNIT: int = 0x400000b4 176 | SDLK_CURRENCYSUBUNIT: int = 0x400000b5 177 | SDLK_KP_LEFTPAREN: int = 0x400000b6 178 | SDLK_KP_RIGHTPAREN: int = 0x400000b7 179 | SDLK_KP_LEFTBRACE: int = 0x400000b8 180 | SDLK_KP_RIGHTBRACE: int = 0x400000b9 181 | SDLK_KP_TAB: int = 0x400000ba 182 | SDLK_KP_BACKSPACE: int = 0x400000bb 183 | SDLK_KP_A: int = 0x400000bc 184 | SDLK_KP_B: int = 0x400000bd 185 | SDLK_KP_C: int = 0x400000be 186 | SDLK_KP_D: int = 0x400000bf 187 | SDLK_KP_E: int = 0x400000c0 188 | SDLK_KP_F: int = 0x400000c1 189 | SDLK_KP_XOR: int = 0x400000c2 190 | SDLK_KP_POWER: int = 0x400000c3 191 | SDLK_KP_PERCENT: int = 0x400000c4 192 | SDLK_KP_LESS: int = 0x400000c5 193 | SDLK_KP_GREATER: int = 0x400000c6 194 | SDLK_KP_AMPERSAND: int = 0x400000c7 195 | SDLK_KP_DBLAMPERSAND: int = 0x400000c8 196 | SDLK_KP_VERTICALBAR: int = 0x400000c9 197 | SDLK_KP_DBLVERTICALBAR: int = 0x400000ca 198 | SDLK_KP_COLON: int = 0x400000cb 199 | SDLK_KP_HASH: int = 0x400000cc 200 | SDLK_KP_SPACE: int = 0x400000cd 201 | SDLK_KP_AT: int = 0x400000ce 202 | SDLK_KP_EXCLAM: int = 0x400000cf 203 | SDLK_KP_MEMSTORE: int = 0x400000d0 204 | SDLK_KP_MEMRECALL: int = 0x400000d1 205 | SDLK_KP_MEMCLEAR: int = 0x400000d2 206 | SDLK_KP_MEMADD: int = 0x400000d3 207 | SDLK_KP_MEMSUBTRACT: int = 0x400000d4 208 | SDLK_KP_MEMMULTIPLY: int = 0x400000d5 209 | SDLK_KP_MEMDIVIDE: int = 0x400000d6 210 | SDLK_KP_PLUSMINUS: int = 0x400000d7 211 | SDLK_KP_CLEAR: int = 0x400000d8 212 | SDLK_KP_CLEARENTRY: int = 0x400000d9 213 | SDLK_KP_BINARY: int = 0x400000da 214 | SDLK_KP_OCTAL: int = 0x400000db 215 | SDLK_KP_DECIMAL: int = 0x400000dc 216 | SDLK_KP_HEXADECIMAL: int = 0x400000dd 217 | SDLK_LCTRL: int = 0x400000e0 218 | SDLK_LSHIFT: int = 0x400000e1 219 | SDLK_LALT: int = 0x400000e2 220 | SDLK_LGUI: int = 0x400000e3 221 | SDLK_RCTRL: int = 0x400000e4 222 | SDLK_RSHIFT: int = 0x400000e5 223 | SDLK_RALT: int = 0x400000e6 224 | SDLK_RGUI: int = 0x400000e7 225 | SDLK_MODE: int = 0x40000101 226 | SDLK_SLEEP: int = 0x40000102 227 | SDLK_WAKE: int = 0x40000103 228 | SDLK_CHANNEL_INCREMENT: int = 0x40000104 229 | SDLK_CHANNEL_DECREMENT: int = 0x40000105 230 | SDLK_MEDIA_PLAY: int = 0x40000106 231 | SDLK_MEDIA_PAUSE: int = 0x40000107 232 | SDLK_MEDIA_RECORD: int = 0x40000108 233 | SDLK_MEDIA_FAST_FORWARD: int = 0x40000109 234 | SDLK_MEDIA_REWIND: int = 0x4000010a 235 | SDLK_MEDIA_NEXT_TRACK: int = 0x4000010b 236 | SDLK_MEDIA_PREVIOUS_TRACK: int = 0x4000010c 237 | SDLK_MEDIA_STOP: int = 0x4000010d 238 | SDLK_MEDIA_EJECT: int = 0x4000010e 239 | SDLK_MEDIA_PLAY_PAUSE: int = 0x4000010f 240 | SDLK_MEDIA_SELECT: int = 0x40000110 241 | SDLK_AC_NEW: int = 0x40000111 242 | SDLK_AC_OPEN: int = 0x40000112 243 | SDLK_AC_CLOSE: int = 0x40000113 244 | SDLK_AC_EXIT: int = 0x40000114 245 | SDLK_AC_SAVE: int = 0x40000115 246 | SDLK_AC_PRINT: int = 0x40000116 247 | SDLK_AC_PROPERTIES: int = 0x40000117 248 | SDLK_AC_SEARCH: int = 0x40000118 249 | SDLK_AC_HOME: int = 0x40000119 250 | SDLK_AC_BACK: int = 0x4000011a 251 | SDLK_AC_FORWARD: int = 0x4000011b 252 | SDLK_AC_STOP: int = 0x4000011c 253 | SDLK_AC_REFRESH: int = 0x4000011d 254 | SDLK_AC_BOOKMARKS: int = 0x4000011e 255 | SDLK_SOFTLEFT: int = 0x4000011f 256 | SDLK_SOFTRIGHT: int = 0x40000120 257 | SDLK_CALL: int = 0x40000121 258 | SDLK_ENDCALL: int = 0x40000122 259 | SDLK_LEFT_TAB: int = 0x20000001 260 | SDLK_LEVEL5_SHIFT: int = 0x20000002 261 | SDLK_MULTI_KEY_COMPOSE: int = 0x20000003 262 | SDLK_LMETA: int = 0x20000004 263 | SDLK_RMETA: int = 0x20000005 264 | SDLK_LHYPER: int = 0x20000006 265 | SDLK_RHYPER: int = 0x20000007 266 | 267 | SDL_Keymod: typing.TypeAlias = SDL_TYPE["SDL_Keymod", ctypes.c_uint16] 268 | 269 | SDL_KMOD_NONE: int = 0x0000 270 | SDL_KMOD_LSHIFT: int = 0x0001 271 | SDL_KMOD_RSHIFT: int = 0x0002 272 | SDL_KMOD_LEVEL5: int = 0x0004 273 | SDL_KMOD_LCTRL: int = 0x0040 274 | SDL_KMOD_RCTRL: int = 0x0080 275 | SDL_KMOD_LALT: int = 0x0100 276 | SDL_KMOD_RALT: int = 0x0200 277 | SDL_KMOD_LGUI: int = 0x0400 278 | SDL_KMOD_RGUI: int = 0x0800 279 | SDL_KMOD_NUM: int = 0x1000 280 | SDL_KMOD_CAPS: int = 0x2000 281 | SDL_KMOD_MODE: int = 0x4000 282 | SDL_KMOD_SCROLL: int = 0x8000 283 | SDL_KMOD_CTRL = SDL_KMOD_LCTRL | SDL_KMOD_RCTRL 284 | SDL_KMOD_SHIFT = SDL_KMOD_LSHIFT | SDL_KMOD_RSHIFT 285 | SDL_KMOD_ALT = SDL_KMOD_LALT | SDL_KMOD_RALT 286 | SDL_KMOD_GUI = SDL_KMOD_LGUI | SDL_KMOD_RGUI -------------------------------------------------------------------------------- /sdl3/SDL_loadso.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC, SDL_BINARY 3 | 4 | from .SDL_stdinc import SDL_FunctionPointer 5 | 6 | class SDL_SharedObject(ctypes.c_void_p): 7 | ... 8 | 9 | SDL_LoadObject: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LoadObject", SDL_POINTER[SDL_SharedObject], [ctypes.c_char_p], SDL_BINARY] 10 | SDL_LoadFunction: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LoadFunction", SDL_FunctionPointer, [SDL_POINTER[SDL_SharedObject], ctypes.c_char_p], SDL_BINARY] 11 | SDL_UnloadObject: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UnloadObject", None, [SDL_POINTER[SDL_SharedObject]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_locale.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC, SDL_BINARY 3 | 4 | class SDL_Locale(ctypes.Structure): 5 | _fields_ = [ 6 | ("language", ctypes.c_char_p), 7 | ("country", ctypes.c_char_p) 8 | ] 9 | 10 | SDL_GetPreferredLocales: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetPreferredLocales", SDL_POINTER[SDL_POINTER[SDL_Locale]], [SDL_POINTER[ctypes.c_int]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_log.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_POINTER, SDL_VA_LIST, \ 2 | SDL_FUNC_TYPE, SDL_FUNC, SDL_TYPE, SDL_BINARY, SDL_ENUM 3 | 4 | SDL_LogCategory: typing.TypeAlias = SDL_TYPE["SDL_LogCategory", SDL_ENUM] 5 | 6 | SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_CATEGORY_ERROR, SDL_LOG_CATEGORY_ASSERT, SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_CATEGORY_AUDIO, \ 7 | SDL_LOG_CATEGORY_VIDEO, SDL_LOG_CATEGORY_RENDER, SDL_LOG_CATEGORY_INPUT, SDL_LOG_CATEGORY_TEST, SDL_LOG_CATEGORY_GPU, SDL_LOG_CATEGORY_RESERVED1, \ 8 | SDL_LOG_CATEGORY_RESERVED2, SDL_LOG_CATEGORY_RESERVED3, SDL_LOG_CATEGORY_RESERVED4, SDL_LOG_CATEGORY_RESERVED5, SDL_LOG_CATEGORY_RESERVED6, SDL_LOG_CATEGORY_RESERVED7, \ 9 | SDL_LOG_CATEGORY_RESERVED8, SDL_LOG_CATEGORY_RESERVED9, SDL_LOG_CATEGORY_RESERVED10, SDL_LOG_CATEGORY_CUSTOM = range(21) 10 | 11 | SDL_LogPriority: typing.TypeAlias = SDL_TYPE["SDL_LogPriority", SDL_ENUM] 12 | 13 | SDL_LOG_PRIORITY_INVALID, SDL_LOG_PRIORITY_TRACE, SDL_LOG_PRIORITY_VERBOSE, SDL_LOG_PRIORITY_DEBUG, SDL_LOG_PRIORITY_INFO, \ 14 | SDL_LOG_PRIORITY_WARN, SDL_LOG_PRIORITY_ERROR, SDL_LOG_PRIORITY_CRITICAL, SDL_LOG_PRIORITY_COUNT = range(9) 15 | 16 | SDL_SetLogPriorities: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetLogPriorities", None, [SDL_LogPriority], SDL_BINARY] 17 | SDL_SetLogPriority: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetLogPriority", None, [ctypes.c_int, SDL_LogPriority], SDL_BINARY] 18 | SDL_GetLogPriority: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetLogPriority", SDL_LogPriority, [ctypes.c_int], SDL_BINARY] 19 | SDL_ResetLogPriorities: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ResetLogPriorities", None, [], SDL_BINARY] 20 | SDL_SetLogPriorityPrefix: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetLogPriorityPrefix", ctypes.c_bool, [SDL_LogPriority, ctypes.c_char_p], SDL_BINARY] 21 | 22 | SDL_Log: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Log", None, [ctypes.c_char_p, ...], SDL_BINARY] 23 | SDL_LogTrace: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LogTrace", None, [ctypes.c_int, ctypes.c_char_p, ...], SDL_BINARY] 24 | SDL_LogVerbose: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LogVerbose", None, [ctypes.c_int, ctypes.c_char_p, ...], SDL_BINARY] 25 | SDL_LogDebug: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LogDebug", None, [ctypes.c_int, ctypes.c_char_p, ...], SDL_BINARY] 26 | SDL_LogInfo: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LogInfo", None, [ctypes.c_int, ctypes.c_char_p, ...], SDL_BINARY] 27 | SDL_LogWarn: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LogWarn", None, [ctypes.c_int, ctypes.c_char_p, ...], SDL_BINARY] 28 | SDL_LogError: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LogError", None, [ctypes.c_int, ctypes.c_char_p, ...], SDL_BINARY] 29 | SDL_LogCritical: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LogCritical", None, [ctypes.c_int, ctypes.c_char_p, ...], SDL_BINARY] 30 | SDL_LogMessage: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LogMessage", None, [ctypes.c_int, SDL_LogPriority, ctypes.c_char_p, ...], SDL_BINARY] 31 | SDL_LogMessageV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LogMessageV", None, [ctypes.c_int, SDL_LogPriority, ctypes.c_char_p, SDL_VA_LIST], SDL_BINARY] 32 | 33 | SDL_LogOutputFunction: typing.TypeAlias = SDL_FUNC_TYPE["SDL_LogOutputFunction", None, [ctypes.c_void_p, ctypes.c_int, SDL_LogPriority, ctypes.c_char_p]] 34 | 35 | SDL_GetDefaultLogOutputFunction: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetDefaultLogOutputFunction", SDL_LogOutputFunction, [], SDL_BINARY] 36 | SDL_GetLogOutputFunction: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetLogOutputFunction", None, [SDL_POINTER[SDL_LogOutputFunction], SDL_POINTER[ctypes.c_void_p]], SDL_BINARY] 37 | SDL_SetLogOutputFunction: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetLogOutputFunction", None, [SDL_LogOutputFunction, ctypes.c_void_p], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_main.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_PLATFORM_SPECIFIC, \ 2 | SDL_POINTER, SDL_FUNC, SDL_FUNC_TYPE, SDL_BINARY 3 | 4 | from .SDL_init import SDL_AppInit_func, \ 5 | SDL_AppIterate_func, SDL_AppEvent_func, SDL_AppQuit_func 6 | 7 | SDL_main_func: typing.TypeAlias = SDL_FUNC_TYPE["SDL_main_func", ctypes.c_int, [ctypes.c_int, SDL_POINTER[ctypes.c_char_p]]] 8 | 9 | SDL_SetMainReady: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetMainReady", None, [], SDL_BINARY] 10 | 11 | SDL_RunApp: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_RunApp", ctypes.c_int, [ctypes.c_int, SDL_POINTER[ctypes.c_char_p], SDL_main_func, ctypes.c_void_p], SDL_BINARY] 12 | SDL_EnterAppMainCallbacks: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_EnterAppMainCallbacks", ctypes.c_int, [ctypes.c_int, SDL_POINTER[ctypes.c_char_p], SDL_AppInit_func, SDL_AppIterate_func, SDL_AppEvent_func, SDL_AppQuit_func], SDL_BINARY] 13 | 14 | if SDL_PLATFORM_SPECIFIC(system = ["Windows"]): 15 | SDL_RegisterApp: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_RegisterApp", ctypes.c_bool, [ctypes.c_char_p, ctypes.c_uint32, ctypes.c_void_p], SDL_BINARY] 16 | SDL_UnregisterApp: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UnregisterApp", None, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_main_impl.py: -------------------------------------------------------------------------------- 1 | from .__init__ import sys, os, ctypes, atexit, types, SDL_POINTER 2 | 3 | from .SDL_main import SDL_EnterAppMainCallbacks, SDL_RunApp, SDL_main_func, \ 4 | SDL_AppEvent_func, SDL_AppInit_func, SDL_AppIterate_func, SDL_AppQuit_func 5 | 6 | if not int(os.environ.get("SDL_MAIN_HANDLED", "0")) > 0 and not int(os.environ.get("SDL_MAIN_NOIMPL", "0")) > 0: 7 | import __main__ 8 | 9 | if int(os.environ.get("SDL_MAIN_USE_CALLBACKS", "0")) > 0: 10 | @SDL_main_func 11 | def SDL_main(argc: ctypes.c_int, argv: SDL_POINTER[ctypes.c_char_p]) -> ctypes.c_int: 12 | callbacks = [getattr(__main__, i, None) for i in ["SDL_AppInit", "SDL_AppIterate", "SDL_AppEvent", "SDL_AppQuit"]] 13 | 14 | for index, i in enumerate(callbacks): 15 | if i is not None and not isinstance(i, ctypes._CFuncPtr): 16 | callbacks[index] = globals()[f"{i.__name__}_func"](i) 17 | 18 | return SDL_EnterAppMainCallbacks(argc, argv, *callbacks) 19 | 20 | os.environ["SDL_MAIN_CALLBACK_STANDARD"] = "1" 21 | setattr(__main__, "SDL_main", SDL_main) 22 | 23 | if (not int(os.environ.get("SDL_MAIN_USE_CALLBACKS", "0")) > 0 or int(os.environ.get("SDL_MAIN_CALLBACK_STANDARD", "0")) > 0) and not int(os.environ.get("SDL_MAIN_EXPORTED", "0")) > 0: 24 | @atexit.register 25 | def SDL_ATEXIT_HANDLER() -> None: 26 | if main := (getattr(__main__, "SDL_main", None) or getattr(__main__, "main", None)): 27 | if not isinstance(main, SDL_main_func): 28 | if isinstance(main, types.ModuleType): return 29 | if main.__name__ == "main": return 30 | main = SDL_main_func(main) 31 | 32 | return SDL_RunApp(len(sys.argv), (ctypes.c_char_p * len(sys.argv))(*[i.encode() for i in sys.argv]), main, None) -------------------------------------------------------------------------------- /sdl3/SDL_messagebox.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_video import SDL_Window 5 | 6 | SDL_MessageBoxFlags: typing.TypeAlias = SDL_TYPE["SDL_MessageBoxFlags", ctypes.c_uint32] 7 | 8 | SDL_MESSAGEBOX_ERROR: int = 0x00000010 9 | SDL_MESSAGEBOX_WARNING: int = 0x00000020 10 | SDL_MESSAGEBOX_INFORMATION: int = 0x00000040 11 | SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT: int = 0x00000080 12 | SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT: int = 0x00000100 13 | 14 | SDL_MessageBoxButtonFlags: typing.TypeAlias = SDL_TYPE["SDL_MessageBoxButtonFlags", ctypes.c_uint32] 15 | 16 | SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT: int = 0x00000001 17 | SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT: int = 0x00000002 18 | 19 | class SDL_MessageBoxButtonData(ctypes.Structure): 20 | _fields_ = [ 21 | ("flags", SDL_MessageBoxButtonFlags), 22 | ("buttonID", ctypes.c_int), 23 | ("text", ctypes.c_char_p) 24 | ] 25 | 26 | class SDL_MessageBoxColor(ctypes.Structure): 27 | _fields_ = [ 28 | ("r", ctypes.c_uint8), 29 | ("g", ctypes.c_uint8), 30 | ("b", ctypes.c_uint8) 31 | ] 32 | 33 | SDL_MessageBoxColorType: typing.TypeAlias = SDL_TYPE["SDL_MessageBoxColorType", SDL_ENUM] 34 | 35 | SDL_MESSAGEBOX_COLOR_BACKGROUND, SDL_MESSAGEBOX_COLOR_TEXT, SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, \ 36 | SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, SDL_MESSAGEBOX_COLOR_COUNT = range(6) 37 | 38 | class SDL_MessageBoxColorScheme(ctypes.Structure): 39 | _fields_ = [ 40 | ("colors", SDL_MessageBoxColor * SDL_MESSAGEBOX_COLOR_COUNT) 41 | ] 42 | 43 | class SDL_MessageBoxData(ctypes.Structure): 44 | _fields_ = [ 45 | ("flags", SDL_MessageBoxFlags), 46 | ("window", SDL_POINTER[SDL_Window]), 47 | ("title", ctypes.c_char_p), 48 | ("message", ctypes.c_char_p), 49 | ("numbuttons", ctypes.c_int), 50 | ("buttons", SDL_POINTER[SDL_MessageBoxButtonData]), 51 | ("colorScheme", SDL_POINTER[SDL_MessageBoxColorScheme]) 52 | ] 53 | 54 | SDL_ShowMessageBox: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShowMessageBox", ctypes.c_bool, [SDL_POINTER[SDL_MessageBoxData], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 55 | SDL_ShowSimpleMessageBox: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShowSimpleMessageBox", ctypes.c_bool, [SDL_MessageBoxFlags, ctypes.c_char_p, ctypes.c_char_p, SDL_POINTER[SDL_Window]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_metal.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_video import SDL_Window 5 | 6 | SDL_MetalView: typing.TypeAlias = SDL_TYPE["SDL_MetalView", ctypes.c_void_p] 7 | 8 | SDL_Metal_CreateView: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Metal_CreateView", SDL_MetalView, [SDL_POINTER[SDL_Window]], SDL_BINARY] 9 | SDL_Metal_DestroyView: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Metal_DestroyView", None, [SDL_MetalView], SDL_BINARY] 10 | SDL_Metal_GetLayer: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Metal_GetLayer", ctypes.c_void_p, [SDL_MetalView], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_misc.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_FUNC, SDL_BINARY 2 | 3 | SDL_OpenURL: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenURL", ctypes.c_bool, [ctypes.c_char_p], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_mouse.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_FUNC_TYPE, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_video import SDL_Window 5 | from .SDL_surface import SDL_Surface 6 | 7 | SDL_MouseID: typing.TypeAlias = SDL_TYPE["SDL_MouseID", ctypes.c_uint32] 8 | 9 | class SDL_Cursor(ctypes.c_void_p): 10 | ... 11 | 12 | SDL_SystemCursor: typing.TypeAlias = SDL_TYPE["SDL_SystemCursor", SDL_ENUM] 13 | 14 | SDL_SYSTEM_CURSOR_DEFAULT, SDL_SYSTEM_CURSOR_TEXT, SDL_SYSTEM_CURSOR_WAIT, SDL_SYSTEM_CURSOR_CROSSHAIR, SDL_SYSTEM_CURSOR_PROGRESS, SDL_SYSTEM_CURSOR_NWSE_RESIZE, \ 15 | SDL_SYSTEM_CURSOR_NESW_RESIZE, SDL_SYSTEM_CURSOR_EW_RESIZE, SDL_SYSTEM_CURSOR_NS_RESIZE, SDL_SYSTEM_CURSOR_MOVE, SDL_SYSTEM_CURSOR_NOT_ALLOWED, SDL_SYSTEM_CURSOR_POINTER, \ 16 | SDL_SYSTEM_CURSOR_NW_RESIZE, SDL_SYSTEM_CURSOR_N_RESIZE, SDL_SYSTEM_CURSOR_NE_RESIZE, SDL_SYSTEM_CURSOR_E_RESIZE, SDL_SYSTEM_CURSOR_SE_RESIZE, SDL_SYSTEM_CURSOR_S_RESIZE, \ 17 | SDL_SYSTEM_CURSOR_SW_RESIZE, SDL_SYSTEM_CURSOR_W_RESIZE, SDL_SYSTEM_CURSOR_COUNT = range(21) 18 | 19 | SDL_MouseWheelDirection: typing.TypeAlias = SDL_TYPE["SDL_MouseWheelDirection", SDL_ENUM] 20 | 21 | SDL_MOUSEWHEEL_NORMAL, SDL_MOUSEWHEEL_FLIPPED = range(2) 22 | 23 | SDL_MouseButtonFlags: typing.TypeAlias = SDL_TYPE["SDL_MouseButtonFlags", ctypes.c_uint32] 24 | 25 | SDL_MouseMotionTransformCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_MouseMotionTransformCallback", None, [ctypes.c_void_p, ctypes.c_uint64, SDL_POINTER[SDL_Window], SDL_MouseID, SDL_POINTER[ctypes.c_float], SDL_POINTER[ctypes.c_float]]] 26 | 27 | SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT, SDL_BUTTON_X1, SDL_BUTTON_X2 = range(1, 6) 28 | 29 | SDL_BUTTON_MASK: abc.Callable[..., int] = lambda x: 1 << (x - 1) 30 | 31 | SDL_BUTTON_LMASK, SDL_BUTTON_MMASK, SDL_BUTTON_RMASK, \ 32 | SDL_BUTTON_X1MASK, SDL_BUTTON_X2MASK = [SDL_BUTTON_MASK(x) for x in range(1, 6)] 33 | 34 | SDL_HasMouse: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasMouse", ctypes.c_bool, [], SDL_BINARY] 35 | SDL_GetMice: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetMice", SDL_POINTER[SDL_MouseID], [SDL_POINTER[ctypes.c_int]], SDL_BINARY] 36 | SDL_GetMouseNameForID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetMouseNameForID", ctypes.c_char_p, [SDL_MouseID], SDL_BINARY] 37 | SDL_GetMouseFocus: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetMouseFocus", SDL_POINTER[SDL_Window], [], SDL_BINARY] 38 | SDL_GetMouseState: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetMouseState", SDL_MouseButtonFlags, [SDL_POINTER[ctypes.c_float], SDL_POINTER[ctypes.c_float]], SDL_BINARY] 39 | SDL_GetGlobalMouseState: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetGlobalMouseState", SDL_MouseButtonFlags, [SDL_POINTER[ctypes.c_float], SDL_POINTER[ctypes.c_float]], SDL_BINARY] 40 | SDL_GetRelativeMouseState: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetRelativeMouseState", SDL_MouseButtonFlags, [SDL_POINTER[ctypes.c_float], SDL_POINTER[ctypes.c_float]], SDL_BINARY] 41 | SDL_WarpMouseInWindow: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WarpMouseInWindow", None, [SDL_POINTER[SDL_Window], ctypes.c_float, ctypes.c_float], SDL_BINARY] 42 | SDL_WarpMouseGlobal: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WarpMouseGlobal", ctypes.c_bool, [ctypes.c_float, ctypes.c_float], SDL_BINARY] 43 | SDL_SetWindowRelativeMouseMode: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetWindowRelativeMouseMode", ctypes.c_bool, [SDL_POINTER[SDL_Window], ctypes.c_bool], SDL_BINARY] 44 | SDL_GetWindowRelativeMouseMode: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetWindowRelativeMouseMode", ctypes.c_bool, [SDL_POINTER[SDL_Window]], SDL_BINARY] 45 | SDL_CaptureMouse: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CaptureMouse", ctypes.c_bool, [ctypes.c_bool], SDL_BINARY] 46 | 47 | SDL_CreateCursor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateCursor", SDL_POINTER[SDL_Cursor], [SDL_POINTER[ctypes.c_uint8], SDL_POINTER[ctypes.c_uint8], ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int], SDL_BINARY] 48 | SDL_CreateColorCursor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateColorCursor", SDL_POINTER[SDL_Cursor], [SDL_POINTER[SDL_Surface], ctypes.c_int, ctypes.c_int], SDL_BINARY] 49 | SDL_CreateSystemCursor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateSystemCursor", SDL_POINTER[SDL_Cursor], [SDL_SystemCursor], SDL_BINARY] 50 | SDL_SetCursor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetCursor", ctypes.c_bool, [SDL_POINTER[SDL_Cursor]], SDL_BINARY] 51 | SDL_GetCursor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCursor", SDL_POINTER[SDL_Cursor], [], SDL_BINARY] 52 | SDL_GetDefaultCursor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetDefaultCursor", SDL_POINTER[SDL_Cursor], [], SDL_BINARY] 53 | SDL_DestroyCursor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroyCursor", None, [SDL_POINTER[SDL_Cursor]], SDL_BINARY] 54 | SDL_ShowCursor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShowCursor", ctypes.c_bool, [], SDL_BINARY] 55 | SDL_HideCursor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HideCursor", ctypes.c_bool, [], SDL_BINARY] 56 | SDL_CursorVisible: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CursorVisible", ctypes.c_bool, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_mutex.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from.SDL_atomic import SDL_AtomicInt 5 | from .SDL_thread import SDL_ThreadID 6 | 7 | SDL_MUTEX_TIMEDOUT: int = 1 8 | 9 | class SDL_Mutex(ctypes.c_void_p): 10 | ... 11 | 12 | SDL_CreateMutex: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateMutex", SDL_POINTER[SDL_Mutex], [], SDL_BINARY] 13 | SDL_LockMutex: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LockMutex", None, [SDL_POINTER[SDL_Mutex]], SDL_BINARY] 14 | SDL_TryLockMutex: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_TryLockMutex", ctypes.c_bool, [SDL_POINTER[SDL_Mutex]], SDL_BINARY] 15 | SDL_UnlockMutex: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UnlockMutex", None, [SDL_POINTER[SDL_Mutex]], SDL_BINARY] 16 | SDL_DestroyMutex: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroyMutex", None, [SDL_POINTER[SDL_Mutex]], SDL_BINARY] 17 | 18 | class SDL_RWLock(ctypes.c_void_p): 19 | ... 20 | 21 | SDL_RWLOCK_TIMEDOUT: int = SDL_MUTEX_TIMEDOUT 22 | 23 | SDL_CreateRWLock: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateRWLock", SDL_POINTER[SDL_RWLock], [], SDL_BINARY] 24 | SDL_LockRWLockForReading: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LockRWLockForReading", None, [SDL_POINTER[SDL_RWLock]], SDL_BINARY] 25 | SDL_LockRWLockForWriting: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LockRWLockForWriting", None, [SDL_POINTER[SDL_RWLock]], SDL_BINARY] 26 | SDL_TryLockRWLockForReading: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_TryLockRWLockForReading", ctypes.c_bool, [SDL_POINTER[SDL_RWLock]], SDL_BINARY] 27 | SDL_TryLockRWLockForWriting: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_TryLockRWLockForWriting", ctypes.c_bool, [SDL_POINTER[SDL_RWLock]], SDL_BINARY] 28 | SDL_UnlockRWLock: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UnlockRWLock", None, [SDL_POINTER[SDL_RWLock]], SDL_BINARY] 29 | SDL_DestroyRWLock: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroyRWLock", None, [SDL_POINTER[SDL_RWLock]], SDL_BINARY] 30 | 31 | class SDL_Semaphore(ctypes.c_void_p): 32 | ... 33 | 34 | SDL_CreateSemaphore: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateSemaphore", SDL_POINTER[SDL_Semaphore], [ctypes.c_uint32], SDL_BINARY] 35 | SDL_DestroySemaphore: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroySemaphore", None, [SDL_POINTER[SDL_Semaphore]], SDL_BINARY] 36 | SDL_WaitSemaphore: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WaitSemaphore", None, [SDL_POINTER[SDL_Semaphore]], SDL_BINARY] 37 | SDL_TryWaitSemaphore: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_TryWaitSemaphore", ctypes.c_bool, [SDL_POINTER[SDL_Semaphore]], SDL_BINARY] 38 | SDL_WaitSemaphoreTimeout: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WaitSemaphoreTimeout", ctypes.c_bool, [SDL_POINTER[SDL_Semaphore], ctypes.c_int32], SDL_BINARY] 39 | SDL_SignalSemaphore: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SignalSemaphore", None, [SDL_POINTER[SDL_Semaphore]], SDL_BINARY] 40 | SDL_GetSemaphoreValue: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSemaphoreValue", ctypes.c_uint32, [SDL_POINTER[SDL_Semaphore]], SDL_BINARY] 41 | 42 | class SDL_Condition(ctypes.c_void_p): 43 | ... 44 | 45 | SDL_CreateCondition: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateCondition", SDL_POINTER[SDL_Condition], [], SDL_BINARY] 46 | SDL_DestroyCondition: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroyCondition", None, [SDL_POINTER[SDL_Condition]], SDL_BINARY] 47 | SDL_SignalCondition: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SignalCondition", None, [SDL_POINTER[SDL_Condition]], SDL_BINARY] 48 | SDL_BroadcastCondition: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_BroadcastCondition", None, [SDL_POINTER[SDL_Condition]], SDL_BINARY] 49 | SDL_WaitCondition: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WaitCondition", None, [SDL_POINTER[SDL_Condition], SDL_POINTER[SDL_Mutex]], SDL_BINARY] 50 | SDL_WaitConditionTimeout: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WaitConditionTimeout", ctypes.c_bool, [SDL_POINTER[SDL_Condition], SDL_POINTER[SDL_Mutex], ctypes.c_int32], SDL_BINARY] 51 | 52 | SDL_InitStatus: typing.TypeAlias = SDL_TYPE["SDL_InitStatus", SDL_ENUM] 53 | 54 | SDL_INIT_STATUS_UNINITIALIZED, SDL_INIT_STATUS_INITIALIZING, SDL_INIT_STATUS_INITIALIZED, SDL_INIT_STATUS_UNINITIALIZING = range(4) 55 | 56 | class SDL_InitState(ctypes.Structure): 57 | _fields_ = [ 58 | ("status", SDL_AtomicInt), 59 | ("thread", SDL_ThreadID), 60 | ("reserved", ctypes.c_void_p) 61 | ] 62 | 63 | SDL_ShouldInit: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShouldInit", ctypes.c_bool, [SDL_POINTER[SDL_InitState]], SDL_BINARY] 64 | SDL_ShouldQuit: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShouldQuit", ctypes.c_bool, [SDL_POINTER[SDL_InitState]], SDL_BINARY] 65 | 66 | SDL_SetInitialized: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetInitialized", None, [SDL_POINTER[SDL_InitState], ctypes.c_bool], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_net.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC, SDL_NET_BINARY 3 | 4 | from .SDL_version import SDL_VERSIONNUM 5 | 6 | SDL_NET_MAJOR_VERSION, SDL_NET_MINOR_VERSION, SDL_NET_MICRO_VERSION = 3, 0, 0 7 | SDL_NET_VERSION: int = SDL_VERSIONNUM(SDL_NET_MAJOR_VERSION, SDL_NET_MINOR_VERSION, SDL_NET_MICRO_VERSION) 8 | 9 | SDL_NET_VERSION_ATLEAST: abc.Callable[[int, int, int], bool] = lambda x, y, z: \ 10 | (SDL_NET_MAJOR_VERSION >= x) and (SDL_NET_MAJOR_VERSION > x or SDL_NET_MINOR_VERSION >= y) and \ 11 | (SDL_NET_MAJOR_VERSION > x or SDL_NET_MINOR_VERSION > y or SDL_NET_MICRO_VERSION >= z) 12 | 13 | NET_GetVersion: abc.Callable[..., typing.Any] = SDL_FUNC["NET_GetVersion", ctypes.c_int, [], SDL_NET_BINARY] 14 | NET_Init: abc.Callable[..., typing.Any] = SDL_FUNC["NET_Init", ctypes.c_bool, [], SDL_NET_BINARY] 15 | NET_Quit: abc.Callable[..., typing.Any] = SDL_FUNC["NET_Quit", None, [], SDL_NET_BINARY] 16 | 17 | class NET_Address(ctypes.c_void_p): 18 | ... 19 | 20 | NET_ResolveHostname: abc.Callable[..., typing.Any] = SDL_FUNC["NET_ResolveHostname", SDL_POINTER[NET_Address], [ctypes.c_char_p], SDL_NET_BINARY] 21 | NET_WaitUntilResolved: abc.Callable[..., typing.Any] = SDL_FUNC["NET_WaitUntilResolved", ctypes.c_int, [SDL_POINTER[NET_Address], ctypes.c_int32], SDL_NET_BINARY] 22 | NET_GetAddressStatus: abc.Callable[..., typing.Any] = SDL_FUNC["NET_GetAddressStatus", ctypes.c_int, [SDL_POINTER[NET_Address]], SDL_NET_BINARY] 23 | NET_GetAddressString: abc.Callable[..., typing.Any] = SDL_FUNC["NET_GetAddressString", ctypes.c_char_p, [SDL_POINTER[NET_Address]], SDL_NET_BINARY] 24 | NET_RefAddress: abc.Callable[..., typing.Any] = SDL_FUNC["NET_RefAddress", SDL_POINTER[NET_Address], [SDL_POINTER[NET_Address]], SDL_NET_BINARY] 25 | NET_UnrefAddress: abc.Callable[..., typing.Any] = SDL_FUNC["NET_UnrefAddress", None, [SDL_POINTER[NET_Address]], SDL_NET_BINARY] 26 | NET_SimulateAddressResolutionLoss: abc.Callable[..., typing.Any] = SDL_FUNC["NET_SimulateAddressResolutionLoss", None, [ctypes.c_int], SDL_NET_BINARY] 27 | NET_CompareAddresses: abc.Callable[..., typing.Any] = SDL_FUNC["NET_CompareAddresses", ctypes.c_int, [SDL_POINTER[NET_Address], SDL_POINTER[NET_Address]], SDL_NET_BINARY] 28 | NET_GetLocalAddresses: abc.Callable[..., typing.Any] = SDL_FUNC["NET_GetLocalAddresses", SDL_POINTER[SDL_POINTER[NET_Address]], [SDL_POINTER[ctypes.c_int]], SDL_NET_BINARY] 29 | NET_FreeLocalAddresses: abc.Callable[..., typing.Any] = SDL_FUNC["NET_FreeLocalAddresses", None, [SDL_POINTER[SDL_POINTER[NET_Address]]], SDL_NET_BINARY] 30 | 31 | class NET_StreamSocket(ctypes.c_void_p): 32 | ... 33 | 34 | NET_CreateClient: abc.Callable[..., typing.Any] = SDL_FUNC["NET_CreateClient", SDL_POINTER[NET_StreamSocket], [SDL_POINTER[NET_Address], ctypes.c_uint16], SDL_NET_BINARY] 35 | NET_WaitUntilConnected: abc.Callable[..., typing.Any] = SDL_FUNC["NET_WaitUntilConnected", ctypes.c_int, [SDL_POINTER[NET_StreamSocket], ctypes.c_int32], SDL_NET_BINARY] 36 | 37 | class NET_Server(ctypes.c_void_p): 38 | ... 39 | 40 | NET_CreateServer: abc.Callable[..., typing.Any] = SDL_FUNC["NET_CreateServer", SDL_POINTER[NET_Server], [SDL_POINTER[NET_Address], ctypes.c_uint16], SDL_NET_BINARY] 41 | NET_AcceptClient: abc.Callable[..., typing.Any] = SDL_FUNC["NET_AcceptClient", ctypes.c_bool, [SDL_POINTER[NET_Server], SDL_POINTER[SDL_POINTER[NET_StreamSocket]]], SDL_NET_BINARY] 42 | NET_DestroyServer: abc.Callable[..., typing.Any] = SDL_FUNC["NET_DestroyServer", None, [SDL_POINTER[NET_Server]], SDL_NET_BINARY] 43 | NET_GetStreamSocketAddress: abc.Callable[..., typing.Any] = SDL_FUNC["NET_GetStreamSocketAddress", SDL_POINTER[NET_Address], [SDL_POINTER[NET_StreamSocket]], SDL_NET_BINARY] 44 | NET_GetConnectionStatus: abc.Callable[..., typing.Any] = SDL_FUNC["NET_GetConnectionStatus", ctypes.c_int, [SDL_POINTER[NET_StreamSocket]], SDL_NET_BINARY] 45 | NET_WriteToStreamSocket: abc.Callable[..., typing.Any] = SDL_FUNC["NET_WriteToStreamSocket", ctypes.c_bool, [SDL_POINTER[NET_StreamSocket], ctypes.c_void_p, ctypes.c_int], SDL_NET_BINARY] 46 | NET_GetStreamSocketPendingWrites: abc.Callable[..., typing.Any] = SDL_FUNC["NET_GetStreamSocketPendingWrites", ctypes.c_int, [SDL_POINTER[NET_StreamSocket]], SDL_NET_BINARY] 47 | NET_WaitUntilStreamSocketDrained: abc.Callable[..., typing.Any] = SDL_FUNC["NET_WaitUntilStreamSocketDrained", ctypes.c_int, [SDL_POINTER[NET_StreamSocket], ctypes.c_int32], SDL_NET_BINARY] 48 | NET_ReadFromStreamSocket: abc.Callable[..., typing.Any] = SDL_FUNC["NET_ReadFromStreamSocket", ctypes.c_int, [SDL_POINTER[NET_StreamSocket], ctypes.c_void_p, ctypes.c_int], SDL_NET_BINARY] 49 | NET_SimulateStreamPacketLoss: abc.Callable[..., typing.Any] = SDL_FUNC["NET_SimulateStreamPacketLoss", None, [SDL_POINTER[NET_StreamSocket], ctypes.c_int], SDL_NET_BINARY] 50 | NET_DestroyStreamSocket: abc.Callable[..., typing.Any] = SDL_FUNC["NET_DestroyStreamSocket", None, [SDL_POINTER[NET_StreamSocket]], SDL_NET_BINARY] 51 | 52 | class NET_DatagramSocket(ctypes.c_void_p): 53 | ... 54 | 55 | class NET_Datagram(ctypes.Structure): 56 | _fields_ = [ 57 | ("addr", SDL_POINTER[NET_Address]), 58 | ("port", ctypes.c_uint16), 59 | ("buf", SDL_POINTER[ctypes.c_uint8]), 60 | ("buflen", ctypes.c_int) 61 | ] 62 | 63 | NET_CreateDatagramSocket: abc.Callable[..., typing.Any] = SDL_FUNC["NET_CreateDatagramSocket", SDL_POINTER[NET_DatagramSocket], [SDL_POINTER[NET_Address], ctypes.c_uint16], SDL_NET_BINARY] 64 | NET_SendDatagram: abc.Callable[..., typing.Any] = SDL_FUNC["NET_SendDatagram", ctypes.c_bool, [SDL_POINTER[NET_DatagramSocket], SDL_POINTER[NET_Address], ctypes.c_uint16, ctypes.c_void_p, ctypes.c_int], SDL_NET_BINARY] 65 | NET_ReceiveDatagram: abc.Callable[..., typing.Any] = SDL_FUNC["NET_ReceiveDatagram", ctypes.c_bool, [SDL_POINTER[NET_DatagramSocket], SDL_POINTER[SDL_POINTER[NET_Datagram]]], SDL_NET_BINARY] 66 | NET_DestroyDatagram: abc.Callable[..., typing.Any] = SDL_FUNC["NET_DestroyDatagram", None, [SDL_POINTER[NET_Datagram]], SDL_NET_BINARY] 67 | NET_SimulateDatagramPacketLoss: abc.Callable[..., typing.Any] = SDL_FUNC["NET_SimulateDatagramPacketLoss", None, [SDL_POINTER[NET_DatagramSocket], ctypes.c_int], SDL_NET_BINARY] 68 | NET_DestroyDatagramSocket: abc.Callable[..., typing.Any] = SDL_FUNC["NET_DestroyDatagramSocket", None, [SDL_POINTER[NET_DatagramSocket]], SDL_NET_BINARY] 69 | NET_WaitUntilInputAvailable: abc.Callable[..., typing.Any] = SDL_FUNC["NET_WaitUntilInputAvailable", ctypes.c_int, [SDL_POINTER[ctypes.c_void_p], ctypes.c_int, ctypes.c_int32], SDL_NET_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_pen.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, SDL_TYPE, SDL_ENUM 2 | 3 | from .SDL_touch import SDL_TouchID 4 | from .SDL_mouse import SDL_MouseID 5 | 6 | SDL_PenID: typing.TypeAlias = SDL_TYPE["SDL_PenID", ctypes.c_uint32] 7 | 8 | SDL_PEN_MOUSEID, SDL_PEN_TOUCHID = SDL_MouseID(-2), SDL_TouchID(-2) 9 | 10 | SDL_PenInputFlags: typing.TypeAlias = SDL_TYPE["SDL_PenInputFlags", ctypes.c_uint32] 11 | 12 | SDL_PEN_INPUT_DOWN: int = 1 << 0 13 | SDL_PEN_INPUT_BUTTON_1: int = 1 << 1 14 | SDL_PEN_INPUT_BUTTON_2: int = 1 << 2 15 | SDL_PEN_INPUT_BUTTON_3: int = 1 << 3 16 | SDL_PEN_INPUT_BUTTON_4: int = 1 << 4 17 | SDL_PEN_INPUT_BUTTON_5: int = 1 << 5 18 | SDL_PEN_INPUT_ERASER_TIP: int = 1 << 30 19 | 20 | SDL_PenAxis: typing.TypeAlias = SDL_TYPE["SDL_PenAxis", SDL_ENUM] 21 | 22 | SDL_PEN_AXIS_PRESSURE, SDL_PEN_AXIS_XTILT, SDL_PEN_AXIS_YTILT, SDL_PEN_AXIS_DISTANCE, SDL_PEN_AXIS_ROTATION, \ 23 | SDL_PEN_AXIS_SLIDER, SDL_PEN_AXIS_TANGENTIAL_PRESSURE, SDL_PEN_AXIS_COUNT = range(8) -------------------------------------------------------------------------------- /sdl3/SDL_platform.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_FUNC, SDL_BINARY 2 | 3 | SDL_GetPlatform: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetPlatform", ctypes.c_char_p, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_power.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | SDL_PowerState: typing.TypeAlias = SDL_TYPE["SDL_PowerState", SDL_ENUM] 5 | 6 | SDL_POWERSTATE_ERROR, SDL_POWERSTATE_UNKNOWN, SDL_POWERSTATE_ON_BATTERY, \ 7 | SDL_POWERSTATE_NO_BATTERY, SDL_POWERSTATE_CHARGING, SDL_POWERSTATE_CHARGED = range(-1, 5) 8 | 9 | SDL_GetPowerInfo: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetPowerInfo", SDL_PowerState, [SDL_POINTER[ctypes.c_int], SDL_POINTER[ctypes.c_int]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_process.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_properties import SDL_PropertiesID 5 | from .SDL_iostream import SDL_IOStream 6 | 7 | class SDL_Process(ctypes.c_void_p): 8 | ... 9 | 10 | SDL_CreateProcess: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateProcess", SDL_POINTER[SDL_Process], [SDL_POINTER[ctypes.c_char_p], ctypes.c_bool], SDL_BINARY] 11 | 12 | SDL_ProcessIO: typing.TypeAlias = SDL_TYPE["SDL_ProcessIO", SDL_ENUM] 13 | 14 | SDL_PROCESS_STDIO_INHERITED, SDL_PROCESS_STDIO_NULL, \ 15 | SDL_PROCESS_STDIO_APP, SDL_PROCESS_STDIO_REDIRECT = range(4) 16 | 17 | SDL_CreateProcessWithProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateProcessWithProperties", SDL_POINTER[SDL_Process], [SDL_PropertiesID], SDL_BINARY] 18 | 19 | SDL_PROP_PROCESS_CREATE_ARGS_POINTER: bytes = "SDL.process.create.args".encode() 20 | SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER: bytes = "SDL.process.create.environment".encode() 21 | SDL_PROP_PROCESS_CREATE_STDIN_NUMBER: bytes = "SDL.process.create.stdin_option".encode() 22 | SDL_PROP_PROCESS_CREATE_STDIN_POINTER: bytes = "SDL.process.create.stdin_source".encode() 23 | SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER: bytes = "SDL.process.create.stdout_option".encode() 24 | SDL_PROP_PROCESS_CREATE_STDOUT_POINTER: bytes = "SDL.process.create.stdout_source".encode() 25 | SDL_PROP_PROCESS_CREATE_STDERR_NUMBER: bytes = "SDL.process.create.stderr_option".encode() 26 | SDL_PROP_PROCESS_CREATE_STDERR_POINTER: bytes = "SDL.process.create.stderr_source".encode() 27 | SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN: bytes = "SDL.process.create.stderr_to_stdout".encode() 28 | SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN: bytes = "SDL.process.create.background".encode() 29 | 30 | SDL_GetProcessProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetProcessProperties", SDL_PropertiesID, [SDL_POINTER[SDL_Process]], SDL_BINARY] 31 | 32 | SDL_PROP_PROCESS_PID_NUMBER: bytes = "SDL.process.pid".encode() 33 | SDL_PROP_PROCESS_STDIN_POINTER: bytes = "SDL.process.stdin".encode() 34 | SDL_PROP_PROCESS_STDOUT_POINTER: bytes = "SDL.process.stdout".encode() 35 | SDL_PROP_PROCESS_STDERR_POINTER: bytes = "SDL.process.stderr".encode() 36 | SDL_PROP_PROCESS_BACKGROUND_BOOLEAN: bytes = "SDL.process.background".encode() 37 | 38 | SDL_ReadProcess: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadProcess", ctypes.c_void_p, [SDL_POINTER[SDL_Process], SDL_POINTER[ctypes.c_size_t], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 39 | 40 | SDL_GetProcessInput: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetProcessInput", SDL_POINTER[SDL_IOStream], [SDL_POINTER[SDL_Process]], SDL_BINARY] 41 | SDL_GetProcessOutput: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetProcessOutput", SDL_POINTER[SDL_IOStream], [SDL_POINTER[SDL_Process]], SDL_BINARY] 42 | 43 | SDL_KillProcess: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_KillProcess", ctypes.c_bool, [SDL_POINTER[SDL_Process], ctypes.c_bool], SDL_BINARY] 44 | SDL_WaitProcess: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WaitProcess", ctypes.c_bool, [SDL_POINTER[SDL_Process], ctypes.c_bool, SDL_POINTER[ctypes.c_int]], SDL_BINARY] 45 | SDL_DestroyProcess: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroyProcess", None, [SDL_POINTER[SDL_Process]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_properties.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_FUNC_TYPE, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | SDL_PropertiesID: typing.TypeAlias = SDL_TYPE["SDL_PropertiesID", ctypes.c_uint32] 5 | SDL_PropertyType: typing.TypeAlias = SDL_TYPE["SDL_PropertyType", SDL_ENUM] 6 | 7 | SDL_PROPERTY_TYPE_INVALID, SDL_PROPERTY_TYPE_POINTER, SDL_PROPERTY_TYPE_STRING, \ 8 | SDL_PROPERTY_TYPE_NUMBER, SDL_PROPERTY_TYPE_FLOAT, SDL_PROPERTY_TYPE_BOOLEAN = range(6) 9 | 10 | SDL_GetGlobalProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetGlobalProperties", SDL_PropertiesID, [], SDL_BINARY] 11 | SDL_CreateProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateProperties", SDL_PropertiesID, [], SDL_BINARY] 12 | SDL_CopyProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CopyProperties", ctypes.c_bool, [SDL_PropertiesID, SDL_PropertiesID], SDL_BINARY] 13 | SDL_LockProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_LockProperties", ctypes.c_bool, [SDL_PropertiesID], SDL_BINARY] 14 | SDL_UnlockProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UnlockProperties", None, [SDL_PropertiesID], SDL_BINARY] 15 | 16 | SDL_CleanupPropertyCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_CleanupPropertyCallback", None, [ctypes.c_void_p, ctypes.c_void_p]] 17 | 18 | SDL_SetPointerPropertyWithCleanup: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetPointerPropertyWithCleanup", ctypes.c_bool, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_void_p, SDL_CleanupPropertyCallback, ctypes.c_void_p], SDL_BINARY] 19 | SDL_SetPointerProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetPointerProperty", ctypes.c_bool, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_void_p], SDL_BINARY] 20 | SDL_SetStringProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetStringProperty", ctypes.c_bool, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 21 | SDL_SetNumberProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetNumberProperty", ctypes.c_bool, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_int64], SDL_BINARY] 22 | SDL_SetFloatProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetFloatProperty", ctypes.c_bool, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_float], SDL_BINARY] 23 | SDL_SetBooleanProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetBooleanProperty", ctypes.c_bool, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_bool], SDL_BINARY] 24 | SDL_HasProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasProperty", ctypes.c_bool, [SDL_PropertiesID, ctypes.c_char_p], SDL_BINARY] 25 | SDL_GetPropertyType: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetPropertyType", SDL_PropertyType, [SDL_PropertiesID, ctypes.c_char_p], SDL_BINARY] 26 | SDL_GetPointerProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetPointerProperty", ctypes.c_void_p, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_void_p], SDL_BINARY] 27 | SDL_GetStringProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetStringProperty", ctypes.c_char_p, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 28 | SDL_GetNumberProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetNumberProperty", ctypes.c_int64, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_int64], SDL_BINARY] 29 | SDL_GetFloatProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetFloatProperty", ctypes.c_float, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_float], SDL_BINARY] 30 | SDL_GetBooleanProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetBooleanProperty", ctypes.c_bool, [SDL_PropertiesID, ctypes.c_char_p, ctypes.c_bool], SDL_BINARY] 31 | SDL_ClearProperty: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ClearProperty", ctypes.c_bool, [SDL_PropertiesID, ctypes.c_char_p], SDL_BINARY] 32 | 33 | SDL_EnumeratePropertiesCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_EnumeratePropertiesCallback", None, [ctypes.c_void_p, SDL_PropertiesID, ctypes.c_char_p]] 34 | 35 | SDL_EnumerateProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_EnumerateProperties", ctypes.c_bool, [SDL_PropertiesID, SDL_EnumeratePropertiesCallback, ctypes.c_void_p], SDL_BINARY] 36 | SDL_DestroyProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroyProperties", None, [SDL_PropertiesID], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_rect.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC, SDL_DEREFERENCE, SDL_BINARY 3 | 4 | from .SDL_stdinc import SDL_FLT_EPSILON 5 | 6 | class SDL_Point(ctypes.Structure): 7 | _fields_ = [ 8 | ("x", ctypes.c_int), 9 | ("y", ctypes.c_int) 10 | ] 11 | 12 | class SDL_FPoint(ctypes.Structure): 13 | _fields_ = [ 14 | ("x", ctypes.c_float), 15 | ("y", ctypes.c_float) 16 | ] 17 | 18 | class SDL_Rect(ctypes.Structure): 19 | _fields_ = [ 20 | ("x", ctypes.c_int), 21 | ("y", ctypes.c_int), 22 | ("w", ctypes.c_int), 23 | ("h", ctypes.c_int) 24 | ] 25 | 26 | class SDL_FRect(ctypes.Structure): 27 | _fields_ = [ 28 | ("x", ctypes.c_float), 29 | ("y", ctypes.c_float), 30 | ("w", ctypes.c_float), 31 | ("h", ctypes.c_float) 32 | ] 33 | 34 | LP_SDL_Point: typing.TypeAlias = SDL_POINTER[SDL_Point] 35 | LP_SDL_FPoint: typing.TypeAlias = SDL_POINTER[SDL_FPoint] 36 | LP_SDL_Rect: typing.TypeAlias = SDL_POINTER[SDL_Rect] 37 | LP_SDL_FRect: typing.TypeAlias = SDL_POINTER[SDL_FRect] 38 | 39 | def SDL_RectToFRect(rect: LP_SDL_Rect, frect: LP_SDL_FRect) -> None: 40 | rect, frect = SDL_DEREFERENCE(rect), SDL_DEREFERENCE(frect) 41 | frect.x, frect.y, frect.w, frect.h = float(rect.x), float(rect.y), float(rect.w), float(rect.h) 42 | 43 | def SDL_PointInRect(p: LP_SDL_Point, r: LP_SDL_Rect) -> bool: 44 | p, r = SDL_DEREFERENCE(p), SDL_DEREFERENCE(r) 45 | return p.x >= r.x and p.x < r.x + r.w and p.y >= r.y and p.y < r.y + r.h 46 | 47 | def SDL_RectEmpty(r: LP_SDL_Rect) -> bool: 48 | r = SDL_DEREFERENCE(r) 49 | return r.w <= 0 or r.h <= 0 50 | 51 | def SDL_RectEquals(a: LP_SDL_Rect, b: LP_SDL_Rect) -> bool: 52 | a, b = SDL_DEREFERENCE(a), SDL_DEREFERENCE(b) 53 | return a.x == b.x and a.y == b.y and a.w == b.w and a.h == b.h 54 | 55 | SDL_HasRectIntersection: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasRectIntersection", ctypes.c_bool, [SDL_POINTER[SDL_Rect], SDL_POINTER[SDL_Rect]], SDL_BINARY] 56 | SDL_GetRectIntersection: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetRectIntersection", ctypes.c_bool, [SDL_POINTER[SDL_Rect], SDL_POINTER[SDL_Rect], SDL_POINTER[SDL_Rect]], SDL_BINARY] 57 | SDL_GetRectUnion: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetRectUnion", ctypes.c_bool, [SDL_POINTER[SDL_Rect], SDL_POINTER[SDL_Rect], SDL_POINTER[SDL_Rect]], SDL_BINARY] 58 | SDL_GetRectEnclosingPoints: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetRectEnclosingPoints", ctypes.c_bool, [SDL_POINTER[SDL_Point], ctypes.c_int, SDL_POINTER[SDL_Rect], SDL_POINTER[SDL_Rect]], SDL_BINARY] 59 | SDL_GetRectAndLineIntersection: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetRectAndLineIntersection", ctypes.c_bool, [SDL_POINTER[SDL_Rect], SDL_POINTER[ctypes.c_int], SDL_POINTER[ctypes.c_int], SDL_POINTER[ctypes.c_int], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 60 | 61 | def SDL_PointInRectFloat(p: LP_SDL_FPoint, r: LP_SDL_FRect) -> bool: 62 | p, r = SDL_DEREFERENCE(p), SDL_DEREFERENCE(r) 63 | return p.x >= r.x and p.x < r.x + r.w and p.y >= r.y and p.y < r.y + r.h 64 | 65 | def SDL_RectEmptyFloat(r: LP_SDL_FRect) -> bool: 66 | r = SDL_DEREFERENCE(r) 67 | return r.w <= 0 or r.h <= 0 68 | 69 | def SDL_RectsEqualEpsilon(a: LP_SDL_FRect, b: LP_SDL_FRect, epsilon: float) -> bool: 70 | a, b = SDL_DEREFERENCE(a), SDL_DEREFERENCE(b) 71 | return abs(a.x - b.x) < epsilon and abs(a.y - b.y) < epsilon and abs(a.w - b.w) < epsilon and abs(a.h - b.h) < epsilon 72 | 73 | def SDL_RectsEqualFloat(a: LP_SDL_FRect, b: LP_SDL_FRect) -> bool: 74 | a, b = SDL_DEREFERENCE(a), SDL_DEREFERENCE(b) 75 | return SDL_RectsEqualEpsilon(a, b, SDL_FLT_EPSILON) 76 | 77 | SDL_HasRectIntersectionFloat: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_HasRectIntersectionFloat", ctypes.c_bool, [SDL_POINTER[SDL_FRect], SDL_POINTER[SDL_FRect]], SDL_BINARY] 78 | SDL_GetRectIntersectionFloat: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetRectIntersectionFloat", ctypes.c_bool, [SDL_POINTER[SDL_FRect], SDL_POINTER[SDL_FRect], SDL_POINTER[SDL_FRect]], SDL_BINARY] 79 | SDL_GetRectUnionFloat: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetRectUnionFloat", ctypes.c_bool, [SDL_POINTER[SDL_FRect], SDL_POINTER[SDL_FRect], SDL_POINTER[SDL_FRect]], SDL_BINARY] 80 | SDL_GetRectEnclosingPointsFloat: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetRectEnclosingPointsFloat", ctypes.c_bool, [SDL_POINTER[SDL_FPoint], ctypes.c_int, SDL_POINTER[SDL_FRect], SDL_POINTER[SDL_FRect]], SDL_BINARY] 81 | SDL_GetRectAndLineIntersectionFloat: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetRectAndLineIntersectionFloat", ctypes.c_bool, [SDL_POINTER[SDL_FRect], SDL_POINTER[ctypes.c_float], SDL_POINTER[ctypes.c_float], SDL_POINTER[ctypes.c_float], SDL_POINTER[ctypes.c_float]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_rtf.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_POINTER, \ 2 | SDL_FUNC_TYPE, SDL_FUNC, SDL_TYPE, SDL_RTF_BINARY, SDL_ENUM 3 | 4 | from .SDL_pixels import SDL_Color 5 | from .SDL_iostream import SDL_IOStream 6 | from .SDL_error import SDL_SetError, SDL_GetError 7 | from .SDL_render import SDL_Renderer, SDL_Texture 8 | from .SDL_version import SDL_VERSIONNUM 9 | from .SDL_rect import SDL_Rect 10 | 11 | SDL_RTF_MAJOR_VERSION, SDL_RTF_MINOR_VERSION, SDL_RTF_MICRO_VERSION = 3, 0, 0 12 | SDL_RTF_VERSION: int = SDL_VERSIONNUM(SDL_RTF_MAJOR_VERSION, SDL_RTF_MINOR_VERSION, SDL_RTF_MICRO_VERSION) 13 | 14 | SDL_RTF_VERSION_ATLEAST: abc.Callable[[int, int, int], bool] = lambda x, y, z: \ 15 | (SDL_RTF_MAJOR_VERSION >= x) and (SDL_RTF_MAJOR_VERSION > x or SDL_RTF_MINOR_VERSION >= y) and \ 16 | (SDL_RTF_MAJOR_VERSION > x or SDL_RTF_MINOR_VERSION > y or SDL_RTF_MICRO_VERSION >= z) 17 | 18 | RTF_Version: abc.Callable[..., typing.Any] = SDL_FUNC["RTF_Version", ctypes.c_int, [], SDL_RTF_BINARY] 19 | 20 | class RTF_Context(ctypes.c_void_p): 21 | ... 22 | 23 | RTF_FontFamily: typing.TypeAlias = SDL_TYPE["RTF_FontFamily", SDL_ENUM] 24 | 25 | RTF_FontDefault, RTF_FontRoman, RTF_FontSwiss, RTF_FontModern, \ 26 | RTF_FontScript, RTF_FontDecor, RTF_FontTech, RTF_FontBidi = range(8) 27 | 28 | RTF_FontStyle: typing.TypeAlias = SDL_TYPE["RTF_FontStyle", SDL_ENUM] 29 | 30 | RTF_FontNormal, RTF_FontBold, RTF_FontItalic, \ 31 | RTF_FontUnderline = 0x00, 0x01, 0x02, 0x04 32 | 33 | RTF_FONT_ENGINE_VERSION: int = 1 34 | 35 | class RTF_FontEngine(ctypes.Structure): 36 | _fields_ = [ 37 | ("version", ctypes.c_int), 38 | ("CreateFont", SDL_FUNC_TYPE["RTF_FontEngine.CreateFont", ctypes.c_void_p, [ctypes.c_char_p, RTF_FontFamily, ctypes.c_int, ctypes.c_int, ctypes.c_int]]), 39 | ("GetLineSpacing", SDL_FUNC_TYPE["RTF_FontEngine.GetLineSpacing", ctypes.c_int, [ctypes.c_void_p]]), 40 | ("GetCharacterOffsets", SDL_FUNC_TYPE["RTF_FontEngine.GetCharacterOffsets", ctypes.c_int, [ctypes.c_void_p, ctypes.c_char_p, SDL_POINTER[ctypes.c_int], SDL_POINTER[ctypes.c_int], ctypes.c_int]]), 41 | ("RenderText", SDL_FUNC_TYPE["RTF_FontEngine.RenderText", SDL_POINTER[SDL_Texture], [ctypes.c_void_p, SDL_POINTER[SDL_Renderer], ctypes.c_char_p, SDL_Color]]), 42 | ("FreeFont", SDL_FUNC_TYPE["RTF_FontEngine.FreeFont", None, [ctypes.c_void_p]]) 43 | ] 44 | 45 | RTF_CreateContext: abc.Callable[..., typing.Any] = SDL_FUNC["RTF_CreateContext", SDL_POINTER[RTF_Context], [SDL_POINTER[SDL_Renderer], SDL_POINTER[RTF_FontEngine]], SDL_RTF_BINARY] 46 | RTF_Load: abc.Callable[..., typing.Any] = SDL_FUNC["RTF_Load", ctypes.c_int, [SDL_POINTER[RTF_Context], ctypes.c_char_p], SDL_RTF_BINARY] 47 | RTF_Load_IO: abc.Callable[..., typing.Any] = SDL_FUNC["RTF_Load_IO", ctypes.c_int, [SDL_POINTER[RTF_Context], SDL_POINTER[SDL_IOStream], ctypes.c_int], SDL_RTF_BINARY] 48 | RTF_GetTitle: abc.Callable[..., typing.Any] = SDL_FUNC["RTF_GetTitle", ctypes.c_char_p, [SDL_POINTER[RTF_Context]], SDL_RTF_BINARY] 49 | RTF_GetSubject: abc.Callable[..., typing.Any] = SDL_FUNC["RTF_GetSubject", ctypes.c_char_p, [SDL_POINTER[RTF_Context]], SDL_RTF_BINARY] 50 | RTF_GetAuthor: abc.Callable[..., typing.Any] = SDL_FUNC["RTF_GetAuthor", ctypes.c_char_p, [SDL_POINTER[RTF_Context]], SDL_RTF_BINARY] 51 | RTF_GetHeight: abc.Callable[..., typing.Any] = SDL_FUNC["RTF_GetHeight", ctypes.c_int, [SDL_POINTER[RTF_Context], ctypes.c_int], SDL_RTF_BINARY] 52 | RTF_Render: abc.Callable[..., typing.Any] = SDL_FUNC["RTF_Render", None, [SDL_POINTER[RTF_Context], SDL_POINTER[SDL_Rect], ctypes.c_int], SDL_RTF_BINARY] 53 | RTF_FreeContext: abc.Callable[..., typing.Any] = SDL_FUNC["RTF_FreeContext", None, [SDL_POINTER[RTF_Context]], SDL_RTF_BINARY] 54 | 55 | RTF_SetError, RTF_GetError = SDL_SetError, SDL_GetError -------------------------------------------------------------------------------- /sdl3/SDL_scancode.py: -------------------------------------------------------------------------------- 1 | from .__init__ import typing, SDL_TYPE, SDL_ENUM 2 | 3 | SDL_Scancode: typing.TypeAlias = SDL_TYPE["SDL_Scancode", SDL_ENUM] 4 | 5 | SDL_SCANCODE_UNKNOWN: int = 0 6 | 7 | SDL_SCANCODE_A, SDL_SCANCODE_B, SDL_SCANCODE_C, SDL_SCANCODE_D, SDL_SCANCODE_E, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_I, SDL_SCANCODE_J, \ 8 | SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_M, SDL_SCANCODE_N, SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_Q, SDL_SCANCODE_R, SDL_SCANCODE_S, SDL_SCANCODE_T, \ 9 | SDL_SCANCODE_U, SDL_SCANCODE_V, SDL_SCANCODE_W, SDL_SCANCODE_X, SDL_SCANCODE_Y, SDL_SCANCODE_Z, \ 10 | \ 11 | SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, \ 12 | \ 13 | SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, SDL_SCANCODE_SPACE, \ 14 | \ 15 | SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_NONUSHASH, \ 16 | SDL_SCANCODE_SEMICOLON, SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_COMMA, SDL_SCANCODE_PERIOD, SDL_SCANCODE_SLASH, SDL_SCANCODE_CAPSLOCK, \ 17 | \ 18 | SDL_SCANCODE_F1, SDL_SCANCODE_F2, SDL_SCANCODE_F3, SDL_SCANCODE_F4, SDL_SCANCODE_F5, SDL_SCANCODE_F6, \ 19 | SDL_SCANCODE_F7, SDL_SCANCODE_F8, SDL_SCANCODE_F9, SDL_SCANCODE_F10, SDL_SCANCODE_F11, SDL_SCANCODE_F12, \ 20 | \ 21 | SDL_SCANCODE_PRINTSCREEN, SDL_SCANCODE_SCROLLLOCK, SDL_SCANCODE_PAUSE, SDL_SCANCODE_INSERT, SDL_SCANCODE_HOME, SDL_SCANCODE_PAGEUP, SDL_SCANCODE_DELETE, \ 22 | SDL_SCANCODE_END, SDL_SCANCODE_PAGEDOWN, SDL_SCANCODE_RIGHT, SDL_SCANCODE_LEFT, SDL_SCANCODE_DOWN, SDL_SCANCODE_UP, \ 23 | \ 24 | SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_KP_DIVIDE, SDL_SCANCODE_KP_MULTIPLY, SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_KP_ENTER, \ 25 | SDL_SCANCODE_KP_1, SDL_SCANCODE_KP_2, SDL_SCANCODE_KP_3, SDL_SCANCODE_KP_4, SDL_SCANCODE_KP_5, SDL_SCANCODE_KP_6, SDL_SCANCODE_KP_7, SDL_SCANCODE_KP_8, \ 26 | SDL_SCANCODE_KP_9, SDL_SCANCODE_KP_0, SDL_SCANCODE_KP_PERIOD, \ 27 | \ 28 | SDL_SCANCODE_NONUSBACKSLASH, SDL_SCANCODE_APPLICATION, SDL_SCANCODE_POWER, SDL_SCANCODE_KP_EQUALS, SDL_SCANCODE_F13, SDL_SCANCODE_F14, SDL_SCANCODE_F15, \ 29 | SDL_SCANCODE_F16, SDL_SCANCODE_F17, SDL_SCANCODE_F18, SDL_SCANCODE_F19, SDL_SCANCODE_F20, SDL_SCANCODE_F21, SDL_SCANCODE_F22, SDL_SCANCODE_F23, SDL_SCANCODE_F24, \ 30 | SDL_SCANCODE_EXECUTE, SDL_SCANCODE_HELP, SDL_SCANCODE_MENU, SDL_SCANCODE_SELECT, SDL_SCANCODE_STOP, SDL_SCANCODE_AGAIN, SDL_SCANCODE_UNDO, SDL_SCANCODE_CUT, \ 31 | SDL_SCANCODE_COPY, SDL_SCANCODE_PASTE, SDL_SCANCODE_FIND, SDL_SCANCODE_MUTE, SDL_SCANCODE_VOLUMEUP, SDL_SCANCODE_VOLUMEDOWN, *_, \ 32 | \ 33 | SDL_SCANCODE_KP_COMMA, SDL_SCANCODE_KP_EQUALSAS400, \ 34 | SDL_SCANCODE_INTERNATIONAL1, SDL_SCANCODE_INTERNATIONAL2, SDL_SCANCODE_INTERNATIONAL3, SDL_SCANCODE_INTERNATIONAL4, SDL_SCANCODE_INTERNATIONAL5, SDL_SCANCODE_INTERNATIONAL6, \ 35 | SDL_SCANCODE_INTERNATIONAL7, SDL_SCANCODE_INTERNATIONAL8, SDL_SCANCODE_INTERNATIONAL9, SDL_SCANCODE_LANG1, SDL_SCANCODE_LANG2, SDL_SCANCODE_LANG3, SDL_SCANCODE_LANG4, \ 36 | SDL_SCANCODE_LANG5, SDL_SCANCODE_LANG6, SDL_SCANCODE_LANG7, SDL_SCANCODE_LANG8, SDL_SCANCODE_LANG9, \ 37 | \ 38 | SDL_SCANCODE_ALTERASE, SDL_SCANCODE_SYSREQ, SDL_SCANCODE_CANCEL, SDL_SCANCODE_CLEAR, SDL_SCANCODE_PRIOR, SDL_SCANCODE_RETURN2, SDL_SCANCODE_SEPARATOR, \ 39 | SDL_SCANCODE_OUT, SDL_SCANCODE_OPER, SDL_SCANCODE_CLEARAGAIN, SDL_SCANCODE_CRSEL, SDL_SCANCODE_EXSEL = range(4, 165) 40 | 41 | SDL_SCANCODE_KP_00, SDL_SCANCODE_KP_000, SDL_SCANCODE_THOUSANDSSEPARATOR, SDL_SCANCODE_DECIMALSEPARATOR, SDL_SCANCODE_CURRENCYUNIT, SDL_SCANCODE_CURRENCYSUBUNIT, \ 42 | SDL_SCANCODE_KP_LEFTPAREN, SDL_SCANCODE_KP_RIGHTPAREN, SDL_SCANCODE_KP_LEFTBRACE, SDL_SCANCODE_KP_RIGHTBRACE, SDL_SCANCODE_KP_TAB, SDL_SCANCODE_KP_BACKSPACE, SDL_SCANCODE_KP_A, \ 43 | SDL_SCANCODE_KP_B, SDL_SCANCODE_KP_C, SDL_SCANCODE_KP_D, SDL_SCANCODE_KP_E, SDL_SCANCODE_KP_F, SDL_SCANCODE_KP_XOR, SDL_SCANCODE_KP_POWER, SDL_SCANCODE_KP_PERCENT, SDL_SCANCODE_KP_LESS, \ 44 | SDL_SCANCODE_KP_GREATER, SDL_SCANCODE_KP_AMPERSAND, SDL_SCANCODE_KP_DBLAMPERSAND, SDL_SCANCODE_KP_VERTICALBAR, SDL_SCANCODE_KP_DBLVERTICALBAR, SDL_SCANCODE_KP_COLON, SDL_SCANCODE_KP_HASH, \ 45 | SDL_SCANCODE_KP_SPACE, SDL_SCANCODE_KP_AT, SDL_SCANCODE_KP_EXCLAM, SDL_SCANCODE_KP_MEMSTORE, SDL_SCANCODE_KP_MEMRECALL, SDL_SCANCODE_KP_MEMCLEAR, SDL_SCANCODE_KP_MEMADD, SDL_SCANCODE_KP_MEMSUBTRACT, \ 46 | SDL_SCANCODE_KP_MEMMULTIPLY, SDL_SCANCODE_KP_MEMDIVIDE, SDL_SCANCODE_KP_PLUSMINUS, SDL_SCANCODE_KP_CLEAR, SDL_SCANCODE_KP_CLEARENTRY, SDL_SCANCODE_KP_BINARY, \ 47 | SDL_SCANCODE_KP_OCTAL, SDL_SCANCODE_KP_DECIMAL, SDL_SCANCODE_KP_HEXADECIMAL, *_, \ 48 | \ 49 | SDL_SCANCODE_LCTRL, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_LALT, SDL_SCANCODE_LGUI, SDL_SCANCODE_RCTRL, \ 50 | SDL_SCANCODE_RSHIFT, SDL_SCANCODE_RALT, SDL_SCANCODE_RGUI = range(176, 232) 51 | 52 | SDL_SCANCODE_MODE, SDL_SCANCODE_SLEEP, SDL_SCANCODE_WAKE, SDL_SCANCODE_CHANNEL_INCREMENT, SDL_SCANCODE_CHANNEL_DECREMENT, \ 53 | SDL_SCANCODE_MEDIA_PLAY, SDL_SCANCODE_MEDIA_PAUSE, SDL_SCANCODE_MEDIA_RECORD, SDL_SCANCODE_MEDIA_FAST_FORWARD, SDL_SCANCODE_MEDIA_REWIND, SDL_SCANCODE_MEDIA_NEXT_TRACK, \ 54 | SDL_SCANCODE_MEDIA_PREVIOUS_TRACK, SDL_SCANCODE_MEDIA_STOP, SDL_SCANCODE_MEDIA_EJECT, SDL_SCANCODE_MEDIA_PLAY_PAUSE, SDL_SCANCODE_MEDIA_SELECT, \ 55 | \ 56 | SDL_SCANCODE_AC_NEW, SDL_SCANCODE_AC_OPEN, SDL_SCANCODE_AC_CLOSE, SDL_SCANCODE_AC_EXIT, \ 57 | SDL_SCANCODE_AC_SAVE, SDL_SCANCODE_AC_PRINT, SDL_SCANCODE_AC_PROPERTIES, \ 58 | \ 59 | SDL_SCANCODE_AC_SEARCH, SDL_SCANCODE_AC_HOME, SDL_SCANCODE_AC_BACK, SDL_SCANCODE_AC_FORWARD, \ 60 | SDL_SCANCODE_AC_STOP, SDL_SCANCODE_AC_REFRESH, SDL_SCANCODE_AC_BOOKMARKS, \ 61 | \ 62 | SDL_SCANCODE_SOFTLEFT, SDL_SCANCODE_SOFTRIGHT, \ 63 | SDL_SCANCODE_CALL, SDL_SCANCODE_ENDCALL = range(257, 291) 64 | 65 | SDL_SCANCODE_RESERVED, SDL_SCANCODE_COUNT = 400, 512 -------------------------------------------------------------------------------- /sdl3/SDL_sensor.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_properties import SDL_PropertiesID 5 | 6 | class SDL_Sensor(ctypes.c_void_p): 7 | ... 8 | 9 | SDL_SensorID: typing.TypeAlias = SDL_TYPE["SDL_SensorID", ctypes.c_uint32] 10 | 11 | SDL_STANDARD_GRAVITY: float = 9.80665 12 | 13 | SDL_SensorType: typing.TypeAlias = SDL_TYPE["SDL_SensorType", SDL_ENUM] 14 | 15 | SDL_SENSOR_INVALID, SDL_SENSOR_UNKNOWN, SDL_SENSOR_ACCEL, SDL_SENSOR_GYRO, \ 16 | SDL_SENSOR_ACCEL_L, SDL_SENSOR_GYRO_L, SDL_SENSOR_ACCEL_R, SDL_SENSOR_GYRO_R = range(-1, 7) 17 | 18 | SDL_GetSensors: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensors", SDL_POINTER[SDL_SensorID], [SDL_POINTER[ctypes.c_int]], SDL_BINARY] 19 | SDL_GetSensorNameForID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensorNameForID", ctypes.c_char_p, [SDL_SensorID], SDL_BINARY] 20 | SDL_GetSensorTypeForID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensorTypeForID", SDL_SensorType, [SDL_SensorID], SDL_BINARY] 21 | SDL_GetSensorNonPortableTypeForID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensorNonPortableTypeForID", ctypes.c_int, [SDL_SensorID], SDL_BINARY] 22 | SDL_OpenSensor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenSensor", SDL_POINTER[SDL_Sensor], [SDL_SensorID], SDL_BINARY] 23 | SDL_GetSensorFromID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensorFromID", SDL_POINTER[SDL_Sensor], [SDL_SensorID], SDL_BINARY] 24 | SDL_GetSensorProperties: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensorProperties", SDL_PropertiesID, [SDL_POINTER[SDL_Sensor]], SDL_BINARY] 25 | SDL_GetSensorName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensorName", ctypes.c_char_p, [SDL_POINTER[SDL_Sensor]], SDL_BINARY] 26 | SDL_GetSensorType: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensorType", SDL_SensorType, [SDL_POINTER[SDL_Sensor]], SDL_BINARY] 27 | SDL_GetSensorNonPortableType: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensorNonPortableType", ctypes.c_int, [SDL_POINTER[SDL_Sensor]], SDL_BINARY] 28 | SDL_GetSensorID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensorID", SDL_SensorID, [SDL_POINTER[SDL_Sensor]], SDL_BINARY] 29 | SDL_GetSensorData: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSensorData", ctypes.c_bool, [SDL_POINTER[SDL_Sensor], SDL_POINTER[ctypes.c_float], ctypes.c_int], SDL_BINARY] 30 | SDL_CloseSensor: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CloseSensor", None, [SDL_POINTER[SDL_Sensor]], SDL_BINARY] 31 | SDL_UpdateSensors: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UpdateSensors", None, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_shadercross.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_POINTER, \ 2 | SDL_FUNC, SDL_TYPE, SDL_ENUM, SDL_SHADERCROSS_BINARY 3 | 4 | from .SDL_properties import SDL_PropertiesID 5 | from .SDL_gpu import SDL_GPUDevice, SDL_GPUShaderFormat, SDL_GPUShader, SDL_GPUComputePipeline 6 | 7 | SDL_SHADERCROSS_MAJOR_VERSION, SDL_SHADERCROSS_MINOR_VERSION, SDL_SHADERCROSS_MICRO_VERSION = 3, 0, 0 8 | 9 | SDL_ShaderCross_ShaderStage: typing.TypeAlias = SDL_TYPE["SDL_ShaderCross_ShaderStage", SDL_ENUM] 10 | 11 | SDL_SHADERCROSS_SHADERSTAGE_VERTEX, SDL_SHADERCROSS_SHADERSTAGE_FRAGMENT, SDL_SHADERCROSS_SHADERSTAGE_COMPUTE = range(3) 12 | 13 | class SDL_ShaderCross_GraphicsShaderMetadata(ctypes.Structure): 14 | _fields_ = [ 15 | ("num_samplers", ctypes.c_uint32), 16 | ("num_storage_textures", ctypes.c_uint32), 17 | ("num_storage_buffers", ctypes.c_uint32), 18 | ("num_uniform_buffers", ctypes.c_uint32), 19 | ("props", SDL_PropertiesID) 20 | ] 21 | 22 | class SDL_ShaderCross_ComputePipelineMetadata(ctypes.Structure): 23 | _fields_ = [ 24 | ("num_samplers", ctypes.c_uint32), 25 | ("num_readonly_storage_textures", ctypes.c_uint32), 26 | ("num_readonly_storage_buffers", ctypes.c_uint32), 27 | ("num_readwrite_storage_textures", ctypes.c_uint32), 28 | ("num_readwrite_storage_buffers", ctypes.c_uint32), 29 | ("num_uniform_buffers", ctypes.c_uint32), 30 | ("threadcount_x", ctypes.c_uint32), 31 | ("threadcount_y", ctypes.c_uint32), 32 | ("threadcount_z", ctypes.c_uint32), 33 | ("props", SDL_PropertiesID) 34 | ] 35 | 36 | class SDL_ShaderCross_SPIRV_Info(ctypes.Structure): 37 | _fields_ = [ 38 | ("bytecode", SDL_POINTER[ctypes.c_uint8]), 39 | ("bytecode_size", ctypes.c_size_t), 40 | ("entrypoint", ctypes.c_char_p), 41 | ("shader_stage", SDL_ShaderCross_ShaderStage), 42 | ("enable_debug", ctypes.c_bool), 43 | ("name", ctypes.c_char_p), 44 | ("props", SDL_PropertiesID) 45 | ] 46 | 47 | SDL_SHADERCROSS_PROP_SPIRV_PSSL_COMPATIBILITY: bytes = "SDL.shadercross.spirv.pssl.compatibility".encode() 48 | SDL_SHADERCROSS_PROP_SPIRV_MSL_VERSION: bytes = "SDL.shadercross.spirv.msl.version".encode() 49 | 50 | class SDL_ShaderCross_HLSL_Define(ctypes.Structure): 51 | _fields_ = [ 52 | ("name", ctypes.c_char_p), 53 | ("value", ctypes.c_char_p) 54 | ] 55 | 56 | class SDL_ShaderCross_HLSL_Info(ctypes.Structure): 57 | _fields_ = [ 58 | ("source", ctypes.c_char_p), 59 | ("entrypoint", ctypes.c_char_p), 60 | ("include_dir", ctypes.c_char_p), 61 | ("defines", SDL_POINTER[SDL_ShaderCross_HLSL_Define]), 62 | ("shader_stage", SDL_ShaderCross_ShaderStage), 63 | ("enable_debug", ctypes.c_bool), 64 | ("name", ctypes.c_char_p), 65 | ("props", SDL_PropertiesID) 66 | ] 67 | 68 | SDL_ShaderCross_Init: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_Init", ctypes.c_bool, [], SDL_SHADERCROSS_BINARY] 69 | SDL_ShaderCross_Quit: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_Quit", None, [], SDL_SHADERCROSS_BINARY] 70 | 71 | SDL_ShaderCross_GetSPIRVShaderFormats: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_GetSPIRVShaderFormats", SDL_GPUShaderFormat, [], SDL_SHADERCROSS_BINARY] 72 | 73 | SDL_ShaderCross_TranspileMSLFromSPIRV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_TranspileMSLFromSPIRV", ctypes.c_void_p, [SDL_POINTER[SDL_ShaderCross_SPIRV_Info]], SDL_SHADERCROSS_BINARY] 74 | SDL_ShaderCross_TranspileHLSLFromSPIRV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_TranspileHLSLFromSPIRV", ctypes.c_void_p, [SDL_POINTER[SDL_ShaderCross_SPIRV_Info]], SDL_SHADERCROSS_BINARY] 75 | SDL_ShaderCross_CompileDXBCFromSPIRV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_CompileDXBCFromSPIRV", ctypes.c_void_p, [SDL_POINTER[SDL_ShaderCross_SPIRV_Info], SDL_POINTER[ctypes.c_size_t]], SDL_SHADERCROSS_BINARY] 76 | SDL_ShaderCross_CompileDXILFromSPIRV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_CompileDXILFromSPIRV", ctypes.c_void_p, [SDL_POINTER[SDL_ShaderCross_SPIRV_Info], SDL_POINTER[ctypes.c_size_t]], SDL_SHADERCROSS_BINARY] 77 | 78 | SDL_ShaderCross_CompileGraphicsShaderFromSPIRV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_CompileGraphicsShaderFromSPIRV", SDL_POINTER[SDL_GPUShader], [SDL_POINTER[SDL_GPUDevice], SDL_POINTER[SDL_ShaderCross_SPIRV_Info], SDL_POINTER[SDL_ShaderCross_GraphicsShaderMetadata]], SDL_SHADERCROSS_BINARY] 79 | SDL_ShaderCross_CompileComputePipelineFromSPIRV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_CompileComputePipelineFromSPIRV", SDL_POINTER[SDL_GPUComputePipeline], [SDL_POINTER[SDL_GPUDevice], SDL_POINTER[SDL_ShaderCross_SPIRV_Info], SDL_POINTER[SDL_ShaderCross_ComputePipelineMetadata]], SDL_SHADERCROSS_BINARY] 80 | 81 | SDL_ShaderCross_ReflectGraphicsSPIRV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_ReflectGraphicsSPIRV", ctypes.c_bool, [SDL_POINTER[ctypes.c_uint8], ctypes.c_size_t, SDL_POINTER[SDL_ShaderCross_GraphicsShaderMetadata]], SDL_SHADERCROSS_BINARY] 82 | SDL_ShaderCross_ReflectComputeSPIRV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_ReflectComputeSPIRV", ctypes.c_bool, [SDL_POINTER[ctypes.c_uint8], ctypes.c_size_t, SDL_POINTER[SDL_ShaderCross_ComputePipelineMetadata]], SDL_SHADERCROSS_BINARY] 83 | 84 | SDL_ShaderCross_GetHLSLShaderFormats: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_GetHLSLShaderFormats", SDL_GPUShaderFormat, [], SDL_SHADERCROSS_BINARY] 85 | 86 | SDL_ShaderCross_CompileDXBCFromHLSL: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_CompileDXBCFromHLSL", ctypes.c_void_p, [SDL_POINTER[SDL_ShaderCross_HLSL_Info], SDL_POINTER[ctypes.c_size_t]], SDL_SHADERCROSS_BINARY] 87 | SDL_ShaderCross_CompileDXILFromHLSL: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_CompileDXILFromHLSL", ctypes.c_void_p, [SDL_POINTER[SDL_ShaderCross_HLSL_Info], SDL_POINTER[ctypes.c_size_t]], SDL_SHADERCROSS_BINARY] 88 | SDL_ShaderCross_CompileSPIRVFromHLSL: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_CompileSPIRVFromHLSL", ctypes.c_void_p, [SDL_POINTER[SDL_ShaderCross_HLSL_Info], SDL_POINTER[ctypes.c_size_t]], SDL_SHADERCROSS_BINARY] 89 | 90 | SDL_ShaderCross_CompileGraphicsShaderFromHLSL: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_CompileGraphicsShaderFromHLSL", SDL_POINTER[SDL_GPUShader], [SDL_POINTER[SDL_GPUDevice], SDL_POINTER[SDL_ShaderCross_HLSL_Info], SDL_POINTER[SDL_ShaderCross_GraphicsShaderMetadata]], SDL_SHADERCROSS_BINARY] 91 | SDL_ShaderCross_CompileComputePipelineFromHLSL: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ShaderCross_CompileComputePipelineFromHLSL", SDL_POINTER[SDL_GPUComputePipeline], [SDL_POINTER[SDL_GPUDevice], SDL_POINTER[SDL_ShaderCross_HLSL_Info], SDL_POINTER[SDL_ShaderCross_ComputePipelineMetadata]], SDL_SHADERCROSS_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_storage.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC_TYPE, SDL_FUNC, SDL_BINARY 3 | 4 | from .SDL_properties import SDL_PropertiesID 5 | from .SDL_filesystem import SDL_GlobFlags, \ 6 | SDL_EnumerateDirectoryCallback, SDL_PathInfo 7 | 8 | class SDL_StorageInterface(ctypes.Structure): 9 | _fields_ = [ 10 | ("version", ctypes.c_uint32), 11 | ("close", SDL_FUNC_TYPE["SDL_StorageInterface.close", ctypes.c_bool, [ctypes.c_void_p]]), 12 | ("ready", SDL_FUNC_TYPE["SDL_StorageInterface.ready", ctypes.c_bool, [ctypes.c_void_p]]), 13 | ("enumerate", SDL_FUNC_TYPE["SDL_StorageInterface.enumerate", ctypes.c_bool, [ctypes.c_void_p, ctypes.c_char_p, SDL_EnumerateDirectoryCallback, ctypes.c_void_p]]), 14 | ("info", SDL_FUNC_TYPE["SDL_StorageInterface.info", ctypes.c_bool, [ctypes.c_void_p, ctypes.c_char_p, SDL_POINTER[SDL_PathInfo]]]), 15 | ("read_file", SDL_FUNC_TYPE["SDL_StorageInterface.read_file", ctypes.c_bool, [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_uint64]]), 16 | ("write_file", SDL_FUNC_TYPE["SDL_StorageInterface.write_file", ctypes.c_bool, [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_uint64]]), 17 | ("mkdir", SDL_FUNC_TYPE["SDL_StorageInterface.mkdir", ctypes.c_bool, [ctypes.c_void_p, ctypes.c_char_p]]), 18 | ("remove", SDL_FUNC_TYPE["SDL_StorageInterface.remove", ctypes.c_bool, [ctypes.c_void_p, ctypes.c_char_p]]), 19 | ("rename", SDL_FUNC_TYPE["SDL_StorageInterface.rename", ctypes.c_bool, [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p]]), 20 | ("copy", SDL_FUNC_TYPE["SDL_StorageInterface.copy", ctypes.c_bool, [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p]]), 21 | ("space_remaining", SDL_FUNC_TYPE["SDL_StorageInterface.space_remaining", ctypes.c_uint64, [ctypes.c_void_p]]) 22 | ] 23 | 24 | class SDL_Storage(ctypes.c_void_p): 25 | ... 26 | 27 | SDL_OpenTitleStorage: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenTitleStorage", SDL_POINTER[SDL_Storage], [ctypes.c_char_p, SDL_PropertiesID], SDL_BINARY] 28 | SDL_OpenUserStorage: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenUserStorage", SDL_POINTER[SDL_Storage], [ctypes.c_char_p, ctypes.c_char_p, SDL_PropertiesID], SDL_BINARY] 29 | SDL_OpenFileStorage: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenFileStorage", SDL_POINTER[SDL_Storage], [ctypes.c_char_p], SDL_BINARY] 30 | SDL_OpenStorage: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OpenStorage", SDL_POINTER[SDL_Storage], [SDL_POINTER[SDL_StorageInterface], ctypes.c_void_p], SDL_BINARY] 31 | SDL_CloseStorage: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CloseStorage", ctypes.c_bool, [SDL_POINTER[SDL_Storage]], SDL_BINARY] 32 | SDL_StorageReady: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_StorageReady", ctypes.c_bool, [SDL_POINTER[SDL_Storage]], SDL_BINARY] 33 | SDL_GetStorageFileSize: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetStorageFileSize", ctypes.c_bool, [SDL_POINTER[SDL_Storage], ctypes.c_char_p, SDL_POINTER[ctypes.c_uint64]], SDL_BINARY] 34 | SDL_ReadStorageFile: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ReadStorageFile", ctypes.c_bool, [SDL_POINTER[SDL_Storage], ctypes.c_char_p, ctypes.c_void_p, ctypes.c_uint64], SDL_BINARY] 35 | SDL_WriteStorageFile: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WriteStorageFile", ctypes.c_bool, [SDL_POINTER[SDL_Storage], ctypes.c_char_p, ctypes.c_void_p, ctypes.c_uint64], SDL_BINARY] 36 | SDL_CreateStorageDirectory: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateStorageDirectory", ctypes.c_bool, [SDL_POINTER[SDL_Storage], ctypes.c_char_p], SDL_BINARY] 37 | SDL_EnumerateStorageDirectory: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_EnumerateStorageDirectory", ctypes.c_bool, [SDL_POINTER[SDL_Storage], ctypes.c_char_p, SDL_EnumerateDirectoryCallback, ctypes.c_void_p], SDL_BINARY] 38 | SDL_RemoveStoragePath: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_RemoveStoragePath", ctypes.c_bool, [SDL_POINTER[SDL_Storage], ctypes.c_char_p], SDL_BINARY] 39 | SDL_RenameStoragePath: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_RenameStoragePath", ctypes.c_bool, [SDL_POINTER[SDL_Storage], ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 40 | SDL_CopyStorageFile: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CopyStorageFile", ctypes.c_bool, [SDL_POINTER[SDL_Storage], ctypes.c_char_p, ctypes.c_char_p], SDL_BINARY] 41 | SDL_GetStoragePathInfo: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetStoragePathInfo", ctypes.c_bool, [SDL_POINTER[SDL_Storage], ctypes.c_char_p, SDL_POINTER[SDL_PathInfo]], SDL_BINARY] 42 | SDL_GetStorageSpaceRemaining: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetStorageSpaceRemaining", ctypes.c_uint64, [SDL_POINTER[SDL_Storage]], SDL_BINARY] 43 | SDL_GlobStorageDirectory: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GlobStorageDirectory", SDL_POINTER[ctypes.c_char_p], [SDL_POINTER[SDL_Storage], ctypes.c_char_p, ctypes.c_char_p, SDL_GlobFlags, SDL_POINTER[ctypes.c_int]], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_system.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_PLATFORM_SPECIFIC, \ 2 | SDL_POINTER, SDL_FUNC, SDL_FUNC_TYPE, SDL_TYPE, SDL_BINARY, SDL_ENUM 3 | 4 | from .SDL_video import SDL_DisplayID 5 | 6 | if SDL_PLATFORM_SPECIFIC(system = ["Windows"]): 7 | import ctypes.wintypes as wintypes 8 | 9 | MSG: typing.TypeAlias = wintypes.tagMSG 10 | SDL_WindowsMessageHook: typing.TypeAlias = SDL_FUNC_TYPE["SDL_WindowsMessageHook", ctypes.c_bool, [ctypes.c_void_p, SDL_POINTER[MSG]]] 11 | SDL_SetWindowsMessageHook: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetWindowsMessageHook", None, [SDL_WindowsMessageHook, ctypes.c_void_p], SDL_BINARY] 12 | 13 | SDL_GetDirect3D9AdapterIndex: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetDirect3D9AdapterIndex", ctypes.c_int, [SDL_DisplayID], SDL_BINARY] 14 | SDL_GetDXGIOutputInfo: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetDXGIOutputInfo", ctypes.c_bool, [SDL_DisplayID, SDL_POINTER[ctypes.c_int], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 15 | 16 | class XEvent(ctypes.Union): 17 | ... 18 | 19 | SDL_X11EventHook: typing.TypeAlias = SDL_FUNC_TYPE["SDL_X11EventHook", ctypes.c_bool, [ctypes.c_void_p, SDL_POINTER[XEvent]]] 20 | SDL_SetX11EventHook: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetX11EventHook", None, [SDL_X11EventHook, ctypes.c_void_p], SDL_BINARY] 21 | 22 | if SDL_PLATFORM_SPECIFIC(system = ["Linux"]): 23 | SDL_SetLinuxThreadPriority: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetLinuxThreadPriority", ctypes.c_bool, [ctypes.c_int64, ctypes.c_int], SDL_BINARY] 24 | SDL_SetLinuxThreadPriorityAndPolicy: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetLinuxThreadPriorityAndPolicy", ctypes.c_bool, [ctypes.c_int64, ctypes.c_int, ctypes.c_int], SDL_BINARY] 25 | 26 | SDL_IsTablet: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IsTablet", ctypes.c_bool, [], SDL_BINARY] 27 | SDL_IsTV: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_IsTV", ctypes.c_bool, [], SDL_BINARY] 28 | 29 | SDL_Sandbox: typing.TypeAlias = SDL_TYPE["SDL_Sandbox", SDL_ENUM] 30 | 31 | SDL_SANDBOX_NONE, SDL_SANDBOX_UNKNOWN_CONTAINER, SDL_SANDBOX_FLATPAK, \ 32 | SDL_SANDBOX_SNAP, SDL_SANDBOX_MACOS = range(5) 33 | 34 | SDL_GetSandbox: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetSandbox", SDL_Sandbox, [], SDL_BINARY] 35 | 36 | SDL_OnApplicationWillTerminate: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OnApplicationWillTerminate", None, [], SDL_BINARY] 37 | SDL_OnApplicationDidReceiveMemoryWarning: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OnApplicationDidReceiveMemoryWarning", None, [], SDL_BINARY] 38 | SDL_OnApplicationWillEnterBackground: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OnApplicationWillEnterBackground", None, [], SDL_BINARY] 39 | SDL_OnApplicationDidEnterBackground: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OnApplicationDidEnterBackground", None, [], SDL_BINARY] 40 | SDL_OnApplicationWillEnterForeground: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OnApplicationWillEnterForeground", None, [], SDL_BINARY] 41 | SDL_OnApplicationDidEnterForeground: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_OnApplicationDidEnterForeground", None, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_textengine.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, \ 2 | SDL_POINTER, SDL_TYPE, SDL_ENUM, SDL_FUNC_TYPE 3 | 4 | from .SDL_rect import SDL_Rect 5 | from .SDL_properties import SDL_PropertiesID 6 | from .SDL_ttf import TTF_Font, TTF_Text, TTF_SubString 7 | from .SDL_pixels import SDL_FColor 8 | 9 | TTF_DrawCommand: typing.TypeAlias = SDL_TYPE["TTF_DrawCommand", SDL_ENUM] 10 | 11 | TTF_DRAW_COMMAND_NOOP, TTF_DRAW_COMMAND_FILL, TTF_DRAW_COMMAND_COPY = range(3) 12 | 13 | class TTF_FillOperation(ctypes.Structure): 14 | _fields_ = [ 15 | ("cmd", TTF_DrawCommand), 16 | ("rect", SDL_Rect) 17 | ] 18 | 19 | class TTF_CopyOperation(ctypes.Structure): 20 | _fields_ = [ 21 | ("cmd", TTF_DrawCommand), 22 | ("text_offset", ctypes.c_int), 23 | ("glyph_font", SDL_POINTER[TTF_Font]), 24 | ("glyph_index", ctypes.c_uint32), 25 | ("src", SDL_Rect), 26 | ("dst", SDL_Rect), 27 | ("reserved", ctypes.c_void_p) 28 | ] 29 | 30 | class TTF_DrawOperation(ctypes.Union): 31 | _fields_ = [ 32 | ("cmd", TTF_DrawCommand), 33 | ("fill", TTF_FillOperation), 34 | ("copy", TTF_CopyOperation) 35 | ] 36 | 37 | class TTF_TextLayout(ctypes.c_void_p): 38 | ... 39 | 40 | class TTF_TextEngine(ctypes.Structure): 41 | _fields_ = [ 42 | ("version", ctypes.c_uint32), 43 | ("userdata", ctypes.c_void_p), 44 | ("CreateText", SDL_FUNC_TYPE["TTF_TextEngine.CreateText", ctypes.c_bool, [ctypes.c_void_p, SDL_POINTER[TTF_Text]]]), 45 | ("DestroyText", SDL_FUNC_TYPE["TTF_TextEngine.DestroyText", None, [ctypes.c_void_p, SDL_POINTER[TTF_Text]]]) 46 | ] 47 | 48 | class TTF_TextData(ctypes.Structure): 49 | _fields_ = [ 50 | ("font", SDL_POINTER[TTF_Font]), 51 | ("color", SDL_FColor), 52 | ("needs_layout_update", ctypes.c_bool), 53 | ("layout", SDL_POINTER[TTF_TextLayout]), 54 | ("x", ctypes.c_int), 55 | ("y", ctypes.c_int), 56 | ("w", ctypes.c_int), 57 | ("h", ctypes.c_int), 58 | ("num_ops", ctypes.c_int), 59 | ("ops", SDL_POINTER[TTF_DrawOperation]), 60 | ("num_clusters", ctypes.c_int), 61 | ("clusters", SDL_POINTER[TTF_SubString]), 62 | ("props", SDL_PropertiesID), 63 | ("needs_engine_update", ctypes.c_bool), 64 | ("engine", TTF_TextEngine), 65 | ("engine_text", ctypes.c_void_p) 66 | ] -------------------------------------------------------------------------------- /sdl3/SDL_thread.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_POINTER, \ 2 | SDL_FUNC_TYPE, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_atomic import SDL_AtomicInt 5 | from .SDL_stdinc import SDL_FunctionPointer 6 | from .SDL_properties import SDL_PropertiesID 7 | 8 | class SDL_Thread(ctypes.c_void_p): 9 | ... 10 | 11 | SDL_ThreadID: typing.TypeAlias = SDL_TYPE["SDL_ThreadID", ctypes.c_uint64] 12 | SDL_TLSID: typing.TypeAlias = SDL_TYPE["SDL_TLSID", SDL_AtomicInt] 13 | 14 | SDL_ThreadPriority: typing.TypeAlias = SDL_TYPE["SDL_ThreadPriority", SDL_ENUM] 15 | 16 | SDL_THREAD_PRIORITY_LOW, SDL_THREAD_PRIORITY_NORMAL, SDL_THREAD_PRIORITY_HIGH, SDL_THREAD_PRIORITY_TIME_CRITICAL = range(4) 17 | 18 | SDL_ThreadState: typing.TypeAlias = SDL_TYPE["SDL_ThreadState", SDL_ENUM] 19 | 20 | SDL_THREAD_UNKNOWN, SDL_THREAD_ALIVE, SDL_THREAD_DETACHED, SDL_THREAD_COMPLETE = range(4) 21 | 22 | SDL_ThreadFunction: typing.TypeAlias = SDL_FUNC_TYPE["SDL_ThreadFunction", ctypes.c_int, [ctypes.c_void_p]] 23 | 24 | SDL_BeginThreadFunction, SDL_EndThreadFunction = SDL_FunctionPointer(0), SDL_FunctionPointer(0) 25 | 26 | SDL_CreateThreadRuntime: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateThreadRuntime", SDL_POINTER[SDL_Thread], [SDL_ThreadFunction, ctypes.c_char_p, ctypes.c_void_p, SDL_FunctionPointer, SDL_FunctionPointer], SDL_BINARY] 27 | SDL_CreateThreadWithPropertiesRuntime: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateThreadWithPropertiesRuntime", SDL_POINTER[SDL_Thread], [SDL_PropertiesID, SDL_FunctionPointer, SDL_FunctionPointer], SDL_BINARY] 28 | 29 | SDL_CreateThread: abc.Callable[[SDL_ThreadFunction, ctypes.c_char_p, ctypes.c_void_p], SDL_POINTER[SDL_Thread]] = \ 30 | lambda fn, name, data: SDL_CreateThreadRuntime(fn, name, data, SDL_BeginThreadFunction, SDL_EndThreadFunction) 31 | 32 | SDL_CreateThreadWithProperties: abc.Callable[[SDL_PropertiesID], SDL_POINTER[SDL_Thread]] = \ 33 | lambda props: SDL_CreateThreadWithPropertiesRuntime(props, SDL_BeginThreadFunction, SDL_EndThreadFunction) 34 | 35 | SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER: bytes = "SDL.thread.create.entry_function".encode() 36 | SDL_PROP_THREAD_CREATE_NAME_STRING: bytes = "SDL.thread.create.name".encode() 37 | SDL_PROP_THREAD_CREATE_USERDATA_POINTER: bytes = "SDL.thread.create.userdata".encode() 38 | SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER: bytes = "SDL.thread.create.stacksize".encode() 39 | 40 | SDL_GetThreadName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetThreadName", ctypes.c_char_p, [SDL_POINTER[SDL_Thread]], SDL_BINARY] 41 | SDL_GetCurrentThreadID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCurrentThreadID", SDL_ThreadID, [], SDL_BINARY] 42 | SDL_GetThreadID: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetThreadID", SDL_ThreadID, [SDL_POINTER[SDL_Thread]], SDL_BINARY] 43 | SDL_SetCurrentThreadPriority: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetCurrentThreadPriority", ctypes.c_bool, [SDL_ThreadPriority], SDL_BINARY] 44 | SDL_WaitThread: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_WaitThread", None, [SDL_POINTER[SDL_Thread], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 45 | SDL_GetThreadState: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetThreadState", SDL_ThreadState, [SDL_POINTER[SDL_Thread]], SDL_BINARY] 46 | SDL_DetachThread: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DetachThread", None, [SDL_POINTER[SDL_Thread]], SDL_BINARY] 47 | SDL_GetTLS: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTLS", ctypes.c_void_p, [SDL_POINTER[SDL_TLSID]], SDL_BINARY] 48 | 49 | SDL_TLSDestructorCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_TLSDestructorCallback", None, [ctypes.c_void_p]] 50 | 51 | SDL_SetTLS: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetTLS", ctypes.c_bool, [SDL_POINTER[SDL_TLSID], ctypes.c_void_p, SDL_TLSDestructorCallback], SDL_BINARY] 52 | SDL_CleanupTLS: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CleanupTLS", None, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_time.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_stdinc import SDL_Time 5 | 6 | class SDL_DateTime(ctypes.Structure): 7 | _fields_ = [ 8 | ("year", ctypes.c_int), 9 | ("month", ctypes.c_int), 10 | ("day", ctypes.c_int), 11 | ("hour", ctypes.c_int), 12 | ("minute", ctypes.c_int), 13 | ("second", ctypes.c_int), 14 | ("nanosecond", ctypes.c_int), 15 | ("day_of_week", ctypes.c_int), 16 | ("utc_offset", ctypes.c_int) 17 | ] 18 | 19 | SDL_DateFormat: typing.TypeAlias = SDL_TYPE["SDL_DateFormat", SDL_ENUM] 20 | 21 | SDL_DATE_FORMAT_YYYYMMDD, SDL_DATE_FORMAT_DDMMYYYY, SDL_DATE_FORMAT_MMDDYYYY = range(3) 22 | 23 | SDL_TimeFormat: typing.TypeAlias = SDL_TYPE["SDL_TimeFormat", SDL_ENUM] 24 | 25 | SDL_TIME_FORMAT_24HR, SDL_TIME_FORMAT_12HR = range(2) 26 | 27 | SDL_GetDateTimeLocalePreferences: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetDateTimeLocalePreferences", ctypes.c_bool, [SDL_POINTER[SDL_DateFormat], SDL_POINTER[SDL_TimeFormat]], SDL_BINARY] 28 | SDL_GetCurrentTime: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetCurrentTime", ctypes.c_bool, [SDL_POINTER[SDL_Time]], SDL_BINARY] 29 | SDL_TimeToDateTime: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_TimeToDateTime", ctypes.c_bool, [SDL_Time, SDL_POINTER[SDL_DateTime], ctypes.c_bool], SDL_BINARY] 30 | SDL_DateTimeToTime: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DateTimeToTime", ctypes.c_bool, [SDL_POINTER[SDL_DateTime], SDL_POINTER[SDL_Time]], SDL_BINARY] 31 | SDL_TimeToWindows: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_TimeToWindows", None, [SDL_Time, SDL_POINTER[ctypes.c_uint32], SDL_POINTER[ctypes.c_uint32]], SDL_BINARY] 32 | SDL_TimeFromWindows: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_TimeFromWindows", SDL_Time, [ctypes.c_uint32, ctypes.c_uint32], SDL_BINARY] 33 | SDL_GetDaysInMonth: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetDaysInMonth", ctypes.c_int, [ctypes.c_int, ctypes.c_int], SDL_BINARY] 34 | SDL_GetDayOfYear: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetDayOfYear", ctypes.c_int, [ctypes.c_int, ctypes.c_int, ctypes.c_int], SDL_BINARY] 35 | SDL_GetDayOfWeek: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetDayOfWeek", ctypes.c_int, [ctypes.c_int, ctypes.c_int, ctypes.c_int], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_timer.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_FUNC_TYPE, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | SDL_MS_PER_SECOND: int = 1000 5 | SDL_US_PER_SECOND: int = 1000000 6 | SDL_NS_PER_SECOND: int = 1000000000 7 | SDL_NS_PER_MS: int = 1000000 8 | SDL_NS_PER_US: int = 1000 9 | 10 | SDL_SECONDS_TO_NS: abc.Callable[[int | float], int | float] = lambda s: s * SDL_NS_PER_SECOND 11 | SDL_NS_TO_SECONDS: abc.Callable[[int | float], float] = lambda ns: ns / SDL_NS_PER_SECOND 12 | SDL_MS_TO_NS: abc.Callable[[int | float], int | float] = lambda ms: ms * SDL_NS_PER_MS 13 | SDL_NS_TO_MS: abc.Callable[[int | float], float] = lambda ns: ns / SDL_NS_PER_MS 14 | SDL_US_TO_NS: abc.Callable[[int | float], int | float] = lambda us: us * SDL_NS_PER_US 15 | SDL_NS_TO_US: abc.Callable[[int | float], float] = lambda ns: ns / SDL_NS_PER_US 16 | 17 | SDL_GetTicks: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTicks", ctypes.c_uint64, [], SDL_BINARY] 18 | SDL_GetTicksNS: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTicksNS", ctypes.c_uint64, [], SDL_BINARY] 19 | SDL_GetPerformanceCounter: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetPerformanceCounter", ctypes.c_uint64, [], SDL_BINARY] 20 | SDL_GetPerformanceFrequency: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetPerformanceFrequency", ctypes.c_uint64, [], SDL_BINARY] 21 | SDL_Delay: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Delay", None, [ctypes.c_uint32], SDL_BINARY] 22 | SDL_DelayNS: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DelayNS", None, [ctypes.c_uint64], SDL_BINARY] 23 | SDL_DelayPrecise: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DelayPrecise", None, [ctypes.c_uint64], SDL_BINARY] 24 | 25 | SDL_TimerID: typing.TypeAlias = SDL_TYPE["SDL_TimerID", ctypes.c_uint32] 26 | SDL_TimerCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_TimerCallback", ctypes.c_uint32, [ctypes.c_void_p, SDL_TimerID, ctypes.c_uint32]] 27 | 28 | SDL_AddTimer: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_AddTimer", SDL_TimerID, [ctypes.c_uint32, SDL_TimerCallback, ctypes.c_void_p], SDL_BINARY] 29 | 30 | SDL_NSTimerCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_NSTimerCallback", ctypes.c_uint64, [ctypes.c_void_p, SDL_TimerID, ctypes.c_uint64]] 31 | 32 | SDL_AddTimerNS: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_AddTimerNS", SDL_TimerID, [ctypes.c_uint64, SDL_NSTimerCallback, ctypes.c_void_p], SDL_BINARY] 33 | SDL_RemoveTimer: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_RemoveTimer", ctypes.c_bool, [SDL_TimerID], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_touch.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_ENUM, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_mouse import SDL_MouseID 5 | 6 | SDL_TouchID: typing.TypeAlias = SDL_TYPE["SDL_TouchID", ctypes.c_uint64] 7 | SDL_FingerID: typing.TypeAlias = SDL_TYPE["SDL_FingerID", ctypes.c_uint64] 8 | 9 | SDL_TouchDeviceType: typing.TypeAlias = SDL_TYPE["SDL_TouchDeviceType", SDL_ENUM] 10 | 11 | SDL_TOUCH_DEVICE_INVALID, SDL_TOUCH_DEVICE_DIRECT, SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, \ 12 | SDL_TOUCH_DEVICE_INDIRECT_RELATIVE = range(-1, 3) 13 | 14 | class SDL_Finger(ctypes.Structure): 15 | _fields_ = [ 16 | ("id", SDL_FingerID), 17 | ("x", ctypes.c_float), 18 | ("y", ctypes.c_float), 19 | ("pressure", ctypes.c_float) 20 | ] 21 | 22 | SDL_TOUCH_MOUSEID, SDL_MOUSE_TOUCHID = \ 23 | SDL_MouseID(-1), SDL_TouchID(-1) 24 | 25 | SDL_GetTouchDevices: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTouchDevices", SDL_POINTER[SDL_TouchID], [SDL_POINTER[ctypes.c_int]], SDL_BINARY] 26 | SDL_GetTouchDeviceName: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTouchDeviceName", ctypes.c_char_p, [SDL_TouchID], SDL_BINARY] 27 | SDL_GetTouchDeviceType: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTouchDeviceType", SDL_TouchDeviceType, [SDL_TouchID], SDL_BINARY] 28 | SDL_GetTouchFingers: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTouchFingers", SDL_POINTER[SDL_POINTER[SDL_Finger]], [SDL_TouchID, SDL_POINTER[ctypes.c_int]], SDL_BINARY] 29 | -------------------------------------------------------------------------------- /sdl3/SDL_tray.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC_TYPE, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_surface import SDL_Surface 5 | 6 | class SDL_Tray(ctypes.c_void_p): 7 | ... 8 | 9 | class SDL_TrayMenu(ctypes.c_void_p): 10 | ... 11 | 12 | class SDL_TrayEntry(ctypes.c_void_p): 13 | ... 14 | 15 | SDL_TrayEntryFlags: typing.TypeAlias = SDL_TYPE["SDL_TrayEntryFlags", ctypes.c_uint32] 16 | 17 | SDL_TRAYENTRY_BUTTON, SDL_TRAYENTRY_CHECKBOX, SDL_TRAYENTRY_SUBMENU, SDL_TRAYENTRY_DISABLED, \ 18 | SDL_TRAYENTRY_CHECKED = 0x00000001, 0x00000002, 0x00000004, 0x80000000, 0x40000000 19 | 20 | SDL_TrayCallback: typing.TypeAlias = SDL_FUNC_TYPE["SDL_TrayCallback", None, [ctypes.c_void_p, SDL_POINTER[SDL_TrayEntry]]] 21 | 22 | SDL_CreateTray: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateTray", SDL_POINTER[SDL_Tray], [SDL_POINTER[SDL_Surface], ctypes.c_char_p], SDL_BINARY] 23 | SDL_SetTrayIcon: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetTrayIcon", None, [SDL_POINTER[SDL_Tray], SDL_POINTER[SDL_Surface]], SDL_BINARY] 24 | SDL_SetTrayTooltip: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetTrayTooltip", None, [SDL_POINTER[SDL_Tray], ctypes.c_char_p], SDL_BINARY] 25 | SDL_CreateTrayMenu: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateTrayMenu", SDL_POINTER[SDL_TrayMenu], [SDL_POINTER[SDL_Tray]], SDL_BINARY] 26 | SDL_CreateTraySubmenu: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_CreateTraySubmenu", SDL_POINTER[SDL_TrayMenu], [SDL_POINTER[SDL_TrayEntry]], SDL_BINARY] 27 | SDL_GetTrayMenu: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTrayMenu", SDL_POINTER[SDL_TrayMenu], [SDL_POINTER[SDL_Tray]], SDL_BINARY] 28 | SDL_GetTraySubmenu: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTraySubmenu", SDL_POINTER[SDL_TrayMenu], [SDL_POINTER[SDL_TrayEntry]], SDL_BINARY] 29 | SDL_GetTrayEntries: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTrayEntries", SDL_POINTER[SDL_POINTER[SDL_TrayEntry]], [SDL_POINTER[SDL_TrayMenu], SDL_POINTER[ctypes.c_int]], SDL_BINARY] 30 | SDL_RemoveTrayEntry: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_RemoveTrayEntry", None, [SDL_POINTER[SDL_TrayEntry]], SDL_BINARY] 31 | SDL_InsertTrayEntryAt: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_InsertTrayEntryAt", SDL_POINTER[SDL_TrayEntry], [SDL_POINTER[SDL_TrayMenu], ctypes.c_int, ctypes.c_char_p, SDL_TrayEntryFlags], SDL_BINARY] 32 | SDL_SetTrayEntryLabel: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetTrayEntryLabel", None, [SDL_POINTER[SDL_TrayEntry], ctypes.c_char_p], SDL_BINARY] 33 | SDL_GetTrayEntryLabel: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTrayEntryLabel", ctypes.c_char_p, [SDL_POINTER[SDL_TrayEntry]], SDL_BINARY] 34 | SDL_SetTrayEntryChecked: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetTrayEntryChecked", None, [SDL_POINTER[SDL_TrayEntry], ctypes.c_bool], SDL_BINARY] 35 | SDL_GetTrayEntryChecked: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTrayEntryChecked", ctypes.c_bool, [SDL_POINTER[SDL_TrayEntry]], SDL_BINARY] 36 | SDL_SetTrayEntryEnabled: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetTrayEntryEnabled", None, [SDL_POINTER[SDL_TrayEntry], ctypes.c_bool], SDL_BINARY] 37 | SDL_GetTrayEntryEnabled: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTrayEntryEnabled", ctypes.c_bool, [SDL_POINTER[SDL_TrayEntry]], SDL_BINARY] 38 | SDL_SetTrayEntryCallback: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_SetTrayEntryCallback", None, [SDL_POINTER[SDL_TrayEntry], SDL_TrayCallback, ctypes.c_void_p], SDL_BINARY] 39 | SDL_ClickTrayEntry: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_ClickTrayEntry", None, [SDL_POINTER[SDL_TrayEntry]], SDL_BINARY] 40 | SDL_DestroyTray: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_DestroyTray", None, [SDL_POINTER[SDL_Tray]], SDL_BINARY] 41 | SDL_GetTrayEntryParent: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTrayEntryParent", SDL_POINTER[SDL_TrayMenu], [SDL_POINTER[SDL_TrayEntry]], SDL_BINARY] 42 | SDL_GetTrayMenuParentEntry: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTrayMenuParentEntry", SDL_POINTER[SDL_TrayEntry], [SDL_POINTER[SDL_TrayMenu]], SDL_BINARY] 43 | SDL_GetTrayMenuParentTray: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetTrayMenuParentTray", SDL_POINTER[SDL_Tray], [SDL_POINTER[SDL_TrayMenu]], SDL_BINARY] 44 | SDL_UpdateTrays: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_UpdateTrays", None, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_version.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, SDL_FUNC, SDL_BINARY 2 | 3 | SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION = 3, 2, 14 4 | 5 | SDL_VERSIONNUM: abc.Callable[[int, int, int], int] = \ 6 | lambda major, minor, patch: major * 1000000 + minor * 1000 + patch 7 | 8 | SDL_VERSIONNUM_MAJOR: abc.Callable[[int], int] = lambda version: int(version / 1000000) 9 | SDL_VERSIONNUM_MINOR: abc.Callable[[int], int] = lambda version: int(version / 1000) % 1000 10 | SDL_VERSIONNUM_MICRO: abc.Callable[[int], int] = lambda version: version % 1000 11 | 12 | SDL_VERSION: int = SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION) 13 | SDL_VERSION_ATLEAST: abc.Callable[[int, int, int], bool] = lambda x, y, z: SDL_VERSION >= SDL_VERSIONNUM(x, y, z) 14 | 15 | SDL_GetVersion: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetVersion", ctypes.c_int, [], SDL_BINARY] 16 | SDL_GetRevision: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_GetRevision", ctypes.c_char_p, [], SDL_BINARY] -------------------------------------------------------------------------------- /sdl3/SDL_vulkan.py: -------------------------------------------------------------------------------- 1 | from .__init__ import ctypes, typing, abc, \ 2 | SDL_POINTER, SDL_FUNC, SDL_TYPE, SDL_BINARY 3 | 4 | from .SDL_video import SDL_Window 5 | from .SDL_stdinc import SDL_FunctionPointer 6 | 7 | class VkInstance(ctypes.c_void_p): 8 | ... 9 | 10 | class VkPhysicalDevice(ctypes.c_void_p): 11 | ... 12 | 13 | class VkAllocationCallbacks(ctypes.c_void_p): 14 | ... 15 | 16 | VkSurfaceKHR: typing.TypeAlias = SDL_TYPE["VkSurfaceKHR", ctypes.c_uint64] 17 | 18 | SDL_Vulkan_LoadLibrary: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Vulkan_LoadLibrary", ctypes.c_bool, [ctypes.c_char_p], SDL_BINARY] 19 | SDL_Vulkan_GetVkGetInstanceProcAddr: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Vulkan_GetVkGetInstanceProcAddr", SDL_FunctionPointer, [], SDL_BINARY] 20 | SDL_Vulkan_UnloadLibrary: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Vulkan_UnloadLibrary", None, [], SDL_BINARY] 21 | SDL_Vulkan_GetInstanceExtensions: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Vulkan_GetInstanceExtensions", SDL_POINTER[ctypes.c_char_p], [SDL_POINTER[ctypes.c_uint32]], SDL_BINARY] 22 | 23 | SDL_Vulkan_CreateSurface: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Vulkan_CreateSurface", ctypes.c_bool, [SDL_POINTER[SDL_Window], VkInstance, SDL_POINTER[VkAllocationCallbacks], SDL_POINTER[VkSurfaceKHR]], SDL_BINARY] 24 | SDL_Vulkan_DestroySurface: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Vulkan_DestroySurface", None, [VkInstance, VkSurfaceKHR, SDL_POINTER[VkAllocationCallbacks]], SDL_BINARY] 25 | SDL_Vulkan_GetPresentationSupport: abc.Callable[..., typing.Any] = SDL_FUNC["SDL_Vulkan_GetPresentationSupport", ctypes.c_bool, [VkInstance, VkPhysicalDevice, ctypes.c_uint32], SDL_BINARY] -------------------------------------------------------------------------------- /tests/TEST_init.py: -------------------------------------------------------------------------------- 1 | from .__init__ import sdl3, ctypes, TEST_RegisterFunction 2 | 3 | @TEST_RegisterFunction(["Linux", "Darwin", "Windows"]) 4 | def TEST_SDL_Init() -> None: 5 | assert sdl3.SDL_Init(sdl3.SDL_INIT_EVENTS), sdl3.SDL_GetError().decode() 6 | assert sdl3.SDL_WasInit(0) & sdl3.SDL_INIT_EVENTS, "Failed to initialize subsystem." 7 | assert (error := sdl3.SDL_GetError()) == "".encode(), error.decode() 8 | sdl3.SDL_Quit() 9 | 10 | @TEST_RegisterFunction(["Linux", "Darwin", "Windows"]) 11 | def TEST_SDL_InitSubSystem() -> None: 12 | assert sdl3.SDL_Init(0), sdl3.SDL_GetError().decode() 13 | assert sdl3.SDL_InitSubSystem(sdl3.SDL_INIT_EVENTS), sdl3.SDL_GetError().decode() 14 | assert (error := sdl3.SDL_GetError()) == "".encode(), error.decode() 15 | assert sdl3.SDL_WasInit(0) & sdl3.SDL_INIT_EVENTS, "Failed to initialize subsystem." 16 | sdl3.SDL_QuitSubSystem(sdl3.SDL_INIT_EVENTS) 17 | sdl3.SDL_Quit() 18 | 19 | @TEST_RegisterFunction(["Linux", "Darwin", "Windows"]) 20 | def TEST_SDL_IsMainThread() -> None: 21 | assert sdl3.SDL_IsMainThread(), sdl3.SDL_GetError().decode() 22 | 23 | @sdl3.SDL_MainThreadCallback 24 | def callback(data: ctypes.c_void_p) -> None: 25 | ctypes.cast(data, sdl3.SDL_POINTER[ctypes.c_bool])[0] = True 26 | 27 | @TEST_RegisterFunction(["Linux", "Darwin", "Windows"]) 28 | def TEST_SDL_RunOnMainThread() -> None: 29 | data = ctypes.pointer(ctypes.c_bool(False)) 30 | assert sdl3.SDL_RunOnMainThread(callback, ctypes.cast(data, ctypes.c_void_p), True), sdl3.SDL_GetError().decode() 31 | assert data[0], "Failed to run on main thread." -------------------------------------------------------------------------------- /tests/TEST_locale.py: -------------------------------------------------------------------------------- 1 | from .__init__ import sdl3, ctypes, TEST_RegisterFunction 2 | 3 | @TEST_RegisterFunction(["Darwin", "Windows"]) 4 | def TEST_SDL_GetPreferredLocales() -> None: 5 | assert sdl3.SDL_Init(0), sdl3.SDL_GetError().decode() 6 | count = ctypes.pointer(ctypes.c_int(0)) 7 | locales = sdl3.SDL_GetPreferredLocales(count) 8 | assert locales, sdl3.SDL_GetError().decode() 9 | assert count.contents.value != 0, "Failed to get preferred locales." 10 | sdl3.SDL_Quit() -------------------------------------------------------------------------------- /tests/TEST_version.py: -------------------------------------------------------------------------------- 1 | from .__init__ import sdl3, TEST_RegisterFunction 2 | 3 | @TEST_RegisterFunction(["Darwin", "Windows", "Linux"]) 4 | def TEST_SDL_GetVersion() -> None: 5 | assert (_ := sdl3.SDL_GetVersion()), "Failed to get version." 6 | assert (major := sdl3.SDL_VERSIONNUM_MAJOR(_)) == sdl3.SDL_MAJOR_VERSION, f"Major version mismatch: {major}." 7 | assert (minor := sdl3.SDL_VERSIONNUM_MINOR(_)) == sdl3.SDL_MINOR_VERSION, f"Minor version mismatch: {minor}." 8 | assert (micro := sdl3.SDL_VERSIONNUM_MICRO(_)) == sdl3.SDL_MICRO_VERSION, f"Micro version mismatch: {micro}." 9 | assert sdl3.SDL_VERSION_ATLEAST(sdl3.SDL_MAJOR_VERSION, sdl3.SDL_MINOR_VERSION, sdl3.SDL_MICRO_VERSION), "Version is not at least the current version." 10 | assert _ == sdl3.SDL_VERSION, f"Version mismatch: {_}." 11 | 12 | @TEST_RegisterFunction(["Darwin", "Windows", "Linux"]) 13 | def TEST_SDL_GetRevision() -> None: 14 | assert (_ := sdl3.SDL_GetRevision()), "Failed to get revision." 15 | assert _.decode(), "Revision is empty." -------------------------------------------------------------------------------- /tests/TEST_video.py: -------------------------------------------------------------------------------- 1 | from .__init__ import sdl3, TEST_RegisterFunction 2 | 3 | @TEST_RegisterFunction(["Darwin", "Windows"]) 4 | def TEST_SDL_CreateWindow() -> None: 5 | assert sdl3.SDL_Init(sdl3.SDL_INIT_VIDEO), sdl3.SDL_GetError().decode() 6 | assert (window := sdl3.SDL_CreateWindow("Test".encode(), 1600, 900, sdl3.SDL_WINDOW_RESIZABLE)), sdl3.SDL_GetError().decode() 7 | assert (error := sdl3.SDL_GetError()) == "".encode(), error.decode() 8 | sdl3.SDL_DestroyWindow(window) 9 | sdl3.SDL_Quit() -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | import os, sys, collections.abc as abc 2 | 3 | sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) 4 | 5 | import sdl3, ctypes, atexit, traceback 6 | 7 | functions: dict[abc.Callable[..., None], list[str]] = {} 8 | 9 | def TEST_RegisterFunction(systems: list[str]) -> abc.Callable[[abc.Callable[..., None]], None]: 10 | return lambda func: functions.update({func: systems}) 11 | 12 | from tests.TEST_init import * 13 | from tests.TEST_locale import * 14 | from tests.TEST_version import * 15 | from tests.TEST_video import * 16 | 17 | @atexit.register 18 | def TEST_RunAllTests() -> None: 19 | if not functions: return 20 | print("\33[32m", f"Initializing tests... (version: {sdl3.__version__}, system: {sdl3.SDL_SYSTEM}, arch: {sdl3.SDL_ARCH}).", "\33[0m", sep = "", flush = True) 21 | passed, failed = 0, 0 22 | 23 | for func, systems in functions.items(): 24 | try: 25 | if sdl3.SDL_SYSTEM not in systems: 26 | print("\33[33m", f"Test '{func.__name__}' is not supported on {sdl3.SDL_SYSTEM}.", "\33[0m", sep = "", flush = True) 27 | 28 | else: 29 | sdl3.SDL_ClearError(); func() 30 | print("\33[32m", f"Test '{func.__name__}' passed.", "\33[0m", sep = "", flush = True) 31 | passed += 1 32 | 33 | except AssertionError as exc: 34 | print("\33[31m", f"Test '{func.__name__}' failed: {str(exc).capitalize()}", "\33[0m", sep = "", flush = True) 35 | failed += 1 36 | 37 | except Exception as exc: 38 | print("\33[31m", f"Test '{func.__name__}' failed: {str(exc).capitalize()}.\n\n{traceback.format_exc()}", "\33[0m", sep = "", flush = True) 39 | os._exit(-1) 40 | 41 | print("\33[31m" if failed else "\33[32m", f"{'Failed' if failed else 'Passed'}! {passed} test(s) passed, {failed} test(s) failed.", "\33[0m", sep = "", flush = True) 42 | if failed: os._exit(-1) --------------------------------------------------------------------------------