mirror of
				https://github.com/raylib-cs/raylib-cs
				synced 2025-10-29 05:59:51 -04:00 
			
		
		
		
	Updated bindings!
- Changed internal class name from rl to Raylib. - Improving documentation and tidying bindings a bit. - Renamed DrawControl to RayForm. - Bindings now a class library for easy reuse.
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -26,6 +26,7 @@ | ||||
| [Rr]eleases/ | ||||
| bld/ | ||||
| [Bb]uild/ | ||||
| Bindings/bin/[Dd]ebug | ||||
| Generator/bin/[Dd]ebug | ||||
| [Oo]bj/ | ||||
| [Ll]og/ | ||||
|   | ||||
| @@ -1,79 +1,82 @@ | ||||
| /********************************************************************************************** | ||||
|  *  | ||||
|  * Raylib easings bindings | ||||
|  * Original - https://github.com/raysan5/raylib/blob/master/src/easings.h | ||||
|  *  | ||||
| **********************************************************************************************/ | ||||
|  | ||||
| using System; | ||||
| using System.Runtime.InteropServices; | ||||
|  | ||||
| namespace Raylib | ||||
| { | ||||
|     #region Raylib-cs Enums | ||||
|  | ||||
|     #endregion | ||||
|  | ||||
|     #region Raylib-cs Types | ||||
|  | ||||
|  | ||||
|     #endregion | ||||
|  | ||||
|     public static partial class rl | ||||
|     public static partial class Raylib | ||||
|     { | ||||
|         #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); | ||||
| @@ -84,7 +87,6 @@ namespace Raylib | ||||
|         [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); | ||||
| @@ -95,7 +97,6 @@ namespace Raylib | ||||
|         [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); | ||||
|   | ||||
| @@ -1,4 +1,11 @@ | ||||
| /********************************************************************************************** | ||||
|  *  | ||||
|  * Physac | ||||
|  * Original -https://github.com/raysan5/raylib/blob/master/src/physac.h | ||||
|  *  | ||||
| **********************************************************************************************/ | ||||
|  | ||||
| using System; | ||||
| using System.Runtime.InteropServices; | ||||
|  | ||||
| namespace Raylib | ||||
| @@ -29,15 +36,19 @@ namespace Raylib | ||||
|     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 | ||||
|  | ||||
|         [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.Struct, SizeConst = Raylib.PHYSAC_MAX_VERTICES)] | ||||
|         public Vector2[] positions;     // Polygon vertex positions vectors | ||||
| 	     | ||||
|         [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.Struct, SizeConst = Raylib.PHYSAC_MAX_VERTICES)] | ||||
|         public Vector2[] normals;       // 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 IntPtr 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) | ||||
| @@ -71,11 +82,14 @@ namespace Raylib | ||||
|     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 PhysicsBodyData bodyA;                          // Manifold first physics body reference | ||||
|         public PhysicsBodyData 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 | ||||
| 	     | ||||
|         [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.Struct, SizeConst = 2)] | ||||
|         public Vector2[] contacts;                        // 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 | ||||
| @@ -84,7 +98,7 @@ namespace Raylib | ||||
|  | ||||
|     #endregion | ||||
|  | ||||
|     public static partial class rl | ||||
|     public static partial class Raylib | ||||
|     { | ||||
|         #region Raylib-cs Variables | ||||
|  | ||||
| @@ -108,59 +122,77 @@ namespace Raylib | ||||
|  | ||||
|         #region Raylib-cs Functions  | ||||
|  | ||||
|         // Initializes physics values, pointers and creates physics loop thread | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern void InitPhysics();                                                                           // Initializes physics values, pointers and creates physics loop thread | ||||
|         public static extern void InitPhysics();                                                                           | ||||
|  | ||||
|         // Returns true if physics thread is currently enabled | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern bool IsPhysicsEnabled();                                                                      // Returns true if physics thread is currently enabled | ||||
|         public static extern bool IsPhysicsEnabled();                                                                       | ||||
|  | ||||
|         // Sets physics global gravity force | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern void SetPhysicsGravity(float x, float y);                                                         // Sets physics global gravity force | ||||
|         public static extern void SetPhysicsGravity(float x, float y);                                                          | ||||
|  | ||||
|         // Creates a new circle physics body with generic parameters | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern PhysicsBodyData CreatePhysicsBodyCircle(Vector2 pos, float radius, float density);                    // Creates a new circle physics body with generic parameters | ||||
|         public static extern PhysicsBodyData CreatePhysicsBodyCircle(Vector2 pos, float radius, float density);                     | ||||
|  | ||||
|         // Creates a new rectangle 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 | ||||
|         public static extern PhysicsBodyData CreatePhysicsBodyRectangle(Vector2 pos, float width, float height, float density);     | ||||
|  | ||||
|         // Creates a new polygon 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 | ||||
|         public static extern PhysicsBodyData CreatePhysicsBodyPolygon(Vector2 pos, float radius, int sides, float density);         | ||||
|  | ||||
|         // Adds a force to a physics body | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern void PhysicsAddForce(PhysicsBodyData body, Vector2 force);                                            // Adds a force to a physics body | ||||
|         public static extern void PhysicsAddForce(PhysicsBodyData body, Vector2 force);                                             | ||||
|  | ||||
|         // Adds an angular force to a physics body | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern void PhysicsAddTorque(PhysicsBodyData body, float amount);                                            // Adds an angular force to a physics body | ||||
|         public static extern void PhysicsAddTorque(PhysicsBodyData body, float amount);                                             | ||||
|          | ||||
|         // Shatters a polygon shape physics body to little physics bodies with explosion force | ||||
|         [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 | ||||
|         public static extern void PhysicsShatter(PhysicsBodyData body, Vector2 position, float force);                              | ||||
|  | ||||
|         // Returns the current amount of created physics bodies | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern int GetPhysicsBodiesCount();                                                                  // Returns the current amount of created physics bodies | ||||
|         public static extern int GetPhysicsBodiesCount();                                                                   | ||||
|  | ||||
|         // Returns a physics body of the bodies pool at a specific index | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern PhysicsBodyData GetPhysicsBody(int index);                                                            // Returns a physics body of the bodies pool at a specific index | ||||
|         public static extern IntPtr GetPhysicsBody(int index);                                                             | ||||
| 	     | ||||
|         // Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON) | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern int GetPhysicsShapeType(int index);                                                               // Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON) | ||||
|         public static extern int GetPhysicsShapeType(int index);                                                              | ||||
|  | ||||
|         // Returns the amount of vertices of a physics body shape | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern int GetPhysicsShapeVerticesCount(int index);                                                      // Returns the amount of vertices of a physics body shape | ||||
|         public static extern int GetPhysicsShapeVerticesCount(int index);                                                       | ||||
|  | ||||
|         // Returns transformed position of a body shape (body position + vertex transformed position) | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern Vector2 GetPhysicsShapeVertex(PhysicsBodyData body, int vertex);                                      // Returns transformed position of a body shape (body position + vertex transformed position) | ||||
|         public static extern Vector2 GetPhysicsShapeVertex(PhysicsBodyData body, int vertex);                                       | ||||
|  | ||||
|         // Sets physics body shape transform based on radians parameter | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern void SetPhysicsBodyRotation(PhysicsBodyData body, float radians);                                     // Sets physics body shape transform based on radians parameter | ||||
|         public static extern void SetPhysicsBodyRotation(PhysicsBodyData body, float radians);                                      | ||||
|  | ||||
|         // Unitializes and destroy a physics body | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern void DestroyPhysicsBody(PhysicsBodyData body);                                                        // Unitializes and destroy a physics body | ||||
|         public static extern void DestroyPhysicsBody(PhysicsBodyData body);                                                         | ||||
|  | ||||
|         // Destroys created physics bodies and manifolds and resets global values | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern void ResetPhysics();                                                                          // Destroys created physics bodies and manifolds and resets global values | ||||
|         public static extern void ResetPhysics();                                                                         | ||||
|  | ||||
|         // Unitializes physics pointers and closes physics loop thread | ||||
|         [DllImport(nativeLibName)] | ||||
| 		public static extern void ClosePhysics();                                                                          // Unitializes physics pointers and closes physics loop thread | ||||
|         public static extern void ClosePhysics();                                                                       | ||||
|  | ||||
|         #endregion | ||||
|  | ||||
|   | ||||
							
								
								
									
										63
									
								
								Bindings/RayForm.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								Bindings/RayForm.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | ||||
| //------------------------------------------------------------------------------ | ||||
| // <auto-generated> | ||||
| //     This code was generated by a tool. | ||||
| //     Runtime Version:4.0.30319.42000 | ||||
| // | ||||
| //     Changes to this file may cause incorrect behavior and will be lost if | ||||
| //     the code is regenerated. | ||||
| // </auto-generated> | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| namespace Raylib { | ||||
|     using System; | ||||
|      | ||||
|      | ||||
|     /// <summary> | ||||
|     ///   A strongly-typed resource class, for looking up localized strings, etc. | ||||
|     /// </summary> | ||||
|     // This class was auto-generated by the StronglyTypedResourceBuilder | ||||
|     // class via a tool like ResGen or Visual Studio. | ||||
|     // To add or remove a member, edit your .ResX file then rerun ResGen | ||||
|     // with the /str option, or rebuild your VS project. | ||||
|     [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] | ||||
|     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | ||||
|     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | ||||
|     public class RayForm { | ||||
|          | ||||
|         private static global::System.Resources.ResourceManager resourceMan; | ||||
|          | ||||
|         private static global::System.Globalization.CultureInfo resourceCulture; | ||||
|          | ||||
|         [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | ||||
|         internal RayForm() { | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///   Returns the cached ResourceManager instance used by this class. | ||||
|         /// </summary> | ||||
|         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | ||||
|         public static global::System.Resources.ResourceManager ResourceManager { | ||||
|             get { | ||||
|                 if (object.ReferenceEquals(resourceMan, null)) { | ||||
|                     global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Raylib.RayForm", typeof(RayForm).Assembly); | ||||
|                     resourceMan = temp; | ||||
|                 } | ||||
|                 return resourceMan; | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         /// <summary> | ||||
|         ///   Overrides the current thread's CurrentUICulture property for all | ||||
|         ///   resource lookups using this strongly typed resource class. | ||||
|         /// </summary> | ||||
|         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | ||||
|         public static global::System.Globalization.CultureInfo Culture { | ||||
|             get { | ||||
|                 return resourceCulture; | ||||
|             } | ||||
|             set { | ||||
|                 resourceCulture = value; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -2,7 +2,7 @@ | ||||
| using System.Drawing; | ||||
| using System.Runtime.InteropServices; | ||||
| using System.Windows.Forms; | ||||
| using static Raylib.rl; | ||||
| using static Raylib.Raylib; | ||||
| 
 | ||||
| namespace Raylib | ||||
| { | ||||
| @@ -1,3 +1,9 @@ | ||||
| /********************************************************************************************** | ||||
|  *  | ||||
|  * Raygui | ||||
|  * https://github.com/raysan5/raygui/blob/master/src/raygui.h | ||||
|  *  | ||||
| **********************************************************************************************/ | ||||
|  | ||||
| using System; | ||||
| using System.Runtime.InteropServices; | ||||
| @@ -182,14 +188,18 @@ namespace Raylib | ||||
|         LISTVIEW_TEXT_COLOR_DISABLED | ||||
|     } | ||||
|  | ||||
|     #endregion | ||||
|  | ||||
|     #region Raylib-cs Types | ||||
|  | ||||
| 	// GUI controls state | ||||
| 	public enum GuiControlState  | ||||
| 	{  | ||||
| 	    DISABLED = 0,  | ||||
| 	    NORMAL,  | ||||
| 	    FOCUSED,  | ||||
| 	    PRESSED  | ||||
| 	} | ||||
|  | ||||
|     #endregion | ||||
|  | ||||
|     public static partial class rl | ||||
|     public static partial class Raylib | ||||
|     { | ||||
|         #region Raylib-cs Variables | ||||
|  | ||||
| @@ -197,10 +207,6 @@ namespace Raylib | ||||
|  | ||||
|         #region Raylib-cs Functions | ||||
|  | ||||
|         //---------------------------------------------------------------------------------- | ||||
|         // Module Functions Declaration | ||||
|         //---------------------------------------------------------------------------------- | ||||
|          | ||||
|         // Global gui modification functions | ||||
|         // Enable gui controls (global state) | ||||
|         [DllImport(nativeLibName)] | ||||
| @@ -214,7 +220,6 @@ namespace Raylib | ||||
|         [DllImport(nativeLibName)] | ||||
|         public static extern void GuiFade(float alpha);                                     | ||||
|            | ||||
|          | ||||
|         // Style set/get functions | ||||
|         // Set one style property | ||||
|         [DllImport(nativeLibName)] | ||||
| @@ -224,7 +229,6 @@ namespace Raylib | ||||
|         [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)] | ||||
| @@ -246,8 +250,6 @@ namespace Raylib | ||||
|         [DllImport(nativeLibName)] | ||||
|         public static extern Vector2 GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 viewScroll);                    | ||||
|          | ||||
|          | ||||
|          | ||||
|         // Basic controls set | ||||
|         // Label control, shows text | ||||
|         [DllImport(nativeLibName)] | ||||
| @@ -341,7 +343,6 @@ namespace Raylib | ||||
|         [DllImport(nativeLibName)] | ||||
|         public static extern void GuiDummyRec(Rectangle bounds, string text);                                               | ||||
|          | ||||
|          | ||||
|         // Advance controls set | ||||
|         // List View control, returns selected list element index | ||||
|         [DllImport(nativeLibName)] | ||||
|   | ||||
							
								
								
									
										1281
									
								
								Bindings/Raylib.cs
									
									
									
									
									
								
							
							
						
						
									
										1281
									
								
								Bindings/Raylib.cs
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,4 +1,11 @@ | ||||
| /********************************************************************************************** | ||||
|  *  | ||||
|  * Raymath v1.2 bindings - Math functions to work with Vector3, Matrix and Quaternions | ||||
|  * Original - https://github.com/raysan5/raylib/blob/master/src/raymath.h  | ||||
|  *  | ||||
| **********************************************************************************************/ | ||||
|  | ||||
| using System; | ||||
| using System.Runtime.InteropServices; | ||||
|  | ||||
| namespace Raylib | ||||
| @@ -17,6 +24,7 @@ namespace Raylib | ||||
|             this.y = y; | ||||
|         } | ||||
|  | ||||
|         // extensions | ||||
|         public override bool Equals(object obj) | ||||
|         { | ||||
|             return (obj is Vector2) && Equals((Vector2)obj); | ||||
| @@ -32,43 +40,6 @@ namespace Raylib | ||||
|             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); | ||||
| @@ -78,6 +49,74 @@ namespace Raylib | ||||
|         { | ||||
|             return !(v1 == v2); | ||||
|         } | ||||
|  | ||||
|         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.x < v2.x && v1.y < v2.y; | ||||
|         } | ||||
|  | ||||
|         // utility for c functions Vector2Zero() -> Vector2.Zero() etc | ||||
|         public static Vector2 Zero() | ||||
|         { | ||||
|             return Raylib.Vector2Zero(); | ||||
|         } | ||||
|  | ||||
|         public static Vector2 One() | ||||
|         { | ||||
|             return Raylib.Vector2One(); | ||||
|         } | ||||
|  | ||||
|         public static float Length(Vector2 v) | ||||
|         { | ||||
|             return Raylib.Vector2Length(v); | ||||
|         } | ||||
|  | ||||
|         public static float DotProduct(Vector2 v1, Vector2 v2) | ||||
|         { | ||||
|             return Raylib.Vector2DotProduct(v1, v2); | ||||
|         } | ||||
|  | ||||
|         public static float Distance(Vector2 v1, Vector2 v2) | ||||
|         { | ||||
|             return Raylib.Vector2Distance(v1, v2); | ||||
|         } | ||||
|  | ||||
|         public static float Angle(Vector2 v1, Vector2 v2) | ||||
|         { | ||||
|             return Raylib.Vector2Angle(v1, v2); | ||||
|         } | ||||
|  | ||||
|         public static Vector2 Scale(Vector2 v, float scale)         | ||||
|         { | ||||
|             return Raylib.Vector2Scale(v, scale); | ||||
|         } | ||||
|  | ||||
|         public static Vector2 Negate(Vector2 v)         | ||||
|         { | ||||
|             return Raylib.Vector2Negate(v); | ||||
|         } | ||||
|  | ||||
|         public static Vector2 Divide(Vector2 v, float div) | ||||
|         { | ||||
|             return Raylib.Vector2Divide(v, div); | ||||
|         } | ||||
|   | ||||
|         public static Vector2 Normalize(Vector2 v) | ||||
|         {          | ||||
|             return Raylib.Vector2Normalize(v); | ||||
|         } | ||||
|  | ||||
|         // extra operators(Vector2Add(v1, v2) -> v1 += v2); | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector2Add")] | ||||
|         public static extern Vector2 operator +(Vector2 v1, Vector2 v2); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector2Subtract")] | ||||
|         public static extern Vector2 operator -(Vector2 v1, Vector2 v2); | ||||
|     } | ||||
|  | ||||
|     // Vector3 type | ||||
| @@ -104,55 +143,10 @@ namespace Raylib | ||||
|             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 override string ToString() | ||||
|         { | ||||
|             return "Vector3(" + x + " " + y + " " + z + ")"; | ||||
|         } | ||||
|  | ||||
|         public static bool operator ==(Vector3 v1, Vector3 v2) | ||||
|         { | ||||
| @@ -163,6 +157,66 @@ namespace Raylib | ||||
|         { | ||||
|             return !(v1 == v2); | ||||
|         } | ||||
|  | ||||
|         /*public 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.x < v2.x && v1.y < v2.y; | ||||
|         }*/ | ||||
|  | ||||
|         // utility for c functions Vector3Zero -> Zero etc | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Zero")] | ||||
|         public static extern Vector3 Zero(); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3One")] | ||||
|         public static extern Vector3 One(); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Add")] | ||||
|         public static extern Vector3 operator +(Vector3 v1, Vector3 v3); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Subtract")] | ||||
|         public static extern Vector3 operator -(Vector3 v1, Vector3 v3); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Length")] | ||||
|         public static extern float Length(Vector3 v); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3DotProduct")] | ||||
|         public static extern float DotProduct(Vector3 v1, Vector3 v3); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Distance")] | ||||
|         public static extern float Distance(Vector3 v1, Vector3 v3); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Angle")] | ||||
|         public static extern float Angle(Vector3 v1, Vector3 v3); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Scale")] | ||||
|         public static extern Vector3 Scale(Vector3 v, float scale); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Negate")] | ||||
|         public static extern Vector3 Negate(Vector3 v); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Divide")] | ||||
|         public static extern Vector3 Divide(Vector3 v, float div); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Normalize")] | ||||
|         public static extern Vector3 Normalize(Vector3 v); | ||||
|  | ||||
|         // operators | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3MultiplyV")] | ||||
|         public static extern Vector3 operator *(Vector3 v1, Vector3 v3); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Multiply")] | ||||
|         public static extern Vector3 operator *(Vector3 v1, float scale); | ||||
|          | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Divide")] | ||||
|         public static extern Vector3 operator /(Vector3 v1, Vector3 v3); | ||||
|  | ||||
|         [DllImport(Raylib.nativeLibName, EntryPoint = "Vector3Negate")] | ||||
|         public static extern Vector3 operator -(Vector3 v1); | ||||
|     } | ||||
|  | ||||
|     // Vector4 type | ||||
| @@ -180,6 +234,21 @@ namespace Raylib | ||||
|             this.z = z; | ||||
|             this.w = w; | ||||
|         } | ||||
|  | ||||
|         public override bool Equals(object obj) | ||||
|         { | ||||
|             return (obj is Vector4) && Equals((Vector4)obj); | ||||
|         } | ||||
|  | ||||
|         public override int GetHashCode() | ||||
|         { | ||||
|             return x.GetHashCode() + y.GetHashCode() + z.GetHashCode() + w.GetHashCode(); | ||||
|         } | ||||
|  | ||||
|         public override string ToString() | ||||
|         { | ||||
|             return "Vector4(" + x + " " + y + " " + z + " " + w + ")"; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // Matrix type (OpenGL style 4x4 - right handed, column major) | ||||
| @@ -190,6 +259,11 @@ namespace Raylib | ||||
|         public float m1, m5, m9, m13; | ||||
|         public float m2, m6, m10, m14; | ||||
|         public float m3, m7, m11, m15; | ||||
|  | ||||
|         public override string ToString() | ||||
|         { | ||||
|             return $"Matrix({m0}, {m4}, {m8}, {m12}\n       {m1}, {m5}, {m9}, {m13}\n      {m2}, {m6}, {m10}, {m14}\n      {m3}, {m7}, {m11}, {m15})"; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // Quaternion type | ||||
| @@ -200,11 +274,16 @@ namespace Raylib | ||||
|         public float y; | ||||
|         public float z; | ||||
|         public float w; | ||||
|  | ||||
|         public override string ToString() | ||||
|         { | ||||
|             return "Quaternion(" + x + " " + y + " " + z + " " + w + ")"; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     #endregion | ||||
|  | ||||
|     public static partial class rl | ||||
|     public static partial class Raylib | ||||
|     { | ||||
|         #region Raylib-cs Functions  | ||||
|  | ||||
| @@ -260,7 +339,6 @@ namespace Raylib | ||||
|         [DllImport(nativeLibName)] | ||||
|         public static extern Vector2 Vector2Normalize(Vector2 v); | ||||
|  | ||||
|  | ||||
|         // Vector with components value 0.0f | ||||
|         [DllImport(nativeLibName)] | ||||
|         public static extern Vector3 Vector3Zero(); | ||||
| @@ -356,7 +434,6 @@ namespace Raylib | ||||
|         [DllImport(nativeLibName)] | ||||
|         public static extern float[] Vector3ToFloatV(Vector3 v); | ||||
|  | ||||
|  | ||||
|         // Compute matrix determinant | ||||
|         [DllImport(nativeLibName)] | ||||
|         public static extern float MatrixDeterminant(Matrix mat); | ||||
| @@ -440,7 +517,6 @@ namespace Raylib | ||||
|         [DllImport(nativeLibName)] | ||||
|         public static extern float[] MatrixToFloatV(Matrix mat); | ||||
|              | ||||
|          | ||||
|         // Returns identity quaternion | ||||
|         [DllImport(nativeLibName)] | ||||
|         public static extern Quaternion QuaternionIdentity(); | ||||
|   | ||||
| @@ -1,3 +1,9 @@ | ||||
| /********************************************************************************************** | ||||
|  *  | ||||
|  * Rlgl | ||||
|  * Original - https://github.com/raysan5/raylib/blob/master/src/rlgl.h | ||||
|  *  | ||||
| **********************************************************************************************/ | ||||
|  | ||||
| using System; | ||||
| using System.Runtime.InteropServices; | ||||
| @@ -13,7 +19,7 @@ namespace Raylib | ||||
|  | ||||
|     #endregion | ||||
|  | ||||
|     public static partial class rl | ||||
|     public static partial class Raylib | ||||
|     { | ||||
|         #region Raylib-cs Variables | ||||
|  | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| @@ -1 +1 @@ | ||||
|  | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								Examples/bin/Debug/Bindings.exe
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Examples/bin/Debug/Bindings.exe
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Examples/bin/Debug/x86/raylib.dll
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Examples/bin/Debug/x86/raylib.dll
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user