├── .clang-format ├── .editorconfig ├── .github ├── actions │ └── setup-ninja │ │ └── action.yml └── workflows │ ├── main.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── .wikiheaders-options ├── Android.mk ├── CHANGES.txt ├── CMakeLists.txt ├── INSTALL.md ├── LICENSE.txt ├── README.md ├── VisualC ├── SDL_ttf.sln ├── SDL_ttf.vcxproj ├── SDL_ttf.vcxproj.filters ├── clean.sh ├── glfont │ └── glfont.vcxproj └── showfont │ └── showfont.vcxproj ├── Xcode ├── Info-Framework.plist ├── SDL_ttf.xcodeproj │ └── project.pbxproj ├── config.xcconfig ├── iOS │ └── SDL3.framework │ │ ├── Headers │ │ ├── SDL.h │ │ ├── SDL_assert.h │ │ ├── SDL_asyncio.h │ │ ├── SDL_atomic.h │ │ ├── SDL_audio.h │ │ ├── SDL_begin_code.h │ │ ├── SDL_bits.h │ │ ├── SDL_blendmode.h │ │ ├── SDL_camera.h │ │ ├── SDL_clipboard.h │ │ ├── SDL_close_code.h │ │ ├── SDL_copying.h │ │ ├── SDL_cpuinfo.h │ │ ├── SDL_dialog.h │ │ ├── SDL_egl.h │ │ ├── SDL_endian.h │ │ ├── SDL_error.h │ │ ├── SDL_events.h │ │ ├── SDL_filesystem.h │ │ ├── SDL_gamepad.h │ │ ├── SDL_gpu.h │ │ ├── SDL_guid.h │ │ ├── SDL_haptic.h │ │ ├── SDL_hidapi.h │ │ ├── SDL_hints.h │ │ ├── SDL_init.h │ │ ├── SDL_intrin.h │ │ ├── SDL_iostream.h │ │ ├── SDL_joystick.h │ │ ├── SDL_keyboard.h │ │ ├── SDL_keycode.h │ │ ├── SDL_loadso.h │ │ ├── SDL_locale.h │ │ ├── SDL_log.h │ │ ├── SDL_main.h │ │ ├── SDL_main_impl.h │ │ ├── SDL_messagebox.h │ │ ├── SDL_metal.h │ │ ├── SDL_misc.h │ │ ├── SDL_mouse.h │ │ ├── SDL_mutex.h │ │ ├── SDL_oldnames.h │ │ ├── SDL_opengl.h │ │ ├── SDL_opengl_glext.h │ │ ├── SDL_opengles.h │ │ ├── SDL_opengles2.h │ │ ├── SDL_opengles2_gl2.h │ │ ├── SDL_opengles2_gl2ext.h │ │ ├── SDL_opengles2_gl2platform.h │ │ ├── SDL_opengles2_khrplatform.h │ │ ├── SDL_pen.h │ │ ├── SDL_pixels.h │ │ ├── SDL_platform.h │ │ ├── SDL_platform_defines.h │ │ ├── SDL_power.h │ │ ├── SDL_process.h │ │ ├── SDL_properties.h │ │ ├── SDL_rect.h │ │ ├── SDL_render.h │ │ ├── SDL_revision.h │ │ ├── SDL_scancode.h │ │ ├── SDL_sensor.h │ │ ├── SDL_stdinc.h │ │ ├── SDL_storage.h │ │ ├── SDL_surface.h │ │ ├── SDL_system.h │ │ ├── SDL_thread.h │ │ ├── SDL_time.h │ │ ├── SDL_timer.h │ │ ├── SDL_touch.h │ │ ├── SDL_tray.h │ │ ├── SDL_version.h │ │ ├── SDL_video.h │ │ └── SDL_vulkan.h │ │ ├── Info.plist │ │ ├── LICENSE.txt │ │ ├── README.md │ │ └── SDL3.tbd ├── macOS │ └── SDL3.framework │ │ ├── Headers │ │ ├── Resources │ │ ├── SDL3.tbd │ │ └── Versions │ │ ├── A │ │ ├── Headers │ │ │ ├── SDL.h │ │ │ ├── SDL_assert.h │ │ │ ├── SDL_asyncio.h │ │ │ ├── SDL_atomic.h │ │ │ ├── SDL_audio.h │ │ │ ├── SDL_begin_code.h │ │ │ ├── SDL_bits.h │ │ │ ├── SDL_blendmode.h │ │ │ ├── SDL_camera.h │ │ │ ├── SDL_clipboard.h │ │ │ ├── SDL_close_code.h │ │ │ ├── SDL_copying.h │ │ │ ├── SDL_cpuinfo.h │ │ │ ├── SDL_dialog.h │ │ │ ├── SDL_egl.h │ │ │ ├── SDL_endian.h │ │ │ ├── SDL_error.h │ │ │ ├── SDL_events.h │ │ │ ├── SDL_filesystem.h │ │ │ ├── SDL_gamepad.h │ │ │ ├── SDL_gpu.h │ │ │ ├── SDL_guid.h │ │ │ ├── SDL_haptic.h │ │ │ ├── SDL_hidapi.h │ │ │ ├── SDL_hints.h │ │ │ ├── SDL_init.h │ │ │ ├── SDL_intrin.h │ │ │ ├── SDL_iostream.h │ │ │ ├── SDL_joystick.h │ │ │ ├── SDL_keyboard.h │ │ │ ├── SDL_keycode.h │ │ │ ├── SDL_loadso.h │ │ │ ├── SDL_locale.h │ │ │ ├── SDL_log.h │ │ │ ├── SDL_main.h │ │ │ ├── SDL_main_impl.h │ │ │ ├── SDL_messagebox.h │ │ │ ├── SDL_metal.h │ │ │ ├── SDL_misc.h │ │ │ ├── SDL_mouse.h │ │ │ ├── SDL_mutex.h │ │ │ ├── SDL_oldnames.h │ │ │ ├── SDL_opengl.h │ │ │ ├── SDL_opengl_glext.h │ │ │ ├── SDL_opengles.h │ │ │ ├── SDL_opengles2.h │ │ │ ├── SDL_opengles2_gl2.h │ │ │ ├── SDL_opengles2_gl2ext.h │ │ │ ├── SDL_opengles2_gl2platform.h │ │ │ ├── SDL_opengles2_khrplatform.h │ │ │ ├── SDL_pen.h │ │ │ ├── SDL_pixels.h │ │ │ ├── SDL_platform.h │ │ │ ├── SDL_platform_defines.h │ │ │ ├── SDL_power.h │ │ │ ├── SDL_process.h │ │ │ ├── SDL_properties.h │ │ │ ├── SDL_rect.h │ │ │ ├── SDL_render.h │ │ │ ├── SDL_revision.h │ │ │ ├── SDL_scancode.h │ │ │ ├── SDL_sensor.h │ │ │ ├── SDL_stdinc.h │ │ │ ├── SDL_storage.h │ │ │ ├── SDL_surface.h │ │ │ ├── SDL_system.h │ │ │ ├── SDL_thread.h │ │ │ ├── SDL_time.h │ │ │ ├── SDL_timer.h │ │ │ ├── SDL_touch.h │ │ │ ├── SDL_tray.h │ │ │ ├── SDL_version.h │ │ │ ├── SDL_video.h │ │ │ └── SDL_vulkan.h │ │ ├── Resources │ │ │ ├── Info.plist │ │ │ ├── LICENSE.txt │ │ │ └── README.md │ │ └── SDL3.tbd │ │ └── Current ├── package ├── pkg-support │ ├── SDL_ttf.info │ ├── mkpackage.sh │ ├── resources │ │ ├── CMake │ │ │ ├── SDL3_ttfConfig.cmake │ │ │ └── SDL3_ttfConfigVersion.cmake │ │ ├── INSTALL.md │ │ ├── SDL_DS_Store │ │ └── framework │ │ │ └── INSTALL.md │ ├── sdl_logo.pdf │ └── share │ │ └── cmake │ │ └── SDL3_ttf │ │ ├── SDL3_ttfConfig.cmake │ │ └── SDL3_ttfConfigVersion.cmake └── showfont │ ├── config.xcconfig │ ├── macOS │ └── macOS.entitlements │ └── showfont.xcodeproj │ └── project.pbxproj ├── build-scripts ├── SDL_migration.cocci ├── build-release.py ├── cmake-toolchain-mingw64-i686.cmake ├── cmake-toolchain-mingw64-x86_64.cmake ├── create-release.py ├── pkg-support │ ├── android │ │ ├── INSTALL.md.in │ │ └── aar │ │ │ ├── __main__.py.in │ │ │ ├── cmake │ │ │ ├── SDL3_ttfConfig.cmake │ │ │ └── SDL3_ttfConfigVersion.cmake.in │ │ │ └── description.json.in │ ├── mingw │ │ ├── INSTALL.md.in │ │ ├── Makefile │ │ └── cmake │ │ │ ├── SDL3_ttfConfig.cmake │ │ │ └── SDL3_ttfConfigVersion.cmake │ └── msvc │ │ ├── INSTALL.md.in │ │ ├── arm64 │ │ └── INSTALL.md.in │ │ ├── cmake │ │ ├── SDL3_ttfConfig.cmake.in │ │ └── SDL3_ttfConfigVersion.cmake.in │ │ ├── x64 │ │ └── INSTALL.md.in │ │ └── x86 │ │ └── INSTALL.md.in ├── release-info.json ├── rename_api.py ├── rename_symbols.py ├── test-versioning.sh └── wikiheaders.pl ├── cmake ├── CPackProjectConfig.cmake.in ├── Findharfbuzz.cmake ├── Findplutosvg.cmake ├── Findplutovg.cmake ├── GetGitRevisionDescription.cmake ├── GetGitRevisionDescription.cmake.in ├── PkgConfigHelper.cmake ├── PrivateSdlFunctions.cmake ├── SDL3_ttfConfig.cmake.in ├── sdl3-ttf.pc.in ├── sdlcpu.cmake ├── sdlmanpages.cmake ├── sdlplatform.cmake └── test │ ├── CMakeLists.txt │ └── main.c ├── docs ├── INTRO-androidstudio.md ├── INTRO-cmake.md ├── INTRO-emscripten.md ├── INTRO-visualstudio.md ├── INTRO-xcode.md ├── README-migration.md ├── README-versions.md ├── hello.c └── release_checklist.md ├── examples ├── editbox.c ├── editbox.h ├── glfont.c ├── showfont.c ├── testapp.c ├── testgputext.c └── testgputext │ ├── SDL_math3d.h │ └── shaders │ ├── build-shaders.sh │ ├── shader-sdf.frag.dxil.h │ ├── shader-sdf.frag.hlsl │ ├── shader-sdf.frag.msl.h │ ├── shader-sdf.frag.spv.h │ ├── shader.frag.dxil.h │ ├── shader.frag.hlsl │ ├── shader.frag.msl.h │ ├── shader.frag.spv.h │ ├── shader.vert.dxil.h │ ├── shader.vert.hlsl │ ├── shader.vert.msl.h │ └── shader.vert.spv.h ├── external ├── Get-GitModules.ps1 └── download.sh ├── include └── SDL3_ttf │ ├── SDL_textengine.h │ └── SDL_ttf.h ├── mingw └── pkg-support │ └── cmake │ ├── sdl3_ttf-config-version.cmake │ └── sdl3_ttf-config.cmake └── src ├── SDL_gpu_textengine.c ├── SDL_hashtable.c ├── SDL_hashtable.h ├── SDL_hashtable_names.h ├── SDL_hashtable_ttf.c ├── SDL_hashtable_ttf.h ├── SDL_renderer_textengine.c ├── SDL_surface_textengine.c ├── SDL_ttf.c ├── SDL_ttf.sym ├── stb_rect_pack.h └── version.rc /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | AlignConsecutiveMacros: Consecutive 3 | AlignConsecutiveAssignments: None 4 | AlignConsecutiveBitFields: None 5 | AlignConsecutiveDeclarations: None 6 | AlignEscapedNewlines: Right 7 | AlignOperands: Align 8 | AlignTrailingComments: true 9 | 10 | AllowAllArgumentsOnNextLine: true 11 | AllowAllParametersOfDeclarationOnNextLine: true 12 | AllowShortEnumsOnASingleLine: true 13 | AllowShortBlocksOnASingleLine: Never 14 | AllowShortCaseLabelsOnASingleLine: false 15 | AllowShortFunctionsOnASingleLine: All 16 | AllowShortIfStatementsOnASingleLine: Never 17 | AllowShortLoopsOnASingleLine: false 18 | 19 | AlwaysBreakAfterDefinitionReturnType: None 20 | AlwaysBreakAfterReturnType: None 21 | AlwaysBreakBeforeMultilineStrings: false 22 | AlwaysBreakTemplateDeclarations: MultiLine 23 | 24 | # Custom brace breaking 25 | BreakBeforeBraces: Custom 26 | BraceWrapping: 27 | AfterCaseLabel: true 28 | AfterClass: true 29 | AfterControlStatement: Never 30 | AfterEnum: true 31 | AfterFunction: true 32 | AfterNamespace: true 33 | AfterObjCDeclaration: true 34 | AfterStruct: true 35 | AfterUnion: true 36 | AfterExternBlock: false 37 | BeforeElse: false 38 | BeforeWhile: false 39 | IndentBraces: false 40 | SplitEmptyFunction: true 41 | SplitEmptyRecord: true 42 | 43 | # Make the closing brace of container literals go to a new line 44 | Cpp11BracedListStyle: false 45 | 46 | # Never format includes 47 | IncludeBlocks: Preserve 48 | # clang-format version 4.0 through 12.0: 49 | #SortIncludes: false 50 | # clang-format version 13.0+: 51 | #SortIncludes: Never 52 | 53 | # No length limit, in case it breaks macros, you can 54 | # disable it with /* clang-format off/on */ comments 55 | ColumnLimit: 0 56 | 57 | IndentWidth: 4 58 | ContinuationIndentWidth: 4 59 | IndentCaseLabels: false 60 | IndentCaseBlocks: false 61 | IndentGotoLabels: true 62 | IndentPPDirectives: None 63 | IndentExternBlock: NoIndent 64 | 65 | PointerAlignment: Right 66 | SpaceAfterCStyleCast: false 67 | SpacesInCStyleCastParentheses: false 68 | SpacesInConditionalStatement: false 69 | SpacesInContainerLiterals: true 70 | SpaceBeforeAssignmentOperators: true 71 | SpaceBeforeCaseColon: false 72 | SpaceBeforeParens: ControlStatements 73 | SpaceAroundPointerQualifiers: Default 74 | SpaceInEmptyBlock: false 75 | SpaceInEmptyParentheses: false 76 | 77 | UseCRLF: false 78 | UseTab: Never 79 | 80 | --- 81 | 82 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # For format see editorconfig.org 2 | # Copyright 2022 Collabora Ltd. 3 | # SPDX-License-Identifier: Zlib 4 | 5 | root = true 6 | 7 | [README.txt] 8 | end_of_line = crlf 9 | 10 | [*.{c,cc,cg,cpp,gradle,h,java,m,metal,pl,py,S,sh,txt}] 11 | indent_size = 4 12 | indent_style = space 13 | insert_final_newline = true 14 | trim_trailing_whitespace = true 15 | 16 | [*.{html,js,json,m4,yml,yaml,vcxproj,vcxproj.filters}] 17 | indent_size = 2 18 | indent_style = space 19 | trim_tailing_whitespace = true 20 | 21 | [{CMakeLists.txt,cmake/*.cmake}] 22 | indent_size = 2 23 | indent_style = space 24 | insert_final_newline = true 25 | trim_trailing_whitespace = true 26 | 27 | [{cmake/*.cmake.in}] 28 | indent_size = 4 29 | indent_style = space 30 | insert_final_newline = true 31 | trim_trailing_whitespace = true 32 | 33 | [{Makefile.*,*.mk,*.sln,*.pbxproj,*.plist}] 34 | indent_size = 8 35 | indent_style = tab 36 | tab_width = 8 37 | 38 | [*.{markdown,md}] 39 | indent_size = 4 40 | indent_style = space 41 | # Markdown syntax treats tabs as 4 spaces 42 | tab_width = 4 43 | 44 | [{*.bat,*.rc}] 45 | end_of_line = crlf 46 | -------------------------------------------------------------------------------- /.github/actions/setup-ninja/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Setup ninja' 2 | description: 'Download ninja and add it to the PATH environment variable' 3 | inputs: 4 | version: 5 | description: 'Ninja version' 6 | default: '1.12.1' 7 | runs: 8 | using: 'composite' 9 | steps: 10 | - name: 'Calculate variables' 11 | id: calc 12 | shell: sh 13 | run: | 14 | case "${{ runner.os }}-${{ runner.arch }}" in 15 | "Linux-X86" | "Linux-X64") 16 | archive="ninja-linux.zip" 17 | ;; 18 | "Linux-ARM64") 19 | archive="ninja-linux-aarch64.zip" 20 | ;; 21 | "macOS-X86" | "macOS-X64" | "macOS-ARM64") 22 | archive="ninja-mac.zip" 23 | ;; 24 | "Windows-X86" | "Windows-X64") 25 | archive="ninja-win.zip" 26 | ;; 27 | "Windows-ARM64") 28 | archive="ninja-winarm64.zip" 29 | ;; 30 | *) 31 | echo "Unsupported ${{ runner.os }}-${{ runner.arch }}" 32 | exit 1; 33 | ;; 34 | esac 35 | echo "archive=${archive}" >> ${GITHUB_OUTPUT} 36 | echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT} 37 | - name: 'Restore cached ${{ steps.calc.outputs.archive }}' 38 | id: cache-restore 39 | uses: actions/cache/restore@v4 40 | with: 41 | path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}' 42 | key: ${{ steps.calc.outputs.cache-key }} 43 | - name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})' 44 | if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }} 45 | shell: pwsh 46 | run: | 47 | Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}" 48 | - name: 'Cache ${{ steps.calc.outputs.archive }}' 49 | if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }} 50 | uses: actions/cache/save@v4 51 | with: 52 | path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}' 53 | key: ${{ steps.calc.outputs.cache-key }} 54 | - name: 'Extract ninja' 55 | shell: pwsh 56 | run: | 57 | 7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}" 58 | - name: 'Set output variables' 59 | id: final 60 | shell: pwsh 61 | run: | 62 | echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | buildbot/ 3 | /VERSION.txt 4 | 5 | *.so 6 | *.so.* 7 | *.dll 8 | *.exe 9 | *.o 10 | *.obj 11 | *.res 12 | *.lib 13 | *.a 14 | *.la 15 | *.dSYM 16 | *,e1f 17 | *,ff8 18 | *.lnk 19 | *.err 20 | *.exp 21 | *.map 22 | *.orig 23 | *~ 24 | *.swp 25 | *.tmp 26 | *.rej 27 | 28 | # for CMake 29 | CMakeFiles/ 30 | CMakeCache.txt 31 | cmake_install.cmake 32 | cmake_uninstall.cmake 33 | SDL3ConfigVersion.cmake 34 | .ninja_* 35 | *.ninja 36 | 37 | # for CLion 38 | .idea 39 | cmake-build-* 40 | 41 | # for Xcode 42 | *.mode1* 43 | *.perspective* 44 | *.pbxuser 45 | (^|/)build($|/) 46 | .DS_Store 47 | xcuserdata 48 | *.xcworkspace 49 | 50 | # for Visual C++ 51 | .vs 52 | Debug 53 | Release 54 | *.user 55 | *.ncb 56 | *.suo 57 | *.sdf 58 | 59 | # for Clangd 60 | .cache 61 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/freetype"] 2 | path = external/freetype 3 | url = https://github.com/libsdl-org/freetype.git 4 | branch = VER-2-13-3-SDL 5 | [submodule "external/harfbuzz"] 6 | path = external/harfbuzz 7 | url = https://github.com/libsdl-org/harfbuzz.git 8 | branch = 8.5.0-SDL 9 | [submodule "external/plutosvg"] 10 | path = external/plutosvg 11 | url = https://github.com/libsdl-org/plutosvg.git 12 | branch = v0.0.7-SDL 13 | [submodule "external/plutovg"] 14 | path = external/plutovg 15 | url = https://github.com/libsdl-org/plutovg.git 16 | branch = v1.1.0-SDL 17 | -------------------------------------------------------------------------------- /.wikiheaders-options: -------------------------------------------------------------------------------- 1 | projectfullname = SDL_ttf 2 | projectshortname = SDL_ttf 3 | incsubdir = include/SDL3_ttf 4 | wikisubdir = SDL3_ttf 5 | apiprefixregex = TTF_ 6 | mainincludefname = SDL3_ttf/SDL_ttf.h 7 | versionfname = include/SDL3_ttf/SDL_ttf.h 8 | versionmajorregex = \A\#define\s+SDL_TTF_MAJOR_VERSION\s+(\d+)\Z 9 | versionminorregex = \A\#define\s+SDL_TTF_MINOR_VERSION\s+(\d+)\Z 10 | versionmicroregex = \A\#define\s+SDL_TTF_MICRO_VERSION\s+(\d+)\Z 11 | selectheaderregex = \ASDL_ttf\.h\Z 12 | projecturl = https://libsdl.org/projects/SDL_ttf 13 | wikiurl = https://wiki.libsdl.org/SDL_ttf 14 | bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new 15 | warn_about_missing = 0 16 | wikipreamble = (This function is part of SDL_ttf, a separate library from SDL.) 17 | wikiheaderfiletext = Defined in [](https://github.com/libsdl-org/SDL_ttf/blob/main/include/SDL3_ttf/%fname%) 18 | manpageheaderfiletext = Defined in SDL3_ttf/%fname% 19 | quickrefenabled = 1 20 | quickreftitle = SDL3_ttf API Quick Reference 21 | quickrefurl = https://libsdl.org/ 22 | quickrefdesc = The latest version of this document can be found at https://wiki.libsdl.org/SDL3_ttf/QuickReference 23 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | # Save the local path 2 | SDL_TTF_LOCAL_PATH := $(call my-dir) 3 | 4 | # Enable this if you want to use PlutoSVG for emoji support 5 | SUPPORT_PLUTOSVG ?= true 6 | PLUTOSVG_LIBRARY_PATH := external/plutosvg 7 | PLUTOVG_LIBRARY_PATH := external/plutovg 8 | 9 | # Enable this if you want to use HarfBuzz 10 | SUPPORT_HARFBUZZ ?= true 11 | HARFBUZZ_LIBRARY_PATH := external/harfbuzz 12 | 13 | FREETYPE_LIBRARY_PATH := external/freetype 14 | 15 | # Build freetype library 16 | ifneq ($(FREETYPE_LIBRARY_PATH),) 17 | include $(SDL_TTF_LOCAL_PATH)/$(FREETYPE_LIBRARY_PATH)/Android.mk 18 | endif 19 | 20 | # Build the library 21 | ifeq ($(SUPPORT_HARFBUZZ),true) 22 | include $(SDL_TTF_LOCAL_PATH)/$(HARFBUZZ_LIBRARY_PATH)/Android.mk 23 | endif 24 | 25 | # Restore local path 26 | LOCAL_PATH := $(SDL_TTF_LOCAL_PATH) 27 | include $(CLEAR_VARS) 28 | 29 | LOCAL_MODULE := SDL3_ttf 30 | 31 | LOCAL_SRC_FILES := \ 32 | src/SDL_ttf.c.neon \ 33 | src/SDL_hashtable.c \ 34 | src/SDL_hashtable_ttf.c \ 35 | src/SDL_gpu_textengine.c \ 36 | src/SDL_renderer_textengine.c \ 37 | src/SDL_surface_textengine.c 38 | 39 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include 40 | 41 | LOCAL_CFLAGS += -O2 42 | 43 | LOCAL_LDFLAGS := -Wl,--no-undefined -Wl,--version-script=$(LOCAL_PATH)/src/SDL_ttf.sym 44 | 45 | ifneq ($(FREETYPE_LIBRARY_PATH),) 46 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(FREETYPE_LIBRARY_PATH)/include 47 | LOCAL_STATIC_LIBRARIES += freetype 48 | endif 49 | 50 | ifeq ($(SUPPORT_HARFBUZZ),true) 51 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(HARFBUZZ_LIBRARY_PATH)/src 52 | LOCAL_CFLAGS += -DTTF_USE_HARFBUZZ 53 | LOCAL_STATIC_LIBRARIES += harfbuzz 54 | endif 55 | 56 | ifeq ($(SUPPORT_PLUTOSVG),true) 57 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(PLUTOVG_LIBRARY_PATH)/include 58 | LOCAL_C_FLAGS += -DTTF_USE_PLUTOSVG -DPLUTOSVG_HAS_FREETYPE 59 | LOCAL_SRC_FILES += \ 60 | external/plutosvg/source/plutosvg.c \ 61 | external/plutovg/source/plutovg-blend.c \ 62 | external/plutovg/source/plutovg-canvas.c \ 63 | external/plutovg/source/plutovg-font.c \ 64 | external/plutovg/source/plutovg-ft-math.c \ 65 | external/plutovg/source/plutovg-ft-raster.c \ 66 | external/plutovg/source/plutovg-ft-stroker.c \ 67 | external/plutovg/source/plutovg-matrix.c \ 68 | external/plutovg/source/plutovg-paint.c \ 69 | external/plutovg/source/plutovg-path.c \ 70 | external/plutovg/source/plutovg-rasterize.c \ 71 | external/plutovg/source/plutovg-surface.c 72 | endif 73 | 74 | LOCAL_SHARED_LIBRARIES := SDL3 75 | 76 | LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)/include 77 | 78 | include $(BUILD_SHARED_LIBRARY) 79 | 80 | ########################### 81 | # 82 | # SDL3_ttf static library 83 | # 84 | ########################### 85 | 86 | LOCAL_MODULE := SDL3_ttf_static 87 | 88 | LOCAL_MODULE_FILENAME := libSDL3_ttf 89 | 90 | LOCAL_LDLIBS := 91 | LOCAL_EXPORT_LDLIBS := 92 | 93 | include $(BUILD_STATIC_LIBRARY) 94 | 95 | -------------------------------------------------------------------------------- /CHANGES.txt: -------------------------------------------------------------------------------- 1 | 3.2.2: 2 | * Added TTF_GetFontWeight() 3 | 4 | 3.2.0: 5 | * Updated for SDL 3.0, see docs/README-migration.md for details 6 | * Added the concept of a text object and text engine, which is able to efficiently render text for a variety of output methods 7 | * Added TTF_CreateSurfaceTextEngine() and TTF_DrawSurfaceText() for drawing text to SDL_Surface output 8 | * Added TTF_CreateRendererTextEngine() and TTF_DrawRendererText() for drawing text to SDL_Renderer output 9 | * Added TTF_CreateGPUTextEngine() and TTF_GetGPUTextDrawData() for drawing text to SDL_GPU output 10 | * Made the text engine API public in so you can integrate text objects into custom font display solutions 11 | * Added TTF_CopyFont() to allow you to easily make fonts of different sizes 12 | * Added TTF_AddFallbackFont() to allow combining fonts with distinct glyph support 13 | * Added support for OT-SVG fonts, which are useful as fallback fonts for color emoji support 14 | * Updated SDF font support and added an example of using it with the SDL GPU API 15 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | # To build and use SDL_ttf: 2 | 3 | SDL_ttf supports a number of development environments: 4 | - [CMake](docs/INTRO-cmake.md) 5 | - [Visual Studio on Windows](docs/INTRO-visualstudio.md) 6 | - [Xcode on Apple platforms](docs/INTRO-xcode.md) 7 | - [Android Studio](docs/INTRO-androidstudio.md) 8 | - [Emscripten for web](docs/INTRO-emscripten.md) 9 | 10 | SDL_ttf is also usable in other environments. The basic steps are to use CMake to build the library and then use the headers and library that you built in your project. You can search online to see if anyone has specific steps for your setup. 11 | 12 | # Documentation 13 | 14 | An API reference and additional documentation is available at: 15 | 16 | https://wiki.libsdl.org/SDL3_ttf 17 | 18 | # Example code 19 | 20 | There are simple example programs in the examples directory. 21 | 22 | If you're using CMake, you can build them adding `-DSDLTTF_SAMPLES=ON` to the CMake command line when building SDL_ttf. 23 | 24 | If you're using Visual Studio there are separate projects in the VisualC directory. 25 | 26 | If you're using Xcode there are separate projects in the Xcode directory. 27 | 28 | # Discussions 29 | 30 | ## Discord 31 | 32 | You can join the official Discord server at: 33 | 34 | https://discord.com/invite/BwpFGBWsv8 35 | 36 | ## Forums/mailing lists 37 | 38 | You can join SDL development discussions at: 39 | 40 | https://discourse.libsdl.org/ 41 | 42 | Once you sign up, you can use the forum through the website or as a mailing list from your email client. 43 | 44 | ## Announcement list 45 | 46 | You can sign up for the low traffic announcement list at: 47 | 48 | https://www.libsdl.org/mailing-list.php 49 | 50 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 1997-2025 Sam Lantinga 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | SDL_ttf 3.0 3 | 4 | This library is a wrapper around the FreeType and Harfbuzz libraries, allowing you to use TrueType fonts to render text in SDL applications. 5 | 6 | The latest version of this library is available from GitHub: 7 | https://github.com/libsdl-org/SDL_ttf/releases 8 | 9 | Installation instructions and a quick introduction is available in 10 | [INSTALL.md](INSTALL.md) 11 | 12 | This library is distributed under the terms of the zlib license, 13 | available in [LICENSE.txt](LICENSE.txt). 14 | 15 | This library also uses the following libraries: 16 | - FreeType, licensed under the [FTL](https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/docs/FTL.TXT) 17 | - HarfBuzz, licensed under the [MIT license](https://github.com/harfbuzz/harfbuzz/blob/main/COPYING) 18 | - PlutoSVG, licensed under the [MIT license](https://github.com/sammycage/plutosvg/blob/master/LICENSE) 19 | - PlutoVG, licensed under the [MIT license](https://github.com/sammycage/plutovg/blob/master/LICENSE) 20 | 21 | Enjoy! 22 | 23 | Sam Lantinga (slouken@libsdl.org) 24 | -------------------------------------------------------------------------------- /VisualC/SDL_ttf.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3_ttf", "SDL_ttf.vcxproj", "{DDDBD07D-DC76-4AF6-8D02-3E2DEB6EE255}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "showfont", "showfont\showfont.vcxproj", "{7B1F60CD-2A09-4514-937C-D9DD044428FB}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glfont", "glfont\glfont.vcxproj", "{3BEF6A23-3BB6-4400-9421-D055B36466DC}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Debug|x64 = Debug|x64 14 | Release|Win32 = Release|Win32 15 | Release|x64 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {DDDBD07D-DC76-4AF6-8D02-3E2DEB6EE255}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {DDDBD07D-DC76-4AF6-8D02-3E2DEB6EE255}.Debug|Win32.Build.0 = Debug|Win32 20 | {DDDBD07D-DC76-4AF6-8D02-3E2DEB6EE255}.Debug|x64.ActiveCfg = Debug|x64 21 | {DDDBD07D-DC76-4AF6-8D02-3E2DEB6EE255}.Debug|x64.Build.0 = Debug|x64 22 | {DDDBD07D-DC76-4AF6-8D02-3E2DEB6EE255}.Release|Win32.ActiveCfg = Release|Win32 23 | {DDDBD07D-DC76-4AF6-8D02-3E2DEB6EE255}.Release|Win32.Build.0 = Release|Win32 24 | {DDDBD07D-DC76-4AF6-8D02-3E2DEB6EE255}.Release|x64.ActiveCfg = Release|x64 25 | {DDDBD07D-DC76-4AF6-8D02-3E2DEB6EE255}.Release|x64.Build.0 = Release|x64 26 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|Win32.ActiveCfg = Debug|Win32 27 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|Win32.Build.0 = Debug|Win32 28 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|x64.ActiveCfg = Debug|x64 29 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Debug|x64.Build.0 = Debug|x64 30 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|Win32.ActiveCfg = Release|Win32 31 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|Win32.Build.0 = Release|Win32 32 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|x64.ActiveCfg = Release|x64 33 | {7B1F60CD-2A09-4514-937C-D9DD044428FB}.Release|x64.Build.0 = Release|x64 34 | {3BEF6A23-3BB6-4400-9421-D055B36466DC}.Debug|Win32.ActiveCfg = Debug|Win32 35 | {3BEF6A23-3BB6-4400-9421-D055B36466DC}.Debug|Win32.Build.0 = Debug|Win32 36 | {3BEF6A23-3BB6-4400-9421-D055B36466DC}.Debug|x64.ActiveCfg = Debug|x64 37 | {3BEF6A23-3BB6-4400-9421-D055B36466DC}.Debug|x64.Build.0 = Debug|x64 38 | {3BEF6A23-3BB6-4400-9421-D055B36466DC}.Release|Win32.ActiveCfg = Release|Win32 39 | {3BEF6A23-3BB6-4400-9421-D055B36466DC}.Release|Win32.Build.0 = Release|Win32 40 | {3BEF6A23-3BB6-4400-9421-D055B36466DC}.Release|x64.ActiveCfg = Release|x64 41 | {3BEF6A23-3BB6-4400-9421-D055B36466DC}.Release|x64.Build.0 = Release|x64 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | EndGlobal 47 | -------------------------------------------------------------------------------- /VisualC/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | find . -type f \( -name '*.user' -o -name '*.sdf' -o -name '*.ncb' -o -name '*.suo' \) -print -delete 3 | rm -rvf Win32 */Win32 x64 */x64 4 | -------------------------------------------------------------------------------- /Xcode/Info-Framework.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | SDL3_ttf 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | SDL3_ttf 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 3.3.0 19 | CFBundleVersion 20 | 3.3.0 21 | 22 | 23 | -------------------------------------------------------------------------------- /Xcode/config.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // config.xcconfig 3 | // 4 | 5 | // Configuration settings file format documentation can be found at: 6 | // https://help.apple.com/xcode/#/dev745c5c974 7 | 8 | // Include any optional config for this build 9 | #include? "build.xcconfig" 10 | 11 | CONFIG_PREPROCESSOR_DEFINITIONS = $(inherited) $(MIDI_PREPROCESSOR_DEFINITIONS) $(MOD_PREPROCESSOR_DEFINITIONS) $(OPUS_PREPROCESSOR_DEFINITIONS) 12 | CONFIG_FRAMEWORK_LDFLAGS = $(inherited) $(MIDI_FRAMEWORK_LDFLAGS) $(MOD_FRAMEWORK_LDFLAGS) $(OPUS_FRAMEWORK_LDFLAGS) 13 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * Main include header for the SDL library, version 3.2.6 24 | * 25 | * It is almost always best to include just this one header instead of 26 | * picking out individual headers included here. There are exceptions to 27 | * this rule--SDL_main.h is special and not included here--but usually 28 | * letting SDL.h include the kitchen sink for you is the correct approach. 29 | */ 30 | 31 | #ifndef SDL_h_ 32 | #define SDL_h_ 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | #include 85 | #include 86 | #include 87 | #include 88 | #include 89 | 90 | #endif /* SDL_h_ */ 91 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* 23 | * This file reverses the effects of SDL_begin_code.h and should be included 24 | * after you finish any function and structure declarations in your headers. 25 | * 26 | * SDL's headers use this; applications generally should not include this 27 | * header directly. 28 | */ 29 | 30 | #ifndef SDL_begin_code_h 31 | #error SDL_close_code.h included without matching SDL_begin_code.h 32 | #endif 33 | #undef SDL_begin_code_h 34 | 35 | /* Reset structure packing at previous byte alignment */ 36 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 37 | #ifdef __BORLANDC__ 38 | #pragma nopackwarning 39 | #endif 40 | #pragma pack(pop) 41 | #endif /* Compiler needs structure packing set */ 42 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* Header file containing SDL's license. */ 23 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_guid.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* WIKI CATEGORY: GUID */ 23 | 24 | /** 25 | * # CategoryGUID 26 | * 27 | * A GUID is a 128-bit value that represents something that is uniquely 28 | * identifiable by this value: "globally unique." 29 | * 30 | * SDL provides functions to convert a GUID to/from a string. 31 | */ 32 | 33 | #ifndef SDL_guid_h_ 34 | #define SDL_guid_h_ 35 | 36 | #include 37 | 38 | #include 39 | /* Set up for C function definitions, even when using C++ */ 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /** 45 | * An SDL_GUID is a 128-bit identifier for an input device that identifies 46 | * that device across runs of SDL programs on the same platform. 47 | * 48 | * If the device is detached and then re-attached to a different port, or if 49 | * the base system is rebooted, the device should still report the same GUID. 50 | * 51 | * GUIDs are as precise as possible but are not guaranteed to distinguish 52 | * physically distinct but equivalent devices. For example, two game 53 | * controllers from the same vendor with the same product ID and revision may 54 | * have the same GUID. 55 | * 56 | * GUIDs may be platform-dependent (i.e., the same device may report different 57 | * GUIDs on different operating systems). 58 | * 59 | * \since This struct is available since SDL 3.2.0. 60 | */ 61 | typedef struct SDL_GUID { 62 | Uint8 data[16]; 63 | } SDL_GUID; 64 | 65 | /* Function prototypes */ 66 | 67 | /** 68 | * Get an ASCII string representation for a given SDL_GUID. 69 | * 70 | * \param guid the SDL_GUID you wish to convert to string. 71 | * \param pszGUID buffer in which to write the ASCII string. 72 | * \param cbGUID the size of pszGUID, should be at least 33 bytes. 73 | * 74 | * \threadsafety It is safe to call this function from any thread. 75 | * 76 | * \since This function is available since SDL 3.2.0. 77 | * 78 | * \sa SDL_StringToGUID 79 | */ 80 | extern SDL_DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); 81 | 82 | /** 83 | * Convert a GUID string into a SDL_GUID structure. 84 | * 85 | * Performs no error checking. If this function is given a string containing 86 | * an invalid GUID, the function will silently succeed, but the GUID generated 87 | * will not be useful. 88 | * 89 | * \param pchGUID string containing an ASCII representation of a GUID. 90 | * \returns a SDL_GUID structure. 91 | * 92 | * \threadsafety It is safe to call this function from any thread. 93 | * 94 | * \since This function is available since SDL 3.2.0. 95 | * 96 | * \sa SDL_GUIDToString 97 | */ 98 | extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_StringToGUID(const char *pchGUID); 99 | 100 | /* Ends C function definitions when using C++ */ 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | #include 105 | 106 | #endif /* SDL_guid_h_ */ 107 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_locale.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * # CategoryLocale 24 | * 25 | * SDL locale services. 26 | * 27 | * This provides a way to get a list of preferred locales (language plus 28 | * country) for the user. There is exactly one function: 29 | * SDL_GetPreferredLocales(), which handles all the heavy lifting, and offers 30 | * documentation on all the strange ways humans might have configured their 31 | * language settings. 32 | */ 33 | 34 | #ifndef SDL_locale_h 35 | #define SDL_locale_h 36 | 37 | #include 38 | #include 39 | 40 | #include 41 | /* Set up for C function definitions, even when using C++ */ 42 | #ifdef __cplusplus 43 | /* *INDENT-OFF* */ 44 | extern "C" { 45 | /* *INDENT-ON* */ 46 | #endif 47 | 48 | /** 49 | * A struct to provide locale data. 50 | * 51 | * Locale data is split into a spoken language, like English, and an optional 52 | * country, like Canada. The language will be in ISO-639 format (so English 53 | * would be "en"), and the country, if not NULL, will be an ISO-3166 country 54 | * code (so Canada would be "CA"). 55 | * 56 | * \since This function is available since SDL 3.2.0. 57 | * 58 | * \sa SDL_GetPreferredLocales 59 | */ 60 | typedef struct SDL_Locale 61 | { 62 | const char *language; /**< A language name, like "en" for English. */ 63 | const char *country; /**< A country, like "US" for America. Can be NULL. */ 64 | } SDL_Locale; 65 | 66 | /** 67 | * Report the user's preferred locale. 68 | * 69 | * Returned language strings are in the format xx, where 'xx' is an ISO-639 70 | * language specifier (such as "en" for English, "de" for German, etc). 71 | * Country strings are in the format YY, where "YY" is an ISO-3166 country 72 | * code (such as "US" for the United States, "CA" for Canada, etc). Country 73 | * might be NULL if there's no specific guidance on them (so you might get { 74 | * "en", "US" } for American English, but { "en", NULL } means "English 75 | * language, generically"). Language strings are never NULL, except to 76 | * terminate the array. 77 | * 78 | * Please note that not all of these strings are 2 characters; some are three 79 | * or more. 80 | * 81 | * The returned list of locales are in the order of the user's preference. For 82 | * example, a German citizen that is fluent in US English and knows enough 83 | * Japanese to navigate around Tokyo might have a list like: { "de", "en_US", 84 | * "jp", NULL }. Someone from England might prefer British English (where 85 | * "color" is spelled "colour", etc), but will settle for anything like it: { 86 | * "en_GB", "en", NULL }. 87 | * 88 | * This function returns NULL on error, including when the platform does not 89 | * supply this information at all. 90 | * 91 | * This might be a "slow" call that has to query the operating system. It's 92 | * best to ask for this once and save the results. However, this list can 93 | * change, usually because the user has changed a system preference outside of 94 | * your program; SDL will send an SDL_EVENT_LOCALE_CHANGED event in this case, 95 | * if possible, and you can call this function again to get an updated copy of 96 | * preferred locales. 97 | * 98 | * \param count a pointer filled in with the number of locales returned, may 99 | * be NULL. 100 | * \returns a NULL terminated array of locale pointers, or NULL on failure; 101 | * call SDL_GetError() for more information. This is a single 102 | * allocation that should be freed with SDL_free() when it is no 103 | * longer needed. 104 | * 105 | * \since This function is available since SDL 3.2.0. 106 | */ 107 | extern SDL_DECLSPEC SDL_Locale ** SDLCALL SDL_GetPreferredLocales(int *count); 108 | 109 | /* Ends C function definitions when using C++ */ 110 | #ifdef __cplusplus 111 | /* *INDENT-OFF* */ 112 | } 113 | /* *INDENT-ON* */ 114 | #endif 115 | #include 116 | 117 | #endif /* SDL_locale_h */ 118 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_metal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * # CategoryMetal 24 | * 25 | * Functions to creating Metal layers and views on SDL windows. 26 | * 27 | * This provides some platform-specific glue for Apple platforms. Most macOS 28 | * and iOS apps can use SDL without these functions, but this API they can be 29 | * useful for specific OS-level integration tasks. 30 | */ 31 | 32 | #ifndef SDL_metal_h_ 33 | #define SDL_metal_h_ 34 | 35 | #include 36 | 37 | #include 38 | /* Set up for C function definitions, even when using C++ */ 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /** 44 | * A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). 45 | * 46 | * \since This datatype is available since SDL 3.2.0. 47 | */ 48 | typedef void *SDL_MetalView; 49 | 50 | /** 51 | * \name Metal support functions 52 | */ 53 | /* @{ */ 54 | 55 | /** 56 | * Create a CAMetalLayer-backed NSView/UIView and attach it to the specified 57 | * window. 58 | * 59 | * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on 60 | * its own. It is up to user code to do that. 61 | * 62 | * The returned handle can be casted directly to a NSView or UIView. To access 63 | * the backing CAMetalLayer, call SDL_Metal_GetLayer(). 64 | * 65 | * \param window the window. 66 | * \returns handle NSView or UIView. 67 | * 68 | * \since This function is available since SDL 3.2.0. 69 | * 70 | * \sa SDL_Metal_DestroyView 71 | * \sa SDL_Metal_GetLayer 72 | */ 73 | extern SDL_DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window *window); 74 | 75 | /** 76 | * Destroy an existing SDL_MetalView object. 77 | * 78 | * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was 79 | * called after SDL_CreateWindow. 80 | * 81 | * \param view the SDL_MetalView object. 82 | * 83 | * \since This function is available since SDL 3.2.0. 84 | * 85 | * \sa SDL_Metal_CreateView 86 | */ 87 | extern SDL_DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); 88 | 89 | /** 90 | * Get a pointer to the backing CAMetalLayer for the given view. 91 | * 92 | * \param view the SDL_MetalView object. 93 | * \returns a pointer. 94 | * 95 | * \since This function is available since SDL 3.2.0. 96 | */ 97 | extern SDL_DECLSPEC void * SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); 98 | 99 | /* @} *//* Metal support functions */ 100 | 101 | /* Ends C function definitions when using C++ */ 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | #include 106 | 107 | #endif /* SDL_metal_h_ */ 108 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * # CategoryMisc 24 | * 25 | * SDL API functions that don't fit elsewhere. 26 | */ 27 | 28 | #ifndef SDL_misc_h_ 29 | #define SDL_misc_h_ 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | /* Set up for C function definitions, even when using C++ */ 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * Open a URL/URI in the browser or other appropriate external application. 43 | * 44 | * Open a URL in a separate, system-provided application. How this works will 45 | * vary wildly depending on the platform. This will likely launch what makes 46 | * sense to handle a specific URL's protocol (a web browser for `http://`, 47 | * etc), but it might also be able to launch file managers for directories and 48 | * other things. 49 | * 50 | * What happens when you open a URL varies wildly as well: your game window 51 | * may lose focus (and may or may not lose focus if your game was fullscreen 52 | * or grabbing input at the time). On mobile devices, your app will likely 53 | * move to the background or your process might be paused. Any given platform 54 | * may or may not handle a given URL. 55 | * 56 | * If this is unimplemented (or simply unavailable) for a platform, this will 57 | * fail with an error. A successful result does not mean the URL loaded, just 58 | * that we launched _something_ to handle it (or at least believe we did). 59 | * 60 | * All this to say: this function can be useful, but you should definitely 61 | * test it on every platform you target. 62 | * 63 | * \param url a valid URL/URI to open. Use `file:///full/path/to/file` for 64 | * local files, if supported. 65 | * \returns true on success or false on failure; call SDL_GetError() for more 66 | * information. 67 | * 68 | * \since This function is available since SDL 3.2.0. 69 | */ 70 | extern SDL_DECLSPEC bool SDLCALL SDL_OpenURL(const char *url); 71 | 72 | /* Ends C function definitions when using C++ */ 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | #include 77 | 78 | #endif /* SDL_misc_h_ */ 79 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* 23 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 24 | */ 25 | 26 | #include 27 | 28 | #ifdef SDL_PLATFORM_IOS 29 | #include 30 | #include 31 | #else 32 | #include 33 | #include 34 | #endif 35 | 36 | #ifndef APIENTRY 37 | #define APIENTRY 38 | #endif 39 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* 23 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 24 | */ 25 | 26 | #include 27 | 28 | #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) 29 | 30 | #ifdef SDL_PLATFORM_IOS 31 | #include 32 | #include 33 | #else 34 | #include 35 | #include 36 | #include 37 | #endif 38 | 39 | #else /* _MSC_VER */ 40 | 41 | /* OpenGL ES2 headers for Visual Studio */ 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #endif /* _MSC_VER */ 48 | 49 | #ifndef APIENTRY 50 | #define APIENTRY GL_APIENTRY 51 | #endif 52 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* 5 | ** Copyright 2017-2020 The Khronos Group Inc. 6 | ** SPDX-License-Identifier: Apache-2.0 7 | */ 8 | 9 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 10 | * 11 | * Adopters may modify khrplatform.h and this file to suit their platform. 12 | * Please contribute modifications back to Khronos as pull requests on the 13 | * public github repository: 14 | * https://github.com/KhronosGroup/OpenGL-Registry 15 | */ 16 | 17 | /*#include */ 18 | 19 | #ifndef GL_APICALL 20 | #define GL_APICALL KHRONOS_APICALL 21 | #endif 22 | 23 | #ifndef GL_APIENTRY 24 | #define GL_APIENTRY KHRONOS_APIENTRY 25 | #endif 26 | 27 | #endif /* __gl2platform_h_ */ 28 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * # CategoryPlatform 24 | * 25 | * SDL provides a means to identify the app's platform, both at compile time 26 | * and runtime. 27 | */ 28 | 29 | #ifndef SDL_platform_h_ 30 | #define SDL_platform_h_ 31 | 32 | #include 33 | 34 | #include 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * Get the name of the platform. 42 | * 43 | * Here are the names returned for some (but not all) supported platforms: 44 | * 45 | * - "Windows" 46 | * - "macOS" 47 | * - "Linux" 48 | * - "iOS" 49 | * - "Android" 50 | * 51 | * \returns the name of the platform. If the correct platform name is not 52 | * available, returns a string beginning with the text "Unknown". 53 | * 54 | * \since This function is available since SDL 3.2.0. 55 | */ 56 | extern SDL_DECLSPEC const char * SDLCALL SDL_GetPlatform(void); 57 | 58 | /* Ends C function definitions when using C++ */ 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | #include 63 | 64 | #endif /* SDL_platform_h_ */ 65 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_power_h_ 23 | #define SDL_power_h_ 24 | 25 | /** 26 | * # CategoryPower 27 | * 28 | * SDL power management routines. 29 | * 30 | * There is a single function in this category: SDL_GetPowerInfo(). 31 | * 32 | * This function is useful for games on the go. This allows an app to know if 33 | * it's running on a draining battery, which can be useful if the app wants to 34 | * reduce processing, or perhaps framerate, to extend the duration of the 35 | * battery's charge. Perhaps the app just wants to show a battery meter when 36 | * fullscreen, or alert the user when the power is getting extremely low, so 37 | * they can save their game. 38 | */ 39 | 40 | #include 41 | #include 42 | 43 | #include 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * The basic state for the system's power supply. 51 | * 52 | * These are results returned by SDL_GetPowerInfo(). 53 | * 54 | * \since This enum is available since SDL 3.2.0. 55 | */ 56 | typedef enum SDL_PowerState 57 | { 58 | SDL_POWERSTATE_ERROR = -1, /**< error determining power status */ 59 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ 60 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ 61 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ 62 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ 63 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ 64 | } SDL_PowerState; 65 | 66 | /** 67 | * Get the current power supply details. 68 | * 69 | * You should never take a battery status as absolute truth. Batteries 70 | * (especially failing batteries) are delicate hardware, and the values 71 | * reported here are best estimates based on what that hardware reports. It's 72 | * not uncommon for older batteries to lose stored power much faster than it 73 | * reports, or completely drain when reporting it has 20 percent left, etc. 74 | * 75 | * Battery status can change at any time; if you are concerned with power 76 | * state, you should call this function frequently, and perhaps ignore changes 77 | * until they seem to be stable for a few seconds. 78 | * 79 | * It's possible a platform can only report battery percentage or time left 80 | * but not both. 81 | * 82 | * \param seconds a pointer filled in with the seconds of battery life left, 83 | * or NULL to ignore. This will be filled in with -1 if we 84 | * can't determine a value or there is no battery. 85 | * \param percent a pointer filled in with the percentage of battery life 86 | * left, between 0 and 100, or NULL to ignore. This will be 87 | * filled in with -1 we can't determine a value or there is no 88 | * battery. 89 | * \returns the current battery state or `SDL_POWERSTATE_ERROR` on failure; 90 | * call SDL_GetError() for more information. 91 | * 92 | * \since This function is available since SDL 3.2.0. 93 | */ 94 | extern SDL_DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *seconds, int *percent); 95 | 96 | /* Ends C function definitions when using C++ */ 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | #include 101 | 102 | #endif /* SDL_power_h_ */ 103 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Headers/SDL_revision.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* WIKI CATEGORY: Version */ 23 | 24 | /* 25 | * SDL_revision.h contains the SDL revision, which might be defined on the 26 | * compiler command line, or generated right into the header itself by the 27 | * build system. 28 | */ 29 | 30 | #ifndef SDL_revision_h_ 31 | #define SDL_revision_h_ 32 | 33 | #ifdef SDL_WIKI_DOCUMENTATION_SECTION 34 | 35 | /** 36 | * This macro is a string describing the source at a particular point in 37 | * development. 38 | * 39 | * This string is often generated from revision control's state at build time. 40 | * 41 | * This string can be quite complex and does not follow any standard. For 42 | * example, it might be something like "SDL-prerelease-3.1.1-47-gf687e0732". 43 | * It might also be user-defined at build time, so it's best to treat it as a 44 | * clue in debugging forensics and not something the app will parse in any 45 | * way. 46 | * 47 | * \since This macro is available since SDL 3.2.0. 48 | */ 49 | #define SDL_REVISION "Some arbitrary string decided at SDL build time" 50 | #elif defined(SDL_VENDOR_INFO) 51 | #define SDL_REVISION SDL_VENDOR_INFO 52 | #else 53 | #define SDL_REVISION "" 54 | #endif 55 | 56 | #endif /* SDL_revision_h_ */ 57 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | SDL3 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | org.libsdl.SDL3 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 23 | CFBundleShortVersionString 24 | 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 1997-2025 Sam Lantinga 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | 19 | -------------------------------------------------------------------------------- /Xcode/iOS/SDL3.framework/README.md: -------------------------------------------------------------------------------- 1 | 2 | Simple DirectMedia Layer (SDL for short) is a cross-platform library 3 | designed to make it easy to write multi-media software, such as games 4 | and emulators. 5 | 6 | You can find the latest release and additional information at: 7 | https://www.libsdl.org/ 8 | 9 | Installation instructions and a quick introduction is available in 10 | [INSTALL.md](INSTALL.md) 11 | 12 | This library is distributed under the terms of the zlib license, 13 | available in [LICENSE.txt](LICENSE.txt). 14 | 15 | Enjoy! 16 | 17 | Sam Lantinga (slouken@libsdl.org) 18 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/SDL3.tbd: -------------------------------------------------------------------------------- 1 | Versions/Current/SDL3.tbd -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * Main include header for the SDL library, version 3.2.6 24 | * 25 | * It is almost always best to include just this one header instead of 26 | * picking out individual headers included here. There are exceptions to 27 | * this rule--SDL_main.h is special and not included here--but usually 28 | * letting SDL.h include the kitchen sink for you is the correct approach. 29 | */ 30 | 31 | #ifndef SDL_h_ 32 | #define SDL_h_ 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | #include 85 | #include 86 | #include 87 | #include 88 | #include 89 | 90 | #endif /* SDL_h_ */ 91 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* 23 | * This file reverses the effects of SDL_begin_code.h and should be included 24 | * after you finish any function and structure declarations in your headers. 25 | * 26 | * SDL's headers use this; applications generally should not include this 27 | * header directly. 28 | */ 29 | 30 | #ifndef SDL_begin_code_h 31 | #error SDL_close_code.h included without matching SDL_begin_code.h 32 | #endif 33 | #undef SDL_begin_code_h 34 | 35 | /* Reset structure packing at previous byte alignment */ 36 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 37 | #ifdef __BORLANDC__ 38 | #pragma nopackwarning 39 | #endif 40 | #pragma pack(pop) 41 | #endif /* Compiler needs structure packing set */ 42 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* Header file containing SDL's license. */ 23 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_guid.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* WIKI CATEGORY: GUID */ 23 | 24 | /** 25 | * # CategoryGUID 26 | * 27 | * A GUID is a 128-bit value that represents something that is uniquely 28 | * identifiable by this value: "globally unique." 29 | * 30 | * SDL provides functions to convert a GUID to/from a string. 31 | */ 32 | 33 | #ifndef SDL_guid_h_ 34 | #define SDL_guid_h_ 35 | 36 | #include 37 | 38 | #include 39 | /* Set up for C function definitions, even when using C++ */ 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /** 45 | * An SDL_GUID is a 128-bit identifier for an input device that identifies 46 | * that device across runs of SDL programs on the same platform. 47 | * 48 | * If the device is detached and then re-attached to a different port, or if 49 | * the base system is rebooted, the device should still report the same GUID. 50 | * 51 | * GUIDs are as precise as possible but are not guaranteed to distinguish 52 | * physically distinct but equivalent devices. For example, two game 53 | * controllers from the same vendor with the same product ID and revision may 54 | * have the same GUID. 55 | * 56 | * GUIDs may be platform-dependent (i.e., the same device may report different 57 | * GUIDs on different operating systems). 58 | * 59 | * \since This struct is available since SDL 3.2.0. 60 | */ 61 | typedef struct SDL_GUID { 62 | Uint8 data[16]; 63 | } SDL_GUID; 64 | 65 | /* Function prototypes */ 66 | 67 | /** 68 | * Get an ASCII string representation for a given SDL_GUID. 69 | * 70 | * \param guid the SDL_GUID you wish to convert to string. 71 | * \param pszGUID buffer in which to write the ASCII string. 72 | * \param cbGUID the size of pszGUID, should be at least 33 bytes. 73 | * 74 | * \threadsafety It is safe to call this function from any thread. 75 | * 76 | * \since This function is available since SDL 3.2.0. 77 | * 78 | * \sa SDL_StringToGUID 79 | */ 80 | extern SDL_DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); 81 | 82 | /** 83 | * Convert a GUID string into a SDL_GUID structure. 84 | * 85 | * Performs no error checking. If this function is given a string containing 86 | * an invalid GUID, the function will silently succeed, but the GUID generated 87 | * will not be useful. 88 | * 89 | * \param pchGUID string containing an ASCII representation of a GUID. 90 | * \returns a SDL_GUID structure. 91 | * 92 | * \threadsafety It is safe to call this function from any thread. 93 | * 94 | * \since This function is available since SDL 3.2.0. 95 | * 96 | * \sa SDL_GUIDToString 97 | */ 98 | extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_StringToGUID(const char *pchGUID); 99 | 100 | /* Ends C function definitions when using C++ */ 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | #include 105 | 106 | #endif /* SDL_guid_h_ */ 107 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_metal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * # CategoryMetal 24 | * 25 | * Functions to creating Metal layers and views on SDL windows. 26 | * 27 | * This provides some platform-specific glue for Apple platforms. Most macOS 28 | * and iOS apps can use SDL without these functions, but this API they can be 29 | * useful for specific OS-level integration tasks. 30 | */ 31 | 32 | #ifndef SDL_metal_h_ 33 | #define SDL_metal_h_ 34 | 35 | #include 36 | 37 | #include 38 | /* Set up for C function definitions, even when using C++ */ 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /** 44 | * A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). 45 | * 46 | * \since This datatype is available since SDL 3.2.0. 47 | */ 48 | typedef void *SDL_MetalView; 49 | 50 | /** 51 | * \name Metal support functions 52 | */ 53 | /* @{ */ 54 | 55 | /** 56 | * Create a CAMetalLayer-backed NSView/UIView and attach it to the specified 57 | * window. 58 | * 59 | * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on 60 | * its own. It is up to user code to do that. 61 | * 62 | * The returned handle can be casted directly to a NSView or UIView. To access 63 | * the backing CAMetalLayer, call SDL_Metal_GetLayer(). 64 | * 65 | * \param window the window. 66 | * \returns handle NSView or UIView. 67 | * 68 | * \since This function is available since SDL 3.2.0. 69 | * 70 | * \sa SDL_Metal_DestroyView 71 | * \sa SDL_Metal_GetLayer 72 | */ 73 | extern SDL_DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window *window); 74 | 75 | /** 76 | * Destroy an existing SDL_MetalView object. 77 | * 78 | * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was 79 | * called after SDL_CreateWindow. 80 | * 81 | * \param view the SDL_MetalView object. 82 | * 83 | * \since This function is available since SDL 3.2.0. 84 | * 85 | * \sa SDL_Metal_CreateView 86 | */ 87 | extern SDL_DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); 88 | 89 | /** 90 | * Get a pointer to the backing CAMetalLayer for the given view. 91 | * 92 | * \param view the SDL_MetalView object. 93 | * \returns a pointer. 94 | * 95 | * \since This function is available since SDL 3.2.0. 96 | */ 97 | extern SDL_DECLSPEC void * SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); 98 | 99 | /* @} *//* Metal support functions */ 100 | 101 | /* Ends C function definitions when using C++ */ 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | #include 106 | 107 | #endif /* SDL_metal_h_ */ 108 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * # CategoryMisc 24 | * 25 | * SDL API functions that don't fit elsewhere. 26 | */ 27 | 28 | #ifndef SDL_misc_h_ 29 | #define SDL_misc_h_ 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | /* Set up for C function definitions, even when using C++ */ 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * Open a URL/URI in the browser or other appropriate external application. 43 | * 44 | * Open a URL in a separate, system-provided application. How this works will 45 | * vary wildly depending on the platform. This will likely launch what makes 46 | * sense to handle a specific URL's protocol (a web browser for `http://`, 47 | * etc), but it might also be able to launch file managers for directories and 48 | * other things. 49 | * 50 | * What happens when you open a URL varies wildly as well: your game window 51 | * may lose focus (and may or may not lose focus if your game was fullscreen 52 | * or grabbing input at the time). On mobile devices, your app will likely 53 | * move to the background or your process might be paused. Any given platform 54 | * may or may not handle a given URL. 55 | * 56 | * If this is unimplemented (or simply unavailable) for a platform, this will 57 | * fail with an error. A successful result does not mean the URL loaded, just 58 | * that we launched _something_ to handle it (or at least believe we did). 59 | * 60 | * All this to say: this function can be useful, but you should definitely 61 | * test it on every platform you target. 62 | * 63 | * \param url a valid URL/URI to open. Use `file:///full/path/to/file` for 64 | * local files, if supported. 65 | * \returns true on success or false on failure; call SDL_GetError() for more 66 | * information. 67 | * 68 | * \since This function is available since SDL 3.2.0. 69 | */ 70 | extern SDL_DECLSPEC bool SDLCALL SDL_OpenURL(const char *url); 71 | 72 | /* Ends C function definitions when using C++ */ 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | #include 77 | 78 | #endif /* SDL_misc_h_ */ 79 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* 23 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 24 | */ 25 | 26 | #include 27 | 28 | #ifdef SDL_PLATFORM_IOS 29 | #include 30 | #include 31 | #else 32 | #include 33 | #include 34 | #endif 35 | 36 | #ifndef APIENTRY 37 | #define APIENTRY 38 | #endif 39 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* 23 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 24 | */ 25 | 26 | #include 27 | 28 | #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) 29 | 30 | #ifdef SDL_PLATFORM_IOS 31 | #include 32 | #include 33 | #else 34 | #include 35 | #include 36 | #include 37 | #endif 38 | 39 | #else /* _MSC_VER */ 40 | 41 | /* OpenGL ES2 headers for Visual Studio */ 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #endif /* _MSC_VER */ 48 | 49 | #ifndef APIENTRY 50 | #define APIENTRY GL_APIENTRY 51 | #endif 52 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* 5 | ** Copyright 2017-2020 The Khronos Group Inc. 6 | ** SPDX-License-Identifier: Apache-2.0 7 | */ 8 | 9 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 10 | * 11 | * Adopters may modify khrplatform.h and this file to suit their platform. 12 | * Please contribute modifications back to Khronos as pull requests on the 13 | * public github repository: 14 | * https://github.com/KhronosGroup/OpenGL-Registry 15 | */ 16 | 17 | /*#include */ 18 | 19 | #ifndef GL_APICALL 20 | #define GL_APICALL KHRONOS_APICALL 21 | #endif 22 | 23 | #ifndef GL_APIENTRY 24 | #define GL_APIENTRY KHRONOS_APIENTRY 25 | #endif 26 | 27 | #endif /* __gl2platform_h_ */ 28 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * # CategoryPlatform 24 | * 25 | * SDL provides a means to identify the app's platform, both at compile time 26 | * and runtime. 27 | */ 28 | 29 | #ifndef SDL_platform_h_ 30 | #define SDL_platform_h_ 31 | 32 | #include 33 | 34 | #include 35 | /* Set up for C function definitions, even when using C++ */ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * Get the name of the platform. 42 | * 43 | * Here are the names returned for some (but not all) supported platforms: 44 | * 45 | * - "Windows" 46 | * - "macOS" 47 | * - "Linux" 48 | * - "iOS" 49 | * - "Android" 50 | * 51 | * \returns the name of the platform. If the correct platform name is not 52 | * available, returns a string beginning with the text "Unknown". 53 | * 54 | * \since This function is available since SDL 3.2.0. 55 | */ 56 | extern SDL_DECLSPEC const char * SDLCALL SDL_GetPlatform(void); 57 | 58 | /* Ends C function definitions when using C++ */ 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | #include 63 | 64 | #endif /* SDL_platform_h_ */ 65 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDL_power_h_ 23 | #define SDL_power_h_ 24 | 25 | /** 26 | * # CategoryPower 27 | * 28 | * SDL power management routines. 29 | * 30 | * There is a single function in this category: SDL_GetPowerInfo(). 31 | * 32 | * This function is useful for games on the go. This allows an app to know if 33 | * it's running on a draining battery, which can be useful if the app wants to 34 | * reduce processing, or perhaps framerate, to extend the duration of the 35 | * battery's charge. Perhaps the app just wants to show a battery meter when 36 | * fullscreen, or alert the user when the power is getting extremely low, so 37 | * they can save their game. 38 | */ 39 | 40 | #include 41 | #include 42 | 43 | #include 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * The basic state for the system's power supply. 51 | * 52 | * These are results returned by SDL_GetPowerInfo(). 53 | * 54 | * \since This enum is available since SDL 3.2.0. 55 | */ 56 | typedef enum SDL_PowerState 57 | { 58 | SDL_POWERSTATE_ERROR = -1, /**< error determining power status */ 59 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ 60 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ 61 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ 62 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ 63 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ 64 | } SDL_PowerState; 65 | 66 | /** 67 | * Get the current power supply details. 68 | * 69 | * You should never take a battery status as absolute truth. Batteries 70 | * (especially failing batteries) are delicate hardware, and the values 71 | * reported here are best estimates based on what that hardware reports. It's 72 | * not uncommon for older batteries to lose stored power much faster than it 73 | * reports, or completely drain when reporting it has 20 percent left, etc. 74 | * 75 | * Battery status can change at any time; if you are concerned with power 76 | * state, you should call this function frequently, and perhaps ignore changes 77 | * until they seem to be stable for a few seconds. 78 | * 79 | * It's possible a platform can only report battery percentage or time left 80 | * but not both. 81 | * 82 | * \param seconds a pointer filled in with the seconds of battery life left, 83 | * or NULL to ignore. This will be filled in with -1 if we 84 | * can't determine a value or there is no battery. 85 | * \param percent a pointer filled in with the percentage of battery life 86 | * left, between 0 and 100, or NULL to ignore. This will be 87 | * filled in with -1 we can't determine a value or there is no 88 | * battery. 89 | * \returns the current battery state or `SDL_POWERSTATE_ERROR` on failure; 90 | * call SDL_GetError() for more information. 91 | * 92 | * \since This function is available since SDL 3.2.0. 93 | */ 94 | extern SDL_DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *seconds, int *percent); 95 | 96 | /* Ends C function definitions when using C++ */ 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | #include 101 | 102 | #endif /* SDL_power_h_ */ 103 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Headers/SDL_revision.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* WIKI CATEGORY: Version */ 23 | 24 | /* 25 | * SDL_revision.h contains the SDL revision, which might be defined on the 26 | * compiler command line, or generated right into the header itself by the 27 | * build system. 28 | */ 29 | 30 | #ifndef SDL_revision_h_ 31 | #define SDL_revision_h_ 32 | 33 | #ifdef SDL_WIKI_DOCUMENTATION_SECTION 34 | 35 | /** 36 | * This macro is a string describing the source at a particular point in 37 | * development. 38 | * 39 | * This string is often generated from revision control's state at build time. 40 | * 41 | * This string can be quite complex and does not follow any standard. For 42 | * example, it might be something like "SDL-prerelease-3.1.1-47-gf687e0732". 43 | * It might also be user-defined at build time, so it's best to treat it as a 44 | * clue in debugging forensics and not something the app will parse in any 45 | * way. 46 | * 47 | * \since This macro is available since SDL 3.2.0. 48 | */ 49 | #define SDL_REVISION "Some arbitrary string decided at SDL build time" 50 | #elif defined(SDL_VENDOR_INFO) 51 | #define SDL_REVISION SDL_VENDOR_INFO 52 | #else 53 | #define SDL_REVISION "" 54 | #endif 55 | 56 | #endif /* SDL_revision_h_ */ 57 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | SDL3 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | org.libsdl.SDL3 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 23 | CFBundleShortVersionString 24 | 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Resources/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 1997-2025 Sam Lantinga 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | 19 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/A/Resources/README.md: -------------------------------------------------------------------------------- 1 | 2 | Simple DirectMedia Layer (SDL for short) is a cross-platform library 3 | designed to make it easy to write multi-media software, such as games 4 | and emulators. 5 | 6 | You can find the latest release and additional information at: 7 | https://www.libsdl.org/ 8 | 9 | Installation instructions and a quick introduction is available in 10 | [INSTALL.md](INSTALL.md) 11 | 12 | This library is distributed under the terms of the zlib license, 13 | available in [LICENSE.txt](LICENSE.txt). 14 | 15 | Enjoy! 16 | 17 | Sam Lantinga (slouken@libsdl.org) 18 | -------------------------------------------------------------------------------- /Xcode/macOS/SDL3.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /Xcode/pkg-support/SDL_ttf.info: -------------------------------------------------------------------------------- 1 | Title SDL_ttf 2.0.7 2 | Version 1 3 | Description SDL_ttf Library for Mac OS X (http://www.libsdl.org/projects/SDL_ttf) 4 | DefaultLocation /Library/Frameworks 5 | Diskname (null) 6 | DeleteWarning 7 | NeedsAuthorization NO 8 | DisableStop NO 9 | UseUserMask NO 10 | Application NO 11 | Relocatable YES 12 | Required NO 13 | InstallOnly NO 14 | RequiresReboot NO 15 | InstallFat NO 16 | -------------------------------------------------------------------------------- /Xcode/pkg-support/mkpackage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Generic script to create a package with Project Builder in mind 4 | # There should only be one version of this script for all projects! 5 | 6 | FRAMEWORK="$1" 7 | VARIANT="$2" 8 | 9 | PACKAGE="$FRAMEWORK" 10 | PACKAGE_RESOURCES="pkg-support/resources" 11 | 12 | echo "Building package for $FRAMEWORK.framework" 13 | echo "Will fetch resources from $PACKAGE_RESOURCES" 14 | echo "Will create the package $PACKAGE.pkg" 15 | 16 | # create a copy of the framework 17 | mkdir -p build/pkg-tmp 18 | xcrun CpMac -r "build/$FRAMEWORK.framework" build/pkg-tmp/ 19 | 20 | ./package build/pkg-tmp "pkg-support/$PACKAGE.info" -d build -r "$PACKAGE_RESOURCES" 21 | 22 | # remove temporary files 23 | rm -rf build/pkg-tmp 24 | 25 | # compress 26 | (cd build; tar -zcvf "$PACKAGE.pkg.tar.gz" "$PACKAGE.pkg") 27 | 28 | -------------------------------------------------------------------------------- /Xcode/pkg-support/resources/CMake/SDL3_ttfConfig.cmake: -------------------------------------------------------------------------------- 1 | # SDL3_ttf CMake configuration file: 2 | # This file is meant to be placed in Resources/CMake of a SDL3_ttf framework 3 | 4 | # INTERFACE_LINK_OPTIONS needs CMake 3.12 5 | cmake_minimum_required(VERSION 3.12...3.28) 6 | 7 | include(FeatureSummary) 8 | set_package_properties(SDL3_ttf PROPERTIES 9 | URL "https://www.libsdl.org/projects/SDL_ttf/" 10 | DESCRIPTION "Support for TrueType (.ttf) font files with Simple Directmedia Layer" 11 | ) 12 | 13 | # Copied from `configure_package_config_file` 14 | macro(check_required_components _NAME) 15 | foreach(comp ${${_NAME}_FIND_COMPONENTS}) 16 | if(NOT ${_NAME}_${comp}_FOUND) 17 | if(${_NAME}_FIND_REQUIRED_${comp}) 18 | set(${_NAME}_FOUND FALSE) 19 | endif() 20 | endif() 21 | endforeach() 22 | endmacro() 23 | 24 | set(SDL3_ttf_FOUND TRUE) 25 | 26 | set(SDLTTF_VENDORED TRUE) 27 | 28 | set(SDLTTF_HARFBUZZ TRUE) 29 | set(SDLTTF_FREETYPE TRUE) 30 | 31 | # Compute the installation prefix relative to this file. 32 | set(_sdl3_ttf_framework_path "${CMAKE_CURRENT_LIST_DIR}") # > /SDL3_ttf.framework/Resources/CMake/ 33 | get_filename_component(_sdl3_ttf_framework_path "${_sdl3_ttf_framework_path}" REALPATH) # > /SDL3_ttf.framework/Versions/Current/Resources/CMake 34 | get_filename_component(_sdl3_ttf_framework_path "${_sdl3_ttf_framework_path}" REALPATH) # > /SDL3_ttf.framework/Versions/A/Resources/CMake/ 35 | get_filename_component(_sdl3_ttf_framework_path "${_sdl3_ttf_framework_path}" PATH) # > /SDL3_ttf.framework/Versions/A/Resources/ 36 | get_filename_component(_sdl3_ttf_framework_path "${_sdl3_ttf_framework_path}" PATH) # > /SDL3_ttf.framework/Versions/A/ 37 | get_filename_component(_sdl3_ttf_framework_path "${_sdl3_ttf_framework_path}" PATH) # > /SDL3_ttf.framework/Versions/ 38 | get_filename_component(_sdl3_ttf_framework_path "${_sdl3_ttf_framework_path}" PATH) # > /SDL3_ttf.framework/ 39 | get_filename_component(_sdl3_ttf_framework_parent_path "${_sdl3_ttf_framework_path}" PATH) # > / 40 | 41 | # All targets are created, even when some might not be requested though COMPONENTS. 42 | # This is done for compatibility with CMake generated SDL3_ttf-target.cmake files. 43 | 44 | if(NOT TARGET SDL3_ttf::SDL3_ttf-shared) 45 | add_library(SDL3_ttf::SDL3_ttf-shared SHARED IMPORTED) 46 | set_target_properties(SDL3_ttf::SDL3_ttf-shared 47 | PROPERTIES 48 | FRAMEWORK "TRUE" 49 | IMPORTED_LOCATION "${_sdl_ttf_framework_path}/SDL3_ttf" 50 | COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" 51 | INTERFACE_SDL3_SHARED "ON" 52 | COMPATIBLE_INTERFACE_STRING "SDL_VERSION" 53 | INTERFACE_SDL_VERSION "SDL3" 54 | ) 55 | endif() 56 | set(SDL3_ttf_SDL3_ttf-shared_FOUND TRUE) 57 | 58 | set(SDL3_ttf_SDL3_ttf-static_FOUND FALSE) 59 | 60 | unset(_sdl3_ttf_framework_path) 61 | unset(_sdl3_ttf_framework_parent_path) 62 | 63 | set(SDL3_ttf_SDL3_ttf_FOUND FALSE) 64 | if(SDL3_ttf_SDL3_ttf-shared_FOUND OR SDL3_ttf_SDL3_ttf-static_FOUND) 65 | set(SDL3_ttf_SDL3_ttf_FOUND TRUE) 66 | endif() 67 | 68 | function(_sdl_create_target_alias_compat NEW_TARGET TARGET) 69 | if(CMAKE_VERSION VERSION_LESS "3.18") 70 | # Aliasing local targets is not supported on CMake < 3.18, so make it global. 71 | add_library(${NEW_TARGET} INTERFACE IMPORTED) 72 | set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}") 73 | else() 74 | add_library(${NEW_TARGET} ALIAS ${TARGET}) 75 | endif() 76 | endfunction() 77 | 78 | # Make sure SDL3_ttf::SDL3_ttf always exists 79 | if(NOT TARGET SDL3_ttf::SDL3_ttf) 80 | if(TARGET SDL3_ttf::SDL3_ttf-shared) 81 | _sdl_create_target_alias_compat(SDL3_ttf::SDL3_ttf SDL3_ttf::SDL3_ttf-shared) 82 | endif() 83 | endif() 84 | 85 | check_required_components(SDL3_ttf) 86 | -------------------------------------------------------------------------------- /Xcode/pkg-support/resources/CMake/SDL3_ttfConfigVersion.cmake: -------------------------------------------------------------------------------- 1 | # based on the files generated by CMake's write_basic_package_version_file 2 | 3 | # SDL3_ttf CMake version configuration file: 4 | # This file is meant to be placed in Resources/CMake of a SDL3_ttf framework 5 | 6 | if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_ttf.h") 7 | message(AUTHOR_WARNING "Could not find SDL_ttf.h. This script is meant to be placed in the Resources/CMake directory of SDL3_ttf.framework") 8 | return() 9 | endif() 10 | 11 | file(READ "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_ttf.h" _sdl_ttf_h) 12 | string(REGEX MATCH "#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_ttf_h}") 13 | set(_sdl_major "${CMAKE_MATCH_1}") 14 | string(REGEX MATCH "#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_ttf_h}") 15 | set(_sdl_minor "${CMAKE_MATCH_1}") 16 | string(REGEX MATCH "#define[ \t]+SDL_TTF_MICRO_VERSION[ \t]+([0-9]+)" _sdl_micro_re "${_sdl_ttf_h}") 17 | set(_sdl_micro "${CMAKE_MATCH_1}") 18 | if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re) 19 | set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}") 20 | else() 21 | message(AUTHOR_WARNING "Could not extract version from SDL_ttf.h.") 22 | return() 23 | endif() 24 | 25 | if(PACKAGE_FIND_VERSION_RANGE) 26 | # Package version must be in the requested version range 27 | if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN) 28 | OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX) 29 | OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX))) 30 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 31 | else() 32 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 33 | endif() 34 | else() 35 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 36 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 37 | else() 38 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 39 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 40 | set(PACKAGE_VERSION_EXACT TRUE) 41 | endif() 42 | endif() 43 | endif() 44 | 45 | # if the using project doesn't have CMAKE_SIZEOF_VOID_P set, fail. 46 | if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") 47 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 48 | endif() 49 | -------------------------------------------------------------------------------- /Xcode/pkg-support/resources/INSTALL.md: -------------------------------------------------------------------------------- 1 | 2 | # Using this package 3 | 4 | This package contains SDL_ttf built for Xcode, and includes support for macOS, iOS and tvOS. 5 | 6 | To use this package in Xcode, drag `SDL3_ttf.xcframework` into your project. 7 | 8 | To use this package in a CMake project, copy both `SDL3_ttf.xcframework` and `share` to `~/Library/Frameworks`. 9 | 10 | # Documentation 11 | 12 | An API reference and additional documentation is available at: 13 | 14 | https://wiki.libsdl.org/SDL3_ttf 15 | 16 | # Discussions 17 | 18 | ## Discord 19 | 20 | You can join the official Discord server at: 21 | 22 | https://discord.com/invite/BwpFGBWsv8 23 | 24 | ## Forums/mailing lists 25 | 26 | You can join SDL development discussions at: 27 | 28 | https://discourse.libsdl.org/ 29 | 30 | Once you sign up, you can use the forum through the website or as a mailing list from your email client. 31 | 32 | ## Announcement list 33 | 34 | You can sign up for the low traffic announcement list at: 35 | 36 | https://www.libsdl.org/mailing-list.php 37 | 38 | -------------------------------------------------------------------------------- /Xcode/pkg-support/resources/SDL_DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libsdl-org/SDL_ttf/ffa54ca2ec6b89b4f6dc92ab113484cfa2ccc3a7/Xcode/pkg-support/resources/SDL_DS_Store -------------------------------------------------------------------------------- /Xcode/pkg-support/resources/framework/INSTALL.md: -------------------------------------------------------------------------------- 1 | 2 | # Using this package 3 | 4 | This package contains SDL_ttf built for Xcode. 5 | 6 | To use this package in Xcode, drag `SDL3_ttf.framework` into your project. 7 | 8 | # Documentation 9 | 10 | An API reference and additional documentation is available at: 11 | 12 | https://wiki.libsdl.org/SDL3_ttf 13 | 14 | # Discussions 15 | 16 | ## Discord 17 | 18 | You can join the official Discord server at: 19 | 20 | https://discord.com/invite/BwpFGBWsv8 21 | 22 | ## Forums/mailing lists 23 | 24 | You can join SDL development discussions at: 25 | 26 | https://discourse.libsdl.org/ 27 | 28 | Once you sign up, you can use the forum through the website or as a mailing list from your email client. 29 | 30 | ## Announcement list 31 | 32 | You can sign up for the low traffic announcement list at: 33 | 34 | https://www.libsdl.org/mailing-list.php 35 | 36 | -------------------------------------------------------------------------------- /Xcode/pkg-support/sdl_logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libsdl-org/SDL_ttf/ffa54ca2ec6b89b4f6dc92ab113484cfa2ccc3a7/Xcode/pkg-support/sdl_logo.pdf -------------------------------------------------------------------------------- /Xcode/pkg-support/share/cmake/SDL3_ttf/SDL3_ttfConfigVersion.cmake: -------------------------------------------------------------------------------- 1 | # based on the files generated by CMake's write_basic_package_version_file 2 | 3 | # SDL CMake version configuration file: 4 | # This file is meant to be placed in share/cmake/SDL3_ttf, next to SDL3_ttf.xcframework 5 | 6 | cmake_minimum_required(VERSION 3.12...3.28) 7 | 8 | get_filename_component(_sdl3_ttf_xcframework_parent_path "${CMAKE_CURRENT_LIST_DIR}" REALPATH) # /share/cmake/SDL3_ttf/ 9 | get_filename_component(_sdl3_ttf_xcframework_parent_path "${_sdl3_ttf_xcframework_parent_path}" REALPATH) # /share/cmake/SDL3_ttf/ 10 | get_filename_component(_sdl3_ttf_xcframework_parent_path "${_sdl3_ttf_xcframework_parent_path}" PATH) # /share/cmake 11 | get_filename_component(_sdl3_ttf_xcframework_parent_path "${_sdl3_ttf_xcframework_parent_path}" PATH) # /share 12 | get_filename_component(_sdl3_ttf_xcframework_parent_path "${_sdl3_ttf_xcframework_parent_path}" PATH) # / 13 | set(_sdl3_ttf_xcframework "${_sdl3_ttf_xcframework_parent_path}/SDL3_ttf.xcframework") # /SDL3_ttf.xcframework 14 | set(_sdl3_ttf_framework "${_sdl3_ttf_xcframework}/macos-arm64_x86_64/SDL3_ttf.framework") # /SDL3_ttf.xcframework/macos-arm64_x86_64/SDL3_ttf.framework 15 | set(_sdl3_ttf_version_h "${_sdl3_ttf_framework}/Headers/SDL_ttf.h") # /SDL3_ttf.xcframework/macos-arm64_x86_64/SDL3_ttf.framework/Headers/SDL_ttf.h 16 | 17 | if(NOT EXISTS "${_sdl3_ttf_version_h}") 18 | message(AUTHOR_WARNING "Cannot not find ${_sdl3_ttf_framework}. This script is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework") 19 | return() 20 | endif() 21 | 22 | file(READ "${_sdl3_ttf_version_h}" _sdl_version_h) 23 | 24 | unset(_sdl3_ttf_xcframework_parent_path) 25 | unset(_sdl3_ttf_framework) 26 | unset(_sdl3_ttf_xcframework) 27 | unset(_sdl3_ttf_version_h) 28 | 29 | string(REGEX MATCH "#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}") 30 | set(_sdl_major "${CMAKE_MATCH_1}") 31 | string(REGEX MATCH "#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}") 32 | set(_sdl_minor "${CMAKE_MATCH_1}") 33 | string(REGEX MATCH "#define[ \t]+SDL_TTF_MICRO_VERSION[ \t]+([0-9]+)" _sdl_micro_re "${_sdl_version_h}") 34 | set(_sdl_micro "${CMAKE_MATCH_1}") 35 | if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re) 36 | set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}") 37 | else() 38 | message(AUTHOR_WARNING "Could not extract version from SDL_ttf.h.") 39 | return() 40 | endif() 41 | 42 | unset(_sdl_major_re) 43 | unset(_sdl_major) 44 | unset(_sdl_minor_re) 45 | unset(_sdl_minor) 46 | unset(_sdl_micro_re) 47 | unset(_sdl_micro) 48 | 49 | if(PACKAGE_FIND_VERSION_RANGE) 50 | # Package version must be in the requested version range 51 | if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN) 52 | OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX) 53 | OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX))) 54 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 55 | else() 56 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 57 | endif() 58 | else() 59 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 60 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 61 | else() 62 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 63 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 64 | set(PACKAGE_VERSION_EXACT TRUE) 65 | endif() 66 | endif() 67 | endif() 68 | 69 | # The SDL3_ttf.xcframework only contains 64-bit archives 70 | if(NOT "${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 71 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 72 | endif() 73 | 74 | if(NOT CMAKE_SYSTEM_NAME MATCHES "^(Darwin|iOS|tvOS)$") 75 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 76 | endif() 77 | -------------------------------------------------------------------------------- /Xcode/showfont/config.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // config.xcconfig 3 | // 4 | 5 | // Configuration settings file format documentation can be found at: 6 | // https://help.apple.com/xcode/#/dev745c5c974 7 | 8 | // Include any optional config for this build 9 | #include? "build.xcconfig" 10 | -------------------------------------------------------------------------------- /Xcode/showfont/macOS/macOS.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build-scripts/SDL_migration.cocci: -------------------------------------------------------------------------------- 1 | @@ 2 | @@ 3 | - TTF_GlyphIsProvided32 4 | + TTF_GlyphIsProvided 5 | (...) 6 | @@ 7 | @@ 8 | - TTF_GlyphMetrics32 9 | + TTF_GlyphMetrics 10 | (...) 11 | @@ 12 | @@ 13 | - TTF_SizeText 14 | + TTF_GetStringSize 15 | (...) 16 | @@ 17 | @@ 18 | - TTF_SizeUTF8 19 | + TTF_GetStringSize 20 | (...) 21 | @@ 22 | @@ 23 | - TTF_MeasureUTF8 24 | + TTF_MeasureString 25 | (...) 26 | @@ 27 | @@ 28 | - TTF_RenderUTF8_Solid 29 | + SDL_RenderText_Solid 30 | (...) 31 | @@ 32 | @@ 33 | - TTF_RenderUTF8_Solid_Wrapped 34 | + TTF_RenderText_Solid_Wrapped 35 | (...) 36 | @@ 37 | @@ 38 | - TTF_RenderGlyph32_Solid 39 | + TTF_RenderGlyph_Solid 40 | (...) 41 | @@ 42 | @@ 43 | - TTF_RenderGlyph32_Solid 44 | + TTF_RenderGlyph_Solid 45 | (...) 46 | @@ 47 | @@ 48 | - TTF_RenderUTF8_Shaded 49 | + TTF_RenderText_Shaded 50 | (...) 51 | @@ 52 | @@ 53 | - TTF_RenderUTF8_Shaded_Wrapped 54 | + TTF_RenderText_Shaded_Wrapped 55 | (...) 56 | @@ 57 | @@ 58 | - TTF_RenderGlyph32_Shaded 59 | + TTF_RenderGlyph_Shaded 60 | (...) 61 | @@ 62 | @@ 63 | - TTF_RenderUTF8_Blended 64 | + TTF_RenderText_Blended 65 | (...) 66 | @@ 67 | @@ 68 | - TTF_RenderUTF8_Blended_Wrapped 69 | + TTF_RenderText_Blended_Wrapped 70 | (...) 71 | @@ 72 | @@ 73 | - TTF_RenderGlyph32_Blended 74 | + TTF_RenderGlyph_Blended 75 | (...) 76 | @@ 77 | @@ 78 | - TTF_RenderUTF8_LCD 79 | + TTF_RenderText_LCD 80 | (...) 81 | @@ 82 | @@ 83 | - TTF_RenderUTF8_LCD_Wrapped 84 | + TTF_RenderText_LCD_Wrapped 85 | (...) 86 | @@ 87 | @@ 88 | - TTF_RenderGlyph32_LCD 89 | + TTF_RenderGlyph_LCD 90 | (...) 91 | @@ 92 | @@ 93 | - TTF_WRAPPED_ALIGN_LEFT 94 | + TTF_HORIZONTAL_ALIGN_LEFT 95 | @@ 96 | @@ 97 | - TTF_WRAPPED_ALIGN_CENTER 98 | + TTF_HORIZONTAL_ALIGN_CENTER 99 | @@ 100 | @@ 101 | - TTF_WRAPPED_ALIGN_RIGHT 102 | + TTF_HORIZONTAL_ALIGN_RIGHT 103 | @@ 104 | @@ 105 | - TTF_GetFontWrappedAlign 106 | + TTF_GetFontWrapAlignment 107 | (...) 108 | @@ 109 | @@ 110 | - TTF_SetFontWrappedAlign 111 | + TTF_SetFontWrapAlignment 112 | (...) 113 | @@ 114 | @@ 115 | - TTF_FontHeight 116 | + TTF_GetFontHeight 117 | (...) 118 | @@ 119 | @@ 120 | - TTF_FontAscent 121 | + TTF_GetFontAscent 122 | (...) 123 | @@ 124 | @@ 125 | - TTF_FontDescent 126 | + TTF_GetFontDescent 127 | (...) 128 | @@ 129 | @@ 130 | - TTF_FontLineSkip 131 | + TTF_GetFontLineSkip 132 | (...) 133 | @@ 134 | @@ 135 | - TTF_FontFaces 136 | + TTF_GetNumFontFaces 137 | (...) 138 | @@ 139 | @@ 140 | - TTF_FontFaceIsFixedWidth 141 | + TTF_FontIsFixedWidth 142 | (...) 143 | @@ 144 | @@ 145 | - TTF_FontFaceFamilyName 146 | + TTF_GetFontFamilyName 147 | (...) 148 | @@ 149 | @@ 150 | - TTF_FontFaceStyleName 151 | + TTF_GetFontStyleName 152 | (...) 153 | @@ 154 | @@ 155 | - TTF_GlyphIsProvided 156 | + TTF_FontHasGlyph 157 | (...) 158 | @@ 159 | @@ 160 | - TTF_GlyphMetrics 161 | + TTF_GetGlyphMetrics 162 | (...) 163 | @@ 164 | @@ 165 | - TTF_IsFontScalable 166 | + TTF_FontIsScalable 167 | (...) 168 | @@ 169 | @@ 170 | - TTF_SetFontScriptName 171 | + TTF_SetFontScript 172 | (...) 173 | -------------------------------------------------------------------------------- /build-scripts/cmake-toolchain-mingw64-i686.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Windows) 2 | set(CMAKE_SYSTEM_PROCESSOR x86) 3 | 4 | find_program(CMAKE_C_COMPILER NAMES i686-w64-mingw32-gcc) 5 | find_program(CMAKE_CXX_COMPILER NAMES i686-w64-mingw32-g++) 6 | find_program(CMAKE_RC_COMPILER NAMES i686-w64-mingw32-windres windres) 7 | 8 | if(NOT CMAKE_C_COMPILER) 9 | message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.") 10 | endif() 11 | 12 | if(NOT CMAKE_CXX_COMPILER) 13 | message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.") 14 | endif() 15 | 16 | if(NOT CMAKE_RC_COMPILER) 17 | message(FATAL_ERROR "Failed to find CMAKE_RC_COMPILER.") 18 | endif() 19 | -------------------------------------------------------------------------------- /build-scripts/cmake-toolchain-mingw64-x86_64.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Windows) 2 | set(CMAKE_SYSTEM_PROCESSOR x86_64) 3 | 4 | find_program(CMAKE_C_COMPILER NAMES x86_64-w64-mingw32-gcc) 5 | find_program(CMAKE_CXX_COMPILER NAMES x86_64-w64-mingw32-g++) 6 | find_program(CMAKE_RC_COMPILER NAMES x86_64-w64-mingw32-windres windres) 7 | 8 | if(NOT CMAKE_C_COMPILER) 9 | message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.") 10 | endif() 11 | 12 | if(NOT CMAKE_CXX_COMPILER) 13 | message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.") 14 | endif() 15 | 16 | if(NOT CMAKE_RC_COMPILER) 17 | message(FATAL_ERROR "Failed to find CMAKE_RC_COMPILER.") 18 | endif() 19 | -------------------------------------------------------------------------------- /build-scripts/create-release.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import argparse 4 | from pathlib import Path 5 | import json 6 | import logging 7 | import re 8 | import subprocess 9 | 10 | ROOT = Path(__file__).resolve().parents[1] 11 | 12 | 13 | def determine_remote() -> str: 14 | text = (ROOT / "build-scripts/release-info.json").read_text() 15 | release_info = json.loads(text) 16 | if "remote" in release_info: 17 | return release_info["remote"] 18 | project_with_version = release_info["name"] 19 | project, _ = re.subn("([^a-zA-Z_])", "", project_with_version) 20 | return f"libsdl-org/{project}" 21 | 22 | 23 | def main(): 24 | default_remote = determine_remote() 25 | 26 | parser = argparse.ArgumentParser(allow_abbrev=False) 27 | parser.add_argument("--ref", required=True, help=f"Name of branch or tag containing release.yml") 28 | parser.add_argument("--remote", "-R", default=default_remote, help=f"Remote repo (default={default_remote})") 29 | parser.add_argument("--commit", help=f"Input 'commit' of release.yml (default is the hash of the ref)") 30 | args = parser.parse_args() 31 | 32 | if args.commit is None: 33 | args.commit = subprocess.check_output(["git", "rev-parse", args.ref], cwd=ROOT, text=True).strip() 34 | 35 | 36 | print(f"Running release.yml workflow:") 37 | print(f" remote = {args.remote}") 38 | print(f" ref = {args.ref}") 39 | print(f" commit = {args.commit}") 40 | 41 | subprocess.check_call(["gh", "-R", args.remote, "workflow", "run", "release.yml", "--ref", args.ref, "-f", f"commit={args.commit}"], cwd=ROOT) 42 | 43 | 44 | if __name__ == "__main__": 45 | raise SystemExit(main()) 46 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/android/INSTALL.md.in: -------------------------------------------------------------------------------- 1 | 2 | # Using this package 3 | 4 | This package contains @<@PROJECT_NAME@>@ built for the Android platform. 5 | 6 | ## Gradle integration 7 | 8 | For integration with CMake/ndk-build, it uses [prefab](https://google.github.io/prefab/). 9 | 10 | Copy the aar archive (@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar) to a `app/libs` directory of your project. 11 | 12 | In `app/build.gradle` of your Android project, add: 13 | ``` 14 | android { 15 | /* ... */ 16 | buildFeatures { 17 | prefab true 18 | } 19 | } 20 | dependencies { 21 | implementation files('libs/@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar') 22 | /* ... */ 23 | } 24 | ``` 25 | 26 | If you're using CMake, add the following to your CMakeLists.txt: 27 | ``` 28 | find_package(@<@PROJECT_NAME@>@ REQUIRED CONFIG) 29 | target_link_libraries(yourgame PRIVATE @<@PROJECT_NAME@>@::@<@PROJECT_NAME@>@) 30 | ``` 31 | 32 | If you use ndk-build, add the following before `include $(BUILD_SHARED_LIBRARY)` to your `Android.mk`: 33 | ``` 34 | LOCAL_SHARED_LIBARARIES := @<@PROJECT_NAME@>@ 35 | ``` 36 | And add the following at the bottom: 37 | ``` 38 | # https://google.github.io/prefab/build-systems.html 39 | 40 | # Add the prefab modules to the import path. 41 | $(call import-add-path,/out) 42 | 43 | # Import @<@PROJECT_NAME@>@ so we can depend on it. 44 | $(call import-module,prefab/@<@PROJECT_NAME@>@) 45 | ``` 46 | 47 | --- 48 | 49 | ## Other build systems (advanced) 50 | 51 | If you want to build a project without Gradle, 52 | running the following command will extract the Android archive into a more common directory structure. 53 | ``` 54 | python @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar -o android_prefix 55 | ``` 56 | Add `--help` for a list of all available options. 57 | 58 | # Documentation 59 | 60 | An API reference and additional documentation is available at: 61 | 62 | https://wiki.libsdl.org/@<@PROJECT_NAME@>@ 63 | 64 | # Discussions 65 | 66 | ## Discord 67 | 68 | You can join the official Discord server at: 69 | 70 | https://discord.com/invite/BwpFGBWsv8 71 | 72 | ## Forums/mailing lists 73 | 74 | You can join SDL development discussions at: 75 | 76 | https://discourse.libsdl.org/ 77 | 78 | Once you sign up, you can use the forum through the website or as a mailing list from your email client. 79 | 80 | ## Announcement list 81 | 82 | You can sign up for the low traffic announcement list at: 83 | 84 | https://www.libsdl.org/mailing-list.php 85 | 86 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/android/aar/__main__.py.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | Create a @<@PROJECT_NAME@>@ SDK prefix from an Android archive 5 | This file is meant to be placed in a the root of an android .aar archive 6 | 7 | Example usage: 8 | ```sh 9 | python @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar -o /usr/opt/android-sdks 10 | cmake -S my-project \ 11 | -DCMAKE_PREFIX_PATH=/usr/opt/android-sdks \ 12 | -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \ 13 | -B build-arm64 -DANDROID_ABI=arm64-v8a \ 14 | -DCMAKE_BUILD_TYPE=Releaase 15 | cmake --build build-arm64 16 | ``` 17 | """ 18 | import argparse 19 | import io 20 | import json 21 | import os 22 | import pathlib 23 | import re 24 | import stat 25 | import zipfile 26 | 27 | 28 | AAR_PATH = pathlib.Path(__file__).resolve().parent 29 | ANDROID_ARCHS = { "armeabi-v7a", "arm64-v8a", "x86", "x86_64" } 30 | 31 | 32 | def main(): 33 | parser = argparse.ArgumentParser( 34 | description="Convert a @<@PROJECT_NAME@>@ Android .aar archive into a SDK", 35 | allow_abbrev=False, 36 | ) 37 | parser.add_argument("--version", action="version", version="@<@PROJECT_NAME@>@ @<@PROJECT_VERSION@>@") 38 | parser.add_argument("-o", dest="output", type=pathlib.Path, required=True, help="Folder where to store the SDK") 39 | args = parser.parse_args() 40 | 41 | print(f"Creating a @<@PROJECT_NAME@>@ SDK at {args.output}...") 42 | 43 | prefix = args.output 44 | incdir = prefix / "include" 45 | libdir = prefix / "lib" 46 | 47 | RE_LIB_MODULE_ARCH = re.compile(r"prefab/modules/(?P[A-Za-z0-9_-]+)/libs/android\.(?P[a-zA-Z0-9_-]+)/(?Plib[A-Za-z0-9_]+\.(?:so|a))") 48 | RE_INC_MODULE_ARCH = re.compile(r"prefab/modules/(?P[A-Za-z0-9_-]+)/include/(?P
[a-zA-Z0-9_./-]+)") 49 | RE_LICENSE = re.compile(r"(?:.*/)?(?P(?:license|copying)(?:\.md|\.txt)?)", flags=re.I) 50 | RE_PROGUARD = re.compile(r"(?:.*/)?(?Pproguard.*\.(?:pro|txt))", flags=re.I) 51 | RE_CMAKE = re.compile(r"(?:.*/)?(?P.*\.cmake)", flags=re.I) 52 | 53 | with zipfile.ZipFile(AAR_PATH) as zf: 54 | project_description = json.loads(zf.read("description.json")) 55 | project_name = project_description["name"] 56 | project_version = project_description["version"] 57 | licensedir = prefix / "share/licenses" / project_name 58 | cmakedir = libdir / "cmake" / project_name 59 | javadir = prefix / "share/java" / project_name 60 | javadocdir = prefix / "share/javadoc" / project_name 61 | 62 | def read_zipfile_and_write(path: pathlib.Path, zippath: str): 63 | data = zf.read(zippath) 64 | path.parent.mkdir(parents=True, exist_ok=True) 65 | path.write_bytes(data) 66 | 67 | for zip_info in zf.infolist(): 68 | zippath = zip_info.filename 69 | if m := RE_LIB_MODULE_ARCH.match(zippath): 70 | lib_path = libdir / m["arch"] / m["filename"] 71 | read_zipfile_and_write(lib_path, zippath) 72 | if m["filename"].endswith(".so"): 73 | os.chmod(lib_path, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) 74 | 75 | elif m := RE_INC_MODULE_ARCH.match(zippath): 76 | header_path = incdir / m["header"] 77 | read_zipfile_and_write(header_path, zippath) 78 | elif m:= RE_LICENSE.match(zippath): 79 | license_path = licensedir / m["filename"] 80 | read_zipfile_and_write(license_path, zippath) 81 | elif m:= RE_PROGUARD.match(zippath): 82 | proguard_path = javadir / m["filename"] 83 | read_zipfile_and_write(proguard_path, zippath) 84 | elif m:= RE_CMAKE.match(zippath): 85 | cmake_path = cmakedir / m["filename"] 86 | read_zipfile_and_write(cmake_path, zippath) 87 | elif zippath == "classes.jar": 88 | versioned_jar_path = javadir / f"{project_name}-{project_version}.jar" 89 | unversioned_jar_path = javadir / f"{project_name}.jar" 90 | read_zipfile_and_write(versioned_jar_path, zippath) 91 | os.symlink(src=versioned_jar_path.name, dst=unversioned_jar_path) 92 | elif zippath == "classes-sources.jar": 93 | jarpath = javadir / f"{project_name}-{project_version}-sources.jar" 94 | read_zipfile_and_write(jarpath, zippath) 95 | elif zippath == "classes-doc.jar": 96 | jarpath = javadocdir / f"{project_name}-{project_version}-javadoc.jar" 97 | read_zipfile_and_write(jarpath, zippath) 98 | 99 | print("... done") 100 | return 0 101 | 102 | 103 | if __name__ == "__main__": 104 | raise SystemExit(main()) 105 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/android/aar/cmake/SDL3_ttfConfig.cmake: -------------------------------------------------------------------------------- 1 | # SDL CMake configuration file: 2 | # This file is meant to be placed in lib/cmake/SDL3_ttf subfolder of a reconstructed Android SDL3_ttf SDK 3 | 4 | cmake_minimum_required(VERSION 3.0...3.28) 5 | 6 | include(FeatureSummary) 7 | set_package_properties(SDL3_ttf PROPERTIES 8 | URL "https://www.libsdl.org/projects/SDL_ttf/" 9 | DESCRIPTION "Support for TrueType (.ttf) font files with Simple Directmedia Layer" 10 | ) 11 | 12 | # Copied from `configure_package_config_file` 13 | macro(set_and_check _var _file) 14 | set(${_var} "${_file}") 15 | if(NOT EXISTS "${_file}") 16 | message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") 17 | endif() 18 | endmacro() 19 | 20 | # Copied from `configure_package_config_file` 21 | macro(check_required_components _NAME) 22 | foreach(comp ${${_NAME}_FIND_COMPONENTS}) 23 | if(NOT ${_NAME}_${comp}_FOUND) 24 | if(${_NAME}_FIND_REQUIRED_${comp}) 25 | set(${_NAME}_FOUND FALSE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endmacro() 30 | 31 | set(SDL3_ttf_FOUND TRUE) 32 | 33 | set(SDLTTF_VENDORED TRUE) 34 | 35 | set(SDLTTF_HARFBUZZ TRUE) 36 | set(SDLTTF_FREETYPE TRUE) 37 | 38 | if(SDL_CPU_X86) 39 | set(_sdl_arch_subdir "x86") 40 | elseif(SDL_CPU_X64) 41 | set(_sdl_arch_subdir "x86_64") 42 | elseif(SDL_CPU_ARM32) 43 | set(_sdl_arch_subdir "armeabi-v7a") 44 | elseif(SDL_CPU_ARM64) 45 | set(_sdl_arch_subdir "arm64-v8a") 46 | else() 47 | set(SDL3_ttf_FOUND FALSE) 48 | return() 49 | endif() 50 | 51 | get_filename_component(_sdl3ttf_prefix "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) 52 | get_filename_component(_sdl3ttf_prefix "${_sdl3ttf_prefix}/.." ABSOLUTE) 53 | get_filename_component(_sdl3ttf_prefix "${_sdl3ttf_prefix}/.." ABSOLUTE) 54 | set_and_check(_sdl3ttf_prefix "${_sdl3ttf_prefix}") 55 | set_and_check(_sdl3ttf_include_dirs "${_sdl3ttf_prefix}/include") 56 | 57 | set_and_check(_sdl3ttf_lib "${_sdl3ttf_prefix}/lib/${_sdl_arch_subdir}/libSDL3_ttf.so") 58 | 59 | unset(_sdl_arch_subdir) 60 | unset(_sdl3ttf_prefix) 61 | 62 | # All targets are created, even when some might not be requested though COMPONENTS. 63 | # This is done for compatibility with CMake generated SDL3_ttf-target.cmake files. 64 | 65 | if(EXISTS "${_sdl3ttf_lib}") 66 | if(NOT TARGET SDL3_ttf::SDL3_ttf-shared) 67 | add_library(SDL3_ttf::SDL3_ttf-shared SHARED IMPORTED) 68 | set_target_properties(SDL3_ttf::SDL3_ttf-shared 69 | PROPERTIES 70 | IMPORTED_LOCATION "${_sdl3ttf_lib}" 71 | INTERFACE_INCLUDE_DIRECTORIES "${_sdl3ttf_include_dirs}" 72 | COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" 73 | INTERFACE_sdl3ttf_SHARED "ON" 74 | COMPATIBLE_INTERFACE_STRING "SDL_VERSION" 75 | INTERFACE_SDL_VERSION "SDL3" 76 | ) 77 | endif() 78 | set(SDL3_ttf_sdl3ttf_ttf-shared_FOUND TRUE) 79 | else() 80 | set(SDL3_ttf_sdl3ttf_ttf-shared_FOUND FALSE) 81 | endif() 82 | unset(_sdl3ttf_lib) 83 | unset(_sdl3ttf_include_dirs) 84 | 85 | set(SDL3_ttf_SDL3_ttf-static_FOUND FALSE) 86 | 87 | if(SDL3_ttf_SDL3_ttf-shared_FOUND OR SDL3_ttf_SDL3_ttf-static_FOUND) 88 | set(SDL3_ttf_SDL3_ttf_FOUND TRUE) 89 | endif() 90 | 91 | function(_sdl_create_target_alias_compat NEW_TARGET TARGET) 92 | if(CMAKE_VERSION VERSION_LESS "3.18") 93 | # Aliasing local targets is not supported on CMake < 3.18, so make it global. 94 | add_library(${NEW_TARGET} INTERFACE IMPORTED) 95 | set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}") 96 | else() 97 | add_library(${NEW_TARGET} ALIAS ${TARGET}) 98 | endif() 99 | endfunction() 100 | 101 | # Make sure SDL3_ttf::SDL3_ttf always exists 102 | if(NOT TARGET SDL3_ttf::SDL3_ttf) 103 | if(TARGET SDL3_ttf::SDL3_ttf-shared) 104 | _sdl_create_target_alias_compat(SDL3_ttf::SDL3_ttf SDL3_ttf::SDL3_ttf-shared) 105 | endif() 106 | endif() 107 | 108 | check_required_components(SDL3_ttf) 109 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/android/aar/cmake/SDL3_ttfConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | # based on the files generated by CMake's write_basic_package_version_file 2 | 3 | # SDL_ttf CMake version configuration file: 4 | # This file is meant to be placed in a lib/cmake/SDL3_ttf subfolder of a reconstructed Android SDL3_ttf SDK 5 | 6 | set(PACKAGE_VERSION "@<@PROJECT_VERSION@>@") 7 | 8 | if(PACKAGE_FIND_VERSION_RANGE) 9 | # Package version must be in the requested version range 10 | if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN) 11 | OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX) 12 | OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX))) 13 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 14 | else() 15 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 16 | endif() 17 | else() 18 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 19 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 20 | else() 21 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 22 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 23 | set(PACKAGE_VERSION_EXACT TRUE) 24 | endif() 25 | endif() 26 | endif() 27 | 28 | include("${CMAKE_CURRENT_LIST_DIR}/sdlcpu.cmake") 29 | SDL_DetectTargetCPUArchitectures(_detected_archs) 30 | 31 | # check that the installed version has a compatible architecture as the one which is currently searching: 32 | if(NOT(SDL_CPU_X86 OR SDL_CPU_X64 OR SDL_CPU_ARM32 OR SDL_CPU_ARM64)) 33 | set(PACKAGE_VERSION "${PACKAGE_VERSION} (X86,X64,ARM32,ARM64)") 34 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 35 | endif() 36 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/android/aar/description.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@<@PROJECT_NAME@>@", 3 | "version": "@<@PROJECT_VERSION@>@", 4 | "git-hash": "@PROJECT_COMMIT@" 5 | } 6 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/mingw/INSTALL.md.in: -------------------------------------------------------------------------------- 1 | 2 | # Using this package 3 | 4 | This package contains @<@PROJECT_NAME@>@ built for the mingw-w64 toolchain. 5 | 6 | The files for 32-bit architecture are in i686-w64-mingw32 7 | The files for 64-bit architecture are in x86_64-w64-mingw32 8 | 9 | You can install them to another location, just type `make` for help. 10 | 11 | To use this package, install the latest SDL3 package, point your include path at _arch_/include and your library path at _arch_/lib, link with the @<@PROJECT_NAME@>@ library and copy _arch_/bin/@<@PROJECT_NAME@>@.dll next to your executable. 12 | 13 | e.g. 14 | ```sh 15 | gcc -o hello.exe hello.c -Ix86_64-w64-mingw32/include -Lx86_64-w64-mingw32/lib -l@<@PROJECT_NAME@>@ -lSDL3 16 | cp x86_64-w64-mingw32/bin/@<@PROJECT_NAME@>@.dll . 17 | cp _SDL3_INSTALL_PATH_/bin/SDL3.dll . 18 | ./hello.exe 19 | ``` 20 | 21 | # Documentation 22 | 23 | An API reference and additional documentation is available at: 24 | 25 | https://wiki.libsdl.org/@<@PROJECT_NAME@>@ 26 | 27 | # Discussions 28 | 29 | ## Discord 30 | 31 | You can join the official Discord server at: 32 | 33 | https://discord.com/invite/BwpFGBWsv8 34 | 35 | ## Forums/mailing lists 36 | 37 | You can join SDL development discussions at: 38 | 39 | https://discourse.libsdl.org/ 40 | 41 | Once you sign up, you can use the forum through the website or as a mailing list from your email client. 42 | 43 | ## Announcement list 44 | 45 | You can sign up for the low traffic announcement list at: 46 | 47 | https://www.libsdl.org/mailing-list.php 48 | 49 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/mingw/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for installing the mingw32 version of the SDL_ttf library 3 | 4 | DESTDIR = /usr/local 5 | ARCHITECTURES := i686-w64-mingw32 x86_64-w64-mingw32 6 | 7 | default: 8 | @echo "Run \"make install-i686\" to install 32-bit" 9 | @echo "Run \"make install-x86_64\" to install 64-bit" 10 | @echo "Run \"make install-all\" to install both" 11 | @echo "Add DESTDIR=/custom/path to change the destination folder" 12 | 13 | install: 14 | @if test -d $(ARCH) && test -d $(DESTDIR); then \ 15 | (cd $(ARCH) && cp -rv bin include lib share $(DESTDIR)/); \ 16 | else \ 17 | echo "*** ERROR: $(ARCH) or $(DESTDIR) does not exist!"; \ 18 | exit 1; \ 19 | fi 20 | 21 | install-i686: 22 | $(MAKE) install ARCH=i686-w64-mingw32 23 | 24 | install-x86_64: 25 | $(MAKE) install ARCH=x86_64-w64-mingw32 26 | 27 | install-all: 28 | @if test -d $(DESTDIR); then \ 29 | mkdir -p $(DESTDIR)/cmake; \ 30 | cp -rv cmake/* $(DESTDIR)/cmake; \ 31 | for arch in $(ARCHITECTURES); do \ 32 | $(MAKE) install ARCH=$$arch DESTDIR=$(DESTDIR)/$$arch; \ 33 | done \ 34 | else \ 35 | echo "*** ERROR: $(DESTDIR) does not exist!"; \ 36 | exit 1; \ 37 | fi 38 | 39 | .PHONY: default install install-i686 install-x86_64 install-all 40 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/mingw/cmake/SDL3_ttfConfig.cmake: -------------------------------------------------------------------------------- 1 | # SDL3_ttf CMake configuration file: 2 | # This file is meant to be placed in a cmake subfolder of SDL3_ttf-devel-3.x.y-mingw 3 | 4 | if(CMAKE_SIZEOF_VOID_P EQUAL 4) 5 | set(sdl3_ttf_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3_ttf/SDL3_ttfConfig.cmake") 6 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) 7 | set(sdl3_ttf_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3_ttf/SDL3_ttfConfig.cmake") 8 | else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") 9 | set(SDL3_ttf_FOUND FALSE) 10 | return() 11 | endif() 12 | 13 | if(NOT EXISTS "${sdl3_ttf_config_path}") 14 | message(WARNING "${sdl3_ttf_config_path} does not exist: MinGW development package is corrupted") 15 | set(SDL3_ttf_FOUND FALSE) 16 | return() 17 | endif() 18 | 19 | include("${sdl3_ttf_config_path}") 20 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/mingw/cmake/SDL3_ttfConfigVersion.cmake: -------------------------------------------------------------------------------- 1 | # SDL3_ttf CMake version configuration file: 2 | # This file is meant to be placed in a cmake subfolder of SDL3_ttf-devel-3.x.y-mingw 3 | 4 | if(CMAKE_SIZEOF_VOID_P EQUAL 4) 5 | set(sdl3_ttf_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3_ttf/SDL3_ttfConfigVersion.cmake") 6 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) 7 | set(sdl3_ttf_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3_ttf/SDL3_ttfConfigVersion.cmake") 8 | else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") 9 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 10 | return() 11 | endif() 12 | 13 | if(NOT EXISTS "${sdl3_ttf_config_path}") 14 | message(WARNING "${sdl3_ttf_config_path} does not exist: MinGW development package is corrupted") 15 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 16 | return() 17 | endif() 18 | 19 | include("${sdl3_ttf_config_path}") 20 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/msvc/INSTALL.md.in: -------------------------------------------------------------------------------- 1 | 2 | # Using this package 3 | 4 | This package contains @<@PROJECT_NAME@>@ built for Visual Studio. 5 | 6 | To use this package, edit your project properties: 7 | - Add the include directory to "VC++ Directories" -> "Include Directories" 8 | - Add the lib/_arch_ directory to "VC++ Directories" -> "Library Directories" 9 | - Add @<@PROJECT_NAME@>@.lib to Linker -> Input -> "Additional Dependencies" 10 | - Copy lib/_arch_/@<@PROJECT_NAME@>@.dll to your project directory. 11 | 12 | # Documentation 13 | 14 | An API reference and additional documentation is available at: 15 | 16 | https://wiki.libsdl.org/@<@PROJECT_NAME@>@ 17 | 18 | # Discussions 19 | 20 | ## Discord 21 | 22 | You can join the official Discord server at: 23 | 24 | https://discord.com/invite/BwpFGBWsv8 25 | 26 | ## Forums/mailing lists 27 | 28 | You can join SDL development discussions at: 29 | 30 | https://discourse.libsdl.org/ 31 | 32 | Once you sign up, you can use the forum through the website or as a mailing list from your email client. 33 | 34 | ## Announcement list 35 | 36 | You can sign up for the low traffic announcement list at: 37 | 38 | https://www.libsdl.org/mailing-list.php 39 | 40 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/msvc/arm64/INSTALL.md.in: -------------------------------------------------------------------------------- 1 | 2 | # Using this package 3 | 4 | This package contains @<@PROJECT_NAME@>@ built for arm64 Windows. 5 | 6 | To use this package, simply replace an existing 64-bit ARM @<@PROJECT_NAME@>@.dll with the one included here. 7 | 8 | # Development packages 9 | 10 | If you're looking for packages with headers and libraries, you can download one of these: 11 | - @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio 12 | - @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64 13 | 14 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/msvc/cmake/SDL3_ttfConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # @<@PROJECT_NAME@>@ CMake configuration file: 2 | # This file is meant to be placed in a cmake subfolder of @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip 3 | 4 | include(FeatureSummary) 5 | set_package_properties(SDL3_ttf PROPERTIES 6 | URL "https://www.libsdl.org/projects/SDL_ttf/" 7 | DESCRIPTION "Support for TrueType (.ttf) font files with Simple Directmedia Layer" 8 | ) 9 | 10 | cmake_minimum_required(VERSION 3.0...3.28) 11 | 12 | set(SDL3_ttf_FOUND TRUE) 13 | 14 | set(SDLTTF_VENDORED TRUE) 15 | 16 | set(SDLTTF_HARFBUZZ TRUE) 17 | set(SDLTTF_FREETYPE TRUE) 18 | 19 | 20 | if(SDL_CPU_X86) 21 | set(_sdl3_ttf_arch_subdir "x86") 22 | elseif(SDL_CPU_X64 OR SDL_CPU_ARM64EC) 23 | set(_sdl3_ttf_arch_subdir "x64") 24 | elseif(SDL_CPU_ARM64) 25 | set(_sdl3_ttf_arch_subdir "arm64") 26 | else() 27 | set(SDL3_mixer_FOUND FALSE) 28 | return() 29 | endif() 30 | 31 | set(_sdl3_ttf_incdir "${CMAKE_CURRENT_LIST_DIR}/../include") 32 | set(_sdl3_ttf_library "${CMAKE_CURRENT_LIST_DIR}/../lib/${_sdl3_ttf_arch_subdir}/SDL3_ttf.lib") 33 | set(_sdl3_ttf_dll "${CMAKE_CURRENT_LIST_DIR}/../lib/${_sdl3_ttf_arch_subdir}/SDL3_ttf.dll") 34 | 35 | # All targets are created, even when some might not be requested though COMPONENTS. 36 | # This is done for compatibility with CMake generated SDL3_ttf-target.cmake files. 37 | 38 | set(SDL3_ttf_SDL3_ttf-shared_FOUND TRUE) 39 | if(NOT TARGET SDL3_ttf::SDL3_ttf-shared) 40 | add_library(SDL3_ttf::SDL3_ttf-shared SHARED IMPORTED) 41 | set_target_properties(SDL3_ttf::SDL3_ttf-shared 42 | PROPERTIES 43 | INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_ttf_incdir}" 44 | IMPORTED_IMPLIB "${_sdl3_ttf_library}" 45 | IMPORTED_LOCATION "${_sdl3_ttf_dll}" 46 | COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" 47 | INTERFACE_SDL3_SHARED "ON" 48 | ) 49 | endif() 50 | 51 | unset(_sdl3_ttf_arch_subdir) 52 | unset(_sdl3_ttf_incdir) 53 | unset(_sdl3_ttf_library) 54 | unset(_sdl3_ttf_dll) 55 | 56 | set(SDL3_ttf_SDL3_ttf-static_FOUND TRUE) 57 | 58 | set(SDL3_ttf_SDL3_ttf_FOUND FALSE) 59 | if(SDL3_ttf_SDL3_ttf-hared_FOUND OR SDL3_ttf_SDL3_ttf-static_FOUND) 60 | set(SDL3_ttf_SDL3_ttf_FOUND TRUE) 61 | endif() 62 | 63 | function(_sdl_create_target_alias_compat NEW_TARGET TARGET) 64 | if(CMAKE_VERSION VERSION_LESS "3.18") 65 | # Aliasing local targets is not supported on CMake < 3.18, so make it global. 66 | add_library(${NEW_TARGET} INTERFACE IMPORTED) 67 | set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}") 68 | else() 69 | add_library(${NEW_TARGET} ALIAS ${TARGET}) 70 | endif() 71 | endfunction() 72 | 73 | # Make sure SDL3_ttf::SDL3_ttf always exists 74 | if(NOT TARGET SDL3_ttf::SDL3_ttf) 75 | if(TARGET SDL3_ttf::SDL3_ttf-shared) 76 | _sdl_create_target_alias_compat(SDL3_ttf::SDL3_ttf SDL3_ttf::SDL3_ttf-shared) 77 | endif() 78 | endif() 79 | 80 | check_required_components(SDL3_ttf) 81 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/msvc/cmake/SDL3_ttfConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | # @<@PROJECT_NAME@>@ CMake version configuration file: 2 | # This file is meant to be placed in a cmake subfolder of @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip 3 | 4 | set(PACKAGE_VERSION "@<@PROJECT_VERSION@>@") 5 | 6 | if(PACKAGE_FIND_VERSION_RANGE) 7 | # Package version must be in the requested version range 8 | if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN) 9 | OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX) 10 | OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX))) 11 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 12 | else() 13 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 14 | endif() 15 | else() 16 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 17 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 18 | else() 19 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 20 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 21 | set(PACKAGE_VERSION_EXACT TRUE) 22 | endif() 23 | endif() 24 | endif() 25 | 26 | include("${CMAKE_CURRENT_LIST_DIR}/sdlcpu.cmake") 27 | SDL_DetectTargetCPUArchitectures(_detected_archs) 28 | 29 | # check that the installed version has a compatible architecture as the one which is currently searching: 30 | if(NOT(SDL_CPU_X86 OR SDL_CPU_X64 OR SDL_CPU_ARM64 OR SDL_CPU_ARM64EC)) 31 | set(PACKAGE_VERSION "${PACKAGE_VERSION} (X86,X64,ARM64)") 32 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 33 | endif() 34 | 35 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/msvc/x64/INSTALL.md.in: -------------------------------------------------------------------------------- 1 | 2 | # Using this package 3 | 4 | This package contains @<@PROJECT_NAME@>@ built for x64 Windows. 5 | 6 | To use this package, simply replace an existing 64-bit @<@PROJECT_NAME@>@.dll with the one included here. 7 | 8 | # Development packages 9 | 10 | If you're looking for packages with headers and libraries, you can download one of these: 11 | - @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio 12 | - @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64 13 | 14 | -------------------------------------------------------------------------------- /build-scripts/pkg-support/msvc/x86/INSTALL.md.in: -------------------------------------------------------------------------------- 1 | 2 | # Using this package 3 | 4 | This package contains @<@PROJECT_NAME@>@ built for x86 Windows. 5 | 6 | To use this package, simply replace an existing 32-bit @<@PROJECT_NAME@>@.dll with the one included here. 7 | 8 | # Development packages 9 | 10 | If you're looking for packages with headers and libraries, you can download one of these: 11 | - @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio 12 | - @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64 13 | 14 | -------------------------------------------------------------------------------- /build-scripts/rename_symbols.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # This script renames symbols in the specified paths 4 | 5 | import argparse 6 | import os 7 | import pathlib 8 | import re 9 | import sys 10 | 11 | 12 | SDL_ROOT = pathlib.Path(__file__).resolve().parents[1] 13 | 14 | SDL_INCLUDE_DIR = SDL_ROOT / "include/SDL3" 15 | 16 | 17 | def main(): 18 | if args.all_symbols: 19 | if len(args.args) < 1: 20 | print("Usage: %s --all-symbols files_or_directories ..." % sys.argv[0]) 21 | exit(1) 22 | 23 | replacements = get_all_replacements() 24 | entries = args.args 25 | 26 | else: 27 | if len(args.args) < 3: 28 | print("Usage: %s [--substring] oldname newname files_or_directories ..." % sys.argv[0]) 29 | exit(1) 30 | 31 | replacements = { args.args[0]: args.args[1] } 32 | entries = args.args[2:] 33 | 34 | if args.substring: 35 | regex = create_substring_regex_from_replacements(replacements) 36 | else: 37 | regex = create_regex_from_replacements(replacements) 38 | 39 | for entry in entries: 40 | path = pathlib.Path(entry) 41 | if not path.exists(): 42 | print("%s doesn't exist, skipping" % entry) 43 | continue 44 | 45 | replace_symbols_in_path(path, regex, replacements) 46 | 47 | 48 | def get_all_replacements(): 49 | replacements = {} 50 | file = (SDL_INCLUDE_DIR / "SDL_oldnames.h") 51 | mode = 0 52 | for line in file.read_text().splitlines(): 53 | if line == "#ifdef SDL_ENABLE_OLD_NAMES": 54 | if mode == 0: 55 | mode = 1 56 | else: 57 | raise Exception("get_all_replacements(): expected mode 0") 58 | elif line == "#elif !defined(SDL_DISABLE_OLD_NAMES)": 59 | if mode == 1: 60 | mode = 2 61 | else: 62 | raise Exception("get_all_replacements(): expected mode 1") 63 | elif line == "#endif /* SDL_ENABLE_OLD_NAMES */": 64 | if mode == 2: 65 | mode = 3 66 | else: 67 | raise Exception("add_symbol_to_oldnames(): expected mode 2") 68 | elif mode == 1 and line.startswith("#define "): 69 | words = line.split() 70 | replacements[words[1]] = words[2] 71 | # In case things are accidentally renamed to the "X_renamed_Y" symbol 72 | #replacements[words[1] + "_renamed_" + words[2]] = words[2] 73 | 74 | return replacements 75 | 76 | 77 | def create_regex_from_replacements(replacements): 78 | return re.compile(r"\b(%s)\b" % "|".join(map(re.escape, replacements.keys()))) 79 | 80 | 81 | def create_substring_regex_from_replacements(replacements): 82 | return re.compile(r"(%s)" % "|".join(map(re.escape, replacements.keys()))) 83 | 84 | 85 | def replace_symbols_in_file(file, regex, replacements): 86 | try: 87 | with file.open("r", encoding="UTF-8", newline="") as rfp: 88 | original = rfp.read() 89 | contents = regex.sub(lambda mo: replacements[mo.string[mo.start():mo.end()]], original) 90 | if contents != original: 91 | with file.open("w", encoding="UTF-8", newline="") as wfp: 92 | wfp.write(contents) 93 | except UnicodeDecodeError: 94 | print("%s is not text, skipping" % file) 95 | except Exception as err: 96 | print("%s" % err) 97 | 98 | 99 | def replace_symbols_in_dir(path, regex, replacements): 100 | for entry in path.glob("*"): 101 | if entry.is_dir(): 102 | replace_symbols_in_dir(entry, regex, replacements) 103 | else: 104 | print("Processing %s" % entry) 105 | replace_symbols_in_file(entry, regex, replacements) 106 | 107 | 108 | def replace_symbols_in_path(path, regex, replacements): 109 | if path.is_dir(): 110 | replace_symbols_in_dir(path, regex, replacements) 111 | else: 112 | replace_symbols_in_file(path, regex, replacements) 113 | 114 | 115 | if __name__ == "__main__": 116 | 117 | parser = argparse.ArgumentParser(fromfile_prefix_chars='@') 118 | parser.add_argument("--all-symbols", action="store_true") 119 | parser.add_argument("--substring", action="store_true") 120 | parser.add_argument("args", nargs="*") 121 | args = parser.parse_args() 122 | 123 | try: 124 | main() 125 | except Exception as e: 126 | print(e) 127 | exit(-1) 128 | 129 | exit(0) 130 | 131 | -------------------------------------------------------------------------------- /build-scripts/test-versioning.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2022 Collabora Ltd. 3 | # SPDX-License-Identifier: Zlib 4 | 5 | set -eu 6 | 7 | cd `dirname $0`/.. 8 | 9 | # Needed so sed doesn't report illegal byte sequences on macOS 10 | export LC_CTYPE=C 11 | 12 | header=include/SDL3_ttf/SDL_ttf.h 13 | ref_major=$(sed -ne 's/^#define SDL_TTF_MAJOR_VERSION *//p' $header) 14 | ref_minor=$(sed -ne 's/^#define SDL_TTF_MINOR_VERSION *//p' $header) 15 | ref_micro=$(sed -ne 's/^#define SDL_TTF_MICRO_VERSION *//p' $header) 16 | ref_version="${ref_major}.${ref_minor}.${ref_micro}" 17 | 18 | tests=0 19 | failed=0 20 | 21 | ok () { 22 | tests=$(( tests + 1 )) 23 | echo "ok - $*" 24 | } 25 | 26 | not_ok () { 27 | tests=$(( tests + 1 )) 28 | echo "not ok - $*" 29 | failed=1 30 | } 31 | 32 | major=$(sed -ne 's/^set(MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt) 33 | minor=$(sed -ne 's/^set(MINOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt) 34 | micro=$(sed -ne 's/^set(MICRO_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt) 35 | ref_sdl_req=$(sed -ne 's/^set(SDL_REQUIRED_VERSION \([0-9.]*\))$/\1/p' CMakeLists.txt) 36 | version="${major}.${minor}.${micro}" 37 | 38 | if [ "$ref_version" = "$version" ]; then 39 | ok "CMakeLists.txt $version" 40 | else 41 | not_ok "CMakeLists.txt $version disagrees with SDL_ttf.h $ref_version" 42 | fi 43 | 44 | for rcfile in src/version.rc; do 45 | tuple=$(sed -ne 's/^ *FILEVERSION *//p' "$rcfile" | tr -d '\r') 46 | ref_tuple="${ref_major},${ref_minor},${ref_micro},0" 47 | 48 | if [ "$ref_tuple" = "$tuple" ]; then 49 | ok "$rcfile FILEVERSION $tuple" 50 | else 51 | not_ok "$rcfile FILEVERSION $tuple disagrees with SDL_ttf.h $ref_tuple" 52 | fi 53 | 54 | tuple=$(sed -ne 's/^ *PRODUCTVERSION *//p' "$rcfile" | tr -d '\r') 55 | 56 | if [ "$ref_tuple" = "$tuple" ]; then 57 | ok "$rcfile PRODUCTVERSION $tuple" 58 | else 59 | not_ok "$rcfile PRODUCTVERSION $tuple disagrees with SDL_ttf.h $ref_tuple" 60 | fi 61 | 62 | tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r') 63 | ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0" 64 | 65 | if [ "$ref_tuple" = "$tuple" ]; then 66 | ok "$rcfile FileVersion $tuple" 67 | else 68 | not_ok "$rcfile FileVersion $tuple disagrees with SDL_ttf.h $ref_tuple" 69 | fi 70 | 71 | tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r') 72 | 73 | if [ "$ref_tuple" = "$tuple" ]; then 74 | ok "$rcfile ProductVersion $tuple" 75 | else 76 | not_ok "$rcfile ProductVersion $tuple disagrees with SDL_ttf.h $ref_tuple" 77 | fi 78 | done 79 | 80 | version=$(sed -Ene '/CFBundleShortVersionString/,+1 s/.*(.*)<\/string>.*/\1/p' Xcode/Info-Framework.plist) 81 | 82 | if [ "$ref_version" = "$version" ]; then 83 | ok "Info-Framework.plist CFBundleShortVersionString $version" 84 | else 85 | not_ok "Info-Framework.plist CFBundleShortVersionString $version disagrees with SDL_ttf.h $ref_version" 86 | fi 87 | 88 | version=$(sed -Ene '/CFBundleVersion/,+1 s/.*(.*)<\/string>.*/\1/p' Xcode/Info-Framework.plist) 89 | 90 | if [ "$ref_version" = "$version" ]; then 91 | ok "Info-Framework.plist CFBundleVersion $version" 92 | else 93 | not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_ttf.h $ref_version" 94 | fi 95 | 96 | # For simplicity this assumes we'll never break ABI before SDL 3. 97 | dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL_ttf.xcodeproj/project.pbxproj) 98 | 99 | case "$ref_minor" in 100 | (*[02468]) 101 | major="$(( ref_minor * 100 + 1 ))" 102 | minor="0" 103 | ;; 104 | (*) 105 | major="$(( ref_minor * 100 + ref_micro + 1 ))" 106 | minor="0" 107 | ;; 108 | esac 109 | 110 | ref="${major}.${minor}.0 111 | ${major}.${minor}.0" 112 | 113 | if [ "$ref" = "$dylib_compat" ]; then 114 | ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is consistent" 115 | else 116 | not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent, expected $ref, got $dylib_compat" 117 | fi 118 | 119 | dylib_cur=$(sed -Ene 's/.*DYLIB_CURRENT_VERSION = (.*);$/\1/p' Xcode/SDL_ttf.xcodeproj/project.pbxproj) 120 | 121 | case "$ref_minor" in 122 | (*[02468]) 123 | major="$(( ref_minor * 100 + 1 ))" 124 | minor="$ref_micro" 125 | ;; 126 | (*) 127 | major="$(( ref_minor * 100 + ref_micro + 1 ))" 128 | minor="0" 129 | ;; 130 | esac 131 | 132 | ref="${major}.${minor}.0 133 | ${major}.${minor}.0" 134 | 135 | if [ "$ref" = "$dylib_cur" ]; then 136 | ok "project.pbxproj DYLIB_CURRENT_VERSION is consistent" 137 | else 138 | not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent, expected $ref, got $dylib_cur" 139 | fi 140 | 141 | echo "1..$tests" 142 | exit "$failed" 143 | -------------------------------------------------------------------------------- /cmake/CPackProjectConfig.cmake.in: -------------------------------------------------------------------------------- 1 | if(CPACK_PACKAGE_FILE_NAME MATCHES ".*-src$") 2 | message(FATAL_ERROR "Creating source archives is not supported.") 3 | endif() 4 | 5 | set(PROJECT_NAME "@PROJECT_NAME@") 6 | set(PROJECT_VERSION "@PROJECT_VERSION@") 7 | set(PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@") 8 | set(SDL_CMAKE_PLATFORM "@SDL_CMAKE_PLATFORM@") 9 | set(SDL_CPU_NAMES "@SDL_CPU_NAMES@") 10 | list(SORT SDL_CPU_NAMES) 11 | 12 | string(TOLOWER "${SDL_CMAKE_PLATFORM}" SDL_CMAKE_PLATFORM) 13 | string(TOLOWER "${SDL_CPU_NAMES}" SDL_CPU_NAMES) 14 | if(lower_sdl_cmake_platform STREQUAL lower_sdl_cpu_names) 15 | set(SDL_CPU_NAMES_WITH_DASHES) 16 | endif() 17 | 18 | string(REPLACE ";" "-" SDL_CPU_NAMES_WITH_DASHES "${SDL_CPU_NAMES}") 19 | if(SDL_CPU_NAMES_WITH_DASHES) 20 | set(SDL_CPU_NAMES_WITH_DASHES "-${SDL_CPU_NAMES_WITH_DASHES}") 21 | endif() 22 | 23 | set(MSVC @MSVC@) 24 | set(MINGW @MINGW@) 25 | if(MSVC) 26 | set(SDL_CMAKE_PLATFORM "${SDL_CMAKE_PLATFORM}-VC") 27 | elseif(MINGW) 28 | set(SDL_CMAKE_PLATFORM "${SDL_CMAKE_PLATFORM}-mingw") 29 | endif() 30 | 31 | set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-${SDL_CMAKE_PLATFORM}${SDL_CPU_NAMES_WITH_DASHES}") 32 | 33 | if(CPACK_GENERATOR STREQUAL "DragNDrop") 34 | set(CPACK_DMG_VOLUME_NAME "@PROJECT_NAME@ @PROJECT_VERSION@") 35 | # FIXME: use pre-built/create .DS_Store through AppleScript (CPACK_DMG_DS_STORE/CPACK_DMG_DS_STORE_SETUP_SCRIPT) 36 | set(CPACK_DMG_DS_STORE "${PROJECT_SOURCE_DIR}/Xcode/SDL/pkg-support/resources/SDL_DS_Store") 37 | endif() 38 | -------------------------------------------------------------------------------- /cmake/Findharfbuzz.cmake: -------------------------------------------------------------------------------- 1 | # Create our own Findharfbuzz.cmake module because harfbuzz-config.cmake, 2 | # distributed along e.g. msys2-mingw64 does not support anything other then APPLE and UNIX. 3 | 4 | include(FindPackageHandleStandardArgs) 5 | 6 | find_package(PkgConfig QUIET) 7 | pkg_check_modules(PC_HARFBUZZ QUIET harfbuzz) 8 | 9 | find_library(harfbuzz_LIBRARY 10 | NAMES harfbuzz 11 | HINTS ${PC_HARFBUZZ_LIBDIR} 12 | ) 13 | 14 | find_path(harfbuzz_INCLUDE_PATH 15 | NAMES hb.h 16 | PATH_SUFFIXES harfbuzz 17 | HINTS ${PC_HARFBUZZ_INCLUDEDIR} 18 | ) 19 | 20 | if(PC_HARFBUZZ_FOUND) 21 | get_flags_from_pkg_config("${harfbuzz_LIBRARY}" "PC_HARFBUZZ" "_harfbuzz") 22 | endif() 23 | 24 | set(harfbuzz_COMPILE_OPTIONS "${_harfbuzz_compile_options}" CACHE STRING "Extra compile flags of harfbuzz") 25 | 26 | set(harfbuzz_LINK_LIBRARIES "${_harfbuzz_link_libraries}" CACHE STRING "Extra link libraries of harfbuzz") 27 | 28 | set(harfbuzz_LINK_OPTIONS "${_harfbuzz_link_options}" CACHE STRING "Extra link flags of harfbuzz") 29 | 30 | set(harfbuzz_LINK_DIRECTORIES "${_harfbuzz_link_directories}" CACHE PATH "Extra link directories of harfbuzz") 31 | 32 | set(harfbuzz_VERSION "harfbuzz_VERSION-NOTFOUND") 33 | foreach(_hb_incpath IN LISTS harfbuzz_INCLUDE_PATH) 34 | if(IS_DIRECTORY "${_hb_incpath}" AND EXISTS "${_hb_incpath}/hb-version.h") 35 | file(READ "${_hb_incpath}/hb-version.h" _hb_version_text) 36 | string(REGEX MATCH "#define[ \t]+HB_VERSION_MAJOR[ \t]+([0-9]+)" _hb_major_re "${_hb_version_text}") 37 | set(_hb_major "${CMAKE_MATCH_1}") 38 | string(REGEX MATCH "#define[ \t]+HB_VERSION_MINOR[ \t]+([0-9]+)" _hb_minor_re "${_hb_version_text}") 39 | set(_hb_minor "${CMAKE_MATCH_1}") 40 | string(REGEX MATCH "#define[ \t]+HB_VERSION_MICRO[ \t]+([0-9]+)" _hb_micro_re "${_hb_version_text}") 41 | set(_hb_micro "${CMAKE_MATCH_1}") 42 | if(_hb_major_re AND _hb_minor_re AND _hb_micro_re) 43 | set(harfbuzz_VERSION "${_hb_major}.${_hb_minor}.${_hb_micro}") 44 | break() 45 | endif() 46 | endif() 47 | endforeach() 48 | 49 | find_package_handle_standard_args(harfbuzz 50 | REQUIRED_VARS harfbuzz_LIBRARY harfbuzz_INCLUDE_PATH 51 | VERSION_VAR harfbuzz_VERSION 52 | ) 53 | 54 | if (harfbuzz_FOUND) 55 | if (NOT TARGET harfbuzz::harfbuzz) 56 | add_library(harfbuzz::harfbuzz UNKNOWN IMPORTED) 57 | set_target_properties(harfbuzz::harfbuzz PROPERTIES 58 | IMPORTED_LOCATION "${harfbuzz_LIBRARY}" 59 | INTERFACE_INCLUDE_DIRECTORIES "${harfbuzz_INCLUDE_PATH}" 60 | INTERFACE_COMPILE_OPTIONS "${harfbuzz_COMPILE_OPTIONS}" 61 | INTERFACE_LINK_LIBRARIES "${harfbuzz_LINK_LIBRARIES}" 62 | INTERFACE_LINK_OPTIONS "${harfbuzz_LINK_OPTIONS}" 63 | INTERFACE_LINK_DIRECTORIES "${harfbuzz_LINK_DIRECTORIES}" 64 | ) 65 | endif() 66 | endif() 67 | -------------------------------------------------------------------------------- /cmake/Findplutosvg.cmake: -------------------------------------------------------------------------------- 1 | 2 | include(FindPackageHandleStandardArgs) 3 | 4 | find_package(PkgConfig QUIET) 5 | pkg_check_modules(PC_PLUTOSVG QUIET plutosvg) 6 | 7 | find_library(plutosvg_LIBRARY 8 | NAMES plutosvg 9 | HINTS ${PC_PLUTOSVG_LIBDIR} 10 | ) 11 | 12 | find_path(plutosvg_INCLUDE_PATH 13 | NAMES plutosvg.h 14 | PATH_SUFFIXES plutosvg 15 | HINTS ${PC_PLUTOSVG_INCLUDEDIR} 16 | ) 17 | 18 | if(PC_PLUTOSVG_FOUND) 19 | get_flags_from_pkg_config("${plutosvg_LIBRARY}" "PC_PLUTOSVG" "_plutosvg") 20 | endif() 21 | 22 | set(plutosvg_COMPILE_OPTIONS "${_plutosvg_compile_options}" CACHE STRING "Extra compile flags of plutosvg") 23 | 24 | set(plutosvg_LINK_LIBRARIES "${_plutosvg_link_libraries}" CACHE STRING "Extra link libraries of plutosvg") 25 | 26 | set(plutosvg_LINK_OPTIONS "${_plutosvg_link_options}" CACHE STRING "Extra link flags of plutosvg") 27 | 28 | set(plutosvg_LINK_DIRECTORIES "${_plutosvg_link_directories}" CACHE STRING "Extra link flags of plutosvg") 29 | 30 | find_package(plutovg) 31 | 32 | find_package_handle_standard_args(plutosvg 33 | REQUIRED_VARS plutosvg_LIBRARY plutosvg_INCLUDE_PATH plutovg_FOUND 34 | ) 35 | 36 | if(plutosvg_FOUND) 37 | if(NOT TARGET plutosvg::plutosvg) 38 | add_library(plutosvg::plutosvg UNKNOWN IMPORTED) 39 | set_target_properties(plutosvg::plutosvg PROPERTIES 40 | IMPORTED_LOCATION "${plutosvg_LIBRARY}" 41 | INTERFACE_INCLUDE_DIRECTORIES "${plutosvg_INCLUDE_PATH}" 42 | INTERFACE_COMPILE_OPTIONS "${plutosvg_COMPILE_OPTIONS}" 43 | INTERFACE_LINK_LIBRARIES "${plutosvg_LINK_LIBRARIES};plutovg::plutovg" 44 | INTERFACE_LINK_OPTIONS "${plutosvg_LINK_OPTIONS}" 45 | INTERFACE_LINK_DIRECTORIES "${plutosvg_LINK_DIRECTORIES}" 46 | ) 47 | endif() 48 | endif() 49 | -------------------------------------------------------------------------------- /cmake/Findplutovg.cmake: -------------------------------------------------------------------------------- 1 | 2 | include(FindPackageHandleStandardArgs) 3 | 4 | find_package(PkgConfig QUIET) 5 | pkg_check_modules(PC_PLUTOSG QUIET plutovg) 6 | 7 | find_library(plutovg_LIBRARY 8 | NAMES plutovg 9 | HINTS ${PC_PLUTOVG_LIBDIR} 10 | ) 11 | 12 | find_path(plutovg_INCLUDE_PATH 13 | NAMES plutovg.h 14 | PATH_SUFFIXES plutovg 15 | HINTS ${PC_PLUTOVG_INCLUDEDIR} 16 | ) 17 | 18 | find_library(PLUTOVG_MATH_LIBRARY NAMES m) 19 | 20 | if(PC_PLUTOVG_FOUND) 21 | get_flags_from_pkg_config("${plutovg_LIBRARY}" "PC_PLUTOVG" "_plutovg") 22 | endif() 23 | 24 | set(plutovg_COMPILE_OPTIONS "${_plutovg_compile_options}" CACHE STRING "Extra compile flags of plutovg") 25 | 26 | set(plutovg_LINK_LIBRARIES "${_plutovg_link_libraries}" CACHE STRING "Extra link libraries of plutovg") 27 | 28 | set(plutovg_LINK_OPTIONS "${_plutovg_link_options}" CACHE STRING "Extra link flags of plutovg") 29 | 30 | set(plutovg_LINK_DIRECTORIES "${_plutovg_link_directories}" CACHE STRING "Extra link flags of plutovg") 31 | 32 | find_package_handle_standard_args(plutovg 33 | REQUIRED_VARS plutovg_LIBRARY plutovg_INCLUDE_PATH 34 | ) 35 | 36 | if(plutovg_FOUND) 37 | if(NOT TARGET plutovg::plutovg) 38 | add_library(plutovg::plutovg UNKNOWN IMPORTED) 39 | set_target_properties(plutovg::plutovg PROPERTIES 40 | IMPORTED_LOCATION "${plutovg_LIBRARY}" 41 | INTERFACE_INCLUDE_DIRECTORIES "${plutovg_INCLUDE_PATH}" 42 | INTERFACE_COMPILE_OPTIONS "${plutovg_COMPILE_OPTIONS}" 43 | INTERFACE_LINK_LIBRARIES "${plutovg_LINK_LIBRARIES}" 44 | INTERFACE_LINK_OPTIONS "${plutovg_LINK_OPTIONS}" 45 | INTERFACE_LINK_DIRECTORIES "${plutovg_LINK_DIRECTORIES}" 46 | ) 47 | if(PLUTOVG_MATH_LIBRARY) 48 | set_property(TARGET plutovg::plutovg APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${PLUTOVG_MATH_LIBRARY}") 49 | endif() 50 | endif() 51 | endif() 52 | -------------------------------------------------------------------------------- /cmake/GetGitRevisionDescription.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # Internal file for GetGitRevisionDescription.cmake 3 | # 4 | # Requires CMake 2.6 or newer (uses the 'function' command) 5 | # 6 | # Original Author: 7 | # 2009-2010 Ryan Pavlik 8 | # http://academic.cleardefinition.com 9 | # Iowa State University HCI Graduate Program/VRAC 10 | # 11 | # Copyright 2009-2012, Iowa State University 12 | # Copyright 2011-2015, Contributors 13 | # Distributed under the Boost Software License, Version 1.0. 14 | # (See accompanying file LICENSE_1_0.txt or copy at 15 | # http://www.boost.org/LICENSE_1_0.txt) 16 | # SPDX-License-Identifier: BSL-1.0 17 | 18 | set(HEAD_HASH) 19 | 20 | file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 21 | 22 | string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 23 | if(HEAD_CONTENTS MATCHES "ref") 24 | # named branch 25 | string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 26 | if(EXISTS "@GIT_DIR@/${HEAD_REF}") 27 | configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 28 | else() 29 | configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) 30 | file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) 31 | if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") 32 | set(HEAD_HASH "${CMAKE_MATCH_1}") 33 | endif() 34 | endif() 35 | else() 36 | # detached HEAD 37 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 38 | endif() 39 | 40 | if(NOT HEAD_HASH) 41 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 42 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 43 | endif() 44 | -------------------------------------------------------------------------------- /cmake/PkgConfigHelper.cmake: -------------------------------------------------------------------------------- 1 | # Helper for Find modules 2 | 3 | function(get_flags_from_pkg_config _library _pc_prefix _out_prefix) 4 | if("${_library}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$") 5 | set(_cflags ${_pc_prefix}_STATIC_CFLAGS_OTHER) 6 | set(_link_libraries ${_pc_prefix}_STATIC_LIBRARIES) 7 | set(_link_options ${_pc_prefix}_STATIC_LDFLAGS_OTHER) 8 | set(_library_dirs ${_pc_prefix}_STATIC_LIBRARY_DIRS) 9 | else() 10 | set(_cflags ${_pc_prefix}_CFLAGS_OTHER) 11 | set(_link_libraries ${_pc_prefix}_LIBRARIES) 12 | set(_link_options ${_pc_prefix}_LDFLAGS_OTHER) 13 | set(_library_dirs ${_pc_prefix}_LIBRARY_DIRS) 14 | endif() 15 | 16 | # The *_LIBRARIES lists always start with the library itself 17 | list(POP_FRONT "${_link_libraries}") 18 | 19 | # Work around CMake's flag deduplication when pc files use `-framework A` instead of `-Wl,-framework,A` 20 | string(REPLACE "-framework;" "-Wl,-framework," "_filtered_link_options" "${${_link_options}}") 21 | 22 | set(${_out_prefix}_compile_options 23 | "${${_cflags}}" 24 | PARENT_SCOPE) 25 | set(${_out_prefix}_link_libraries 26 | "${${_link_libraries}}" 27 | PARENT_SCOPE) 28 | set(${_out_prefix}_link_options 29 | "${_filtered_link_options}" 30 | PARENT_SCOPE) 31 | set(${_out_prefix}_link_directories 32 | "${${_library_dirs}}" 33 | PARENT_SCOPE) 34 | endfunction() 35 | -------------------------------------------------------------------------------- /cmake/SDL3_ttfConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # sdl3_ttf cmake project-config input for CMakeLists.txt script 2 | 3 | include(FeatureSummary) 4 | set_package_properties(SDL3_ttf PROPERTIES 5 | URL "https://www.libsdl.org/projects/SDL_ttf/" 6 | DESCRIPTION "Support for TrueType (.ttf) font files with Simple Directmedia Layer" 7 | ) 8 | 9 | set(SDL3_ttf_FOUND ON) 10 | 11 | set(SDLTTF_VENDORED @SDLTTF_VENDORED@) 12 | 13 | set(SDLTTF_PLUTOSVG @SDLTTF_PLUTOSVG_ENABLED@) 14 | set(SDLTTF_HARFBUZZ @SDLTTF_HARFBUZZ_ENABLED@) 15 | set(SDLTTF_FREETYPE @SDLTTF_FREETYPE_ENABLED@) 16 | 17 | set(SDLTTF_HARFBUZZ_REQUIRED_VERSION @HARFBUZZ_REQUIRED_VERSION@) 18 | set(SDLTTF_SDL3_REQUIRED_VERSION @SDL_REQUIRED_VERSION@) 19 | 20 | set(SDL3_ttf_SDL3_ttf-shared_FOUND FALSE) 21 | if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_ttf-shared-targets.cmake") 22 | include("${CMAKE_CURRENT_LIST_DIR}/SDL3_ttf-shared-targets.cmake") 23 | set(SDL3_ttf_SDL3_ttf-shared_FOUND TRUE) 24 | endif() 25 | 26 | set(SDL3_ttf_SDL3_ttf-static_FOUND FALSE) 27 | if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_ttf-static-targets.cmake") 28 | if(SDLTTF_VENDORED) 29 | if(SDLTTF_HARFBUZZ AND NOT MSVC) 30 | find_package(Threads) 31 | endif() 32 | include(CheckLanguage) 33 | check_language(CXX) 34 | if(NOT CMAKE_CXX_COMPILER AND NOT _sdl3ttf_nowarning) 35 | message(WARNING "CXX language not enabled. Linking to SDL3_ttf::SDL3_ttf-static might fail.") 36 | endif() 37 | else() 38 | set(_sdl_cmake_module_path "${CMAKE_MODULE_PATH}") 39 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") 40 | 41 | include(CMakeFindDependencyMacro) 42 | include(PkgConfigHelper) 43 | 44 | if(SDLTTF_FREETYPE AND NOT Freetype::Freetype) 45 | find_dependency(Freetype) 46 | endif() 47 | 48 | if(SDLTTF_HARFBUZZ AND NOT harfbuzz::harfbuzz) 49 | list(APPEND harfbuzz_ROOT "${CMAKE_CURRENT_LIST_DIR}") 50 | find_dependency(harfbuzz ${SDLTTF_HARFBUZZ_REQUIRED_VERSION}) 51 | endif() 52 | 53 | if(SDLTTF_PLUTOSVG AND NOT plutosvg::plutosvg) 54 | list(APPEND plutosvg_ROOT "${CMAKE_CURRENT_LIST_DIR}") 55 | find_dependency(plutosvg) 56 | endif() 57 | 58 | set(CMAKE_MODULE_PATH "${_sdl_cmake_module_path}") 59 | unset(_sdl_cmake_module_path) 60 | endif() 61 | 62 | include("${CMAKE_CURRENT_LIST_DIR}/SDL3_ttf-static-targets.cmake") 63 | set(SDL3_ttf_SDL3_ttf-static_FOUND TRUE) 64 | endif() 65 | 66 | function(_sdl_create_target_alias_compat NEW_TARGET TARGET) 67 | if(CMAKE_VERSION VERSION_LESS "3.18") 68 | # Aliasing local targets is not supported on CMake < 3.18, so make it global. 69 | add_library(${NEW_TARGET} INTERFACE IMPORTED) 70 | set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}") 71 | else() 72 | add_library(${NEW_TARGET} ALIAS ${TARGET}) 73 | endif() 74 | endfunction() 75 | 76 | # Make sure SDL3_ttf::SDL3_ttf always exists 77 | if(NOT TARGET SDL3_ttf::SDL3_ttf) 78 | if(TARGET SDL3_ttf::SDL3_ttf-shared) 79 | _sdl_create_target_alias_compat(SDL3_ttf::SDL3_ttf SDL3_ttf::SDL3_ttf-shared) 80 | elseif(TARGET SDL3_ttf::SDL3_ttf-static) 81 | _sdl_create_target_alias_compat(SDL3_ttf::SDL3_ttf SDL3_ttf::SDL3_ttf-static) 82 | endif() 83 | endif() 84 | 85 | if(NOT SDL3_ttf_COMPONENTS AND NOT TARGET SDL3_ttf::SDL3_ttf-shared AND NOT TARGET SDL3_ttf::SDL3_ttf-static) 86 | set(SDL3_ttf_FOUND FALSE) 87 | endif() 88 | @PACKAGE_INIT@ 89 | check_required_components(SDL3_ttf) 90 | -------------------------------------------------------------------------------- /cmake/sdl3-ttf.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@SDL_PKGCONFIG_PREFIX@ 2 | exec_prefix=${prefix} 3 | libdir=@LIBDIR_FOR_PKG_CONFIG@ 4 | includedir=@INCLUDEDIR_FOR_PKG_CONFIG@ 5 | 6 | Name: SDL3_ttf 7 | Description: ttf library for Simple DirectMedia Layer with FreeType 2 support 8 | Version: @PROJECT_VERSION@ 9 | Requires: sdl3 >= @SDL_REQUIRED_VERSION@ 10 | Libs: -L${libdir} -lSDL3_ttf 11 | Requires.private: @PC_REQUIRES@ 12 | Libs.private: @PC_LIBS@ 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /cmake/sdlmanpages.cmake: -------------------------------------------------------------------------------- 1 | include(CMakeParseArguments) 2 | include(GNUInstallDirs) 3 | 4 | function(SDL_generate_manpages) 5 | cmake_parse_arguments(ARG "" "RESULT_VARIABLE;NAME;BUILD_DOCDIR;HEADERS_DIR;SOURCE_DIR;SYMBOL;OPTION_FILE;WIKIHEADERS_PL_PATH;REVISION" "" ${ARGN}) 6 | 7 | set(wikiheaders_extra_args) 8 | 9 | if(NOT ARG_NAME) 10 | set(ARG_NAME "${PROJECT_NAME}") 11 | endif() 12 | 13 | if(NOT ARG_SOURCE_DIR) 14 | set(ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 15 | endif() 16 | 17 | if(NOT ARG_OPTION_FILE) 18 | set(ARG_OPTION_FILE "${PROJECT_SOURCE_DIR}/.wikiheaders-options") 19 | endif() 20 | 21 | if(NOT ARG_HEADERS_DIR) 22 | message(FATAL_ERROR "Missing required HEADERS_DIR argument") 23 | endif() 24 | 25 | # FIXME: get rid of SYMBOL and let the perl script figure out the dependencies 26 | if(NOT ARG_SYMBOL) 27 | message(FATAL_ERROR "Missing required SYMBOL argument") 28 | endif() 29 | 30 | if(ARG_REVISION) 31 | list(APPEND wikiheaders_extra_args "--rev=${ARG_REVISION}") 32 | endif() 33 | 34 | if(NOT ARG_BUILD_DOCDIR) 35 | set(ARG_BUILD_DOCDIR "${CMAKE_CURRENT_BINARY_DIR}/docs") 36 | endif() 37 | set(BUILD_WIKIDIR "${ARG_BUILD_DOCDIR}/wiki") 38 | set(BUILD_MANDIR "${ARG_BUILD_DOCDIR}/man") 39 | 40 | find_package(Perl) 41 | file(GLOB HEADER_FILES "${ARG_HEADERS_DIR}/*.h") 42 | 43 | set(result FALSE) 44 | 45 | if(PERL_FOUND AND EXISTS "${ARG_WIKIHEADERS_PL_PATH}") 46 | add_custom_command( 47 | OUTPUT "${BUILD_WIKIDIR}/${ARG_SYMBOL}.md" 48 | COMMAND "${CMAKE_COMMAND}" -E make_directory "${BUILD_WIKIDIR}" 49 | COMMAND "${PERL_EXECUTABLE}" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_SOURCE_DIR}" "${BUILD_WIKIDIR}" "--options=${ARG_OPTION_FILE}" --copy-to-wiki ${wikiheaders_extra_args} 50 | DEPENDS ${HEADER_FILES} "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_OPTION_FILE}" 51 | COMMENT "Generating ${ARG_NAME} wiki markdown files" 52 | ) 53 | add_custom_command( 54 | OUTPUT "${BUILD_MANDIR}/man3/${ARG_SYMBOL}.3" 55 | COMMAND "${PERL_EXECUTABLE}" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_SOURCE_DIR}" "${BUILD_WIKIDIR}" "--options=${ARG_OPTION_FILE}" "--manpath=${BUILD_MANDIR}" --copy-to-manpages ${wikiheaders_extra_args} 56 | DEPENDS "${BUILD_WIKIDIR}/${ARG_SYMBOL}.md" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_OPTION_FILE}" 57 | COMMENT "Generating ${ARG_NAME} man pages" 58 | ) 59 | add_custom_target(${ARG_NAME}-docs ALL DEPENDS "${BUILD_MANDIR}/man3/${ARG_SYMBOL}.3") 60 | 61 | install(DIRECTORY "${BUILD_MANDIR}/" DESTINATION "${CMAKE_INSTALL_MANDIR}") 62 | set(result TRUE) 63 | endif() 64 | 65 | if(ARG_RESULT_VARIABLE) 66 | set(${ARG_RESULT_VARIABLE} ${result} PARENT_SCOPE) 67 | endif() 68 | endfunction() 69 | -------------------------------------------------------------------------------- /cmake/sdlplatform.cmake: -------------------------------------------------------------------------------- 1 | macro(SDL_DetectCMakePlatform) 2 | set(SDL_CMAKE_PLATFORM ) 3 | # Get the platform 4 | if(WIN32) 5 | set(SDL_CMAKE_PLATFORM Windows) 6 | elseif(PSP) 7 | set(SDL_CMAKE_PLATFORM psp) 8 | elseif(APPLE) 9 | if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*") 10 | set(SDL_CMAKE_PLATFORM Darwin) 11 | elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*") 12 | set(SDL_CMAKE_PLATFORM MacosX) 13 | elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*") 14 | set(SDL_CMAKE_PLATFORM tvOS) 15 | elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*") 16 | set(SDL_CMAKE_PLATFORM iOS) 17 | endif() 18 | elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*") 19 | set(SDL_CMAKE_PLATFORM Haiku) 20 | elseif(NINTENDO_3DS) 21 | set(SDL_CMAKE_PLATFORM n3ds) 22 | elseif(PS2) 23 | set(SDL_CMAKE_PLATFORM ps2) 24 | elseif(VITA) 25 | set(SDL_CMAKE_PLATFORM Vita) 26 | elseif(CMAKE_SYSTEM_NAME MATCHES ".*Linux") 27 | set(SDL_CMAKE_PLATFORM Linux) 28 | elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*") 29 | set(SDL_CMAKE_PLATFORM FreeBSD) 30 | elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*") 31 | set(SDL_CMAKE_PLATFORM NetBSD) 32 | elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*") 33 | set(SDL_CMAKE_PLATFORM OpenBSD) 34 | elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*") 35 | set(SDL_CMAKE_PLATFORM GNU) 36 | elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*") 37 | set(SDL_CMAKE_PLATFORM BSDi) 38 | elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD") 39 | set(SDL_CMAKE_PLATFORM FreeBSD) 40 | elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*") 41 | set(SDL_CMAKE_PLATFORM SYSV5) 42 | elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*") 43 | set(SDL_CMAKE_PLATFORM Solaris) 44 | elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*") 45 | set(SDL_CMAKE_PLATFORM HPUX) 46 | elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*") 47 | set(SDL_CMAKE_PLATFORM AIX) 48 | elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*") 49 | set(SDL_CMAKE_PLATFORM Minix) 50 | elseif(CMAKE_SYSTEM_NAME MATCHES "Android.*") 51 | set(SDL_CMAKE_PLATFORM Android) 52 | elseif(CMAKE_SYSTEM_NAME MATCHES "Emscripten.*") 53 | set(SDL_CMAKE_PLATFORM Emscripten) 54 | elseif(CMAKE_SYSTEM_NAME MATCHES "QNX.*") 55 | set(SDL_CMAKE_PLATFORM QNX) 56 | elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*") 57 | message(FATAL_ERROR "BeOS support has been removed as of SDL 2.0.2.") 58 | endif() 59 | 60 | if(SDL_CMAKE_PLATFORM) 61 | string(TOUPPER "${SDL_CMAKE_PLATFORM}" _upper_platform) 62 | set(${_upper_platform} TRUE) 63 | else() 64 | set(SDL_CMAKE_PLATFORM} "unknown") 65 | endif() 66 | endmacro() 67 | 68 | function(SDL_DetectCPUArchitecture) 69 | set(sdl_cpu_names) 70 | if(APPLE AND CMAKE_OSX_ARCHITECTURES) 71 | foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES}) 72 | if(osx_arch STREQUAL "x86_64") 73 | list(APPEND sdl_cpu_names "x64") 74 | elseif(osx_arch STREQUAL "arm64") 75 | list(APPEND sdl_cpu_names "arm64") 76 | endif() 77 | endforeach() 78 | endif() 79 | 80 | set(sdl_known_archs x64 x86 arm64 arm32 emscripten powerpc64 powerpc32 loongarch64) 81 | if(NOT sdl_cpu_names) 82 | set(found FALSE) 83 | foreach(sdl_known_arch ${sdl_known_archs}) 84 | if(NOT found) 85 | string(TOUPPER "${sdl_known_arch}" sdl_known_arch_upper) 86 | set(var_name "SDL_CPU_${sdl_known_arch_upper}") 87 | check_cpu_architecture(${sdl_known_arch} ${var_name}) 88 | if(${var_name}) 89 | list(APPEND sdl_cpu_names ${sdl_known_arch}) 90 | set(found TRUE) 91 | endif() 92 | endif() 93 | endforeach() 94 | endif() 95 | 96 | foreach(sdl_known_arch ${sdl_known_archs}) 97 | string(TOUPPER "${sdl_known_arch}" sdl_known_arch_upper) 98 | set(var_name "SDL_CPU_${sdl_known_arch_upper}") 99 | if(sdl_cpu_names MATCHES "(^|;)${sdl_known_arch}($|;)") # FIXME: use if(IN_LIST) 100 | set(${var_name} 1 PARENT_SCOPE) 101 | else() 102 | set(${var_name} 0 PARENT_SCOPE) 103 | endif() 104 | endforeach() 105 | set(SDL_CPU_NAMES ${sdl_cpu_names} PARENT_SCOPE) 106 | endfunction() 107 | -------------------------------------------------------------------------------- /cmake/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This cmake build script is meant for verifying the various CMake configuration script. 2 | 3 | cmake_minimum_required(VERSION 3.12...3.28) 4 | project(sdl_test LANGUAGES C) 5 | 6 | cmake_policy(SET CMP0074 NEW) 7 | 8 | # Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL3_ttf outside of sysroot 9 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER) 10 | 11 | include(FeatureSummary) 12 | 13 | option(TEST_SHARED "Test linking to shared SDL3_ttf library" ON) 14 | add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library") 15 | 16 | option(TEST_STATIC "Test linking to static SDL3_ttf libary" ON) 17 | add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library") 18 | 19 | if(ANDROID) 20 | macro(add_executable NAME) 21 | set(args ${ARGN}) 22 | list(REMOVE_ITEM args WIN32) 23 | add_library(${NAME} SHARED ${args}) 24 | unset(args) 25 | endmacro() 26 | endif() 27 | 28 | if(TEST_SHARED) 29 | find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3) 30 | find_package(SDL3_ttf REQUIRED CONFIG) 31 | add_executable(main_shared main.c) 32 | target_link_libraries(main_shared PRIVATE SDL3_ttf::SDL3_ttf-shared SDL3::SDL3) 33 | endif() 34 | 35 | if(TEST_STATIC) 36 | find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3) 37 | # some static vendored libraries use c++ (enable CXX after `find_package` might show a warning) 38 | enable_language(CXX) 39 | find_package(SDL3_ttf REQUIRED CONFIG) 40 | add_executable(main_static main.c) 41 | target_link_libraries(main_static PRIVATE SDL3_ttf::SDL3_ttf-static SDL3::SDL3) 42 | endif() 43 | 44 | feature_summary(WHAT ALL) 45 | -------------------------------------------------------------------------------- /cmake/test/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | (void)argc; 8 | (void)argv; 9 | if (!SDL_Init(0)) { 10 | SDL_Log("SDL_Init: could not initialize SDL: %s", SDL_GetError()); 11 | return 1; 12 | } 13 | if (!TTF_Init()) { 14 | SDL_Log("TTF_Init: %s", SDL_GetError()); 15 | } 16 | TTF_Quit(); 17 | SDL_Quit(); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /docs/INTRO-androidstudio.md: -------------------------------------------------------------------------------- 1 | 2 | # Introduction to SDL_ttf with Android Studio 3 | 4 | A complete example is available at: 5 | 6 | https://github.com/Ravbug/sdl3-sample 7 | 8 | -------------------------------------------------------------------------------- /docs/INTRO-cmake.md: -------------------------------------------------------------------------------- 1 | 2 | # Introduction to SDL_ttf with CMake 3 | 4 | The easiest way to use SDL_ttf is to include it along with SDL as subprojects in your project. 5 | 6 | We'll start by creating a simple project to build and run [hello.c](hello.c) 7 | 8 | Create the file CMakeLists.txt 9 | ```cmake 10 | cmake_minimum_required(VERSION 3.16) 11 | project(hello) 12 | 13 | # set the output directory for built objects. 14 | # This makes sure that the dynamic library goes into the build directory automatically. 15 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") 16 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") 17 | 18 | # Use vendored libs 19 | set(SDLTTF_VENDORED ON) 20 | 21 | # This assumes the SDL source is available in vendored/SDL 22 | add_subdirectory(vendored/SDL EXCLUDE_FROM_ALL) 23 | 24 | # This assumes the SDL_ttf source is available in vendored/SDL_ttf 25 | add_subdirectory(vendored/SDL_ttf EXCLUDE_FROM_ALL) 26 | 27 | # Create your game executable target as usual 28 | add_executable(hello WIN32 hello.c) 29 | 30 | # Link to the actual SDL3 library. 31 | target_link_libraries(hello PRIVATE SDL3_ttf::SDL3_ttf SDL3::SDL3) 32 | ``` 33 | 34 | Build: 35 | ```sh 36 | cmake -S . -B build 37 | cmake --build build 38 | ``` 39 | 40 | Run: 41 | - On Windows the executable is in the build Debug directory: 42 | ```sh 43 | cd build/Debug 44 | ./hello 45 | ``` 46 | - On other platforms the executable is in the build directory: 47 | ```sh 48 | cd build 49 | ./hello 50 | ``` 51 | 52 | A more complete example is available at: 53 | 54 | https://github.com/Ravbug/sdl3-sample 55 | 56 | -------------------------------------------------------------------------------- /docs/INTRO-emscripten.md: -------------------------------------------------------------------------------- 1 | 2 | # Introduction to SDL_ttf with Emscripten 3 | 4 | The easiest way to use SDL_ttf is to include it along with SDL as subprojects in your project. 5 | 6 | We'll start by creating a simple project to build and run [hello.c](hello.c) 7 | 8 | First, you should have the Emscripten SDK installed from: 9 | 10 | https://emscripten.org/docs/getting_started/downloads.html 11 | 12 | Now make sure you have downloaded the external dependencies. You can do that by running `download.sh` in the external directory. 13 | 14 | Create the file CMakeLists.txt 15 | ```cmake 16 | cmake_minimum_required(VERSION 3.16) 17 | project(hello) 18 | 19 | # set the output directory for built objects. 20 | # This makes sure that the dynamic library goes into the build directory automatically. 21 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") 22 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$") 23 | 24 | # This assumes the SDL source is available in vendored/SDL 25 | add_subdirectory(vendored/SDL EXCLUDE_FROM_ALL) 26 | 27 | # This assumes the SDL_ttf source is available in vendored/SDL_ttf 28 | add_subdirectory(vendored/SDL_ttf EXCLUDE_FROM_ALL) 29 | 30 | # on Web targets, we need CMake to generate a HTML webpage. 31 | if(EMSCRIPTEN) 32 | set(CMAKE_EXECUTABLE_SUFFIX ".html" CACHE INTERNAL "") 33 | endif() 34 | 35 | # Create your game executable target as usual 36 | add_executable(hello WIN32 hello.c) 37 | 38 | # Link to the actual SDL3 library. 39 | target_link_libraries(hello PRIVATE SDL3_ttf::SDL3_ttf SDL3::SDL3) 40 | ``` 41 | 42 | Build: 43 | ```sh 44 | emcmake cmake -S . -B build 45 | cd build 46 | emmake make 47 | ``` 48 | 49 | You can now run your app by pointing a webserver at your build directory and connecting a web browser to it, opening hello.html 50 | 51 | A more complete example is available at: 52 | 53 | https://github.com/Ravbug/sdl3-sample 54 | 55 | -------------------------------------------------------------------------------- /docs/INTRO-visualstudio.md: -------------------------------------------------------------------------------- 1 | 2 | # Introduction to SDL_ttf with Visual Studio 3 | 4 | The easiest way to use SDL_ttf is to include it along with SDL as subprojects in your project. 5 | 6 | First, make sure you have downloaded the external dependencies. You can do that by running `Get-GitModules.ps1` in the external directory. 7 | 8 | We'll start by creating a simple project to build and run [hello.c](hello.c) 9 | 10 | - Create a new project in Visual Studio, using the C++ Empty Project template 11 | - Add hello.c to the Source Files 12 | - Right click the solution, select add an existing project, navigate to the SDL VisualC/SDL directory and add SDL.vcxproj 13 | - Right click the solution, select add an existing project, navigate to the SDL_ttf VisualC directory and add SDL_ttf.vcxproj 14 | - Select your SDL_ttf project and go to Project -> Add Reference and select SDL3 15 | - Select your SDL_ttf project and go to Project -> Properties, set the filter at the top to "All Configurations" and "All Platforms", select VC++ Directories and modify the default SDL path in "Include Directories" to point to your SDL include directories 16 | - Select your main project and go to Project -> Add Reference and select SDL3 and SDL3_ttf 17 | - Select your main project and go to Project -> Properties, set the filter at the top to "All Configurations" and "All Platforms", select VC++ Directories and add the SDL and SDL_ttf include directories to "Include Directories" 18 | - Build and run! 19 | 20 | -------------------------------------------------------------------------------- /docs/INTRO-xcode.md: -------------------------------------------------------------------------------- 1 | 2 | # Introduction to SDL_ttf with Xcode 3 | 4 | The easiest way to use SDL_ttf is to include it along with SDL as subprojects in your project. 5 | 6 | First, make sure you have downloaded the external dependencies. You can do that by running `download.sh` in the external directory. 7 | 8 | We'll start by creating a simple project to build and run [hello.c](hello.c) 9 | 10 | - Create a new project in Xcode, using the App template and selecting Objective C as the language 11 | - Remove the .h and .m files that were automatically added to the project 12 | - Remove the main storyboard that was automatically added to the project 13 | - On iOS projects, select the project, select the main target, select the Info tab, look for "Custom iOS Target Properties", and remove "Main storyboard base file name" and "Application Scene Manifest" 14 | - Right click the project and select "Add Files to [project]", navigate to the SDL_ttf docs directory and add the file hello.c 15 | - Right click the project and select "Add Files to [project]", navigate to the SDL Xcode/SDL directory and add SDL.xcodeproj 16 | - Right click the project and select "Add Files to [project]", navigate to the SDL_ttf Xcode directory and add SDL_ttf.xcodeproj 17 | - Select the project, select the main target, select the General tab, look for "Frameworks, Libaries, and Embedded Content", and add SDL3.framework and SDL3_ttf.framework 18 | - Build and run! 19 | 20 | -------------------------------------------------------------------------------- /docs/README-migration.md: -------------------------------------------------------------------------------- 1 | 2 | # Migrating to SDL_ttf 3.0 3 | 4 | This guide provides useful information for migrating applications from SDL_ttf 2.0 to SDL_ttf 3.0. 5 | 6 | Functions that previously returned a negative error code now return bool. 7 | 8 | Code that used to look like this: 9 | ```c 10 | if (TTF_Function() < 0 || TTF_Function() == -1) { 11 | /* Failure... */ 12 | } 13 | ``` 14 | or 15 | ```c 16 | if (TTF_Function() == 0) { 17 | /* Success... */ 18 | } 19 | ``` 20 | or 21 | ```c 22 | if (!TTF_Function()) { 23 | /* Success... */ 24 | } 25 | ``` 26 | should be changed to: 27 | ```c 28 | if (TTF_Function()) { 29 | /* Success... */ 30 | } else { 31 | /* Failure... */ 32 | } 33 | ``` 34 | 35 | Several functions have been renamed. We have provided a handy semantic patch to migrate more easily to SDL3: [SDL_migration.cocci](https://github.com/libsdl-org/SDL_ttf/blob/main/build-scripts/SDL_migration.cocci) 36 | 37 | In general we have switched to using UTF8 in the API. Functions which had 3 variants, for Latin-1, UTF-8, and UCS2, now accept UTF-8 text. In addition, those functions now have an optional length parameter which allows you to render substrings. 38 | 39 | The alpha in background colors is now transparent if it's equal to 0. 40 | 41 | The following functions have been renamed: 42 | * TTF_FontAscent() => TTF_GetFontAscent() 43 | * TTF_FontDescent() => TTF_GetFontDescent() 44 | * TTF_FontFaceFamilyName() => TTF_GetFontFamilyName() 45 | * TTF_FontFaceIsFixedWidth() => TTF_FontIsFixedWidth() 46 | * TTF_FontFaceStyleName() => TTF_GetFontStyleName() 47 | * TTF_FontFaces() => TTF_GetNumFontFaces() 48 | * TTF_FontHeight() => TTF_GetFontHeight() 49 | * TTF_FontLineSkip() => TTF_GetFontLineSkip() 50 | * TTF_GetFontWrappedAlign() => TTF_GetFontWrapAlignment() 51 | * TTF_GlyphIsProvided() => TTF_FontHasGlyph() 52 | * TTF_GlyphIsProvided32() => TTF_FontHasGlyph() 53 | * TTF_GlyphMetrics() => TTF_GetGlyphMetrics() 54 | * TTF_GlyphMetrics32() => TTF_GetGlyphMetrics() 55 | * TTF_IsFontScalable() => TTF_FontIsScalable() 56 | * TTF_RenderGlyph32_Blended() => TTF_RenderGlyph_Blended() 57 | * TTF_RenderGlyph32_LCD() => TTF_RenderGlyph_LCD() 58 | * TTF_RenderGlyph32_Shaded() => TTF_RenderGlyph_Shaded() 59 | * TTF_RenderGlyph32_Solid() => TTF_RenderGlyph_Solid() 60 | * TTF_RenderUTF8_Blended() => TTF_RenderText_Blended() 61 | * TTF_RenderUTF8_Blended_Wrapped() => TTF_RenderText_Blended_Wrapped() 62 | * TTF_RenderUTF8_LCD() => TTF_RenderText_LCD() 63 | * TTF_RenderUTF8_LCD_Wrapped() => TTF_RenderText_LCD_Wrapped() 64 | * TTF_RenderUTF8_Shaded() => TTF_RenderText_Shaded() 65 | * TTF_RenderUTF8_Shaded_Wrapped() => TTF_RenderText_Shaded_Wrapped() 66 | * TTF_RenderUTF8_Solid() => TTF_RenderText_Solid() 67 | * TTF_RenderUTF8_Solid_Wrapped() => TTF_RenderText_Solid_Wrapped() 68 | * TTF_SetFontScriptName() => TTF_SetFontScript() 69 | * TTF_SetFontWrappedAlign() => TTF_SetFontWrapAlignment() 70 | * TTF_SizeText() => TTF_GetTextSize() 71 | * TTF_SizeUTF8() => TTF_SizeText() 72 | 73 | The following functions have been removed: 74 | * TTF_ByteSwappedUNICODE() 75 | * TTF_GetFontKerningSizeGlyphs() - replaced with TTF_GetGlyphKerning() 76 | * TTF_GetFontKerningSizeGlyphs32() - replaced with TTF_GetGlyphKerning() 77 | * TTF_Linked_Version() - replaced with TTF_Version() 78 | * TTF_MeasureText() - replaced with TTF_MeasureString() 79 | * TTF_MeasureUNICODE() - replaced with TTF_MeasureString() 80 | * TTF_MeasureUTF8() - replaced with TTF_MeasureString() 81 | * TTF_OpenFontDPI() - replaced with TTF_OpenFontWithProperties() 82 | * TTF_OpenFontDPIIO() - replaced with TTF_OpenFontWithProperties() 83 | * TTF_OpenFontIndex() - replaced with TTF_OpenFontWithProperties() 84 | * TTF_OpenFontIndexDPI() - replaced with TTF_OpenFontWithProperties() 85 | * TTF_OpenFontIndexDPIIO() - replaced with TTF_OpenFontWithProperties() 86 | * TTF_OpenFontIndexIO() - replaced with TTF_OpenFontWithProperties() 87 | * TTF_RenderGlyph_Solid() 88 | * TTF_RenderText_Solid() 89 | * TTF_RenderText_Solid_Wrapped() 90 | * TTF_RenderUNICODE_Blended() 91 | * TTF_RenderUNICODE_Blended_Wrapped() 92 | * TTF_RenderUNICODE_LCD() 93 | * TTF_RenderUNICODE_LCD_Wrapped() 94 | * TTF_RenderUNICODE_Shaded() 95 | * TTF_RenderUNICODE_Shaded_Wrapped() 96 | * TTF_RenderUNICODE_Solid() 97 | * TTF_RenderUNICODE_Solid_Wrapped() 98 | * TTF_SizeUNICODE() 99 | The following symbols have been renamed: 100 | * TTF_WRAPPED_ALIGN_CENTER => TTF_HORIZONTAL_ALIGN_CENTER 101 | * TTF_WRAPPED_ALIGN_LEFT => TTF_HORIZONTAL_ALIGN_LEFT 102 | * TTF_WRAPPED_ALIGN_RIGHT => TTF_HORIZONTAL_ALIGN_RIGHT 103 | 104 | -------------------------------------------------------------------------------- /docs/README-versions.md: -------------------------------------------------------------------------------- 1 | # Versioning 2 | 3 | ## Since 3.2.0 4 | 5 | SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak 6 | and older versions of the Linux kernel: 7 | 8 | * If the minor version (second part) and the patch version (third part) is 9 | divisible by 2 (for example 3.2.6, 3.4.0), this indicates a version of 10 | SDL that is believed to be stable and suitable for production use. 11 | 12 | * In stable releases, the patchlevel or micro version (third part) 13 | indicates bugfix releases. Bugfix releases may add small changes 14 | to the ABI, so newer patch versions are backwards-compatible but 15 | not fully forwards-compatible. For example, programs built against 16 | SDL 3.2.0 should work fine with SDL 3.2.8, but programs built against 17 | SDL 3.2.8 may not work with 3.2.0. 18 | 19 | * The minor version increases when significant changes are made that 20 | require longer development or testing time, e.g. major new functionality, 21 | or revamping support for a platform. Newer minor versions are 22 | backwards-compatible, but not fully forwards-compatible. For example, 23 | programs built against SDL 3.2.x should work fine with SDL 3.4.x, 24 | but programs built against SDL 3.4.x may not work with 3.2.x. 25 | 26 | * If the minor version (second part) or patch version (third part) is not 27 | divisible by 2 (for example 3.2.9, 3.3.x), this indicates a development 28 | prerelease of SDL that is not suitable for stable software distributions. 29 | Use with caution. 30 | 31 | * The patchlevel or micro version (third part) increases with each prerelease. 32 | 33 | * Prereleases are backwards-compatible with older stable branches. 34 | For example, programs built against SDL 3.2.x should work fine with 35 | SDL 3.3.x, but programs built against SDL 3.3.x may not work with 3.2.x. 36 | 37 | * Prereleases are not guaranteed to be backwards-compatible with each other. 38 | For example, new API or ABI added in 3.3.0 might be removed or changed in 39 | 3.3.1. If this would be a problem for you, please do not use prereleases. 40 | 41 | * Only use a prerelease if you can guarantee that you will promptly upgrade 42 | to the stable release that follows it. For example, do not use 3.3.x 43 | unless you will be able to upgrade to 3.4.0 when it becomes available. 44 | 45 | * Software distributions that have a freeze policy (in particular Linux 46 | distributions with a release cycle, such as Debian and Fedora) 47 | should only package stable releases, and not prereleases. 48 | 49 | -------------------------------------------------------------------------------- /docs/release_checklist.md: -------------------------------------------------------------------------------- 1 | # Release checklist 2 | 3 | ## New feature release 4 | 5 | * Update `CHANGES.txt` 6 | 7 | * Bump version number to 3.EVEN.0 in all these locations: 8 | 9 | * `include/SDL3/SDL_ttf.h`: 10 | `SDL_TTF_MAJOR_VERSION`, `SDL_TTF_MINOR_VERSION`, `SDL_TTF_MICRO_VERSION` 11 | * `CMakeLists.txt`: 12 | `MAJOR_VERSION`, `MINOR_VERSION`, `MICRO_VERSION` 13 | * `version.rc`: 14 | `FILEVERSION`, `PRODUCTVERSION`, `FileVersion`, `ProductVersion` 15 | * `VisualC/Version.rc`: 16 | `FILEVERSION`, `PRODUCTVERSION`, `FileVersion`, `ProductVersion` 17 | * `Xcode/Info-Framework.plist`: 18 | `CFBundleShortVersionString`, `CFBundleVersion` 19 | 20 | * Bump ABI version information 21 | 22 | * `Xcode/SDL_ttf.xcodeproj/project.pbxproj`: 23 | `DYLIB_CURRENT_VERSION`, `DYLIB_COMPATIBILITY_VERSION` 24 | * set first number in `DYLIB_CURRENT_VERSION` to 25 | (100 * *minor*) + 1 26 | * set second number in `DYLIB_CURRENT_VERSION` to 0 27 | * set `DYLIB_COMPATIBILITY_VERSION` to the same value 28 | 29 | * Regenerate `configure` 30 | 31 | * Run `./test-versioning.sh` to verify that everything is consistent 32 | 33 | * Do the release 34 | 35 | ## New bugfix release 36 | 37 | * Check that no new API/ABI was added 38 | 39 | * If it was, do a new feature release (see above) instead 40 | 41 | * Bump version number from 3.Y.Z to 3.Y.(Z+1) (Y is even) 42 | 43 | * Same places as listed above 44 | 45 | * Bump ABI version information 46 | 47 | * `Xcode/SDL_ttf.xcodeproj/project.pbxproj`: 48 | `DYLIB_CURRENT_VERSION`, `DYLIB_COMPATIBILITY_VERSION` 49 | * set second number in `DYLIB_CURRENT_VERSION` to *micro* 50 | * Leave `DYLIB_COMPATIBILITY_VERSION` unchanged 51 | 52 | * Regenerate `configure` 53 | 54 | * Run test/versioning.sh to verify that everything is consistent 55 | 56 | * Do the release 57 | 58 | ## After a feature release 59 | 60 | * Create a branch like `release-3.6.x` 61 | 62 | * Bump version number to 3.ODD.0 for next development branch 63 | 64 | * Same places as listed above 65 | 66 | * Bump ABI version information 67 | 68 | * Same places as listed above 69 | * Assume that the next feature release will contain new API/ABI 70 | 71 | * Run test/versioning.sh to verify that everything is consistent 72 | 73 | * Add a new milestone for issues 74 | 75 | ## New development prerelease 76 | 77 | * Bump version number from 3.Y.Z to 3.Y.(Z+1) (Y is odd) 78 | 79 | * Same places as listed above 80 | 81 | * Bump ABI version information 82 | 83 | * `Xcode/SDL_ttf.xcodeproj/project.pbxproj`: 84 | `DYLIB_CURRENT_VERSION`, `DYLIB_COMPATIBILITY_VERSION` 85 | * set first number in `DYLIB_CURRENT_VERSION` to 86 | (100 * *minor*) + *micro* + 1 87 | * set second number in `DYLIB_CURRENT_VERSION` to 0 88 | * set `DYLIB_COMPATIBILITY_VERSION` to the same value 89 | 90 | * Regenerate `configure` 91 | 92 | * Run test/versioning.sh to verify that everything is consistent 93 | 94 | * Do the release 95 | -------------------------------------------------------------------------------- /examples/editbox.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2025 Sam Lantinga 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely. 11 | */ 12 | 13 | /* This is an example of using SDL_ttf to create a multi-line editbox 14 | * with full IME support. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | /* Define this if you want to test the surface text engine */ 21 | #define TEST_SURFACE_ENGINE 22 | 23 | typedef struct EditBox { 24 | SDL_Window *window; 25 | SDL_Renderer *renderer; 26 | TTF_Font *font; 27 | TTF_Text *text; 28 | SDL_FRect rect; 29 | bool has_focus; 30 | 31 | /* Cursor support */ 32 | int cursor; 33 | int cursor_length; 34 | bool cursor_visible; 35 | Uint64 last_cursor_change; 36 | SDL_FRect cursor_rect; 37 | 38 | /* Highlight support */ 39 | bool highlighting; 40 | int highlight1; 41 | int highlight2; 42 | 43 | /* IME composition */ 44 | int composition_start; 45 | int composition_length; 46 | int composition_cursor; 47 | int composition_cursor_length; 48 | 49 | /* IME candidates */ 50 | TTF_Text *candidates; 51 | int selected_candidate_start; 52 | int selected_candidate_length; 53 | 54 | #ifdef TEST_SURFACE_ENGINE 55 | SDL_Surface *window_surface; 56 | #endif 57 | } EditBox; 58 | 59 | 60 | extern EditBox *EditBox_Create(SDL_Window *window, SDL_Renderer *renderer, TTF_TextEngine *engine, TTF_Font *font, const SDL_FRect *rect); 61 | extern void EditBox_Destroy(EditBox *edit); 62 | extern void EditBox_SetFocus(EditBox *edit, bool focus); 63 | extern void EditBox_Draw(EditBox *edit); 64 | extern void EditBox_MoveCursorLeft(EditBox *edit); 65 | extern void EditBox_MoveCursorRight(EditBox *edit); 66 | extern void EditBox_MoveCursorUp(EditBox *edit); 67 | extern void EditBox_MoveCursorDown(EditBox *edit); 68 | extern void EditBox_MoveCursorBeginningOfLine(EditBox *edit); 69 | extern void EditBox_MoveCursorEndOfLine(EditBox *edit); 70 | extern void EditBox_MoveCursorBeginning(EditBox *edit); 71 | extern void EditBox_MoveCursorEnd(EditBox *edit); 72 | extern void EditBox_Backspace(EditBox *edit); 73 | extern void EditBox_BackspaceToBeginning(EditBox *edit); 74 | extern void EditBox_DeleteToEnd(EditBox *edit); 75 | extern void EditBox_Delete(EditBox *edit); 76 | extern void EditBox_SelectAll(EditBox *edit); 77 | extern bool EditBox_DeleteHighlight(EditBox *edit); 78 | extern void EditBox_Copy(EditBox *edit); 79 | extern void EditBox_Cut(EditBox *edit); 80 | extern void EditBox_Paste(EditBox *edit); 81 | extern void EditBox_Insert(EditBox *edit, const char *text); 82 | extern bool EditBox_HandleEvent(EditBox *edit, SDL_Event *event); 83 | 84 | -------------------------------------------------------------------------------- /examples/testgputext/shaders/build-shaders.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | make-header() { 6 | xxd -i "$1" | sed \ 7 | -e 's/^unsigned /const unsigned /g' \ 8 | -e 's,^const,static const,' \ 9 | > "$1.h" 10 | } 11 | 12 | # Requires shadercross CLI installed from SDL_shadercross 13 | for filename in *.hlsl; do 14 | if [ -f "$filename" ]; then 15 | shadercross "$filename" -o "${filename/.hlsl/.spv}" 16 | make-header "${filename/.hlsl/.spv}" 17 | shadercross "$filename" -o "${filename/.hlsl/.msl}" 18 | make-header "${filename/.hlsl/.msl}" 19 | shadercross "$filename" -o "${filename/.hlsl/.dxil}" 20 | make-header "${filename/.hlsl/.dxil}" 21 | fi 22 | done 23 | 24 | rm -f *.spv *.msl *.dxil 25 | -------------------------------------------------------------------------------- /examples/testgputext/shaders/shader-sdf.frag.hlsl: -------------------------------------------------------------------------------- 1 | Texture2D tex : register(t0, space2); 2 | SamplerState samp : register(s0, space2); 3 | 4 | struct PSInput { 5 | float4 color : TEXCOORD0; 6 | float2 tex_coord : TEXCOORD1; 7 | }; 8 | 9 | struct PSOutput { 10 | float4 color : SV_Target; 11 | }; 12 | 13 | PSOutput main(PSInput input) { 14 | PSOutput output; 15 | const float smoothing = (1.0 / 16.0); 16 | float distance = tex.Sample(samp, input.tex_coord).a; 17 | float alpha = smoothstep(0.5 - smoothing, 0.5 + smoothing, distance); 18 | output.color = float4(input.color.rgb, input.color.a * alpha); 19 | return output; 20 | } 21 | -------------------------------------------------------------------------------- /examples/testgputext/shaders/shader-sdf.frag.msl.h: -------------------------------------------------------------------------------- 1 | static const unsigned char shader_sdf_frag_msl[] = { 2 | 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65, 3 | 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x3e, 0x0a, 4 | 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69, 5 | 0x6d, 0x64, 0x2f, 0x73, 0x69, 0x6d, 0x64, 0x2e, 0x68, 0x3e, 0x0a, 0x0a, 6 | 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 7 | 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x0a, 8 | 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x30, 9 | 0x5f, 0x6f, 0x75, 0x74, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 10 | 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x6f, 0x75, 0x74, 0x5f, 0x76, 0x61, 11 | 0x72, 0x5f, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 12 | 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 13 | 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 14 | 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x30, 0x5f, 0x69, 0x6e, 0x0a, 0x7b, 0x0a, 15 | 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x69, 16 | 0x6e, 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 17 | 0x52, 0x44, 0x30, 0x20, 0x5b, 0x5b, 0x75, 0x73, 0x65, 0x72, 0x28, 0x6c, 18 | 0x6f, 0x63, 0x6e, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 19 | 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x69, 0x6e, 0x5f, 0x76, 20 | 0x61, 0x72, 0x5f, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x31, 21 | 0x20, 0x5b, 0x5b, 0x75, 0x73, 0x65, 0x72, 0x28, 0x6c, 0x6f, 0x63, 0x6e, 22 | 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x66, 0x72, 23 | 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x30, 24 | 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x30, 0x28, 0x6d, 25 | 0x61, 0x69, 0x6e, 0x30, 0x5f, 0x69, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x5b, 26 | 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 27 | 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, 28 | 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x74, 0x65, 0x78, 0x20, 0x5b, 0x5b, 29 | 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 30 | 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x73, 0x61, 31 | 0x6d, 0x70, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 32 | 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 33 | 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x30, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x6f, 34 | 0x75, 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 35 | 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x6f, 0x75, 0x74, 0x5f, 0x76, 0x61, 0x72, 36 | 0x5f, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x3d, 37 | 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x69, 0x6e, 0x2e, 0x69, 38 | 0x6e, 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 39 | 0x52, 0x44, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x69, 0x6e, 0x2e, 40 | 0x69, 0x6e, 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x54, 0x45, 0x58, 0x43, 0x4f, 41 | 0x4f, 0x52, 0x44, 0x30, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x73, 0x6d, 0x6f, 42 | 0x6f, 0x74, 0x68, 0x73, 0x74, 0x65, 0x70, 0x28, 0x30, 0x2e, 0x34, 0x33, 43 | 0x37, 0x35, 0x2c, 0x20, 0x30, 0x2e, 0x35, 0x36, 0x32, 0x35, 0x2c, 0x20, 44 | 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 45 | 0x61, 0x6d, 0x70, 0x2c, 0x20, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x5f, 0x76, 46 | 0x61, 0x72, 0x5f, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x31, 47 | 0x29, 0x2e, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 48 | 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 49 | 0x0a, 0x0a 50 | }; 51 | static const unsigned int shader_sdf_frag_msl_len = 566; 52 | -------------------------------------------------------------------------------- /examples/testgputext/shaders/shader.frag.hlsl: -------------------------------------------------------------------------------- 1 | Texture2D tex : register(t0, space2); 2 | SamplerState samp : register(s0, space2); 3 | 4 | struct PSInput { 5 | float4 color : TEXCOORD0; 6 | float2 tex_coord : TEXCOORD1; 7 | }; 8 | 9 | struct PSOutput { 10 | float4 color : SV_Target; 11 | }; 12 | 13 | PSOutput main(PSInput input) { 14 | PSOutput output; 15 | output.color = input.color * tex.Sample(samp, input.tex_coord); 16 | return output; 17 | } 18 | -------------------------------------------------------------------------------- /examples/testgputext/shaders/shader.frag.msl.h: -------------------------------------------------------------------------------- 1 | static const unsigned char shader_frag_msl[] = { 2 | 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x6d, 0x65, 3 | 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x64, 0x6c, 0x69, 0x62, 0x3e, 0x0a, 4 | 0x23, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x3c, 0x73, 0x69, 5 | 0x6d, 0x64, 0x2f, 0x73, 0x69, 0x6d, 0x64, 0x2e, 0x68, 0x3e, 0x0a, 0x0a, 6 | 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 7 | 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x0a, 8 | 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x30, 9 | 0x5f, 0x6f, 0x75, 0x74, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 10 | 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x6f, 0x75, 0x74, 0x5f, 0x76, 0x61, 11 | 0x72, 0x5f, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 12 | 0x5b, 0x5b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 13 | 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 14 | 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x30, 0x5f, 0x69, 0x6e, 0x0a, 0x7b, 0x0a, 15 | 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x69, 16 | 0x6e, 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 17 | 0x52, 0x44, 0x30, 0x20, 0x5b, 0x5b, 0x75, 0x73, 0x65, 0x72, 0x28, 0x6c, 18 | 0x6f, 0x63, 0x6e, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 19 | 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x69, 0x6e, 0x5f, 0x76, 20 | 0x61, 0x72, 0x5f, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x31, 21 | 0x20, 0x5b, 0x5b, 0x75, 0x73, 0x65, 0x72, 0x28, 0x6c, 0x6f, 0x63, 0x6e, 22 | 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x0a, 0x66, 0x72, 23 | 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x30, 24 | 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x30, 0x28, 0x6d, 25 | 0x61, 0x69, 0x6e, 0x30, 0x5f, 0x69, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x5b, 26 | 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 27 | 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, 28 | 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x74, 0x65, 0x78, 0x20, 0x5b, 0x5b, 29 | 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 30 | 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x73, 0x61, 31 | 0x6d, 0x70, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 32 | 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x20, 33 | 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x30, 0x5f, 0x6f, 0x75, 0x74, 0x20, 0x6f, 34 | 0x75, 0x74, 0x20, 0x3d, 0x20, 0x7b, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 35 | 0x20, 0x6f, 0x75, 0x74, 0x2e, 0x6f, 0x75, 0x74, 0x5f, 0x76, 0x61, 0x72, 36 | 0x5f, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x20, 0x3d, 37 | 0x20, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x5f, 0x76, 0x61, 0x72, 0x5f, 0x54, 38 | 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x30, 0x20, 0x2a, 0x20, 0x74, 39 | 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x73, 0x61, 40 | 0x6d, 0x70, 0x2c, 0x20, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x5f, 0x76, 0x61, 41 | 0x72, 0x5f, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x31, 0x29, 42 | 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 43 | 0x20, 0x6f, 0x75, 0x74, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a 44 | }; 45 | static const unsigned int shader_frag_msl_len = 501; 46 | -------------------------------------------------------------------------------- /examples/testgputext/shaders/shader.vert.hlsl: -------------------------------------------------------------------------------- 1 | cbuffer uniforms : register(b0, space1) 2 | { 3 | row_major float4x4 proj_view : packoffset(c0); 4 | row_major float4x4 model : packoffset(c4); 5 | }; 6 | 7 | struct VSInput 8 | { 9 | float3 position : TEXCOORD0; 10 | float4 color : TEXCOORD1; 11 | float2 tex_coord : TEXCOORD2; 12 | }; 13 | 14 | struct VSOutput 15 | { 16 | float4 color : TEXCOORD0; 17 | float2 tex_coord : TEXCOORD1; 18 | float4 position : SV_Position; 19 | }; 20 | 21 | VSOutput main(VSInput input) 22 | { 23 | VSOutput output; 24 | output.color = input.color; 25 | output.tex_coord = input.tex_coord; 26 | output.position = mul(float4(input.position, 1.0f), mul(model, proj_view)); 27 | return output; 28 | } 29 | -------------------------------------------------------------------------------- /external/Get-GitModules.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Downloads the Git modules specified in ../.gitmodules 4 | 5 | .DESCRIPTION 6 | Parses and downloads the Github repositories specified in the .gitmodules file 7 | 8 | .EXAMPLE 9 | PS> .\Get-GitModules.ps1 10 | < Downloads and parses the repositories in the .gitmodules file. > 11 | #> 12 | 13 | #------- Variables ------------------------------------------------------------- 14 | [String] $PathRegex = "path\s*=\s*(?.*)" 15 | [String] $URLRegex = "url\s*=\s*(?.*)" 16 | [String] $BranchRegex = "branch\s*=\s*(?.*)" 17 | [String[]] $Arguments = $args 18 | 19 | #------- Script ---------------------------------------------------------------- 20 | if (-not $Arguments) { 21 | [String[]]$Arguments = "--depth", "1" 22 | } 23 | 24 | foreach ($Line in Get-Content $PSScriptRoot\..\.gitmodules) { 25 | if ($Line -match $PathRegex) { 26 | $Match = Select-String -InputObject $Line -Pattern $PathRegex 27 | $Path = $Match.Matches[0].Groups[1].Value 28 | } 29 | elseif ($Line -match $URLRegex) { 30 | $Match = Select-String -InputObject $Line -Pattern $URLRegex 31 | $URL = $Match.Matches[0].Groups[1].Value 32 | } 33 | elseif ($Line -match $BranchRegex) { 34 | $Match = Select-String -InputObject $Line -Pattern $BranchRegex 35 | $Branch = $Match.Matches[0].Groups[1].Value 36 | 37 | Write-Host "git clone --filter=blob:none $URL $Path -b $Branch --recursive $Arguments" ` 38 | -ForegroundColor Blue 39 | git clone --filter=blob:none $URL $PSScriptRoot/../$Path -b $Branch --recursive $Arguments 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /external/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | ARGUMENTS="$*" 6 | 7 | cd $(dirname "$0")/.. 8 | cat .gitmodules | \ 9 | while true; do 10 | read module || break 11 | read line; set -- $line 12 | path=$3 13 | read line; set -- $line 14 | url=$3 15 | read line; set -- $line 16 | branch=$3 17 | 18 | if [ -z "$ARGUMENTS" ]; then 19 | ARGUMENTS="--depth 1" 20 | fi 21 | 22 | git clone --filter=blob:none $url $path -b $branch --recursive $ARGUMENTS 23 | done 24 | -------------------------------------------------------------------------------- /mingw/pkg-support/cmake/sdl3_ttf-config-version.cmake: -------------------------------------------------------------------------------- 1 | # SDL3_ttf CMake version configuration file: 2 | # This file is meant to be placed in a cmake subfolder of SDL3_ttf-devel-3.x.y-mingw 3 | 4 | if(CMAKE_SIZEOF_VOID_P EQUAL 4) 5 | set(sdl3_ttf_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3_ttf/sdl3_ttf-config-version.cmake") 6 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) 7 | set(sdl3_ttf_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3_ttf/sdl3_ttf-config-version.cmake") 8 | else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") 9 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 10 | return() 11 | endif() 12 | 13 | if(NOT EXISTS "${sdl3_ttf_config_path}") 14 | message(WARNING "${sdl3_ttf_config_path} does not exist: MinGW development package is corrupted") 15 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 16 | return() 17 | endif() 18 | 19 | include("${sdl3_ttf_config_path}") 20 | -------------------------------------------------------------------------------- /mingw/pkg-support/cmake/sdl3_ttf-config.cmake: -------------------------------------------------------------------------------- 1 | # SDL3_ttf CMake configuration file: 2 | # This file is meant to be placed in a cmake subfolder of SDL3_ttf-devel-3.x.y-mingw 3 | 4 | if(CMAKE_SIZEOF_VOID_P EQUAL 4) 5 | set(sdl3_ttf_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3_ttf/sdl3_ttf-config.cmake") 6 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) 7 | set(sdl3_ttf_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3_ttf/sdl3_ttf-config.cmake") 8 | else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") 9 | set(SDL3_ttf_FOUND FALSE) 10 | return() 11 | endif() 12 | 13 | if(NOT EXISTS "${sdl3_ttf_config_path}") 14 | message(WARNING "${sdl3_ttf_config_path} does not exist: MinGW development package is corrupted") 15 | set(SDL3_ttf_FOUND FALSE) 16 | return() 17 | endif() 18 | 19 | include("${sdl3_ttf_config_path}") 20 | -------------------------------------------------------------------------------- /src/SDL_hashtable_names.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #define SDL_CreateHashTable TTF_CreateHashTable 23 | #define SDL_DestroyHashTable TTF_DestroyHashTable 24 | #define SDL_InsertIntoHashTable TTF_InsertIntoHashTable 25 | #define SDL_FindInHashTable TTF_FindInHashTable 26 | #define SDL_RemoveFromHashTable TTF_RemoveFromHashTable 27 | #define SDL_ClearHashTable TTF_ClearHashTable 28 | #define SDL_HashTableEmpty TTF_HashTableEmpty 29 | #define SDL_IterateHashTable TTF_IterateHashTable 30 | #define SDL_HashPointer TTF_HashPointer 31 | #define SDL_KeyMatchPointer TTF_KeyMatchPointer 32 | #define SDL_HashString TTF_HashString 33 | #define SDL_KeyMatchString TTF_KeyMatchString 34 | #define SDL_HashID TTF_HashID 35 | #define SDL_KeyMatchID TTF_KeyMatchID 36 | #define SDL_DestroyHashKeyAndValue TTF_DestroyHashKeyAndValue 37 | #define SDL_DestroyHashKey TTF_DestroyHashKey 38 | #define SDL_DestroyHashValue TTF_DestroyHashValue 39 | -------------------------------------------------------------------------------- /src/SDL_hashtable_ttf.c: -------------------------------------------------------------------------------- 1 | /* 2 | SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts 3 | Copyright (C) 2001-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | #include 22 | 23 | #include "SDL_hashtable.h" 24 | #include "SDL_hashtable_ttf.h" 25 | 26 | typedef struct GlyphHashtableKey { 27 | TTF_Font *font; 28 | Uint32 glyph_index; 29 | } GlyphHashtableKey; 30 | 31 | static Uint32 SDLCALL SDL_HashGlyphHashtableKey(void *unused, const void *key) 32 | { 33 | (void)unused; 34 | return SDL_murmur3_32(key, sizeof(GlyphHashtableKey), 0); 35 | } 36 | 37 | static bool SDLCALL SDL_KeyMatchGlyphHashtableKey(void *unused, const void *a, const void *b) 38 | { 39 | (void)unused; 40 | GlyphHashtableKey *A = (GlyphHashtableKey *)a; 41 | GlyphHashtableKey *B = (GlyphHashtableKey *)b; 42 | return (A->font == B->font && A->glyph_index == B->glyph_index); 43 | } 44 | 45 | static void SDLCALL SDL_NukeFreeGlyphHashtableKey(void *data, const void *key, const void *value) 46 | { 47 | SDL_GlyphHashTable_NukeFn nukefn = (SDL_GlyphHashTable_NukeFn)data; 48 | 49 | if (nukefn) { 50 | nukefn(value); 51 | } 52 | SDL_free((void *)key); 53 | } 54 | 55 | SDL_HashTable *SDL_CreateGlyphHashTable(SDL_GlyphHashTable_NukeFn nukefn) 56 | { 57 | return SDL_CreateHashTable(128, false, SDL_HashGlyphHashtableKey, SDL_KeyMatchGlyphHashtableKey, SDL_NukeFreeGlyphHashtableKey, nukefn); 58 | } 59 | 60 | bool SDL_InsertIntoGlyphHashTable(SDL_HashTable *table, TTF_Font *font, Uint32 glyph_index, const void *value) 61 | { 62 | GlyphHashtableKey *key = (GlyphHashtableKey *)SDL_calloc(1, sizeof(*key)); 63 | key->font = font; 64 | key->glyph_index = glyph_index; 65 | return SDL_InsertIntoHashTable(table, key, value, true); 66 | } 67 | 68 | bool SDL_FindInGlyphHashTable(SDL_HashTable *table, TTF_Font *font, Uint32 glyph_index, const void **value) 69 | { 70 | GlyphHashtableKey key; 71 | SDL_zero(key); 72 | key.font = font; 73 | key.glyph_index = glyph_index; 74 | return SDL_FindInHashTable(table, &key, value); 75 | } 76 | 77 | void SDL_DestroyGlyphHashTable(SDL_HashTable *table) 78 | { 79 | SDL_DestroyHashTable(table); 80 | } 81 | 82 | -------------------------------------------------------------------------------- /src/SDL_hashtable_ttf.h: -------------------------------------------------------------------------------- 1 | /* 2 | SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts 3 | Copyright (C) 2001-2025 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | typedef void (*SDL_GlyphHashTable_NukeFn)(const void *value); 23 | 24 | extern SDL_HashTable *SDL_CreateGlyphHashTable(SDL_GlyphHashTable_NukeFn nukefn); 25 | extern bool SDL_InsertIntoGlyphHashTable(SDL_HashTable *table, TTF_Font *font, Uint32 glyph_index, const void *value); 26 | extern bool SDL_FindInGlyphHashTable(SDL_HashTable *table, TTF_Font *font, Uint32 glyph_index, const void **value); 27 | extern void SDL_DestroyGlyphHashTable(SDL_HashTable *table); 28 | 29 | -------------------------------------------------------------------------------- /src/SDL_ttf.sym: -------------------------------------------------------------------------------- 1 | SDL3_ttf_0.0.0 { 2 | global: 3 | TTF_AddFallbackFont; 4 | TTF_AppendTextString; 5 | TTF_ClearFallbackFonts; 6 | TTF_CloseFont; 7 | TTF_CopyFont; 8 | TTF_CreateGPUTextEngine; 9 | TTF_CreateGPUTextEngineWithProperties; 10 | TTF_CreateRendererTextEngine; 11 | TTF_CreateRendererTextEngineWithProperties; 12 | TTF_CreateSurfaceTextEngine; 13 | TTF_CreateText; 14 | TTF_DeleteTextString; 15 | TTF_DestroyGPUTextEngine; 16 | TTF_DestroyRendererTextEngine; 17 | TTF_DestroySurfaceTextEngine; 18 | TTF_DestroyText; 19 | TTF_DrawRendererText; 20 | TTF_DrawSurfaceText; 21 | TTF_FontHasGlyph; 22 | TTF_FontIsFixedWidth; 23 | TTF_FontIsScalable; 24 | TTF_GetFontAscent; 25 | TTF_GetFontDPI; 26 | TTF_GetFontDescent; 27 | TTF_GetFontDirection; 28 | TTF_GetFontFamilyName; 29 | TTF_GetFontGeneration; 30 | TTF_GetFontHeight; 31 | TTF_GetFontHinting; 32 | TTF_GetFontKerning; 33 | TTF_GetFontLineSkip; 34 | TTF_GetFontOutline; 35 | TTF_GetFontProperties; 36 | TTF_GetFontScript; 37 | TTF_GetFontSDF; 38 | TTF_GetFontSize; 39 | TTF_GetFontStyle; 40 | TTF_GetFontStyleName; 41 | TTF_GetFontWeight; 42 | TTF_GetFontWrapAlignment; 43 | TTF_GetFreeTypeVersion; 44 | TTF_GetGlyphImage; 45 | TTF_GetGlyphImageForIndex; 46 | TTF_GetGlyphKerning; 47 | TTF_GetGlyphMetrics; 48 | TTF_GetGlyphScript; 49 | TTF_GetGPUTextDrawData; 50 | TTF_GetGPUTextEngineWinding; 51 | TTF_GetHarfBuzzVersion; 52 | TTF_GetNextTextSubString; 53 | TTF_GetNumFontFaces; 54 | TTF_GetPreviousTextSubString; 55 | TTF_GetStringSize; 56 | TTF_GetStringSizeWrapped; 57 | TTF_GetTextColor; 58 | TTF_GetTextColorFloat; 59 | TTF_GetTextDirection; 60 | TTF_GetTextEngine; 61 | TTF_GetTextFont; 62 | TTF_GetTextPosition; 63 | TTF_GetTextProperties; 64 | TTF_GetTextScript; 65 | TTF_GetTextSize; 66 | TTF_GetTextSubString; 67 | TTF_GetTextSubStringForLine; 68 | TTF_GetTextSubStringForPoint; 69 | TTF_GetTextSubStringsForRange; 70 | TTF_GetTextWrapWidth; 71 | TTF_Init; 72 | TTF_InsertTextString; 73 | TTF_MeasureString; 74 | TTF_OpenFont; 75 | TTF_OpenFontIO; 76 | TTF_OpenFontWithProperties; 77 | TTF_Quit; 78 | TTF_RemoveFallbackFont; 79 | TTF_RenderGlyph_Blended; 80 | TTF_RenderGlyph_LCD; 81 | TTF_RenderGlyph_Shaded; 82 | TTF_RenderGlyph_Solid; 83 | TTF_RenderText_Blended; 84 | TTF_RenderText_Blended_Wrapped; 85 | TTF_RenderText_LCD; 86 | TTF_RenderText_LCD_Wrapped; 87 | TTF_RenderText_Shaded; 88 | TTF_RenderText_Shaded_Wrapped; 89 | TTF_RenderText_Solid; 90 | TTF_RenderText_Solid_Wrapped; 91 | TTF_SetFontDirection; 92 | TTF_SetFontHinting; 93 | TTF_SetFontKerning; 94 | TTF_SetFontLanguage; 95 | TTF_SetFontLineSkip; 96 | TTF_SetFontOutline; 97 | TTF_SetFontSDF; 98 | TTF_SetFontScript; 99 | TTF_SetFontSize; 100 | TTF_SetFontSizeDPI; 101 | TTF_SetFontStyle; 102 | TTF_SetFontWrapAlignment; 103 | TTF_SetGPUTextEngineWinding; 104 | TTF_SetTextColor; 105 | TTF_SetTextColorFloat; 106 | TTF_SetTextDirection; 107 | TTF_SetTextEngine; 108 | TTF_SetTextFont; 109 | TTF_SetTextPosition; 110 | TTF_SetTextScript; 111 | TTF_SetTextString; 112 | TTF_SetTextWrapWhitespaceVisible; 113 | TTF_SetTextWrapWidth; 114 | TTF_StringToTag; 115 | TTF_TagToString; 116 | TTF_TextWrapWhitespaceVisible; 117 | TTF_UpdateText; 118 | TTF_Version; 119 | TTF_WasInit; 120 | local: *; 121 | }; 122 | -------------------------------------------------------------------------------- /src/version.rc: -------------------------------------------------------------------------------- 1 | 2 | #include "winresrc.h" 3 | 4 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 5 | 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Version 9 | // 10 | 11 | VS_VERSION_INFO VERSIONINFO 12 | FILEVERSION 3,3,0,0 13 | PRODUCTVERSION 3,3,0,0 14 | FILEFLAGSMASK 0x3fL 15 | FILEFLAGS 0x0L 16 | FILEOS 0x40004L 17 | FILETYPE 0x2L 18 | FILESUBTYPE 0x0L 19 | BEGIN 20 | BLOCK "StringFileInfo" 21 | BEGIN 22 | BLOCK "040904b0" 23 | BEGIN 24 | VALUE "CompanyName", "\0" 25 | VALUE "FileDescription", "SDL_ttf\0" 26 | VALUE "FileVersion", "3, 3, 0, 0\0" 27 | VALUE "InternalName", "SDL_ttf\0" 28 | VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0" 29 | VALUE "OriginalFilename", "SDL3_ttf.dll\0" 30 | VALUE "ProductName", "Simple DirectMedia Layer\0" 31 | VALUE "ProductVersion", "3, 3, 0, 0\0" 32 | END 33 | END 34 | BLOCK "VarFileInfo" 35 | BEGIN 36 | VALUE "Translation", 0x409, 1200 37 | END 38 | END 39 | --------------------------------------------------------------------------------