Compare commits
6 Commits
master
...
update-lin
Author | SHA1 | Date | |
---|---|---|---|
|
24578c20ae | ||
|
48cdbafc7d | ||
|
f224faa1e9 | ||
|
b6e1f4a796 | ||
|
8079474552 | ||
|
d271140842 |
9
.github/dependabot.yml
vendored
9
.github/dependabot.yml
vendored
@ -1,9 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- directory: /
|
||||
package-ecosystem: github-actions
|
||||
reviewers:
|
||||
- marysaka
|
||||
- TSRBerry
|
||||
schedule:
|
||||
interval: daily
|
138
.github/workflows/build.yml
vendored
138
.github/workflows/build.yml
vendored
@ -3,8 +3,9 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
rev:
|
||||
description: 'Ryujinx/SDL commit to build (this has to be a full commit sha, otherwise it will not work)'
|
||||
required: true
|
||||
description: 'Ryujinx/SDL commit to build'
|
||||
required: false
|
||||
default: 'master'
|
||||
# schedule:
|
||||
# - cron: '0 0 * * *'
|
||||
env:
|
||||
@ -18,35 +19,91 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: win-x64, os: windows-latest, arch: x64 }
|
||||
# - { name: win-x86, os: windows-latest, arch: Win32 }
|
||||
- { name: win-arm64, os: windows-latest, arch: ARM64 }
|
||||
- { name: linux-x64, os: ubuntu-20.04, arch: amd64 }
|
||||
# - { name: linux-x86, os: ubuntu-20.04, arch: i386 }
|
||||
- { name: linux-arm64, os: ubuntu-20.04, arch: arm64 }
|
||||
- { name: osx-x64, os: macos-latest, arch: x86_64 }
|
||||
- { name: osx-arm64, os: macos-latest, arch: arm64 }
|
||||
- { name: win-x64, os: windows-latest, flags: -A x64 }
|
||||
- { name: win-x86, os: windows-latest, flags: -A Win32 }
|
||||
- { name: win-arm64, os: windows-latest, flags: -A ARM64 }
|
||||
- { name: linux-x64, os: ubuntu-18.04, flags: -GNinja , target_apt_arch: ":amd64" }
|
||||
- { name: linux-x86, os: ubuntu-18.04, flags: -GNinja, cmake_configure_env: CFLAGS=-m32 CXXFLAGS=-m32, target_apt_arch: ":i386" }
|
||||
- { name: osx-x64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.14" }
|
||||
# NOTE: macOS 11.0 is the first released supported by Apple Silicon.
|
||||
- { name: osx-arm64, os: macos-latest, flags: -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" }
|
||||
steps:
|
||||
- name: Setup qemu static
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Setup Linux dependencies
|
||||
if: runner.os == 'Linux'
|
||||
- uses: actions/checkout@v4
|
||||
run: |
|
||||
# TODO: only run this command on i386
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo add-apt-repository ppa:team-xbmc/ppa
|
||||
sudo apt-get update -y -qq
|
||||
sudo apt-get install wayland-protocols${{ matrix.platform.target_apt_arch }} \
|
||||
pkg-config${{ matrix.platform.target_apt_arch }} \
|
||||
ninja-build${{ matrix.platform.target_apt_arch }} \
|
||||
libasound2-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libdbus-1-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libegl1-mesa-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libgl1-mesa-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libgles2-mesa-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libglu1-mesa-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libibus-1.0-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libpulse-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libsdl2-2.0-0${{ matrix.platform.target_apt_arch }} \
|
||||
libsndio-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libudev-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libwayland-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libx11-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libxcursor-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libxext-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libxi-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libxinerama-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libxkbcommon-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libxrandr-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libxss-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libxt-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libxv-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libxxf86vm-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libdrm-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libgbm-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libpulse-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libhidapi-dev${{ matrix.platform.target_apt_arch }} \
|
||||
libwayland-client++0$ \
|
||||
libwayland-cursor++0$ \
|
||||
wayland-scanner++ \
|
||||
gcc-multilib \
|
||||
g++-multilib
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
repository: Ryujinx/SDL
|
||||
ref: ${{ github.event.inputs.rev }}
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
path: 'SDL2-CS'
|
||||
- name: Build and prepare release
|
||||
run: SDL2-CS/ci/run.sh $PWD $PWD/SDL2-CS/native/${{ matrix.platform.name }} ${{ matrix.platform.arch }}
|
||||
shell: bash
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.platform.name }}-binaries
|
||||
path: install_output
|
||||
- name: Configure CMake
|
||||
run: ${{ matrix.platform.cmake_configure_env }} cmake -B build ${{ matrix.platform.flags }} -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON
|
||||
- name: Build
|
||||
run: cmake --build build/ --config Release
|
||||
- name: Install (Windows)
|
||||
run: cmake --install build/ --prefix install_output --config Release
|
||||
if: runner.os == 'Windows'
|
||||
- name: Install
|
||||
run: sudo cmake --install build/ --prefix install_output --config Release
|
||||
if: runner.os != 'Windows'
|
||||
- name: Prepare release directory (Windows)
|
||||
run: mkdir -Force SDL2-CS/native/${{ matrix.platform.name }}
|
||||
if: runner.os == 'Windows'
|
||||
- name: Prepare release directory
|
||||
run: mkdir -p SDL2-CS/native/${{ matrix.platform.name }}
|
||||
if: runner.os != 'Windows'
|
||||
- name: Prepare release (Windows)
|
||||
run: cp install_output/bin/SDL2.dll SDL2-CS/native/${{ matrix.platform.name }}/SDL2.dll
|
||||
if: runner.os == 'Windows'
|
||||
- name: Prepare release (Linux)
|
||||
run: cp install_output/lib/libSDL2-2.0.so.0 SDL2-CS/native/${{ matrix.platform.name }}/libSDL2.so
|
||||
if: runner.os == 'Linux'
|
||||
- name: Prepare release (OSX)
|
||||
run: cp install_output/lib/libSDL2-2.0.dylib SDL2-CS/native/${{ matrix.platform.name }}/libSDL2.dylib
|
||||
if: runner.os == 'macOS'
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
uses: peter-evans/create-pull-request@v2
|
||||
with:
|
||||
commit-message: Update ${{ matrix.platform.name }} SDL binaries
|
||||
title: Update ${{ matrix.platform.name }} SDL binaries
|
||||
@ -55,38 +112,3 @@ jobs:
|
||||
path: 'SDL2-CS'
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
||||
|
||||
build-ios:
|
||||
name: ios
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: Ryujinx/SDL
|
||||
ref: ${{ github.event.inputs.rev }}
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'SDL2-CS'
|
||||
- name: Build (iOS)
|
||||
run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -scheme xcFramework-iOS -configuration Release
|
||||
- name: Prepare release directory (iOS)
|
||||
run: mkdir -p SDL2-CS/native/ios
|
||||
- name: Prepare release (iOS)
|
||||
run: |
|
||||
mkdir -p SDL2-CS/native/ios/SDL2.xcframework/ios-arm64/SDL2.framework;
|
||||
mkdir -p SDL2-CS/native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework;
|
||||
cp Xcode/SDL/Products/SDL2.xcframework/Info.plist SDL2-CS/native/ios/SDL2.xcframework/Info.plist;
|
||||
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64/SDL2.framework/SDL2 SDL2-CS/native/ios/SDL2.xcframework/ios-arm64/SDL2.framework/SDL2;
|
||||
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64/SDL2.framework/Info.plist SDL2-CS/native/ios/SDL2.xcframework/ios-arm64/SDL2.framework/Info.plist;
|
||||
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/SDL2 SDL2-CS/native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/SDL2;
|
||||
cp Xcode/SDL/Products/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/Info.plist SDL2-CS/native/ios/SDL2.xcframework/ios-arm64_x86_64-simulator/SDL2.framework/Info.plist;
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
commit-message: Update iOS SDL binaries
|
||||
title: Update iOS SDL binaries
|
||||
body: This PR has been auto-genereated to update the iOS SDL binaries
|
||||
branch: update-ios-binaries
|
||||
path: 'SDL2-CS'
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
||||
|
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -11,11 +11,11 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 7.0.x
|
||||
dotnet-version: 6.0.x
|
||||
- uses: nuget/setup-nuget@v1
|
||||
with:
|
||||
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AssemblyTitle>SDL2#</AssemblyTitle>
|
||||
@ -8,10 +8,10 @@
|
||||
<Description>libSDL2 bindings for C#</Description>
|
||||
<RootNamespace>SDL2</RootNamespace>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<VersionPrefix>2.30.0</VersionPrefix>
|
||||
<VersionPrefix>2.0.22</VersionPrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="NuGet">
|
||||
<Authors>marysaka & ppy Pty Ltd & flibitijibibo</Authors>
|
||||
<Authors>Thog & ppy Pty Ltd & flibitijibibo</Authors>
|
||||
<Title>SDL2#</Title>
|
||||
<PackageId>Ryujinx.SDL2-CS</PackageId>
|
||||
<PackageProjectUrl>https://github.com/Ryujinx/SDL2-CS</PackageProjectUrl>
|
||||
@ -28,6 +28,11 @@
|
||||
<PackagePath>runtimes/win-arm64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\win-x86\SDL2.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/win-x86/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\osx-x64\libSDL2.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/osx-x64/native</PackagePath>
|
||||
@ -43,14 +48,9 @@
|
||||
<PackagePath>runtimes/linux-x64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\linux-arm64\libSDL2.so">
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\linux-x86\libSDL2.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/linux-arm64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\ios\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/ios/native</PackagePath>
|
||||
<PackagePath>runtimes/linux-x86/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
@ -1,4 +1,4 @@
|
||||
image: Visual Studio 2022
|
||||
image: Visual Studio 2017
|
||||
build_script:
|
||||
- cmd: dotnet restore
|
||||
- cmd: dotnet pack SDL2-CS.csproj -c:Release --include-symbols /p:Version=%APPVEYOR_BUILD_VERSION%
|
||||
|
109
ci/compile.sh
109
ci/compile.sh
@ -1,109 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$#" -le 1 ]; then
|
||||
echo "usage: <sdl_dir> <output_path> [build_arch]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
uname_system="$(uname -s)"
|
||||
|
||||
case "${uname_system}" in
|
||||
Linux*) system_name=linux;;
|
||||
Darwin*) system_name=macos;;
|
||||
CYGWIN*) system_name=win;;
|
||||
MINGW*) system_name=win;;
|
||||
*) system_name="Unknown OS: ${uname_system}"
|
||||
esac
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
sdl_dir=$1
|
||||
output_path=$2
|
||||
build_arch=$3
|
||||
|
||||
mkdir -p $output_path
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
if [ $system_name == "linux" ]; then
|
||||
build_arch=$(dpkg --print-architecture)
|
||||
else
|
||||
echo "ERROR - build_arch parameter needed on macOS and Windows"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if command -v sudo &> /dev/null
|
||||
then
|
||||
SUDO=sudo
|
||||
fi
|
||||
|
||||
if [[ $system_name == "linux" ]]; then
|
||||
if [[ $build_arch == "i386" ]]; then
|
||||
sudo dpkg --add-architecture i386
|
||||
|
||||
export CFLAGS=-m32
|
||||
export CXXFLAGS=-m32
|
||||
fi
|
||||
|
||||
$SUDO apt-get update -y
|
||||
$SUDO apt-get install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
wayland-scanner++ \
|
||||
wayland-protocols \
|
||||
pkg-config:$build_arch \
|
||||
libasound2-dev:$build_arch \
|
||||
libdbus-1-dev:$build_arch \
|
||||
libegl1-mesa-dev:$build_arch \
|
||||
libgl1-mesa-dev:$build_arch \
|
||||
libgles2-mesa-dev:$build_arch \
|
||||
libglu1-mesa-dev:$build_arch \
|
||||
libibus-1.0-dev:$build_arch \
|
||||
libpulse-dev:$build_arch \
|
||||
libsdl2-2.0-0:$build_arch \
|
||||
libsndio-dev:$build_arch \
|
||||
libudev-dev:$build_arch \
|
||||
libwayland-dev:$build_arch \
|
||||
libx11-dev:$build_arch \
|
||||
libxcursor-dev:$build_arch \
|
||||
libxext-dev:$build_arch \
|
||||
libxi-dev:$build_arch \
|
||||
libxinerama-dev:$build_arch \
|
||||
libxkbcommon-dev:$build_arch \
|
||||
libxrandr-dev:$build_arch \
|
||||
libxss-dev:$build_arch \
|
||||
libxt-dev:$build_arch \
|
||||
libxv-dev:$build_arch \
|
||||
libxxf86vm-dev:$build_arch \
|
||||
libdrm-dev:$build_arch \
|
||||
libgbm-dev:$build_arch \
|
||||
libpulse-dev:$build_arch \
|
||||
libhidapi-dev:$build_arch \
|
||||
libwayland-client++0:$build_arch \
|
||||
libwayland-cursor++0:$build_arch
|
||||
|
||||
extra_cmake_flags="-GNinja"
|
||||
elif [[ $system_name == "macos" ]]; then
|
||||
extra_cmake_flags="-DCMAKE_OSX_ARCHITECTURES=\"$build_arch\" -DCMAKE_OSX_DEPLOYMENT_TARGET=\"11.0\""
|
||||
elif [[ $system_name == "win" ]]; then
|
||||
extra_cmake_flags="-A $build_arch"
|
||||
fi
|
||||
|
||||
pushd $sdl_dir
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON $extra_cmake_flags
|
||||
cmake --build build/ --config Release
|
||||
$SUDO cmake --install build/ --prefix install_output --config Release
|
||||
|
||||
mkdir -p $output_path
|
||||
|
||||
if [[ $system_name == "linux" ]]; then
|
||||
cp install_output/lib/libSDL2-2.0.so.0 $output_path/libSDL2.so
|
||||
elif [[ $system_name == "macos" ]]; then
|
||||
cp install_output/lib/libSDL2-2.0.dylib $output_path/libSDL2.dylib
|
||||
elif [[ $system_name == "win" ]]; then
|
||||
cp install_output/bin/SDL2.dll $output_path/SDL2.dll
|
||||
fi
|
||||
popd
|
41
ci/run.sh
41
ci/run.sh
@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$#" -le 2 ]; then
|
||||
echo "usage: <sdl_dir> <output_path> <build_arch>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
uname_system="$(uname -s)"
|
||||
|
||||
case "${uname_system}" in
|
||||
Linux*) system_name=linux;;
|
||||
Darwin*) system_name=macos;;
|
||||
CYGWIN*) system_name=win;;
|
||||
MINGW*) system_name=win;;
|
||||
*) system_name="Unknown OS: ${uname_system}"
|
||||
esac
|
||||
|
||||
sdl_dir=$1
|
||||
output_path=$2
|
||||
build_arch=$3
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
mkdir -p $output_path
|
||||
|
||||
if [ $system_name == "linux" ] && [ $build_arch == "arm64" ]; then
|
||||
if command -v podman &> /dev/null; then
|
||||
DOCKER=podman
|
||||
elif command -v docker &> /dev/null; then
|
||||
DOCKER=docker
|
||||
else
|
||||
echo "ERROR - Missing docker/podman env, cannot crossbuild"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$DOCKER run --rm -v $SCRIPT_DIR:/scripts -v $output_path:/output -v $sdl_dir:/source -t arm64v8/ubuntu:focal bash /scripts/compile.sh /source /output $build_arch
|
||||
else
|
||||
$SCRIPT_DIR/compile.sh "$sdl_dir" "$output_path" "$build_arch"
|
||||
fi
|
@ -1,40 +0,0 @@
|
||||
<?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>AvailableLibraries</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>SDL2.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64_x86_64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>SDL2.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>simulator</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XFWK</string>
|
||||
<key>XCFrameworkFormatVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -37,12 +37,6 @@ namespace SDL2
|
||||
{
|
||||
public static class SDL
|
||||
{
|
||||
static SDL()
|
||||
{
|
||||
if (OperatingSystem.IsIOS())
|
||||
NativeLibrary.SetDllImportResolver(typeof(SDL).Assembly, (_, assembly, path) => NativeLibrary.Load("@rpath/SDL2.framework/SDL2", assembly, path));
|
||||
}
|
||||
|
||||
#region SDL2# Variables
|
||||
|
||||
private const string nativeLibName = "SDL2";
|
||||
|
@ -1,317 +0,0 @@
|
||||
#region License
|
||||
/* SDL2# - C# Wrapper for SDL2
|
||||
*
|
||||
* Copyright (c) 2013-2021 Ethan Lee.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in a
|
||||
* product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* Ethan "flibitijibibo" Lee <flibitijibibo@flibitijibibo.com>
|
||||
*
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
#endregion
|
||||
|
||||
namespace SDL2
|
||||
{
|
||||
public static class SDL_image
|
||||
{
|
||||
#region SDL2# Variables
|
||||
|
||||
/* Used by DllImport to load the native library. */
|
||||
private const string nativeLibName = "SDL2_image";
|
||||
|
||||
#endregion
|
||||
|
||||
#region SDL_image.h
|
||||
|
||||
/* Similar to the headers, this is the version we're expecting to be
|
||||
* running with. You will likely want to check this somewhere in your
|
||||
* program!
|
||||
*/
|
||||
public const int SDL_IMAGE_MAJOR_VERSION = 2;
|
||||
public const int SDL_IMAGE_MINOR_VERSION = 0;
|
||||
public const int SDL_IMAGE_PATCHLEVEL = 6;
|
||||
|
||||
[Flags]
|
||||
public enum IMG_InitFlags
|
||||
{
|
||||
IMG_INIT_JPG = 0x00000001,
|
||||
IMG_INIT_PNG = 0x00000002,
|
||||
IMG_INIT_TIF = 0x00000004,
|
||||
IMG_INIT_WEBP = 0x00000008
|
||||
}
|
||||
|
||||
public static void SDL_IMAGE_VERSION(out SDL.SDL_version X)
|
||||
{
|
||||
X.major = SDL_IMAGE_MAJOR_VERSION;
|
||||
X.minor = SDL_IMAGE_MINOR_VERSION;
|
||||
X.patch = SDL_IMAGE_PATCHLEVEL;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_Linked_Version", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern IntPtr INTERNAL_IMG_Linked_Version();
|
||||
public static SDL.SDL_version IMG_Linked_Version()
|
||||
{
|
||||
SDL.SDL_version result;
|
||||
IntPtr result_ptr = INTERNAL_IMG_Linked_Version();
|
||||
result = (SDL.SDL_version) Marshal.PtrToStructure(
|
||||
result_ptr,
|
||||
typeof(SDL.SDL_version)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int IMG_Init(IMG_InitFlags flags);
|
||||
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void IMG_Quit();
|
||||
|
||||
/* IntPtr refers to an SDL_Surface* */
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_Load", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_IMG_Load(
|
||||
byte* file
|
||||
);
|
||||
public static unsafe IntPtr IMG_Load(string file)
|
||||
{
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
IntPtr handle = INTERNAL_IMG_Load(
|
||||
utf8File
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* src refers to an SDL_RWops*, IntPtr to an SDL_Surface* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_Load_RW(
|
||||
IntPtr src,
|
||||
int freesrc
|
||||
);
|
||||
|
||||
/* src refers to an SDL_RWops*, IntPtr to an SDL_Surface* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_LoadTyped_RW", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_IMG_LoadTyped_RW(
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
byte* type
|
||||
);
|
||||
public static unsafe IntPtr IMG_LoadTyped_RW(
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
string type
|
||||
) {
|
||||
int utf8TypeBufSize = SDL.Utf8Size(type);
|
||||
byte* utf8Type = stackalloc byte[utf8TypeBufSize];
|
||||
return INTERNAL_IMG_LoadTyped_RW(
|
||||
src,
|
||||
freesrc,
|
||||
SDL.Utf8Encode(type, utf8Type, utf8TypeBufSize)
|
||||
);
|
||||
}
|
||||
|
||||
/* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_LoadTexture", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_IMG_LoadTexture(
|
||||
IntPtr renderer,
|
||||
byte* file
|
||||
);
|
||||
public static unsafe IntPtr IMG_LoadTexture(
|
||||
IntPtr renderer,
|
||||
string file
|
||||
) {
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
IntPtr handle = INTERNAL_IMG_LoadTexture(
|
||||
renderer,
|
||||
utf8File
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* renderer refers to an SDL_Renderer*.
|
||||
* src refers to an SDL_RWops*.
|
||||
* IntPtr to an SDL_Texture*.
|
||||
*/
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_LoadTexture_RW(
|
||||
IntPtr renderer,
|
||||
IntPtr src,
|
||||
int freesrc
|
||||
);
|
||||
|
||||
/* renderer refers to an SDL_Renderer*.
|
||||
* src refers to an SDL_RWops*.
|
||||
* IntPtr to an SDL_Texture*.
|
||||
*/
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_LoadTextureTyped_RW", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe IntPtr INTERNAL_IMG_LoadTextureTyped_RW(
|
||||
IntPtr renderer,
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
byte* type
|
||||
);
|
||||
public static unsafe IntPtr IMG_LoadTextureTyped_RW(
|
||||
IntPtr renderer,
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
string type
|
||||
) {
|
||||
byte* utf8Type = SDL.Utf8EncodeHeap(type);
|
||||
IntPtr handle = INTERNAL_IMG_LoadTextureTyped_RW(
|
||||
renderer,
|
||||
src,
|
||||
freesrc,
|
||||
utf8Type
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8Type);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* IntPtr refers to an SDL_Surface* */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_ReadXPMFromArray(
|
||||
[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)]
|
||||
string[] xpm
|
||||
);
|
||||
|
||||
/* surface refers to an SDL_Surface* */
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_SavePNG", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe int INTERNAL_IMG_SavePNG(
|
||||
IntPtr surface,
|
||||
byte* file
|
||||
);
|
||||
public static unsafe int IMG_SavePNG(IntPtr surface, string file)
|
||||
{
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
int result = INTERNAL_IMG_SavePNG(
|
||||
surface,
|
||||
utf8File
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* surface refers to an SDL_Surface*, dst to an SDL_RWops* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int IMG_SavePNG_RW(
|
||||
IntPtr surface,
|
||||
IntPtr dst,
|
||||
int freedst
|
||||
);
|
||||
|
||||
/* surface refers to an SDL_Surface* */
|
||||
[DllImport(nativeLibName, EntryPoint = "IMG_SaveJPG", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern unsafe int INTERNAL_IMG_SaveJPG(
|
||||
IntPtr surface,
|
||||
byte* file,
|
||||
int quality
|
||||
);
|
||||
public static unsafe int IMG_SaveJPG(IntPtr surface, string file, int quality)
|
||||
{
|
||||
byte* utf8File = SDL.Utf8EncodeHeap(file);
|
||||
int result = INTERNAL_IMG_SaveJPG(
|
||||
surface,
|
||||
utf8File,
|
||||
quality
|
||||
);
|
||||
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* surface refers to an SDL_Surface*, dst to an SDL_RWops* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int IMG_SaveJPG_RW(
|
||||
IntPtr surface,
|
||||
IntPtr dst,
|
||||
int freedst,
|
||||
int quality
|
||||
);
|
||||
|
||||
public static string IMG_GetError()
|
||||
{
|
||||
return SDL.SDL_GetError();
|
||||
}
|
||||
|
||||
public static void IMG_SetError(string fmtAndArglist)
|
||||
{
|
||||
SDL.SDL_SetError(fmtAndArglist);
|
||||
}
|
||||
|
||||
#region Animated Image Support
|
||||
|
||||
/* This region is only available in 2.0.6 or higher. */
|
||||
|
||||
public struct IMG_Animation
|
||||
{
|
||||
public int w;
|
||||
public int h;
|
||||
public IntPtr frames; /* SDL_Surface** */
|
||||
public IntPtr delays; /* int* */
|
||||
}
|
||||
|
||||
/* IntPtr refers to an IMG_Animation* */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_LoadAnimation(
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string file
|
||||
);
|
||||
|
||||
/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_LoadAnimation_RW(
|
||||
IntPtr src,
|
||||
int freesrc
|
||||
);
|
||||
|
||||
/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_LoadAnimationTyped_RW(
|
||||
IntPtr src,
|
||||
int freesrc,
|
||||
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
||||
string type
|
||||
);
|
||||
|
||||
/* anim refers to an IMG_Animation* */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void IMG_FreeAnimation(IntPtr anim);
|
||||
|
||||
/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */
|
||||
/* THIS IS A PUBLIC RWops FUNCTION! */
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr IMG_LoadGIFAnimation_RW(IntPtr src);
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user