Full Code of Ravbug/sdl3-sample for AI

main 0bb9df88a320 cached
23 files
37.2 KB
10.0k tokens
6 symbols
1 requests
Download .txt
Repository: Ravbug/sdl3-sample
Branch: main
Commit: 0bb9df88a320
Files: 23
Total size: 37.2 KB

Directory structure:
gitextract_fvasxu2p/

├── .github/
│   └── workflows/
│       ├── android-build.yml
│       ├── build.yml
│       └── web-build.yml
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── LICENSE
├── README.md
├── build.gradle
├── config/
│   ├── README.md
│   ├── config-generic.sh
│   ├── config-ios-xcode.sh
│   ├── config-mac-xcode.sh
│   ├── config-tvos-xcode.sh
│   ├── config-visionos-xcode.sh
│   ├── config-web-unix.sh
│   ├── config-web-win.bat
│   └── config-win.bat
└── src/
    ├── Info.plist.in
    ├── attributions.txt
    ├── iosLaunchScreen.storyboard
    ├── main.cpp
    └── the_entertainer.ogg

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/workflows/android-build.yml
================================================
name: Build Sample for Android

on: [push, pull_request]

jobs:
  apk:
    name: Apk Build
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
      - uses: actions/setup-java@v4
        with:
          distribution: 'temurin'
          java-version: '17'

      - name: Update the build.gradle
        run:  |
               cp build.gradle SDL/android-project/app/

      - name: Build the APK
        run: |
              cd SDL/android-project/
              ./gradlew assembleDebug

      - name: Upload the APK
        uses: actions/upload-artifact@v4
        with: 
          name: app-debug.apk
          path: SDL/android-project/app/build/outputs/apk/debug/app-debug.apk


================================================
FILE: .github/workflows/build.yml
================================================
name: Build Sample
on: [push, pull_request]

