mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-06-30 19:03:42 -04:00
Alot of binding improvements!
- Improved bindings and added initial ones for Easings, Physac, Raygui and Raymath(Not yet fully tested). - Renamed ExamplesApplication to Bindings to make it more clear. - Examples separated from bindings. - Improve readme to reflect changes.
This commit is contained in:
6
Bindings/App.config
Normal file
6
Bindings/App.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
</configuration>
|
106
Bindings/Bindings.csproj
Normal file
106
Bindings/Bindings.csproj
Normal file
@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A2B3BBC8-3D48-46DD-B3CF-263F554E4474}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>ExampleApplication</RootNamespace>
|
||||
<AssemblyName>ExampleApplication</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="core_basic_window.cs" />
|
||||
<Compile Include="DrawControl.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Easings.cs" />
|
||||
<Compile Include="Physac.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Raygui.cs" />
|
||||
<Compile Include="Raylib.cs" />
|
||||
<Compile Include="Raymath.cs" />
|
||||
<Compile Include="Rlgl.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="DrawControl.resx">
|
||||
<DependentUpon>DrawControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
52
Bindings/DrawControl.cs
Normal file
52
Bindings/DrawControl.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using static Raylib.rl;
|
||||
|
||||
namespace Raylib
|
||||
{
|
||||
class DrawControl : Form
|
||||
{
|
||||
private Panel panel;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr SetParent(IntPtr child, IntPtr newParent);
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr ShowWindow(IntPtr handle, int command);
|
||||
|
||||
public static void Run()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new DrawControl());
|
||||
}
|
||||
|
||||
public DrawControl()
|
||||
{
|
||||
panel = new Panel();
|
||||
panel.Size = new Size(640, 480);
|
||||
panel.Location = new Point(80, 10);
|
||||
panel.BackColor = System.Drawing.Color.Red;
|
||||
Controls.Add(panel);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// DrawControl
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(284, 261);
|
||||
this.Name = "DrawControl";
|
||||
this.Load += new System.EventHandler(this.DrawControl_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
private void DrawControl_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
120
Bindings/DrawControl.resx
Normal file
120
Bindings/DrawControl.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
112
Bindings/Easings.cs
Normal file
112
Bindings/Easings.cs
Normal file
@ -0,0 +1,112 @@
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raylib
|
||||
{
|
||||
#region Raylib-cs Enums
|
||||
|
||||
#endregion
|
||||
|
||||
#region Raylib-cs Types
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public static partial class rl
|
||||
{
|
||||
#region Raylib-cs Variables
|
||||
|
||||
#endregion
|
||||
|
||||
#region Raylib-cs Functions
|
||||
|
||||
// Linear Easing functions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseLinearNone(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseLinearIn(float t, float b, float c, float d);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseLinearOut(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseLinearInOut(float t, float b, float c, float d);
|
||||
|
||||
// Sine Easing functions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseSineIn(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseSineOut(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseSineInOut(float t, float b, float c, float d);
|
||||
|
||||
// Circular Easing functions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseCircIn(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseCircOut(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseCircInOut(float t, float b, float c, float d);
|
||||
|
||||
// Cubic Easing functions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseCubicIn(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseCubicOut(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseCubicInOut(float t, float b, float c, float d);
|
||||
|
||||
// Quadratic Easing functions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseQuadIn(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseQuadOut(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseQuadInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
// Exponential Easing functions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseExpoIn(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseExpoOut(float t, float b, float c, float d);
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseExpoInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
// Back Easing functions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseBackIn(float t, float b, float c, float d);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseBackOut(float t, float b, float c, float d);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseBackInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
// Bounce Easing functions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseBounceOut(float t, float b, float c, float d);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseBounceIn(float t, float b, float c, float d);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseBounceInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
// Elastic Easing functions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseElasticIn(float t, float b, float c, float d);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseElasticOut(float t, float b, float c, float d);
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float EaseElasticInOut(float t, float b, float c, float d);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
168
Bindings/Physac.cs
Normal file
168
Bindings/Physac.cs
Normal file
@ -0,0 +1,168 @@
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raylib
|
||||
{
|
||||
#region Raylib-cs Enums
|
||||
|
||||
public enum PhysicsShapeType
|
||||
{
|
||||
PHYSICS_CIRCLE,
|
||||
PHYSICS_POLYGON
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Raylib-cs Types
|
||||
|
||||
// Mat2 type (used for polygon shape rotation matrix)
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct Mat2
|
||||
{
|
||||
public float m00;
|
||||
public float m01;
|
||||
public float m10;
|
||||
public float m11;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct PolygonData
|
||||
{
|
||||
public uint vertexCount; // Current used vertex and normals count
|
||||
//public Vector2 positions[PHYSAC_MAX_VERTICES]; // Polygon vertex positions vectors
|
||||
//public Vector2 normals[PHYSAC_MAX_VERTICES]; // Polygon vertex normals vectors
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct PhysicsShape
|
||||
{
|
||||
public PhysicsShapeType type; // Physics shape type (circle or polygon)
|
||||
//public PhysicsBodyData body; // Shape physics body reference
|
||||
public float radius; // Circle shape radius (used for circle shapes)
|
||||
public Mat2 transform; // Vertices transform matrix 2x2
|
||||
public PolygonData vertexData; // Polygon shape vertices position and normals data (just used for polygon shapes)
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct PhysicsBodyData
|
||||
{
|
||||
public uint id; // Reference unique identifier
|
||||
public bool enabled; // Enabled dynamics state (collisions are calculated anyway)
|
||||
public Vector2 position; // Physics body shape pivot
|
||||
public Vector2 velocity; // Current linear velocity applied to position
|
||||
public Vector2 force; // Current linear force (reset to 0 every step)
|
||||
public float angularVelocity; // Current angular velocity applied to orient
|
||||
public float torque; // Current angular force (reset to 0 every step)
|
||||
public float orient; // Rotation in radians
|
||||
public float inertia; // Moment of inertia
|
||||
public float inverseInertia; // Inverse value of inertia
|
||||
public float mass; // Physics body mass
|
||||
public float inverseMass; // Inverse value of mass
|
||||
public float staticFriction; // Friction when the body has not movement (0 to 1)
|
||||
public float dynamicFriction; // Friction when the body has movement (0 to 1)
|
||||
public float restitution; // Restitution coefficient of the body (0 to 1)
|
||||
public bool useGravity; // Apply gravity force to dynamics
|
||||
public bool isGrounded; // Physics grounded on other body state
|
||||
public bool freezeOrient; // Physics rotation constraint
|
||||
public PhysicsShape shape; // Physics body shape information (type, radius, vertices, normals)
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct PhysicsManifoldData
|
||||
{
|
||||
public uint id; // Reference unique identifier
|
||||
//public PhysicsBody bodyA; // Manifold first physics body reference
|
||||
//public PhysicsBody bodyB; // Manifold second physics body reference
|
||||
public float penetration; // Depth of penetration from collision
|
||||
public Vector2 normal; // Normal direction vector from 'a' to 'b'
|
||||
//public Vector2 contacts[2]; // Points of contact during collision
|
||||
public uint contactsCount; // Current collision number of contacts
|
||||
public float restitution; // Mixed restitution during collision
|
||||
public float dynamicFriction; // Mixed dynamic friction during collision
|
||||
public float staticFriction; // Mixed static friction during collision
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static partial class rl
|
||||
{
|
||||
#region Raylib-cs Variables
|
||||
|
||||
// Used by DllImport to load the native library.
|
||||
// private const string nativeLibName = "raylib.dll";
|
||||
public const int PHYSAC_MAX_BODIES = 64;
|
||||
public const int PHYSAC_MAX_MANIFOLDS = 4096;
|
||||
public const int PHYSAC_MAX_VERTICES = 24;
|
||||
public const int PHYSAC_CIRCLE_VERTICES = 24;
|
||||
|
||||
public const float PHYSAC_DESIRED_DELTATIME = 1.0f / 60.0f;
|
||||
public const float PHYSAC_MAX_TIMESTEP = 0.02f;
|
||||
public const int PHYSAC_COLLISION_ITERATIONS = 100;
|
||||
public const float PHYSAC_PENETRATION_ALLOWANCE = 0.05f;
|
||||
public const float PHYSAC_PENETRATION_CORRECTION = 0.4f;
|
||||
|
||||
public const float PHYSAC_PI = 3.14159265358979323846f;
|
||||
public const float PHYSAC_DEG2RAD = (PHYSAC_PI / 180.0f);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Raylib-cs Functions
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void InitPhysics(); // Initializes physics values, pointers and creates physics loop thread
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool IsPhysicsEnabled(); // Returns true if physics thread is currently enabled
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void SetPhysicsGravity(float x, float y); // Sets physics global gravity force
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern PhysicsBodyData CreatePhysicsBodyCircle(Vector2 pos, float radius, float density); // Creates a new circle physics body with generic parameters
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern PhysicsBodyData CreatePhysicsBodyRectangle(Vector2 pos, float width, float height, float density); // Creates a new rectangle physics body with generic parameters
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern PhysicsBodyData CreatePhysicsBodyPolygon(Vector2 pos, float radius, int sides, float density); // Creates a new polygon physics body with generic parameters
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void PhysicsAddForce(PhysicsBodyData body, Vector2 force); // Adds a force to a physics body
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void PhysicsAddTorque(PhysicsBodyData body, float amount); // Adds an angular force to a physics body
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void PhysicsShatter(PhysicsBodyData body, Vector2 position, float force); // Shatters a polygon shape physics body to little physics bodies with explosion force
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int GetPhysicsBodiesCount(); // Returns the current amount of created physics bodies
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern PhysicsBodyData GetPhysicsBody(int index); // Returns a physics body of the bodies pool at a specific index
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int GetPhysicsShapeType(int index); // Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON)
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int GetPhysicsShapeVerticesCount(int index); // Returns the amount of vertices of a physics body shape
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector2 GetPhysicsShapeVertex(PhysicsBodyData body, int vertex); // Returns transformed position of a body shape (body position + vertex transformed position)
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void SetPhysicsBodyRotation(PhysicsBodyData body, float radians); // Sets physics body shape transform based on radians parameter
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void DestroyPhysicsBody(PhysicsBodyData body); // Unitializes and destroy a physics body
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void ResetPhysics(); // Destroys created physics bodies and manifolds and resets global values
|
||||
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void ClosePhysics(); // Unitializes physics pointers and closes physics loop thread
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
11
Bindings/Program.cs
Normal file
11
Bindings/Program.cs
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
namespace Bindings
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Examples.core_basic_window();
|
||||
}
|
||||
}
|
||||
}
|
36
Bindings/Properties/AssemblyInfo.cs
Normal file
36
Bindings/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Raylib-example")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Raylib-example")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("a2b3bbc8-3d48-46dd-b3cf-263f554e4474")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
361
Bindings/Raygui.cs
Normal file
361
Bindings/Raygui.cs
Normal file
@ -0,0 +1,361 @@
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raylib
|
||||
{
|
||||
#region Raylib-cs Enums
|
||||
|
||||
// Gui properties enumeration
|
||||
enum GuiProperty
|
||||
{
|
||||
//--------------------------------------------
|
||||
// NOTE: This first set of properties is for general style,
|
||||
// following control-specific properties overwritte those styles
|
||||
DEFAULT_BACKGROUND_COLOR = 0,
|
||||
DEFAULT_LINES_COLOR,
|
||||
DEFAULT_TEXT_FONT,
|
||||
DEFAULT_TEXT_SIZE,
|
||||
DEFAULT_BORDER_WIDTH,
|
||||
DEFAULT_BORDER_COLOR_NORMAL,
|
||||
DEFAULT_BASE_COLOR_NORMAL,
|
||||
DEFAULT_TEXT_COLOR_NORMAL,
|
||||
DEFAULT_BORDER_COLOR_FOCUSED,
|
||||
DEFAULT_BASE_COLOR_FOCUSED,
|
||||
DEFAULT_TEXT_COLOR_FOCUSED,
|
||||
DEFAULT_BORDER_COLOR_PRESSED,
|
||||
DEFAULT_BASE_COLOR_PRESSED,
|
||||
DEFAULT_TEXT_COLOR_PRESSED,
|
||||
DEFAULT_BORDER_COLOR_DISABLED,
|
||||
DEFAULT_BASE_COLOR_DISABLED,
|
||||
DEFAULT_TEXT_COLOR_DISABLED,
|
||||
//--------------------------------------------
|
||||
// Label
|
||||
LABEL_TEXT_COLOR_NORMAL,
|
||||
LABEL_TEXT_COLOR_FOCUSED,
|
||||
LABEL_TEXT_COLOR_PRESSED,
|
||||
LABEL_TEXT_COLOR_DISABLED,
|
||||
// Button
|
||||
BUTTON_BORDER_WIDTH,
|
||||
BUTTON_BORDER_COLOR_NORMAL,
|
||||
BUTTON_BASE_COLOR_NORMAL,
|
||||
BUTTON_TEXT_COLOR_NORMAL,
|
||||
BUTTON_BORDER_COLOR_FOCUSED,
|
||||
BUTTON_BASE_COLOR_FOCUSED,
|
||||
BUTTON_TEXT_COLOR_FOCUSED,
|
||||
BUTTON_BORDER_COLOR_PRESSED,
|
||||
BUTTON_BASE_COLOR_PRESSED,
|
||||
BUTTON_TEXT_COLOR_PRESSED,
|
||||
BUTTON_BORDER_COLOR_DISABLED,
|
||||
BUTTON_BASE_COLOR_DISABLED,
|
||||
BUTTON_TEXT_COLOR_DISABLED,
|
||||
// Toggle
|
||||
TOGGLE_BORDER_WIDTH,
|
||||
TOGGLE_BORDER_COLOR_NORMAL,
|
||||
TOGGLE_BASE_COLOR_NORMAL,
|
||||
TOGGLE_TEXT_COLOR_NORMAL,
|
||||
TOGGLE_BORDER_COLOR_FOCUSED,
|
||||
TOGGLE_BASE_COLOR_FOCUSED,
|
||||
TOGGLE_TEXT_COLOR_FOCUSED,
|
||||
TOGGLE_BORDER_COLOR_PRESSED,
|
||||
TOGGLE_BASE_COLOR_PRESSED,
|
||||
TOGGLE_TEXT_COLOR_PRESSED,
|
||||
TOGGLE_BORDER_COLOR_DISABLED,
|
||||
TOGGLE_BASE_COLOR_DISABLED,
|
||||
TOGGLE_TEXT_COLOR_DISABLED,
|
||||
TOGGLEGROUP_PADDING,
|
||||
// Slider
|
||||
SLIDER_BORDER_WIDTH,
|
||||
SLIDER_SLIDER_WIDTH,
|
||||
SLIDER_BORDER_COLOR_NORMAL,
|
||||
SLIDER_BASE_COLOR_NORMAL,
|
||||
SLIDER_BORDER_COLOR_FOCUSED,
|
||||
SLIDER_BASE_COLOR_FOCUSED,
|
||||
SLIDER_BORDER_COLOR_PRESSED,
|
||||
SLIDER_BASE_COLOR_PRESSED,
|
||||
SLIDER_BORDER_COLOR_DISABLED,
|
||||
SLIDER_BASE_COLOR_DISABLED,
|
||||
// SliderBar
|
||||
SLIDERBAR_INNER_PADDING,
|
||||
SLIDERBAR_BORDER_WIDTH,
|
||||
SLIDERBAR_BORDER_COLOR_NORMAL,
|
||||
SLIDERBAR_BASE_COLOR_NORMAL,
|
||||
SLIDERBAR_BORDER_COLOR_FOCUSED,
|
||||
SLIDERBAR_BASE_COLOR_FOCUSED,
|
||||
SLIDERBAR_BORDER_COLOR_PRESSED,
|
||||
SLIDERBAR_BASE_COLOR_PRESSED,
|
||||
SLIDERBAR_BORDER_COLOR_DISABLED,
|
||||
SLIDERBAR_BASE_COLOR_DISABLED,
|
||||
// ProgressBar
|
||||
PROGRESSBAR_INNER_PADDING,
|
||||
PROGRESSBAR_BORDER_WIDTH,
|
||||
PROGRESSBAR_BORDER_COLOR_NORMAL,
|
||||
PROGRESSBAR_BASE_COLOR_NORMAL,
|
||||
PROGRESSBAR_BORDER_COLOR_FOCUSED,
|
||||
PROGRESSBAR_BASE_COLOR_FOCUSED,
|
||||
PROGRESSBAR_BORDER_COLOR_PRESSED,
|
||||
PROGRESSBAR_BASE_COLOR_PRESSED,
|
||||
PROGRESSBAR_BORDER_COLOR_DISABLED,
|
||||
PROGRESSBAR_BASE_COLOR_DISABLED,
|
||||
// ValueBox
|
||||
VALUEBOX_BUTTON_PADDING,
|
||||
VALUEBOX_BUTTONS_WIDTH,
|
||||
VALUEBOX_BORDER_COLOR_NORMAL,
|
||||
VALUEBOX_BASE_COLOR_NORMAL,
|
||||
VALUEBOX_TEXT_COLOR_NORMAL,
|
||||
VALUEBOX_BORDER_COLOR_FOCUSED,
|
||||
VALUEBOX_BASE_COLOR_FOCUSED,
|
||||
VALUEBOX_TEXT_COLOR_FOCUSED,
|
||||
VALUEBOX_BORDER_COLOR_PRESSED,
|
||||
VALUEBOX_BASE_COLOR_PRESSED,
|
||||
VALUEBOX_TEXT_COLOR_PRESSED,
|
||||
VALUEBOX_BORDER_COLOR_DISABLED,
|
||||
VALUEBOX_BASE_COLOR_DISABLED,
|
||||
VALUEBOX_TEXT_COLOR_DISABLED,
|
||||
// ComboBox
|
||||
COMBOBOX_BORDER_WIDTH,
|
||||
COMBOBOX_BUTTON_PADDING,
|
||||
COMBOBOX_SELECTOR_WIDTH,
|
||||
COMBOBOX_BORDER_COLOR_NORMAL,
|
||||
COMBOBOX_BASE_COLOR_NORMAL,
|
||||
COMBOBOX_TEXT_COLOR_NORMAL,
|
||||
COMBOBOX_BORDER_COLOR_FOCUSED,
|
||||
COMBOBOX_BASE_COLOR_FOCUSED,
|
||||
COMBOBOX_TEXT_COLOR_FOCUSED,
|
||||
COMBOBOX_BORDER_COLOR_PRESSED,
|
||||
COMBOBOX_BASE_COLOR_PRESSED,
|
||||
COMBOBOX_TEXT_COLOR_PRESSED,
|
||||
COMBOBOX_BORDER_COLOR_DISABLED,
|
||||
COMBOBOX_BASE_COLOR_DISABLED,
|
||||
COMBOBOX_TEXT_COLOR_DISABLED,
|
||||
// CheckBox
|
||||
CHECKBOX_BORDER_WIDTH,
|
||||
CHECKBOX_INNER_PADDING,
|
||||
CHECKBOX_BORDER_COLOR_NORMAL,
|
||||
CHECKBOX_BASE_COLOR_NORMAL,
|
||||
CHECKBOX_BORDER_COLOR_FOCUSED,
|
||||
CHECKBOX_BASE_COLOR_FOCUSED,
|
||||
CHECKBOX_BORDER_COLOR_PRESSED,
|
||||
CHECKBOX_BASE_COLOR_PRESSED,
|
||||
CHECKBOX_BORDER_COLOR_DISABLED,
|
||||
CHECKBOX_BASE_COLOR_DISABLED,
|
||||
// TextBox
|
||||
TEXTBOX_BORDER_WIDTH,
|
||||
TEXTBOX_BORDER_COLOR_NORMAL,
|
||||
TEXTBOX_BASE_COLOR_NORMAL,
|
||||
TEXTBOX_TEXT_COLOR_NORMAL,
|
||||
TEXTBOX_BORDER_COLOR_FOCUSED,
|
||||
TEXTBOX_BASE_COLOR_FOCUSED,
|
||||
TEXTBOX_TEXT_COLOR_FOCUSED,
|
||||
TEXTBOX_BORDER_COLOR_PRESSED,
|
||||
TEXTBOX_BASE_COLOR_PRESSED,
|
||||
TEXTBOX_TEXT_COLOR_PRESSED,
|
||||
TEXTBOX_BORDER_COLOR_DISABLED,
|
||||
TEXTBOX_BASE_COLOR_DISABLED,
|
||||
TEXTBOX_TEXT_COLOR_DISABLED,
|
||||
// ColorPicker
|
||||
COLORPICKER_BARS_THICK,
|
||||
COLORPICKER_BARS_PADDING,
|
||||
COLORPICKER_BORDER_COLOR_NORMAL,
|
||||
COLORPICKER_BASE_COLOR_NORMAL,
|
||||
COLORPICKER_BORDER_COLOR_FOCUSED,
|
||||
COLORPICKER_BASE_COLOR_FOCUSED,
|
||||
COLORPICKER_BORDER_COLOR_PRESSED,
|
||||
COLORPICKER_BASE_COLOR_PRESSED,
|
||||
COLORPICKER_BORDER_COLOR_DISABLED,
|
||||
COLORPICKER_BASE_COLOR_DISABLED,
|
||||
// ListView
|
||||
LISTVIEW_ELEMENTS_HEIGHT,
|
||||
LISTVIEW_ELEMENTS_PADDING,
|
||||
LISTVIEW_BAR_WIDTH,
|
||||
LISTVIEW_BORDER_COLOR_NORMAL,
|
||||
LISTVIEW_BASE_COLOR_NORMAL,
|
||||
LISTVIEW_TEXT_COLOR_NORMAL,
|
||||
LISTVIEW_BORDER_COLOR_FOCUSED,
|
||||
LISTVIEW_BASE_COLOR_FOCUSED,
|
||||
LISTVIEW_TEXT_COLOR_FOCUSED,
|
||||
LISTVIEW_BORDER_COLOR_PRESSED,
|
||||
LISTVIEW_BASE_COLOR_PRESSED,
|
||||
LISTVIEW_TEXT_COLOR_PRESSED,
|
||||
LISTVIEW_BORDER_COLOR_DISABLED,
|
||||
LISTVIEW_BASE_COLOR_DISABLED,
|
||||
LISTVIEW_TEXT_COLOR_DISABLED
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Raylib-cs Types
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public static partial class rl
|
||||
{
|
||||
#region Raylib-cs Variables
|
||||
|
||||
#endregion
|
||||
|
||||
#region Raylib-cs Functions
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Global gui modification functions
|
||||
// Enable gui controls (global state)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void GuiEnable();
|
||||
|
||||
// Disable gui controls (global state)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void GuiDisable();
|
||||
|
||||
// Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void GuiFade(float alpha);
|
||||
|
||||
|
||||
// Style set/get functions
|
||||
// Set one style property
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void GuiSetStyleProperty(int guiProperty, int value);
|
||||
|
||||
// Get one style property
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int GuiGetStyleProperty(int guiProperty);
|
||||
|
||||
|
||||
// Container/separator controls, useful for controls organization
|
||||
// Window Box control, shows a window that can be closed
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiWindowBox(Rectangle bounds, string text);
|
||||
|
||||
// Group Box control with title name
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void GuiGroupBox(Rectangle bounds, string text);
|
||||
|
||||
// Line separator control
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void GuiLine(Rectangle bounds, int thick);
|
||||
|
||||
// Panel control, useful to group controls
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void GuiPanel(Rectangle bounds);
|
||||
|
||||
// Scroll Panel control
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector2 GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 viewScroll);
|
||||
|
||||
|
||||
|
||||
// Basic controls set
|
||||
// Label control, shows text
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void GuiLabel(Rectangle bounds, string text);
|
||||
|
||||
// Button control, returns true when clicked
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiButton(Rectangle bounds, string text);
|
||||
|
||||
// Label button control, show true when clicked
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiLabelButton(Rectangle bounds, string text);
|
||||
|
||||
// Image button control, returns true when clicked
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiImageButton(Rectangle bounds, Texture2D texture);
|
||||
|
||||
// Image button extended control, returns true when clicked
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiImageButtonEx(Rectangle bounds, Texture2D texture, Rectangle texSource, string text);
|
||||
|
||||
// Toggle Button control, returns true when active
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiToggleButton(Rectangle bounds, string text, bool toggle);
|
||||
|
||||
// Toggle Group control, returns toggled button index
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int GuiToggleGroup(Rectangle bounds, string text, int count, int active);
|
||||
|
||||
// Check Box control, returns true when active
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiCheckBox(Rectangle bounds, bool isChecked);
|
||||
|
||||
// Check Box control with text, returns true when active
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiCheckBoxEx(Rectangle bounds, bool isChecked, string text);
|
||||
|
||||
// Combo Box control, returns selected item index
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int GuiComboBox(Rectangle bounds, string text, int count, int active);
|
||||
|
||||
// Dropdown Box control, returns selected item
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int GuiDropdownBox(Rectangle bounds, string[] text, int count, int active);
|
||||
|
||||
// Spinner control, returns selected value
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int GuiSpinner(Rectangle bounds, int value, int maxValue, int btnWidth);
|
||||
|
||||
// Value Box control, updates input text with numbers
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int GuiValueBox(Rectangle bounds, int value, int maxValue);
|
||||
|
||||
// Text Box control, updates input text
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiTextBox(Rectangle bounds, char text, int textSize, bool freeEdit);
|
||||
|
||||
// Text Box control with multiple lines
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiTextBoxMulti(Rectangle bounds, string text, int textSize, bool editMode);
|
||||
|
||||
// Slider control, returns selected value
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float GuiSlider(Rectangle bounds, float value, float minValue, float maxValue);
|
||||
|
||||
// Slider control, returns selected value
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float GuiSliderEx(Rectangle bounds, float value, float minValue, float maxValue, string text, bool showValue);
|
||||
|
||||
// Slider Bar control, returns selected value
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float GuiSliderBar(Rectangle bounds, float value, float minValue, float maxValue);
|
||||
|
||||
// Slider Bar control, returns selected value
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float GuiSliderBarEx(Rectangle bounds, float value, float minValue, float maxValue, string text, bool showValue);
|
||||
|
||||
// Progress Bar control, shows current progress value
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float GuiProgressBar(Rectangle bounds, float value, float minValue, float maxValue);
|
||||
|
||||
// Progress Bar control, shows current progress value
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float GuiProgressBarEx(Rectangle bounds, float value, float minValue, float maxValue, bool showValue);
|
||||
|
||||
// Status Bar control, shows info text
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void GuiStatusBar(Rectangle bounds, string text, int offsetX);
|
||||
|
||||
// Dummy control for placeholders
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void GuiDummyRec(Rectangle bounds, string text);
|
||||
|
||||
|
||||
// Advance controls set
|
||||
// List View control, returns selected list element index
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern int GuiListView(Rectangle bounds, string text, int count, int active);
|
||||
|
||||
// Color Picker control
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Color GuiColorPicker(Rectangle bounds, Color color);
|
||||
|
||||
// Message Box control, displays a message
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern bool GuiMessageBox(Rectangle bounds, string windowTitle, string message);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
1654
Bindings/Raylib.cs
Normal file
1654
Bindings/Raylib.cs
Normal file
File diff suppressed because it is too large
Load Diff
513
Bindings/Raymath.cs
Normal file
513
Bindings/Raymath.cs
Normal file
@ -0,0 +1,513 @@
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raylib
|
||||
{
|
||||
#region Raylib-cs Types
|
||||
|
||||
// Vector2 type
|
||||
public struct Vector2
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
|
||||
public Vector2(float x, float y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return (obj is Vector2) && Equals((Vector2)obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return x.GetHashCode() + y.GetHashCode();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Vector2(" + x + " " + y + ")";
|
||||
}
|
||||
|
||||
// utility for c functions Vector2Zero -> Zero etc
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2Zero")]
|
||||
public static extern Vector2 Zero();
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2One")]
|
||||
public static extern Vector2 One();
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2Add")]
|
||||
public static extern Vector2 operator +(Vector2 v1, Vector2 v2);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2Subtract")]
|
||||
public static extern Vector2 operator -(Vector2 v1, Vector2 v2);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2Length")]
|
||||
public static extern float Length(Vector2 v);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2DotProduct")]
|
||||
public static extern float DotProduct(Vector2 v1, Vector2 v2);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2Distance")]
|
||||
public static extern float Distance(Vector2 v1, Vector2 v2);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2Angle")]
|
||||
public static extern float Angle(Vector2 v1, Vector2 v2);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2Scale")]
|
||||
public static extern Vector2 Scale(Vector2 v, float scale);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2Negate")]
|
||||
public static extern Vector2 Negate(Vector2 v);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2Divide")]
|
||||
public static extern Vector2 Divide(Vector2 v, float div);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector2Normalize")]
|
||||
public static extern Vector2 Normalize(Vector2 v);
|
||||
|
||||
public static bool operator ==(Vector2 v1, Vector2 v2)
|
||||
{
|
||||
return (v1.x == v2.x && v1.y == v2.y);
|
||||
}
|
||||
|
||||
public static bool operator !=(Vector2 v1, Vector2 v2)
|
||||
{
|
||||
return !(v1 == v2);
|
||||
}
|
||||
}
|
||||
|
||||
// Vector3 type
|
||||
public struct Vector3
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
|
||||
public Vector3(float x, float y, float z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return (obj is Vector3) && Equals((Vector3)obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return x.GetHashCode() + y.GetHashCode() + z.GetHashCode();
|
||||
}
|
||||
|
||||
// utility for c functions Vector3Zero -> Zero etc
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Zero")]
|
||||
public static extern Vector3 Zero();
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3One")]
|
||||
public static extern Vector3 One();
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Add")]
|
||||
public static extern Vector3 operator +(Vector3 v1, Vector3 v3);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Subtract")]
|
||||
public static extern Vector3 operator -(Vector3 v1, Vector3 v3);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Length")]
|
||||
public static extern float Length(Vector3 v);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3DotProduct")]
|
||||
public static extern float DotProduct(Vector3 v1, Vector3 v3);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Distance")]
|
||||
public static extern float Distance(Vector3 v1, Vector3 v3);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Angle")]
|
||||
public static extern float Angle(Vector3 v1, Vector3 v3);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Scale")]
|
||||
public static extern Vector3 Scale(Vector3 v, float scale);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Negate")]
|
||||
public static extern Vector3 Negate(Vector3 v);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Divide")]
|
||||
public static extern Vector3 Divide(Vector3 v, float div);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Normalize")]
|
||||
public static extern Vector3 Normalize(Vector3 v);
|
||||
|
||||
// operators
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3MultiplyV")]
|
||||
public static extern Vector3 operator *(Vector3 v1, Vector3 v3);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Multiply")]
|
||||
public static extern Vector3 operator *(Vector3 v1, float scale);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Divide")]
|
||||
public static extern Vector3 operator /(Vector3 v1, Vector3 v3);
|
||||
|
||||
[DllImport(rl.nativeLibName, EntryPoint = "Vector3Negate")]
|
||||
public static extern Vector3 operator -(Vector3 v1);
|
||||
|
||||
public static bool operator ==(Vector3 v1, Vector3 v2)
|
||||
{
|
||||
return (v1.x == v2.x && v1.y == v2.y && v1.z == v2.z);
|
||||
}
|
||||
|
||||
public static bool operator !=(Vector3 v1, Vector3 v2)
|
||||
{
|
||||
return !(v1 == v2);
|
||||
}
|
||||
}
|
||||
|
||||
// Vector4 type
|
||||
public struct Vector4
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
public float w;
|
||||
|
||||
public Vector4(float x, float y, float z, float w)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
}
|
||||
|
||||
// Matrix type (OpenGL style 4x4 - right handed, column major)
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct Matrix
|
||||
{
|
||||
public float m0, m4, m8, m12;
|
||||
public float m1, m5, m9, m13;
|
||||
public float m2, m6, m10, m14;
|
||||
public float m3, m7, m11, m15;
|
||||
}
|
||||
|
||||
// Quaternion type
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public struct Quaternion
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
public float w;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static partial class rl
|
||||
{
|
||||
#region Raylib-cs Functions
|
||||
|
||||
// Clamp float value
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float Clamp(float value, float min, float max);
|
||||
|
||||
// Vector with components value 0.0f
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector2 Vector2Zero();
|
||||
|
||||
// Vector with components value 1.0f
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector2 Vector2One();
|
||||
|
||||
// Add two vectors (v1 + v2)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector2 Vector2Add(Vector2 v1, Vector2 v2);
|
||||
|
||||
// Subtract two vectors (v1 - v2)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector2 Vector2Subtract(Vector2 v1, Vector2 v2);
|
||||
|
||||
// Calculate vector length
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float Vector2Length(Vector2 v);
|
||||
|
||||
// Calculate two vectors dot product
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float Vector2DotProduct(Vector2 v1, Vector2 v2);
|
||||
|
||||
// Calculate distance between two vectors
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float Vector2Distance(Vector2 v1, Vector2 v2);
|
||||
|
||||
// Calculate angle from two vectors in X-axis
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float Vector2Angle(Vector2 v1, Vector2 v2);
|
||||
|
||||
// Scale vector (multiply by value)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector2 Vector2Scale(Vector2 v, float scale);
|
||||
|
||||
// Negate vector
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector2 Vector2Negate(Vector2 v);
|
||||
|
||||
// Divide vector by a float value
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector2 Vector2Divide(Vector2 v, float div);
|
||||
|
||||
// Normalize provided vector
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector2 Vector2Normalize(Vector2 v);
|
||||
|
||||
|
||||
// Vector with components value 0.0f
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Zero();
|
||||
|
||||
// Vector with components value 1.0f
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3One();
|
||||
|
||||
// Add two vectors
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Add(Vector3 v1, Vector3 v2);
|
||||
|
||||
// Substract two vectors
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Subtract(Vector3 v1, Vector3 v2);
|
||||
|
||||
// Multiply vector by scalar
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Multiply(Vector3 v, float scalar);
|
||||
|
||||
// Multiply vector by vector
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3MultiplyV(Vector3 v1, Vector3 v2);
|
||||
|
||||
// Calculate two vectors cross product
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2);
|
||||
|
||||
// Calculate one vector perpendicular vector
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Perpendicular(Vector3 v);
|
||||
|
||||
// Calculate vector length
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float Vector3Length(Vector3 v);
|
||||
|
||||
// Calculate two vectors dot product
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float Vector3DotProduct(Vector3 v1, Vector3 v2);
|
||||
|
||||
// Calculate distance between two vectors
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float Vector3Distance(Vector3 v1, Vector3 v2);
|
||||
|
||||
// Scale provided vector
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Scale(Vector3 v, float scale);
|
||||
|
||||
// Negate provided vector (invert direction)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Negate(Vector3 v);
|
||||
|
||||
// Normalize provided vector
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Normalize(Vector3 v);
|
||||
|
||||
// Orthonormalize provided vectors
|
||||
// Makes vectors normalized and orthogonal to each other
|
||||
// Gram-Schmidt function implementation
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void Vector3OrthoNormalize(out Vector3 v1, out Vector3 v2);
|
||||
|
||||
// Transforms a Vector3 by a given Matrix
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Transform(Vector3 v, Matrix mat);
|
||||
|
||||
// Transform a vector by quaternion rotation
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q);
|
||||
|
||||
// Calculate linear interpolation between two vectors
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);
|
||||
|
||||
// Calculate reflected vector to normal
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Reflect(Vector3 v, Vector3 normal);
|
||||
|
||||
// Return min value for each pair of components
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Min(Vector3 v1, Vector3 v2);
|
||||
|
||||
// Return max value for each pair of components
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Max(Vector3 v1, Vector3 v2);
|
||||
|
||||
// Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c)
|
||||
// NOTE: Assumes P is on the plane of the triangle
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c);
|
||||
|
||||
// Returns Vector3 as float array
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float[] Vector3ToFloatV(Vector3 v);
|
||||
|
||||
|
||||
// Compute matrix determinant
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float MatrixDeterminant(Matrix mat);
|
||||
|
||||
// Returns the trace of the matrix (sum of the values along the diagonal)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float MatrixTrace(Matrix mat);
|
||||
|
||||
// Transposes provided matrix
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixTranspose(Matrix mat);
|
||||
|
||||
// Invert provided matrix
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixInvert(Matrix mat);
|
||||
|
||||
// Normalize provided matrix
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixNormalize(Matrix mat);
|
||||
|
||||
// Returns identity matrix
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixIdentity();
|
||||
|
||||
// Add two matrices
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixAdd(Matrix left, Matrix right);
|
||||
|
||||
// Substract two matrices (left - right)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixSubstract(Matrix left, Matrix right);
|
||||
|
||||
// Create rotation matrix from axis and angle
|
||||
// NOTE: Angle should be provided in radians
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixTranslate(float x, float y, float z);
|
||||
|
||||
// Returns x-rotation matrix (angle in radians)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixRotate(Vector3 axis, float angle);
|
||||
|
||||
// Returns x-rotation matrix (angle in radians)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixRotateX(float angle);
|
||||
|
||||
// Returns y-rotation matrix (angle in radians)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixRotateY(float angle);
|
||||
|
||||
// Returns z-rotation matrix (angle in radians)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixRotateZ(float angle);
|
||||
|
||||
// Returns scaling matrix
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixScale(float x, float y, float z);
|
||||
|
||||
// Returns two matrix multiplication
|
||||
// NOTE: When multiplying matrices... the order matters!
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixMultiply(Matrix left, Matrix right);
|
||||
|
||||
// Returns perspective projection matrix
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixFrustum(double left, double right, double bottom, double top, double near, double far);
|
||||
|
||||
// Returns perspective projection matrix
|
||||
// NOTE: Angle should be provided in radians
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixPerspective(double fovy, double aspect, double near, double far);
|
||||
|
||||
// Returns orthographic projection matrix
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixOrtho(double left, double right, double bottom, double top, double near, double far);
|
||||
|
||||
// Returns camera look-at matrix (view matrix)
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up);
|
||||
|
||||
// Returns float array of matrix data
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float[] MatrixToFloatV(Matrix mat);
|
||||
|
||||
|
||||
// Returns identity quaternion
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionIdentity();
|
||||
|
||||
// Computes the length of a quaternion
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern float QuaternionLength(Quaternion q);
|
||||
|
||||
// Normalize provided quaternion
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionNormalize(Quaternion q);
|
||||
|
||||
// Invert provided quaternion
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionInvert(Quaternion q);
|
||||
|
||||
// Calculate two quaternion multiplication
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionMultiply(Quaternion q1, Quaternion q2);
|
||||
|
||||
// Calculate linear interpolation between two quaternions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount);
|
||||
|
||||
// Calculate slerp-optimized interpolation between two quaternions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount);
|
||||
|
||||
// Calculates spherical linear interpolation between two quaternions
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);
|
||||
|
||||
// Calculate quaternion based on the rotation from one vector to another
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);
|
||||
|
||||
// Returns a quaternion for a given rotation matrix
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionFromMatrix(Matrix mat);
|
||||
|
||||
// Returns a matrix for a given quaternion
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Matrix QuaternionToMatrix(Quaternion q);
|
||||
|
||||
// Returns rotation quaternion for an angle and axis
|
||||
// NOTE: angle must be provided in radians
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle);
|
||||
|
||||
// Returns the rotation angle and axis for a given quaternion
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern void QuaternionToAxisAngle(Quaternion q, out Vector3 outAxis, float[] outAngle);
|
||||
|
||||
// Returns he quaternion equivalent to Euler angles
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionFromEuler(float roll, float pitch, float yaw);
|
||||
|
||||
// Return the Euler angles equivalent to quaternion (roll, pitch, yaw)
|
||||
// NOTE: Angles are returned in a Vector3 struct in degrees
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Vector3 QuaternionToEuler(Quaternion q);
|
||||
|
||||
// Transform a quaternion given a transformation matrix
|
||||
[DllImport(nativeLibName)]
|
||||
public static extern Quaternion QuaternionTransform(Quaternion q, Matrix mat);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
27
Bindings/Rlgl.cs
Normal file
27
Bindings/Rlgl.cs
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raylib
|
||||
{
|
||||
#region Raylib-cs Enums
|
||||
|
||||
#endregion
|
||||
|
||||
#region Raylib-cs Types
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public static partial class rl
|
||||
{
|
||||
#region Raylib-cs Variables
|
||||
|
||||
#endregion
|
||||
|
||||
#region Raylib-cs Functions
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
BIN
Bindings/bin/Debug/ExampleApplication.exe
Normal file
BIN
Bindings/bin/Debug/ExampleApplication.exe
Normal file
Binary file not shown.
6
Bindings/bin/Debug/ExampleApplication.exe.config
Normal file
6
Bindings/bin/Debug/ExampleApplication.exe.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
</configuration>
|
BIN
Bindings/bin/Debug/raylib.dll
Normal file
BIN
Bindings/bin/Debug/raylib.dll
Normal file
Binary file not shown.
1
Bindings/core_basic_window.cs
Normal file
1
Bindings/core_basic_window.cs
Normal file
@ -0,0 +1 @@
|
||||
|
Reference in New Issue
Block a user