Compare commits
204 Commits
master
...
update-lin
Author | SHA1 | Date | |
---|---|---|---|
|
24578c20ae | ||
|
48cdbafc7d | ||
|
f224faa1e9 | ||
|
b6e1f4a796 | ||
|
8079474552 | ||
|
d271140842 | ||
|
d1e53cea05 | ||
|
1821b2bb17 | ||
|
b7fd7d726c | ||
|
19aa8b1798 | ||
|
f32e4b5478 | ||
|
366aa00589 | ||
|
ae180cfc1f | ||
|
187f94d325 | ||
|
81c382eab4 | ||
|
11d2922072 | ||
|
702b7c877a | ||
|
735989b51e | ||
|
8cefdf4486 | ||
|
9a9d4fbfb9 | ||
|
f84a835639 | ||
|
52f2a61602 | ||
|
3b42c239f0 | ||
|
a0a6f8f64d | ||
|
d4c8b25a79 | ||
|
31db8dd836 | ||
|
0e75d73195 | ||
|
8f179f0549 | ||
|
ff380bf048 | ||
|
48224c9bd6 | ||
|
d4bc1065c0 | ||
|
c168f4271a | ||
|
0c6e7ac1a2 | ||
|
054e86eabe | ||
|
6dd9f14040 | ||
|
9a854009f0 | ||
|
80841ecef0 | ||
|
9ad2ef91d4 | ||
|
46d450901c | ||
|
a903801fcb | ||
|
79c04ec4e4 | ||
|
365ac7343c | ||
|
589530739f | ||
|
3dd6caee61 | ||
|
7b9cc0930c | ||
|
9e75a76b27 | ||
|
1ccc304a3b | ||
|
41f1a7b98c | ||
|
7411451ccd | ||
|
6cbf30b667 | ||
|
13efd80035 | ||
|
661432e075 | ||
|
07bf0132e2 | ||
|
1740846bfb | ||
|
c7b2eed527 | ||
|
1f5701255d | ||
|
47d127ff42 | ||
|
57efe7508d | ||
|
180c6624da | ||
|
616ec3e4af | ||
|
d122cdc0cc | ||
|
7fef4e4bcf | ||
|
54fea85d7f | ||
|
7e253ea7fd | ||
|
1b8cb2a3ef | ||
|
be91db5b85 | ||
|
e063120875 | ||
|
a5dd0e3002 | ||
|
55c8fc9736 | ||
|
1d947d73ad | ||
|
c51685eab3 | ||
|
6ce8eaf83a | ||
|
8ac357412e | ||
|
e7e6bdefb0 | ||
|
36ceacad9b | ||
|
c1556e8f95 | ||
|
52db66311c | ||
|
606c573d3e | ||
|
c94f27fa40 | ||
|
7a875af110 | ||
|
253d6b4da9 | ||
|
88abfa1730 | ||
|
4c2bf2ab88 | ||
|
82aef37aca | ||
|
52e4a98e0a | ||
|
7a7197c277 | ||
|
ef5dc11cd3 | ||
|
e368843d7a | ||
|
74a1fff30b | ||
|
bcec137696 | ||
|
33e12f2306 | ||
|
3fcefdd96d | ||
|
104a0e76cc | ||
|
184bcfd476 | ||
|
ae543f186c | ||
|
1f2d1af595 | ||
|
ec825444fb | ||
|
d786027acc | ||
|
7e899b49c0 | ||
|
2c82d193b9 | ||
|
300874e40a | ||
|
4b751678a2 | ||
|
d0d4705c55 | ||
|
d9511db82c | ||
|
16fdc264b6 | ||
|
1415d15998 | ||
|
cd42526f1c | ||
|
251ec9ae31 | ||
|
b188a3b90c | ||
|
9cb3215569 | ||
|
a535172268 | ||
|
afaa34f0f3 | ||
|
42709cf78f | ||
|
abd696f7c0 | ||
|
8b76a259af | ||
|
0ea9805e1d | ||
|
dc716ca7c5 | ||
|
db92e59f27 | ||
|
94f6c5e79a | ||
|
b97b3cd339 | ||
|
460f879545 | ||
|
5944136044 | ||
|
c54101eaf5 | ||
|
b40112a74b | ||
|
722f71f3a5 | ||
|
2ee992ef3b | ||
|
4785fd817f | ||
|
a04537c994 | ||
|
8462f99195 | ||
|
7b7585b045 | ||
|
65b8105f09 | ||
|
83717c51ef | ||
|
b8b194a7ec | ||
|
c9b096c847 | ||
|
4c196724b0 | ||
|
ecc9a9a154 | ||
|
d5484a2fec | ||
|
9be777f917 | ||
|
c0281870b1 | ||
|
a858e3061d | ||
|
8110b3c582 | ||
|
89753c4684 | ||
|
36eccd760b | ||
|
0c4c44634f | ||
|
b904c1164d | ||
|
8825ccdf59 | ||
|
4ca474a69b | ||
|
8807bcc1b2 | ||
|
503baa3663 | ||
|
408fadcded | ||
|
8a2eb9bfa0 | ||
|
e05d0ef426 | ||
|
53596261ca | ||
|
e230266ff3 | ||
|
1b81e33fee | ||
|
947e2503da | ||
|
b6fdbf043e | ||
|
c37b077242 | ||
|
9bf64d5cd1 | ||
|
3216da88bf | ||
|
7bc858acd8 | ||
|
cc7d210bf4 | ||
|
3442d7e8b4 | ||
|
a043e0bb33 | ||
|
186a34554d | ||
|
67dc4d0842 | ||
|
d00bb32648 | ||
|
18cbf1485e | ||
|
742ad3c971 | ||
|
82e95483bd | ||
|
e2fb4179bd | ||
|
eb4e0cbe50 | ||
|
dc028d0497 | ||
|
32330ebdbd | ||
|
51e0a82a3c | ||
|
c5911dcc22 | ||
|
5ace052807 | ||
|
5b7f489e98 | ||
|
ef21e36cea | ||
|
600dfe2de5 | ||
|
0dfc1a8cbb | ||
|
4c3602ce14 | ||
|
98e58cb814 | ||
|
1a11a38891 | ||
|
eedabe04d2 | ||
|
c219f70e0d | ||
|
5acf9e579e | ||
|
243fe0b884 | ||
|
9289a3fd82 | ||
|
4d11cf48a9 | ||
|
0c9a67cd45 | ||
|
6dba3318fa | ||
|
12c4d809ef | ||
|
155c51adb8 | ||
|
0addb31520 | ||
|
32c23f3e35 | ||
|
0729f73aa1 | ||
|
67a6fb4532 | ||
|
ad755967f3 | ||
|
19be86c467 | ||
|
2994716b99 | ||
|
ef9c50923a | ||
|
849d398070 | ||
|
0f73183733 |
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@ -1 +0,0 @@
|
||||
github: [flibitijibibo]
|
114
.github/workflows/build.yml
vendored
Normal file
114
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
name: build-native
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
rev:
|
||||
description: 'Ryujinx/SDL commit to build'
|
||||
required: false
|
||||
default: 'master'
|
||||
# schedule:
|
||||
# - cron: '0 0 * * *'
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.platform.name }}
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { 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 Linux dependencies
|
||||
if: runner.os == 'Linux'
|
||||
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@v2
|
||||
with:
|
||||
path: 'SDL2-CS'
|
||||
- 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@v2
|
||||
with:
|
||||
commit-message: Update ${{ matrix.platform.name }} SDL binaries
|
||||
title: Update ${{ matrix.platform.name }} SDL binaries
|
||||
body: This PR has been auto-generated to update the ${{ matrix.platform.name }} SDL binaries.
|
||||
branch: update-${{ matrix.platform.name }}-binaries
|
||||
path: 'SDL2-CS'
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
34
.github/workflows/ci.yml
vendored
Normal file
34
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs: {}
|
||||
#push:
|
||||
# branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
- uses: nuget/setup-nuget@v1
|
||||
with:
|
||||
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
|
||||
nuget-version: '6.x'
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --no-restore
|
||||
- name: Test
|
||||
run: dotnet test --no-build --verbosity normal
|
||||
- name: Pack & Publish
|
||||
run: |
|
||||
dotnet pack --version-suffix "build${{ github.run_number }}" -c Release .\SDL2-CS.csproj -o .
|
||||
$file_to_publish = Get-ChildItem -Path $dir -Filter *.nupkg | Select -First 1
|
||||
echo $file_to_publish
|
||||
nuget push $file_to_publish -Source https://api.nuget.org/v3/index.json
|
@ -1,58 +0,0 @@
|
||||
stages:
|
||||
- build
|
||||
- package
|
||||
- deploy
|
||||
|
||||
build_net461:
|
||||
image: mono
|
||||
stage: build
|
||||
only:
|
||||
- schedules
|
||||
script:
|
||||
- ./gitlab-ci/build-net461.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- bin/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
build_netcore:
|
||||
image: microsoft/dotnet:2.1-sdk
|
||||
stage: build
|
||||
only:
|
||||
- schedules
|
||||
script:
|
||||
- ./gitlab-ci/build-netcore.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- bin/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
package_nuget:
|
||||
image: mono
|
||||
stage: package
|
||||
only:
|
||||
- schedules
|
||||
script:
|
||||
- ./gitlab-ci/package.sh
|
||||
dependencies:
|
||||
- build_net461
|
||||
- build_netcore
|
||||
artifacts:
|
||||
paths:
|
||||
- '*.nupkg'
|
||||
|
||||
deploy_nuget:
|
||||
image: mono
|
||||
stage: deploy
|
||||
only:
|
||||
- schedules
|
||||
script:
|
||||
- ./gitlab-ci/deploy.sh
|
||||
dependencies:
|
||||
- package_nuget
|
||||
environment:
|
||||
name: nuget
|
||||
url: http://nuget.org/
|
||||
|
33
Makefile
33
Makefile
@ -1,33 +0,0 @@
|
||||
# Makefile for SDL2#
|
||||
# Written by Ethan "flibitijibibo" Lee
|
||||
|
||||
# Source Lists
|
||||
SRC = \
|
||||
src/SDL2.cs \
|
||||
src/SDL2_gfx.cs \
|
||||
src/SDL2_image.cs \
|
||||
src/SDL2_mixer.cs \
|
||||
src/SDL2_ttf.cs
|
||||
|
||||
# Targets
|
||||
|
||||
debug: clean-debug
|
||||
mkdir -p bin/Debug
|
||||
cp app.config bin/Debug/SDL2-CS.dll.config
|
||||
mcs /unsafe -debug -out:bin/Debug/SDL2-CS.dll -target:library $(SRC)
|
||||
|
||||
clean-debug:
|
||||
rm -rf bin/Debug
|
||||
|
||||
release: clean-release
|
||||
mkdir -p bin/Release
|
||||
cp app.config bin/Release/SDL2-CS.dll.config
|
||||
mcs /unsafe -optimize -out:bin/Release/SDL2-CS.dll -target:library $(SRC)
|
||||
|
||||
clean-release:
|
||||
rm -rf bin/Release
|
||||
|
||||
clean: clean-debug clean-release
|
||||
rm -rf bin
|
||||
|
||||
all: debug release
|
@ -1,31 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net40;netstandard2.0</TargetFrameworks>
|
||||
<Platforms>x64</Platforms>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<EnableDefaultItems>false</EnableDefaultItems>
|
||||
<AssemblyName>SDL2-CS</AssemblyName>
|
||||
<RootNamespace>SDL2</RootNamespace>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SDLSettingsPropsFilePath>$(SolutionDir)SDL2-CS.Settings.props</SDLSettingsPropsFilePath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SDLSettingsPropsFilePath)" Condition="Exists('$(SDLSettingsPropsFilePath)')" />
|
||||
<Target Name="ValidatePropsFilePath" BeforeTargets="BeforeBuild">
|
||||
<Message Importance="High" Text="No property overrides found at '$(SDLSettingsPropsFilePath)'" Condition="!Exists('$(SDLSettingsPropsFilePath)')" />
|
||||
<Message Importance="High" Text="Loaded property overrides from '$(SDLSettingsPropsFilePath)'" Condition="Exists('$(SDLSettingsPropsFilePath)')" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<Compile Include="src\SDL2.cs" />
|
||||
<Compile Include="src\SDL2_gfx.cs" />
|
||||
<Compile Include="src\SDL2_image.cs" />
|
||||
<Compile Include="src\SDL2_mixer.cs" />
|
||||
<Compile Include="src\SDL2_ttf.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
162
SDL2-CS.csproj
162
SDL2-CS.csproj
@ -1,102 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{85480198-8711-4355-830E-72FD794AD3F6}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>SDL2</RootNamespace>
|
||||
<AssemblyName>SDL2-CS</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<SDLSettingsPropsFilePath>$(SolutionDir)SDL2-CS.Settings.props</SDLSettingsPropsFilePath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SDLSettingsPropsFilePath)" Condition="Exists('$(SDLSettingsPropsFilePath)')" />
|
||||
<Target Name="ValidatePropsFilePath" BeforeTargets="BeforeBuild">
|
||||
<Message Importance="High" Text="No property overrides found at '$(SDLSettingsPropsFilePath)'" Condition="!Exists('$(SDLSettingsPropsFilePath)')" />
|
||||
<Message Importance="High" Text="Loaded property overrides from '$(SDLSettingsPropsFilePath)'" Condition="Exists('$(SDLSettingsPropsFilePath)')" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<Compile Include="src\SDL2.cs" />
|
||||
<Compile Include="src\SDL2_gfx.cs" />
|
||||
<Compile Include="src\SDL2_image.cs" />
|
||||
<Compile Include="src\SDL2_mixer.cs" />
|
||||
<Compile Include="src\SDL2_ttf.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config">
|
||||
<Link>$(TargetFileName).config</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AssemblyTitle>SDL2#</AssemblyTitle>
|
||||
<AssemblyName>SDL2-CS</AssemblyName>
|
||||
<Description>libSDL2 bindings for C#</Description>
|
||||
<RootNamespace>SDL2</RootNamespace>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<VersionPrefix>2.0.22</VersionPrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="NuGet">
|
||||
<Authors>Thog & ppy Pty Ltd & flibitijibibo</Authors>
|
||||
<Title>SDL2#</Title>
|
||||
<PackageId>Ryujinx.SDL2-CS</PackageId>
|
||||
<PackageProjectUrl>https://github.com/Ryujinx/SDL2-CS</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/Ryujinx/SDL2-CS</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\win-x64\SDL2.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/win-x64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\win-arm64\SDL2.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<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>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\osx-arm64\libSDL2.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/osx-arm64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\linux-x64\libSDL2.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/linux-x64/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)native\linux-x86\libSDL2.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<PackagePath>runtimes/linux-x86/native</PackagePath>
|
||||
<Pack>true</Pack>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="app.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
18
app.config
18
app.config
@ -1,22 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<dllmap dll="SDL2" os="windows" target="SDL2.dll"/>
|
||||
<dllmap dll="SDL2" os="osx" target="libSDL2-2.0.0.dylib"/>
|
||||
<dllmap dll="SDL2" os="osx" target="libSDL2.dylib"/>
|
||||
<dllmap dll="SDL2" os="linux" target="libSDL2-2.0.so.0"/>
|
||||
|
||||
<dllmap dll="SDL2_gfx" os="windows" target="SDL2_gfx.dll"/>
|
||||
<dllmap dll="SDL2_gfx" os="osx" target="libSDL2_gfx-1.0.0.dylib"/>
|
||||
<dllmap dll="SDL2_gfx" os="linux" target="libSDL2_gfx-1.0.so.0"/>
|
||||
|
||||
<dllmap dll="SDL2_image" os="windows" target="SDL2_image.dll"/>
|
||||
<dllmap dll="SDL2_image" os="osx" target="libSDL2_image-2.0.0.dylib"/>
|
||||
<dllmap dll="SDL2_image" os="linux" target="libSDL2_image-2.0.so.0"/>
|
||||
|
||||
<dllmap dll="SDL2_mixer" os="windows" target="SDL2_mixer.dll"/>
|
||||
<dllmap dll="SDL2_mixer" os="osx" target="libSDL2_mixer-2.0.0.dylib"/>
|
||||
<dllmap dll="SDL2_mixer" os="linux" target="libSDL2_mixer-2.0.so.0"/>
|
||||
|
||||
<dllmap dll="SDL2_ttf" os="windows" target="SDL2_ttf.dll"/>
|
||||
<dllmap dll="SDL2_ttf" os="osx" target="libSDL2_ttf-2.0.0.dylib"/>
|
||||
<dllmap dll="SDL2_ttf" os="linux" target="libSDL2_ttf-2.0.so.0"/>
|
||||
</configuration>
|
||||
|
8
appveyor.yml
Normal file
8
appveyor.yml
Normal file
@ -0,0 +1,8 @@
|
||||
image: Visual Studio 2017
|
||||
build_script:
|
||||
- cmd: dotnet restore
|
||||
- cmd: dotnet pack SDL2-CS.csproj -c:Release --include-symbols /p:Version=%APPVEYOR_BUILD_VERSION%
|
||||
test: off
|
||||
version: 1.0.{build}-alpha
|
||||
artifacts:
|
||||
- path: 'bin\Release\*.nupkg'
|
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>SDL2-CS-Rolling</id>
|
||||
<version>2000.1.1</version>
|
||||
<authors>flibitijibibo</authors>
|
||||
<owners>beannaich</owners>
|
||||
<licenseUrl>https://github.com/flibitijibibo/SDL2-CS/blob/master/LICENSE</licenseUrl>
|
||||
<projectUrl>https://github.com/flibitijibibo/SDL2-CS</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>SDL2# - C# Wrapper for SDL2</description>
|
||||
<copyright>Copyright 2013-2021</copyright>
|
||||
<tags>SDL2# SDL2 SDL</tags>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\bin\Debug\*.dll" target="lib/net461" />
|
||||
<file src="..\bin\Debug\*.dll.config" target="lib/net461" />
|
||||
<file src="..\bin\Debug\*.pdb" target="lib/net461" />
|
||||
<file src="..\bin\Debug\netstandard2.0\*.dll" target="lib/netstandard2.0" />
|
||||
<file src="..\bin\Debug\netstandard2.0\*.dll.config" target="lib/netstandard2.0" />
|
||||
<file src="..\bin\Debug\netstandard2.0\*.pdb" target="lib/netstandard2.0" />
|
||||
</files>
|
||||
</package>
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
msbuild /p:Configuration=Release SDL2-CS.csproj
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
dotnet build -c Release SDL2-CS.Core.csproj
|
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
nuget setApiKey $NUGET_API_KEY -verbosity quiet
|
||||
|
||||
for package in `find *.nupkg`; do
|
||||
nuget push $package -source https://nuget.org/
|
||||
done
|
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
version=`date +"%Y.%m.%d"`
|
||||
|
||||
nuspec="gitlab-ci/SDL2-CS.nuspec"
|
||||
|
||||
nuget pack $nuspec -Version $version
|
19
linux-build/Dockerfile.amd64
Normal file
19
linux-build/Dockerfile.amd64
Normal file
@ -0,0 +1,19 @@
|
||||
FROM debian:jessie
|
||||
|
||||
# We build on Jessie, but libwayland-dev and wayland-protocols are only in
|
||||
# Stretch and later.
|
||||
COPY stretch-package-pins /etc/apt/preferences.d/stretch
|
||||
|
||||
# Packages are from https://hg.libsdl.org/SDL/file/default/docs/README-linux.md
|
||||
RUN echo deb http://deb.debian.org/debian/ stretch main > /etc/apt/sources.list.d/stretch.list && \
|
||||
echo deb http://security.debian.org/debian-security stretch/updates main >> /etc/apt/sources.list.d/stretch.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y build-essential mercurial make cmake autoconf automake \
|
||||
libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
|
||||
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
|
||||
libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
|
||||
libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
|
||||
fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \
|
||||
libxkbcommon-dev wayland-protocols
|
||||
|
||||
ENTRYPOINT ["/entry"]
|
19
linux-build/Dockerfile.i386
Normal file
19
linux-build/Dockerfile.i386
Normal file
@ -0,0 +1,19 @@
|
||||
FROM i386/debian:jessie
|
||||
|
||||
# We build on Jessie, but libwayland-dev and wayland-protocols are only in
|
||||
# Stretch and later.
|
||||
COPY stretch-package-pins /etc/apt/preferences.d/stretch
|
||||
|
||||
# Packages are from https://hg.libsdl.org/SDL/file/default/docs/README-linux.md
|
||||
RUN echo deb http://deb.debian.org/debian/ stretch main > /etc/apt/sources.list.d/stretch.list && \
|
||||
echo deb http://security.debian.org/debian-security stretch/updates main >> /etc/apt/sources.list.d/stretch.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y build-essential mercurial make cmake autoconf automake \
|
||||
libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
|
||||
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
|
||||
libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
|
||||
libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
|
||||
fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \
|
||||
libxkbcommon-dev wayland-protocols
|
||||
|
||||
ENTRYPOINT ["/entry"]
|
11
linux-build/compile
Executable file
11
linux-build/compile
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euf -o pipefail
|
||||
|
||||
cd /src
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
../configure --prefix=/io
|
||||
make -j$(nproc)
|
||||
make install
|
27
linux-build/stretch-package-pins
Normal file
27
linux-build/stretch-package-pins
Normal file
@ -0,0 +1,27 @@
|
||||
Package: *
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 50
|
||||
|
||||
Package: libwayland-dev
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
||||
|
||||
Package: libwayland-bin
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
||||
|
||||
Package: libwayland-client0
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
||||
|
||||
Package: libwayland-cursor0
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
||||
|
||||
Package: libwayland-server0
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
||||
|
||||
Package: wayland-protocols
|
||||
Pin: release n=stretch
|
||||
Pin-Priority: 800
|
BIN
native/linux-x64/libSDL2.so
Executable file
BIN
native/linux-x64/libSDL2.so
Executable file
Binary file not shown.
BIN
native/linux-x86/libSDL2.so
Executable file
BIN
native/linux-x86/libSDL2.so
Executable file
Binary file not shown.
BIN
native/osx-arm64/libSDL2.dylib
Executable file
BIN
native/osx-arm64/libSDL2.dylib
Executable file
Binary file not shown.
BIN
native/osx-x64/libSDL2.dylib
Executable file
BIN
native/osx-x64/libSDL2.dylib
Executable file
Binary file not shown.
BIN
native/win-arm64/SDL2.dll
Normal file
BIN
native/win-arm64/SDL2.dll
Normal file
Binary file not shown.
BIN
native/win-x64/SDL2.dll
Executable file
BIN
native/win-x64/SDL2.dll
Executable file
Binary file not shown.
BIN
native/win-x86/SDL2.dll
Executable file
BIN
native/win-x86/SDL2.dll
Executable file
Binary file not shown.
@ -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