jobs:
    build-win:
        name: Build for Windows
        runs-on: windows-latest
        strategy:
          fail-fast: false
          matrix:
              arch: [x64, ARM64]
              target: [Windows]

        steps:
          - uses: actions/checkout@v4
            with:
                submodules: recursive
          - name: Configure
            run: cmake -DCMAKE_SYSTEM_NAME=${{ matrix.target }} -DCMAKE_SYSTEM_VERSION="10.0" -A${{ matrix.arch }} -S . -B build
          - name: Build
            run: cmake --build build --target sdl-min --config Release
          - name: Upload Build
            uses: actions/upload-artifact@v4
            if: ${{ matrix.target != 'WindowsStore' }}
            with: 
                name: sdl-min-${{ matrix.target }}-${{ matrix.arch }}
                path: |
                    build/Release/*.exe
                    build/Release/*.dll
                    build/Release/*.ttf
                    build/Release/*.ogg
                    build/Release/*.svg
                    
    build-linux:
        name: Build for Linux
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
            with:
                submodules: recursive
          - name: Install Dependencies
            run: |
                sudo apt update
                sudo apt install -y --no-install-recommends build-essential git cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev libxtst-dev
          - name: Configure
            run: cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S . -B build
          - name: Build
            run: cmake --build build --target sdl-min --config Release
          - name: Upload Build
            uses: actions/upload-artifact@v4
            with: 
                name: sdl-min-Linux
                path: |
                    build/Release/sdl-min
                    build/Release/*.so
                    build/Release/*.ttf
                    build/Release/*.ogg
                    build/Release/*.svg

    build-mac:
        name: Build for Apple
        runs-on: macos-14
        strategy:
          fail-fast: false
          matrix:
              target: [iOS, tvOS, visionOS, '']

        steps:
          - uses: actions/checkout@v4
            with:
                submodules: recursive
          - name: Setup Xcode version
            uses: maxim-lobanov/setup-xcode@v1.6.0
            with:
                xcode-version: "16.1"
          - name: Configure
            run: cmake -G "Xcode" -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO -DCMAKE_SYSTEM_NAME=${{ matrix.target }} -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -S . -B build
          - name: Build
            run: cmake --build build --target install --config Release
          - name: Ad-Hoc Codesign
            run: codesign -s - -f "./build/release/sdl-min.app" --deep
          - name: Create DMG
            run: | 
                cd build
                hdiutil create -size 2g -srcfolder release -volname sdl_min_apple_${{ matrix.target }} sdl_min_apple_${{ matrix.target }}.dmg
          - name: Upload Build
            uses: actions/upload-artifact@v4
            with: 
                name: sdl-min-apple-${{ matrix.target }}
                path: build/*.dmg


================================================
FILE: .github/workflows/web-build.yml
================================================
name: Build Sample For Web
on: [push, pull_request]

jobs:
  build-web:
    name: Build demo for Web
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          submodules: recursive
      - name: Get Emscripten
        run: |
          git clone https://github.com/emscripten-core/emsdk.git --depth=1
          cd emsdk
          ./emsdk install tot
          ./emsdk activate tot
      - name: Build for web
        run: |
          source emsdk/emsdk_env.sh
          emcmake cmake -S . -B build
          cmake --build build --parallel
      - name: Prepare for upload
        run: |
           mkdir _site
           mv build/sdl-min.html _site/index.html
           mv build/sdl-* _site/
      - name: Fix permissions
        run: |
         chmod -c -R +rX "_site/" | while read line; do
           echo "::warning title=Invalid file permissions automatically fixed::$line"
         done
      - name: Upload 
        uses: actions/upload-pages-artifact@v3
        with:
          path: _site/
        
 # Deploy job
  deploy:
    # Add a dependency to the build job
    needs: build-web

    # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
    permissions:
      pages: write      # to deploy to Pages
      id-token: write   # to verify the deployment originates from an appropriate source

    # Deploy to the github-pages environment
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}

    # Specify runner + deployment step
    runs-on: ubuntu-latest
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4 # or the latest "vX.X.X" version tag for this action


================================================
FILE: .gitignore
================================================
.DS_Store
build/


================================================
FILE: .gitmodules
================================================
[submodule "SDL"]
	path = SDL
	url = https://github.com/libsdl-org/SDL
[submodule "SDL_ttf"]
	path = SDL_ttf
	url = https://github.com/libsdl-org/SDL_ttf
[submodule "SDL_mixer"]
	path = SDL_mixer
	url = https://github.com/libsdl-org/SDL_mixer
[submodule "SDL_image"]
	path = SDL_image
	url = https://github.com/libsdl-org/SDL_image


================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.16)

# set the output directory for built objects.
# This makes sure that the dynamic library goes into the build directory automatically.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")

# prevent installing to system directories. 
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE INTERNAL "")

# Declare the project
project(sdl-min)

if ((APPLE AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") OR EMSCRIPTEN)
    set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")    # Disable shared builds on platforms where it does not make sense to use them
    set(SDL_SHARED OFF)
else()
    set(SDL_SHARED ON)
endif()

if(MSVC)
    if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
        add_definitions(/MP)				# parallelize each target, unless Ninja is the generator
    endif()
endif()

# Set the name of the executable
set(EXECUTABLE_NAME ${PROJECT_NAME})

# Create an executable or a shared library based on the platform and add our sources to it
if (ANDROID)
	# The SDL java code is hardcoded to load libmain.so on android, so we need to change EXECUTABLE_NAME
	set(EXECUTABLE_NAME main)
	add_library(${EXECUTABLE_NAME} SHARED)
else()
	add_executable(${EXECUTABLE_NAME})
endif()

# Add your sources to the target
target_sources(${EXECUTABLE_NAME} 
PRIVATE 
    src/main.cpp
    src/iosLaunchScreen.storyboard
)
# What is iosLaunchScreen.storyboard? This file describes what Apple's mobile platforms
# should show the user while the application is starting up. If you don't include one,
# then you get placed in a compatibility mode that does not allow HighDPI.
# This file is referenced inside Info.plist.in, where it is marked as the launch screen file.
# It is also ignored on non-Apple platforms. 

# To get an app icon on Apple platforms, add it to your executable.
# Afterward, the image file in Info.plist.in.
if(APPLE)
    target_sources("${EXECUTABLE_NAME}" PRIVATE "src/logo.png")
endif()

# Set C++ version
target_compile_features(${EXECUTABLE_NAME} PUBLIC cxx_std_20)

# on Web targets, we need CMake to generate a HTML webpage. 
if(EMSCRIPTEN)
	set(CMAKE_EXECUTABLE_SUFFIX ".html" CACHE INTERNAL "")
endif()

# Configure SDL by calling its CMake file.
# we use EXCLUDE_FROM_ALL so that its install targets and configs don't
# pollute upwards into our configuration.
add_subdirectory(SDL EXCLUDE_FROM_ALL)

# If you don't want SDL_ttf, then remove this section.
set(SDLTTF_VENDORED ON) # tell SDL_ttf to build its own dependencies
add_subdirectory(SDL_ttf EXCLUDE_FROM_ALL)	

# SDL_mixer (used for playing audio)
set(SDLMIXER_MIDI_NATIVE OFF)     # disable formats we don't use to make the build faster and smaller. Also some of these don't work on all platforms so you'll need to do some experimentation.
set(SDLMIXER_GME OFF)
set(SDLMIXER_WAVPACK OFF)     
set(SDLMIXER_MOD OFF)
set(SDLMIXER_MOD_XMP OFF)
set(SDLMIXER_OPUS OFF)
set(SDLMIXER_MP3_MPG123 OFF)
set(SDLMIXER_VORBIS_VORBISFILE OFF)
set(SDLMIXER_FLAC_LIBFLAC OFF)
set(SDLMIXER_VENDORED ON)   # tell SDL_mixer to build its own dependencies
add_subdirectory(SDL_mixer EXCLUDE_FROM_ALL)

# SDL_image (used for loading various image formats)
set(SDLIMAGE_VENDORED ON)
set(SDLIMAGE_AVIF OFF)	# disable formats we don't use to make the build faster and smaller.
set(SDLIMAGE_BMP OFF)
set(SDLIMAGE_JPG OFF)
set(SDLIMAGE_WEBP OFF)
set(SDLIMAGE_PNG_LIBPNG OFF)    # SDL3 includes built-in support for loading PNGs. If you need more than what that supports, enable this option.
add_subdirectory(SDL_image EXCLUDE_FROM_ALL)

# Link SDL to our executable. This also makes its include directory available to us. 
target_link_libraries(${EXECUTABLE_NAME} PUBLIC 
	SDL3_ttf::SDL3_ttf      # remove if you are not using SDL_ttf
	SDL3_mixer::SDL3_mixer  # remove if you are not using SDL_mixer
	SDL3_image::SDL3_image	# remove if you are not using SDL_image
    SDL3::SDL3              # If using satelite libraries, SDL must be the last item in the list. 
)

# Dealing with assets
# We have some non-code resources that our application needs in order to work. How we deal with those differs per platform.
if (APPLE)
    # on Apple targets, the application bundle has a "resources" subfolder where we can place our assets.
    # SDL_GetBasePath() gives us easy access to that location.
    set(input_root "${CMAKE_CURRENT_LIST_DIR}/src")
    macro(add_resource FILE)
        file(RELATIVE_PATH relpath "${input_root}" "${FILE}")
        get_filename_component(relpath "${relpath}" DIRECTORY)
        target_sources(${EXECUTABLE_NAME} PRIVATE ${FILE})
        set_property(SOURCE ${FILE} PROPERTY MACOSX_PACKAGE_LOCATION "Resources/${relpath}")
    endmacro()
    add_resource("${CMAKE_CURRENT_LIST_DIR}/src/Inter-VariableFont.ttf")
    add_resource("${CMAKE_CURRENT_LIST_DIR}/src/the_entertainer.ogg")
    add_resource("${CMAKE_CURRENT_LIST_DIR}/src/gs_tiger.svg")
elseif(EMSCRIPTEN)
    # on the web, we have to put the files inside of the webassembly
    # somewhat unintuitively, this is done via a linker argument.
    target_link_libraries(${EXECUTABLE_NAME} PRIVATE 
        "--preload-file \"${CMAKE_CURRENT_LIST_DIR}/src/Inter-VariableFont.ttf@/\""
        "--preload-file \"${CMAKE_CURRENT_LIST_DIR}/src/the_entertainer.ogg@/\""
        "--preload-file \"${CMAKE_CURRENT_LIST_DIR}/src/gs_tiger.svg@/\""
    )
else()
    if (ANDROID)
        if (NOT MOBILE_ASSETS_DIR)
            message(FATAL_ERROR "Building for Android, but MOBILE_ASSETS_DIR is not set")
        endif()
        file(MAKE_DIRECTORY "${MOBILE_ASSETS_DIR}")    # we need to create the project Assets dir otherwise CMake won't copy our assets.
    endif()

    
    macro(copy_helper filename)
        if (ANDROID)
            # MOBILE_ASSETS_DIR is set in the gradle file via the cmake command line and points to the Android Studio Assets folder. 
            # when we copy assets there, the Android build pipeline knows to add them to the apk. 
            set(outname "${MOBILE_ASSETS_DIR}/${filename}")    
        else()
            # for platforms that do not have a good packaging format, all we can do is copy the assets to the process working directory.
            set(outname "${CMAKE_BINARY_DIR}/$<CONFIGURATION>/${filename}")
        endif()
        add_custom_command(POST_BUILD
            TARGET "${EXECUTABLE_NAME}"
		    COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_LIST_DIR}/src/${filename}" "${outname}"
	    )
    endmacro()
    copy_helper("Inter-VariableFont.ttf")
    copy_helper("the_entertainer.ogg")
    copy_helper("gs_tiger.svg")
endif()

# set some extra configs for each platform
set(RESOURCE_FILES "src/logo.png")
if(IOS)
    set(RESOURCE_FILES "src/iosLaunchScreen.storyboard;src/logo.png") # make the splash screen show up on iOS
endif()

set_target_properties(${EXECUTABLE_NAME} PROPERTIES 
    # On macOS, make a proper .app bundle instead of a bare executable
    MACOSX_BUNDLE TRUE
    # Set the Info.plist file for Apple Mobile platforms. Without this file, your app
    # will not launch. 
    MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/src/Info.plist.in"

    # in Xcode, create a Scheme in the schemes dropdown for the app.
    XCODE_GENERATE_SCHEME TRUE
    # Identification for Xcode
    XCODE_ATTRIBUTE_BUNDLE_IDENTIFIER "com.ravbug.sdl3-sample"
	XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.ravbug.sdl3-sample"
	XCODE_ATTRIBUTE_CURRENTYEAR "${CURRENTYEAR}"
    RESOURCE "${RESOURCE_FILES}"
)

# on Visual Studio, set our app as the default project
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "${EXECUTABLE_NAME}")

# On macOS Platforms, ensure that the bundle is valid for distribution by calling fixup_bundle.
# note that fixup_bundle does not work on iOS, so you will want to use static libraries 
# or manually copy dylibs and set rpaths
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
    # tell Install about the target, otherwise fixup won't know about the transitive dependencies
    install(TARGETS ${EXECUTABLE_NAME}
    	BUNDLE DESTINATION ./install COMPONENT Runtime
   	    RUNTIME DESTINATION ./install/bin COMPONENT Runtime
    )
	
    set(DEP_DIR "${CMAKE_BINARY_DIR}")  # where to look for dependencies when fixing up
    INSTALL(CODE 
        "include(BundleUtilities)
        fixup_bundle(\"$<TARGET_BUNDLE_DIR:${EXECUTABLE_NAME}>\" \"\" \"${DEP_DIR}\")
        " 
    )
    set(CPACK_GENERATOR "DragNDrop")
    include(CPack)
endif()


================================================
FILE: LICENSE
================================================
Creative Commons Legal Code

CC0 1.0 Universal

    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
    LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
    INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
    REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
    PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
    THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
    HEREUNDER.

Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").

Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.

For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:

  i. the right to reproduce, adapt, distribute, perform, display,
     communicate, and translate a Work;
 ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
     likeness depicted in a Work;
 iv. rights protecting against unfair competition in regards to a Work,
     subject to the limitations in paragraph 4(a), below;
  v. rights protecting the extraction, dissemination, use and reuse of data
     in a Work;
 vi. database rights (such as those arising under Directive 96/9/EC of the
     European Parliament and of the Council of 11 March 1996 on the legal
     protection of databases, and under any national implementation
     thereof, including any amended or successor version of such
     directive); and
vii. other similar, equivalent or corresponding rights throughout the
     world based on applicable law or treaty, and any national
     implementations thereof.

2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.

4. Limitations and Disclaimers.

 a. No trademark or patent rights held by Affirmer are waived, abandoned,
    surrendered, licensed or otherwise affected by this document.
 b. Affirmer offers the Work as-is and makes no representations or
    warranties of any kind concerning the Work, express, implied,
    statutory or otherwise, including without limitation warranties of
    title, merchantability, fitness for a particular purpose, non
    infringement, or the absence of latent or other defects, accuracy, or
    the present or absence of errors, whether or not discoverable, all to
    the greatest extent permissible under applicable law.
 c. Affirmer disclaims responsibility for clearing rights of other persons
    that may apply to the Work or any use thereof, including without
    limitation any person's Copyright and Related Rights in the Work.
    Further, Affirmer disclaims responsibility for obtaining any necessary
    consents, permissions or other rights required for any use of the
    Work.
 d. Affirmer understands and acknowledges that Creative Commons is not a
    party to this document and has no duty or obligation with respect to
    this CC0 or use of the Work.


================================================
FILE: README.md
================================================
## SDL3 App From Source Minimal Example
This is a minimal example for building and using SDL3, SDL_Mixer, SDL_Image, and SDL_ttf_ from source 
using C++ and CMake. It also demonstrates setting up things like macOS/iOS
bundles.
See [src/main.cpp](src/main.cpp) for the code. 

### Building And Running
Are you a complete beginner? If so, read [this](https://github.com/Ravbug/sdl3-sample/wiki/Setting-up-your-computer)!
Otherwise, install CMake and your favorite compiler, and follow the commands below:
```sh
# You need to clone with submodules, otherwise SDL will not download.
git clone https://github.com/Ravbug/sdl3-sample --depth=1 --recurse-submodules
cd sdl3-sample
cmake -S . -B build
```
You can also use an init script inside [`config/`](config/). Then open the IDE project inside `build/` 
(If you had CMake generate one) and run!

## Supported Platforms
I have tested the following:
| Platform | Architecture | Generator |
| --- | --- | --- |
| macOS | x86_64, arm64 | Xcode |
| iOS | x86_64, arm64 | Xcode |
| tvOS | x86_64, arm64 | Xcode |
| visionOS* | arm64 | Xcode |
| Windows | x86_64, arm64 | Visual Studio |
| Linux | x86_64, arm64 | Ninja, Make |
| Web* | wasm | Ninja, Make |
| Android* | x86, x64, arm, arm64 | Ninja via Android Studio |

*See further instructions in [`config/`](config/)

Note: UWP support was [removed from SDL3](https://github.com/libsdl-org/SDL/pull/10731) during its development. For historical reasons, you can get a working UWP sample via this commit: [df270da](https://github.com/Ravbug/sdl3-sample/tree/df270daa8d6d48426e128e50c73357dfdf89afbf)

## Updating SDL
Just update the submodule:
```sh
cd SDL
git pull
cd ..

cd SDL_ttf
git pull
```
You don't need to use a submodule, you can also copy the source in directly. This
repository uses a submodule to keep its size to a minimum.

## Reporting issues
Is something not working? Create an Issue or send a Pull Request on this repository!


================================================
FILE: build.gradle
================================================
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
def buildAsApplication = !buildAsLibrary
if (buildAsApplication) {
    apply plugin: 'com.android.application'
}
else {
    apply plugin: 'com.android.library'
}

android {
    compileSdkVersion 34
    if (buildAsApplication) {
        namespace "org.libsdl.app"
    }
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 34
        versionCode 1
        versionName "1.0"
        externalNativeBuild {
            cmake {
                arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static", "-DCMAKE_VERBOSE_MAKEFILE=ON", "-DMOBILE_ASSETS_DIR=${System.getProperty("user.dir")}/app/src/main/assets"
                // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
                // abiFilters 'arm64-v8a'
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    applicationVariants.all { variant ->
        tasks["merge${variant.name.capitalize()}Assets"]
                .dependsOn("externalNativeBuild${variant.name.capitalize()}")
    }
    if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
        sourceSets.main {
            jniLibs.srcDir 'libs'
        }
        externalNativeBuild {
            // ndkBuild {
            //     path 'jni/Android.mk'
            // }
            cmake {
                path "../../../CMakeLists.txt"
                version "3.22.1"
            }
        }

    }
    lintOptions {
        abortOnError false
    }

    if (buildAsLibrary) {
        libraryVariants.all { variant ->
            variant.outputs.each { output ->
                def outputFile = output.outputFile
                if (outputFile != null && outputFile.name.endsWith(".aar")) {
                    def fileName = "org.libsdl.app.aar";
                    output.outputFile = new File(outputFile.parent, fileName);
                }
            }
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
}


================================================
FILE: config/README.md
================================================
# How to use these scripts

For the most part, just run the scripts in this directory from this directory. 

## Notes:
- visionOS
	- Requires CMake 3.28 or newer
- Web
 	1. Install emsdk somewhere.
  	2. On Windows hosts, run `config-web-win.bat` via the `emcmdprompt.bat` cmd in the emsdk root directory
	3. On Unix hosts, first run `source emsdk_env.sh` (found in the emsdk root directory), then run `config-web-unix.sh` 
	4. After the build completes, use `python3 -m http.server` in the build directory to make the page accessible.
- Android
	- There is no easy CMake config for this platform. Instead, follow the steps as outlined below. See the android GitHub action for more details. 
	1. Install Android Studio + NDK from https://developer.android.com/studio
 	2. Copy `build.gradle` to `SDL/android-project/app/`. If you look inside `build.gradle`, you'll see `"../../../CMakeLists.txt"` as the path to the CMakeLists file. This points to the CMakeLists in this repo's root directory after it is copied. 
  	3. `cd SDL/android-project/`
  	4. `./gradlew assembleDebug`. You'll get an apk which you can then install onto a device. 


================================================
FILE: config/config-generic.sh
================================================
#!/bin/bash
cd "${0%/*}"/

cmake -B "../build/`uname`" -S ..

================================================
FILE: config/config-ios-xcode.sh
================================================
#!/bin/bash
cd "${0%/*}"

cmake -G "Xcode" -DCMAKE_SYSTEM_NAME="iOS" -B ../build/ios -S ..


================================================
FILE: config/config-mac-xcode.sh
================================================
#!/bin/bash
cd "${0%/*}"

cmake -G "Xcode" -B ../build/mac  -S ..

================================================
FILE: config/config-tvos-xcode.sh
================================================
#!/bin/bash
cd "${0%/*}"

cmake -G "Xcode" -DCMAKE_SYSTEM_NAME="tvOS" -B ../build/tvos -S ..


================================================
FILE: config/config-visionos-xcode.sh
================================================
#!/bin/bash

# note: requires CMake 3.28 or newer

cd "${0%/*}"

cmake -G "Xcode" -DCMAKE_SYSTEM_NAME="visionOS" -S .. -B ../build/visionOS


================================================
FILE: config/config-web-unix.sh
================================================
#!/bin/bash
cd "${0%/*}"

emcmake cmake -S .. -B ../build/web

================================================
FILE: config/config-web-win.bat
================================================
@echo OFF

emcmake cmake -S .. -B ..\build\web

================================================
FILE: config/config-win.bat
================================================
@echo OFF

cmake -S .. -B ..\build\win

================================================
FILE: src/Info.plist.in
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSHighResolutionCapable</key>
	<true/>
	<key>CFBundleDevelopmentRegion</key>
	<string>$(DEVELOPMENT_LANGUAGE)</string>
	<key>UILaunchStoryboardName</key>
	<string>iosLaunchScreen</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIconFile</key>
	<string></string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>LSMinimumSystemVersion</key>
	<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
	<key>NSHumanReadableCopyright</key>
	<string>Copyright © $(CURRENTYEAR) Ravbug. All rights reserved.</string>
	<key>NSSupportsAutomaticTermination</key>
	<true/>
	<key>NSSupportsSuddenTermination</key>
	<true/>
	<key>CFBundleIconFile</key>
	<string>logo.png</string>
    <key>UIRequiresFullScreen</key>
    <true/>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
</dict>
</plist>


================================================
FILE: src/attributions.txt
================================================
"The Entertainer" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0 License

http://creativecommons.org/licenses/by/4.0/


"Tiger from the Ghostscript examples" (gs_tiger.svg) is under the terms of the 
GNU Affero General Public License as published by the Free Software Foundation; 
either version 3 of the License, or any later version. This work is distributed 
in the hope that it will be useful, but without any warranty; without even the 
implied warranty of merchantability or fitness for a particular purpose. 
See version 3 of the GNU Affero General Public License for more details.



================================================
FILE: src/iosLaunchScreen.storyboard
================================================
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
    <device id="retina6_12" orientation="landscape" appearance="light"/>
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <scenes>
        <!--View Controller-->
        <scene sceneID="EHf-IW-A2E">
            <objects>
                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
                    <imageView key="view" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo.png" id="mAg-Nv-QPQ">
                        <rect key="frame" x="0.0" y="0.0" width="852" height="393"/>
                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                    </imageView>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="53" y="375"/>
        </scene>
    </scenes>
    <resources>
        <image name="logo.png" width="460" height="460"/>
    </resources>
</document>


================================================
FILE: src/main.cpp
================================================
#define SDL_MAIN_USE_CALLBACKS  // This is necessary for the new callbacks API. To use the legacy API, don't define this. 
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3/SDL_init.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <SDL3_mixer/SDL_mixer.h>
#include <SDL3_image/SDL_image.h>
#include <cmath>
#include <string_view>
#include <filesystem>
#include <thread>

constexpr uint32_t windowStartWidth = 400;
constexpr uint32_t windowStartHeight = 400;

struct AppContext {
    SDL_Window* window;
    SDL_Renderer* renderer;
    SDL_Texture* messageTex, *imageTex;
    SDL_FRect messageDest;
    SDL_AudioDeviceID audioDevice;
    MIX_Track* track;
    SDL_AppResult app_quit = SDL_APP_CONTINUE;
};

SDL_AppResult SDL_Fail(){
    SDL_LogError(SDL_LOG_CATEGORY_CUSTOM, "Error %s", SDL_GetError());
    return SDL_APP_FAILURE;
}

SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]) {
    // init the library, here we make a window so we only need the Video capabilities.
    if (not SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)){
        return SDL_Fail();
    }
    
    // init TTF
    if (not TTF_Init()) {
        return SDL_Fail();
    }
    
    // init Mixer
    if (not MIX_Init()) {
        return SDL_Fail();
    }
    
    // create a window
   
    SDL_Window* window = SDL_CreateWindow("SDL Minimal Sample", windowStartWidth, windowStartHeight, SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY);
    if (not window){
        return SDL_Fail();
    }
    
    // create a renderer
    SDL_Renderer* renderer = SDL_CreateRenderer(window, NULL);
    if (not renderer){
        return SDL_Fail();
    }
    
    // load the font
#if __ANDROID__
    std::filesystem::path basePath = "";   // on Android we do not want to use basepath. Instead, assets are available at the root directory.
#else
    auto basePathPtr = SDL_GetBasePath();
     if (not basePathPtr){
        return SDL_Fail();
    }
     const std::filesystem::path basePath = basePathPtr;
#endif

    const auto fontPath = basePath / "Inter-VariableFont.ttf";
    TTF_Font* font = TTF_OpenFont(fontPath.string().c_str(), 36);
    if (not font) {
        return SDL_Fail();
    }

    // render the font to a surface
    const std::string_view text = "Hello SDL!";
    SDL_Surface* surfaceMessage = TTF_RenderText_Solid(font, text.data(), text.length(), { 255,255,255 });

    // make a texture from the surface
    SDL_Texture* messageTex = SDL_CreateTextureFromSurface(renderer, surfaceMessage);

    // we no longer need the font or the surface, so we can destroy those now.
    TTF_CloseFont(font);
    SDL_DestroySurface(surfaceMessage);

    // load the SVG
    auto svg_surface = IMG_Load((basePath / "gs_tiger.svg").string().c_str());
    SDL_Texture* tex = SDL_CreateTextureFromSurface(renderer, svg_surface);
    SDL_DestroySurface(svg_surface);
    

    // get the on-screen dimensions of the text. this is necessary for rendering it
    auto messageTexProps = SDL_GetTextureProperties(messageTex);
    SDL_FRect text_rect{
            .x = 0,
            .y = 0,
            .w = float(SDL_GetNumberProperty(messageTexProps, SDL_PROP_TEXTURE_WIDTH_NUMBER, 0)),
            .h = float(SDL_GetNumberProperty(messageTexProps, SDL_PROP_TEXTURE_HEIGHT_NUMBER, 0))
    };

    // init SDL Mixer
    MIX_Mixer* mixer = MIX_CreateMixerDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, NULL);
    if (mixer == nullptr) {
        return SDL_Fail();
    }
    
    auto mixerTrack = MIX_CreateTrack(mixer);

    // load the music
    auto musicPath = basePath / "the_entertainer.ogg";
    auto music = MIX_LoadAudio(mixer,musicPath.string().c_str(),false);
    if (not music) {
        return SDL_Fail();
    }

    // play the music (does not loop)
    MIX_SetTrackAudio(mixerTrack, music);
    MIX_PlayTrack(mixerTrack, NULL);
    
    // print some information about the window
    SDL_ShowWindow(window);
    {
        int width, height, bbwidth, bbheight;
        SDL_GetWindowSize(window, &width, &height);
        SDL_GetWindowSizeInPixels(window, &bbwidth, &bbheight);
        SDL_Log("Window size: %ix%i", width, height);
        SDL_Log("Backbuffer size: %ix%i", bbwidth, bbheight);
        if (width != bbwidth){
            SDL_Log("This is a highdpi environment.");
        }
    }

    // set up the application data
    *appstate = new AppContext{
       .window = window,
       .renderer = renderer,
       .messageTex = messageTex,
       .imageTex = tex,
       .messageDest = text_rect,
       .track = mixerTrack,
    };
    
    SDL_SetRenderVSync(renderer, -1);   // enable vysnc
    
    SDL_Log("Application started successfully!");

    return SDL_APP_CONTINUE;
}

SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event* event) {
    auto* app = (AppContext*)appstate;
    
    if (event->type == SDL_EVENT_QUIT) {
        app->app_quit = SDL_APP_SUCCESS;
    }

    return SDL_APP_CONTINUE;
}

SDL_AppResult SDL_AppIterate(void *appstate) {
    auto* app = (AppContext*)appstate;

    // draw a color
    auto time = SDL_GetTicks() / 1000.f;
    auto red = (std::sin(time) + 1) / 2.0 * 255;
    auto green = (std::sin(time / 2) + 1) / 2.0 * 255;
    auto blue = (std::sin(time) * 2 + 1) / 2.0 * 255;
    
    SDL_SetRenderDrawColor(app->renderer, red, green, blue, SDL_ALPHA_OPAQUE);
    SDL_RenderClear(app->renderer);

    // Renderer uses the painter's algorithm to make the text appear above the image, we must render the image first.
    SDL_RenderTexture(app->renderer, app->imageTex, NULL, NULL);
    SDL_RenderTexture(app->renderer, app->messageTex, NULL, &app->messageDest);

    SDL_RenderPresent(app->renderer);

    return app->app_quit;
}

void SDL_AppQuit(void* appstate, SDL_AppResult result) {
    auto* app = (AppContext*)appstate;
    if (app) {
        SDL_DestroyRenderer(app->renderer);
        SDL_DestroyWindow(app->window);
        
        // prevent the music from abruptly ending.
        MIX_StopTrack(app->track, MIX_TrackMSToFrames(app->track, 1000));
        std::this_thread::sleep_for(std::chrono::milliseconds(1000));
        //Mix_FreeMusic(app->music); // this call blocks until the music has finished fading
        SDL_CloseAudioDevice(app->audioDevice);

        delete app;
    }
    TTF_Quit();
    MIX_Quit();

    SDL_Log("Application quit successfully!");
    SDL_Quit();
}
Download .txt
gitextract_fvasxu2p/

├── .github/
│   └── workflows/
│       ├── android-build.yml
│       ├── build.yml
│       └── web-build.yml
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── LICENSE
├── README.md
├── build.gradle
├── config/
│   ├── README.md
│   ├── config-generic.sh
│   ├── config-ios-xcode.sh
│   ├── config-mac-xcode.sh
│   ├── config-tvos-xcode.sh
│   ├── config-visionos-xcode.sh
│   ├── config-web-unix.sh
│   ├── config-web-win.bat
│   └── config-win.bat
└── src/
    ├── Info.plist.in
    ├── attributions.txt
    ├── iosLaunchScreen.storyboard
    ├── main.cpp
    └── the_entertainer.ogg
Download .txt
SYMBOL INDEX (6 symbols across 1 files)

FILE: src/main.cpp
  type AppContext (line 16) | struct AppContext {
  function SDL_AppResult (line 26) | SDL_AppResult SDL_Fail(){
  function SDL_AppResult (line 31) | SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]) {
  function SDL_AppResult (line 152) | SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event* event) {
  function SDL_AppResult (line 162) | SDL_AppResult SDL_AppIterate(void *appstate) {
  function SDL_AppQuit (line 183) | void SDL_AppQuit(void* appstate, SDL_AppResult result) {
Condensed preview — 23 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (41K chars).
[
  {
    "path": ".github/workflows/android-build.yml",
    "chars": 780,
    "preview": "name: Build Sample for Android\r\n\r\non: [push, pull_request]\r\n\r\njobs:\r\n  apk:\r\n    name: Apk Build\r\n    runs-on: ubuntu-la"
  },
  {
    "path": ".github/workflows/build.yml",
    "chars": 3655,
    "preview": "name: Build Sample\non: [push, pull_request]\n\njobs:\n    build-win:\n        name: Build for Windows\n        runs-on: windo"
  },
  {
    "path": ".github/workflows/web-build.yml",
    "chars": 1757,
    "preview": "name: Build Sample For Web\non: [push, pull_request]\n\njobs:\n  build-web:\n    name: Build demo for Web\n    runs-on: ubuntu"
  },
  {
    "path": ".gitignore",
    "chars": 17,
    "preview": ".DS_Store\nbuild/\n"
  },
  {
    "path": ".gitmodules",
    "chars": 332,
    "preview": "[submodule \"SDL\"]\n\tpath = SDL\n\turl = https://github.com/libsdl-org/SDL\n[submodule \"SDL_ttf\"]\n\tpath = SDL_ttf\n\turl = http"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 8507,
    "preview": "cmake_minimum_required(VERSION 3.16)\n\n# set the output directory for built objects.\n# This makes sure that the dynamic l"
  },
  {
    "path": "LICENSE",
    "chars": 7048,
    "preview": "Creative Commons Legal Code\n\nCC0 1.0 Universal\n\n    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE\n"
  },
  {
    "path": "README.md",
    "chars": 1938,
    "preview": "## SDL3 App From Source Minimal Example\nThis is a minimal example for building and using SDL3, SDL_Mixer, SDL_Image, and"
  },
  {
    "path": "build.gradle",
    "chars": 2206,
    "preview": "def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');\r\ndef buildAsApplication = !buildAsLibrary\r\nif (buildAsAppl"
  },
  {
    "path": "config/README.md",
    "chars": 1158,
    "preview": "# How to use these scripts\r\n\r\nFor the most part, just run the scripts in this directory from this directory. \r\n\r\n## Note"
  },
  {
    "path": "config/config-generic.sh",
    "chars": 60,
    "preview": "#!/bin/bash\ncd \"${0%/*}\"/\n\ncmake -B \"../build/`uname`\" -S .."
  },
  {
    "path": "config/config-ios-xcode.sh",
    "chars": 91,
    "preview": "#!/bin/bash\ncd \"${0%/*}\"\n\ncmake -G \"Xcode\" -DCMAKE_SYSTEM_NAME=\"iOS\" -B ../build/ios -S ..\n"
  },
  {
    "path": "config/config-mac-xcode.sh",
    "chars": 65,
    "preview": "#!/bin/bash\ncd \"${0%/*}\"\n\ncmake -G \"Xcode\" -B ../build/mac  -S .."
  },
  {
    "path": "config/config-tvos-xcode.sh",
    "chars": 93,
    "preview": "#!/bin/bash\ncd \"${0%/*}\"\n\ncmake -G \"Xcode\" -DCMAKE_SYSTEM_NAME=\"tvOS\" -B ../build/tvos -S ..\n"
  },
  {
    "path": "config/config-visionos-xcode.sh",
    "chars": 140,
    "preview": "#!/bin/bash\n\n# note: requires CMake 3.28 or newer\n\ncd \"${0%/*}\"\n\ncmake -G \"Xcode\" -DCMAKE_SYSTEM_NAME=\"visionOS\" -S .. -"
  },
  {
    "path": "config/config-web-unix.sh",
    "chars": 61,
    "preview": "#!/bin/bash\ncd \"${0%/*}\"\n\nemcmake cmake -S .. -B ../build/web"
  },
  {
    "path": "config/config-web-win.bat",
    "chars": 46,
    "preview": "@echo OFF\n\nemcmake cmake -S .. -B ..\\build\\web"
  },
  {
    "path": "config/config-win.bat",
    "chars": 38,
    "preview": "@echo OFF\n\ncmake -S .. -B ..\\build\\win"
  },
  {
    "path": "src/Info.plist.in",
    "chars": 1461,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "src/attributions.txt",
    "chars": 640,
    "preview": "\"The Entertainer\" Kevin MacLeod (incompetech.com)\r\nLicensed under Creative Commons: By Attribution 4.0 License\r\n\r\nhttp:/"
  },
  {
    "path": "src/iosLaunchScreen.storyboard",
    "chars": 1654,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3"
  },
  {
    "path": "src/main.cpp",
    "chars": 6335,
    "preview": "#define SDL_MAIN_USE_CALLBACKS  // This is necessary for the new callbacks API. To use the legacy API, don't define this"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the Ravbug/sdl3-sample GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 23 files (37.2 KB), approximately 10.0k tokens, and a symbol index with 6 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!