mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-03-08 10:10:00 +00:00
Removed sdl2-cs in favor of a leaner, better-designed binding.
This commit is contained in:
parent
7aa5499f3e
commit
192fedbca5
|
@ -28,7 +28,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||
|
||||
OpenTK.Compatibility includes portions of the Tao Framework library (Tao.OpenGl, Tao.OpenAl and Tao.Platform.Windows.SimpleOpenGlControl). These portions are covered by the following license:
|
||||
|
||||
Copyright ©2003-2007 Tao Framework Team
|
||||
Copyright <EFBFBD>2003-2007 Tao Framework Team
|
||||
http://www.taoframework.com
|
||||
All rights reserved.
|
||||
|
||||
|
@ -50,33 +50,3 @@ Redistribution and use in source and binary forms, with or without modification,
|
|||
* Neither the name of Industrial Light & Magic nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
SDL2-CS library in OpenTK.Platform.SDL2 is covered by the following license:
|
||||
|
||||
/* SDL2# - C# Wrapper for SDL2
|
||||
*
|
||||
* Copyright (c) 2013 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>
|
||||
*
|
||||
*/
|
|
@ -779,10 +779,6 @@
|
|||
<Compile Include="IntPtrEqualityComparer.cs" />
|
||||
<Compile Include="Input\GamePadButton.cs" />
|
||||
<Compile Include="Input\GamePadAxis.cs" />
|
||||
<None Include="Platform\SDL2\sdl2-cs\LICENSE" />
|
||||
<None Include="Platform\SDL2\sdl2-cs\README" />
|
||||
<Compile Include="Platform\SDL2\sdl2-cs\src\LPUtf8StrMarshaler.cs" />
|
||||
<Compile Include="Platform\SDL2\sdl2-cs\src\SDL2.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2DisplayDeviceDriver.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2Factory.cs" />
|
||||
<Compile Include="Platform\SDL2\Sdl2GraphicsContext.cs" />
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
bin/
|
||||
obj/
|
||||
*.userprefs
|
|
@ -1,25 +0,0 @@
|
|||
/* SDL2# - C# Wrapper for SDL2
|
||||
*
|
||||
* Copyright (c) 2013 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>
|
||||
*
|
||||
*/
|
|
@ -1,45 +0,0 @@
|
|||
This is SDL2#, a C# wrapper for SDL2.
|
||||
|
||||
Project Website: https://github.com/flibitijibibo/SDL2-CS
|
||||
|
||||
License
|
||||
-------
|
||||
SDL2 and SDL2# are released under the zlib license. See LICENSE for details.
|
||||
|
||||
SDL2# currently uses parts of OpenTK, which is released under the MIT license.
|
||||
See opentk.LICENSE for details.
|
||||
|
||||
About SDL2
|
||||
----------
|
||||
For more information about SDL2, visit the SDL wiki:
|
||||
|
||||
http://wiki.libsdl.org/moin.fcg/FrontPage
|
||||
|
||||
About the C# Wrapper
|
||||
--------------------
|
||||
The C# wrapper was written to be used for MonoGame's desktop platforms. However,
|
||||
this is written in a way that can be used for any general C# application.
|
||||
|
||||
The wrapper provides bindings for the following libraries:
|
||||
- SDL2
|
||||
- SDL2_image
|
||||
- SDL2_mixer
|
||||
- SDL2_ttf
|
||||
|
||||
We also provide bindings for OpenGL and OpenAL, taken from OpenTK.
|
||||
|
||||
Note that SDL2# will not provide every single SDL2 function. This is due to
|
||||
limitations in the C# language that would cause major conflicts with the native
|
||||
SDL2 library and its extensions.
|
||||
|
||||
SDL2# is a pure port of the C headers. The naming schemes for this library will
|
||||
be exactly as they are done in the C library, with little-to-no concern for
|
||||
"appropriate" C# style. The namespace indicates that this is SDL2, the class
|
||||
names will indicate which library file the function/type/value exists in, and
|
||||
everything else will be as close to the C version as technically possible.
|
||||
|
||||
Roadmap
|
||||
-------
|
||||
To see the current roadmap for SDL2#, visit the GitHub issues page:
|
||||
|
||||
https://github.com/flibitijibibo/SDL2-CS/issues
|
|
@ -1,106 +0,0 @@
|
|||
/* SDL2# - C# Wrapper for SDL2
|
||||
*
|
||||
* Copyright (c) 2013 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>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Platform.SDL2
|
||||
{
|
||||
internal unsafe class LPUtf8StrMarshaler : ICustomMarshaler
|
||||
{
|
||||
public const string LeaveAllocated = "LeaveAllocated";
|
||||
|
||||
private static ICustomMarshaler
|
||||
_leaveAllocatedInstance = new LPUtf8StrMarshaler(true),
|
||||
_defaultInstance = new LPUtf8StrMarshaler(false);
|
||||
|
||||
public static ICustomMarshaler GetInstance(string cookie)
|
||||
{
|
||||
switch (cookie)
|
||||
{
|
||||
case "LeaveAllocated":
|
||||
return _leaveAllocatedInstance;
|
||||
default:
|
||||
return _defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _leaveAllocated;
|
||||
|
||||
public LPUtf8StrMarshaler(bool leaveAllocated)
|
||||
{
|
||||
_leaveAllocated = leaveAllocated;
|
||||
}
|
||||
|
||||
public object MarshalNativeToManaged(IntPtr pNativeData)
|
||||
{
|
||||
if (pNativeData == IntPtr.Zero)
|
||||
return null;
|
||||
var ptr = (byte*)pNativeData;
|
||||
while (*ptr != 0)
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
var bytes = new byte[ptr - (byte*)pNativeData];
|
||||
Marshal.Copy(pNativeData, bytes, 0, bytes.Length);
|
||||
return Encoding.UTF8.GetString(bytes);
|
||||
}
|
||||
|
||||
public IntPtr MarshalManagedToNative(object ManagedObj)
|
||||
{
|
||||
if (ManagedObj == null)
|
||||
return IntPtr.Zero;
|
||||
var str = ManagedObj as string;
|
||||
if (str == null)
|
||||
{
|
||||
throw new ArgumentException("ManagedObj must be a string.", "ManagedObj");
|
||||
}
|
||||
var bytes = Encoding.UTF8.GetBytes(str);
|
||||
var mem = Marshal.AllocHGlobal(bytes.Length + 1);
|
||||
Marshal.Copy(bytes, 0, mem, bytes.Length);
|
||||
((byte*)mem)[bytes.Length] = 0;
|
||||
return mem;
|
||||
}
|
||||
|
||||
public void CleanUpManagedData(object ManagedObj)
|
||||
{
|
||||
}
|
||||
|
||||
public void CleanUpNativeData(IntPtr pNativeData)
|
||||
{
|
||||
if (!_leaveAllocated)
|
||||
{
|
||||
Marshal.FreeHGlobal(pNativeData);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetNativeDataSize ()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue