mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-09-09 03:01:41 -04:00
Remove Physac-cs and Raygui-cs
- Not actively maintained and a pain for users to setup...
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
|
||||||
<EnableDefaultItems>false</EnableDefaultItems>
|
|
||||||
<AssemblyName>Physac-cs</AssemblyName>
|
|
||||||
<RootNamespace>Physac_cs</RootNamespace>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Physac.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="../Raylib-cs/Raylib-cs.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@@ -1,230 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Numerics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Security;
|
|
||||||
using Raylib_cs;
|
|
||||||
|
|
||||||
namespace Physac_cs
|
|
||||||
{
|
|
||||||
public enum PhysicsShapeType
|
|
||||||
{
|
|
||||||
PHYSICS_CIRCLE,
|
|
||||||
PHYSICS_POLYGON
|
|
||||||
}
|
|
||||||
|
|
||||||
// Matrix2x2 type (used for polygon shape rotation matrix)
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct Matrix2x2
|
|
||||||
{
|
|
||||||
public float m00;
|
|
||||||
public float m01;
|
|
||||||
public float m10;
|
|
||||||
public float m11;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @TODO Custom array marshall issue https://github.com/ChrisDill/Raylib-cs/issues/9
|
|
||||||
// Hack same as raylib.cs _MaterialMap_e_FixedBuffer
|
|
||||||
// No easy way to marshall arrays of custom types. no idea why?
|
|
||||||
public unsafe struct _Polygon_e_FixedBuffer
|
|
||||||
{
|
|
||||||
public Vector2 v0;
|
|
||||||
public Vector2 v1;
|
|
||||||
public Vector2 v2;
|
|
||||||
public Vector2 v3;
|
|
||||||
public Vector2 v4;
|
|
||||||
public Vector2 v5;
|
|
||||||
public Vector2 v6;
|
|
||||||
public Vector2 v7;
|
|
||||||
public Vector2 v8;
|
|
||||||
public Vector2 v9;
|
|
||||||
public Vector2 v10;
|
|
||||||
public Vector2 v11;
|
|
||||||
public Vector2 v12;
|
|
||||||
public Vector2 v13;
|
|
||||||
public Vector2 v14;
|
|
||||||
public Vector2 v15;
|
|
||||||
public Vector2 v16;
|
|
||||||
public Vector2 v17;
|
|
||||||
public Vector2 v18;
|
|
||||||
public Vector2 v19;
|
|
||||||
public Vector2 v20;
|
|
||||||
public Vector2 v21;
|
|
||||||
public Vector2 v22;
|
|
||||||
public Vector2 v23;
|
|
||||||
public Vector2 v24;
|
|
||||||
|
|
||||||
public Vector2 this[int index]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
fixed (Vector2* e = &v0)
|
|
||||||
return e[index];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct PhysicsVertexData
|
|
||||||
{
|
|
||||||
public uint vertexCount; // Vertex count (positions and normals)
|
|
||||||
public _Polygon_e_FixedBuffer positions; // Vertex positions vectors
|
|
||||||
public _Polygon_e_FixedBuffer normals; // Vertex normals vectors
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct PhysicsShape
|
|
||||||
{
|
|
||||||
public PhysicsShapeType type; // Shape type (circle or polygon)
|
|
||||||
public IntPtr body; // Shape physics body reference
|
|
||||||
public PhysicsVertexData vertexData; // Shape vertices data (used for polygon shapes)
|
|
||||||
public float radius; // Shape radius (used for circle shapes)
|
|
||||||
public Matrix2x2 transform; // Vertices transform matrix 2x2
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct PhysicsBodyData
|
|
||||||
{
|
|
||||||
public uint id; // Unique identifier
|
|
||||||
public byte 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 byte useGravity; // Apply gravity force to dynamics
|
|
||||||
public byte isGrounded; // Physics grounded on other body state
|
|
||||||
public byte freezeOrient; // Physics rotation constraint
|
|
||||||
public PhysicsShape shape; // Physics body shape information (type, radius, vertices, transform)
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct PhysicsManifoldData
|
|
||||||
{
|
|
||||||
public uint id; // Reference unique identifier
|
|
||||||
public IntPtr bodyA; // Manifold first physics body reference
|
|
||||||
public IntPtr 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 contactsA; // Points of contact during collision
|
|
||||||
public Vector2 contactsB; // 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
|
|
||||||
}
|
|
||||||
|
|
||||||
[SuppressUnmanagedCodeSecurity]
|
|
||||||
public static class Physac
|
|
||||||
{
|
|
||||||
// Used by DllImport to load the native library.
|
|
||||||
public const string nativeLibName = "physac";
|
|
||||||
|
|
||||||
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 int PHYSAC_COLLISION_ITERATIONS = 100;
|
|
||||||
public const float PHYSAC_PENETRATION_ALLOWANCE = 0.05f;
|
|
||||||
public const float PHYSAC_PENETRATION_CORRECTION = 0.4f;
|
|
||||||
|
|
||||||
// Physics system management
|
|
||||||
|
|
||||||
// Initializes physics values, pointers and creates physics loop thread
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void InitPhysics();
|
|
||||||
|
|
||||||
// Update physics system
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void UpdatePhysics();
|
|
||||||
|
|
||||||
// Reset physics system (global variables)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void ResetPhysics();
|
|
||||||
|
|
||||||
// Close physics system and unload used memory
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void ClosePhysics();
|
|
||||||
|
|
||||||
// Sets physics fixed time step in milliseconds. 1.666666 by default
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void SetPhysicsTimeStep(double delta);
|
|
||||||
|
|
||||||
// Sets physics global gravity force
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void SetPhysicsGravity(float x, float y);
|
|
||||||
|
|
||||||
|
|
||||||
// Physic body creation/destroy
|
|
||||||
|
|
||||||
// Creates a new circle physics body with generic parameters
|
|
||||||
// IntPtr refers to a PhysicsBodyData *
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern IntPtr CreatePhysicsBodyCircle(Vector2 pos, float radius, float density);
|
|
||||||
|
|
||||||
// Creates a new rectangle physics body with generic parameters
|
|
||||||
// IntPtr refers to a PhysicsBodyData *
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern IntPtr CreatePhysicsBodyRectangle(Vector2 pos, float width, float height, float density);
|
|
||||||
|
|
||||||
// Creates a new polygon physics body with generic parameters
|
|
||||||
// IntPtr refers to a PhysicsBodyData *
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern IntPtr CreatePhysicsBodyPolygon(Vector2 pos, float radius, int sides, float density);
|
|
||||||
|
|
||||||
// Destroy a physics body
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void DestroyPhysicsBody(PhysicsBodyData body);
|
|
||||||
|
|
||||||
|
|
||||||
// Physic body forces
|
|
||||||
|
|
||||||
// Adds a force to a physics body
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void PhysicsAddForce(PhysicsBodyData body, Vector2 force);
|
|
||||||
|
|
||||||
// Adds an angular force to a physics body
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void PhysicsAddTorque(PhysicsBodyData body, float amount);
|
|
||||||
|
|
||||||
// Shatters a polygon shape physics body to little physics bodies with explosion force
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void PhysicsShatter(PhysicsBodyData body, Vector2 position, float force);
|
|
||||||
|
|
||||||
// Sets physics body shape transform based on radians parameter
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void SetPhysicsBodyRotation(PhysicsBodyData body, float radians);
|
|
||||||
|
|
||||||
|
|
||||||
// Query physics info
|
|
||||||
|
|
||||||
// Returns a physics body of the bodies pool at a specific index
|
|
||||||
// IntPtr refers to a PhysicsBodyData *
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern IntPtr GetPhysicsBody(int index);
|
|
||||||
|
|
||||||
// Returns the current amount of created physics bodies
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GetPhysicsBodiesCount();
|
|
||||||
|
|
||||||
// Returns the physics body shape type (PHYSICS_CIRCLE or PHYSICS_POLYGON)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GetPhysicsShapeType(int index);
|
|
||||||
|
|
||||||
// Returns the amount of vertices of a physics body shape
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GetPhysicsShapeVerticesCount(int index);
|
|
||||||
|
|
||||||
// Returns transformed position of a body shape (body position + vertex transformed position)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Vector2 GetPhysicsShapeVertex(PhysicsBodyData body, int vertex);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,18 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
|
||||||
<EnableDefaultItems>false</EnableDefaultItems>
|
|
||||||
<AssemblyName>Raygui-cs</AssemblyName>
|
|
||||||
<RootNamespace>Raygui_cs</RootNamespace>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Raygui.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="../Raylib-cs/Raylib-cs.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@@ -1,454 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Numerics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Security;
|
|
||||||
using System.Text;
|
|
||||||
using Raylib_cs;
|
|
||||||
|
|
||||||
namespace Raygui_cs
|
|
||||||
{
|
|
||||||
// Style property
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
struct GuiStyleProp
|
|
||||||
{
|
|
||||||
ushort controlId;
|
|
||||||
ushort propertyId;
|
|
||||||
int propertyValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gui global state enum
|
|
||||||
public enum GuiControlState
|
|
||||||
{
|
|
||||||
GUI_STATE_NORMAL = 0,
|
|
||||||
GUI_STATE_FOCUSED,
|
|
||||||
GUI_STATE_PRESSED,
|
|
||||||
GUI_STATE_DISABLED,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gui global text alignment
|
|
||||||
public enum GuiTextAlignment
|
|
||||||
{
|
|
||||||
GUI_TEXT_ALIGN_LEFT = 0,
|
|
||||||
GUI_TEXT_ALIGN_CENTER,
|
|
||||||
GUI_TEXT_ALIGN_RIGHT,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gui standard controls
|
|
||||||
public enum GuiControl
|
|
||||||
{
|
|
||||||
DEFAULT = 0,
|
|
||||||
LABEL, // LABELBUTTON
|
|
||||||
BUTTON, // IMAGEBUTTON
|
|
||||||
TOGGLE, // TOGGLEGROUP
|
|
||||||
SLIDER, // SLIDERBAR
|
|
||||||
PROGRESSBAR,
|
|
||||||
CHECKBOX,
|
|
||||||
COMBOBOX,
|
|
||||||
DROPDOWNBOX,
|
|
||||||
TEXTBOX, // TEXTBOXMULTI
|
|
||||||
VALUEBOX,
|
|
||||||
SPINNER,
|
|
||||||
LISTVIEW,
|
|
||||||
COLORPICKER,
|
|
||||||
SCROLLBAR,
|
|
||||||
STATUSBAR
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gui default properties for every control
|
|
||||||
public enum GuiControlProperty
|
|
||||||
{
|
|
||||||
BORDER_COLOR_NORMAL = 0,
|
|
||||||
BASE_COLOR_NORMAL,
|
|
||||||
TEXT_COLOR_NORMAL,
|
|
||||||
BORDER_COLOR_FOCUSED,
|
|
||||||
BASE_COLOR_FOCUSED,
|
|
||||||
TEXT_COLOR_FOCUSED,
|
|
||||||
BORDER_COLOR_PRESSED,
|
|
||||||
BASE_COLOR_PRESSED,
|
|
||||||
TEXT_COLOR_PRESSED,
|
|
||||||
BORDER_COLOR_DISABLED,
|
|
||||||
BASE_COLOR_DISABLED,
|
|
||||||
TEXT_COLOR_DISABLED,
|
|
||||||
BORDER_WIDTH,
|
|
||||||
TEXT_PADDING,
|
|
||||||
TEXT_ALIGNMENT,
|
|
||||||
RESERVED
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gui extended properties depending on control type
|
|
||||||
// NOTE: We reserve a fixed size of additional properties per control
|
|
||||||
|
|
||||||
// Default properties
|
|
||||||
public enum GuiDefaultProperty
|
|
||||||
{
|
|
||||||
TEXT_SIZE = 16,
|
|
||||||
TEXT_SPACING,
|
|
||||||
LINE_COLOR,
|
|
||||||
BACKGROUND_COLOR,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Toggle / ToggleGroup
|
|
||||||
public enum GuiToggleProperty
|
|
||||||
{
|
|
||||||
GROUP_PADDING = 16,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Slider / SliderBar
|
|
||||||
public enum GuiSliderProperty
|
|
||||||
{
|
|
||||||
SLIDER_WIDTH = 16,
|
|
||||||
TEXT_PADDING
|
|
||||||
}
|
|
||||||
|
|
||||||
// ProgressBar
|
|
||||||
public enum GuiProgressBarProperty
|
|
||||||
{
|
|
||||||
PROGRESS_PADDING = 16,
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckBox
|
|
||||||
public enum GuiCheckBoxProperty
|
|
||||||
{
|
|
||||||
CHECK_PADDING = 16
|
|
||||||
}
|
|
||||||
|
|
||||||
// ComboBox
|
|
||||||
public enum GuiComboBoxProperty
|
|
||||||
{
|
|
||||||
SELECTOR_WIDTH = 16,
|
|
||||||
SELECTOR_PADDING
|
|
||||||
}
|
|
||||||
|
|
||||||
// DropdownBox
|
|
||||||
public enum GuiDropdownBoxProperty
|
|
||||||
{
|
|
||||||
ARROW_PADDING = 16,
|
|
||||||
DROPDOWN_ITEMS_PADDING
|
|
||||||
}
|
|
||||||
|
|
||||||
// TextBox / TextBoxMulti / ValueBox / Spinner
|
|
||||||
public enum GuiTextBoxProperty
|
|
||||||
{
|
|
||||||
TEXT_INNER_PADDING = 16,
|
|
||||||
TEXT_LINES_PADDING,
|
|
||||||
COLOR_SELECTED_FG,
|
|
||||||
COLOR_SELECTED_BG
|
|
||||||
}
|
|
||||||
|
|
||||||
// Spinner
|
|
||||||
public enum GuiSpinnerProperty
|
|
||||||
{
|
|
||||||
SPIN_BUTTON_WIDTH = 16,
|
|
||||||
SPIN_BUTTON_PADDING,
|
|
||||||
}
|
|
||||||
|
|
||||||
// ScrollBar
|
|
||||||
public enum GuiScrollBarProperty
|
|
||||||
{
|
|
||||||
ARROWS_SIZE = 16,
|
|
||||||
ARROWS_VISIBLE,
|
|
||||||
SCROLL_SLIDER_PADDING,
|
|
||||||
SCROLL_SLIDER_SIZE,
|
|
||||||
SCROLL_PADDING,
|
|
||||||
SCROLL_SPEED,
|
|
||||||
}
|
|
||||||
|
|
||||||
// ScrollBar side
|
|
||||||
public enum GuiScrollBarSide
|
|
||||||
{
|
|
||||||
SCROLLBAR_LEFT_SIDE = 0,
|
|
||||||
SCROLLBAR_RIGHT_SIDE
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListView
|
|
||||||
public enum GuiListViewProperty
|
|
||||||
{
|
|
||||||
LIST_ITEMS_HEIGHT = 16,
|
|
||||||
LIST_ITEMS_PADDING,
|
|
||||||
SCROLLBAR_WIDTH,
|
|
||||||
SCROLLBAR_SIDE,
|
|
||||||
}
|
|
||||||
|
|
||||||
// ColorPicker
|
|
||||||
public enum GuiColorPickerProperty
|
|
||||||
{
|
|
||||||
COLOR_SELECTOR_SIZE = 16,
|
|
||||||
HUEBAR_WIDTH, // Right hue bar width
|
|
||||||
HUEBAR_PADDING, // Right hue bar separation from panel
|
|
||||||
HUEBAR_SELECTOR_HEIGHT, // Right hue bar selector height
|
|
||||||
HUEBAR_SELECTOR_OVERFLOW // Right hue bar selector overflow
|
|
||||||
}
|
|
||||||
|
|
||||||
[SuppressUnmanagedCodeSecurity]
|
|
||||||
public static class Raygui
|
|
||||||
{
|
|
||||||
// Used by DllImport to load the native library.
|
|
||||||
public const string nativeLibName = "raygui";
|
|
||||||
|
|
||||||
public const string RAYGUI_VERSION = "2.9-dev";
|
|
||||||
|
|
||||||
public const int NUM_CONTROLS = 16; // Number of standard controls
|
|
||||||
public const int NUM_PROPS_DEFAULT = 16; // Number of standard properties
|
|
||||||
public const int NUM_PROPS_EXTENDED = 8; // Number of extended properties
|
|
||||||
|
|
||||||
public const int TEXTEDIT_CURSOR_BLINK_FRAMES = 20; // Text edit controls cursor blink timming
|
|
||||||
|
|
||||||
// State modification functions
|
|
||||||
|
|
||||||
// Enable gui controls (global state)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiEnable();
|
|
||||||
|
|
||||||
// Disable gui controls (global state)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiDisable();
|
|
||||||
|
|
||||||
// Lock gui controls (global state)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiLock();
|
|
||||||
|
|
||||||
// Unlock gui controls (global state)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiUnlock();
|
|
||||||
|
|
||||||
// Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiFade(float alpha);
|
|
||||||
|
|
||||||
// Set gui state (global state)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiSetState(int state);
|
|
||||||
|
|
||||||
// Get gui state (global state)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GuiGetState();
|
|
||||||
|
|
||||||
|
|
||||||
// Font set/get functions
|
|
||||||
|
|
||||||
// Get gui custom font (global state)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiSetFont(Font font);
|
|
||||||
|
|
||||||
// Set gui custom font (global state)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Font GuiGetFont();
|
|
||||||
|
|
||||||
|
|
||||||
// Style set/get functions
|
|
||||||
|
|
||||||
// Set one style property
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiSetStyle(GuiControl control, GuiControlProperty property, int value);
|
|
||||||
|
|
||||||
// Get one style property
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GuiGetStyle(GuiControl control, GuiControlProperty property);
|
|
||||||
|
|
||||||
|
|
||||||
// Container/separator controls, useful for controls organization
|
|
||||||
|
|
||||||
// Window Box control, shows a window that can be closed
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiWindowBox(Rectangle bounds, string text);
|
|
||||||
|
|
||||||
// Group Box control with title name
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiGroupBox(Rectangle bounds, string text);
|
|
||||||
|
|
||||||
// Line separator control
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiLine(Rectangle bounds, string text);
|
|
||||||
|
|
||||||
// Panel control, useful to group controls
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiPanel(Rectangle bounds);
|
|
||||||
|
|
||||||
// Scroll Panel control
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, ref Vector2 scroll);
|
|
||||||
|
|
||||||
|
|
||||||
// Basic controls set
|
|
||||||
|
|
||||||
// Label control, shows text
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiLabel(Rectangle bounds, string text);
|
|
||||||
|
|
||||||
// Button control, returns true when clicked
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiButton(Rectangle bounds, string text);
|
|
||||||
|
|
||||||
// Label button control, show true when clicked
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiLabelButton(Rectangle bounds, string text);
|
|
||||||
|
|
||||||
// Image button control, returns true when clicked
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiImageButton(Rectangle bounds, string text, Texture2D texture);
|
|
||||||
|
|
||||||
// Image button extended control, returns true when clicked
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiImageButtonEx(Rectangle bounds, string text, Texture2D texture, Rectangle texSource);
|
|
||||||
|
|
||||||
// Toggle Button control, returns true when active
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiToggle(Rectangle bounds, string text, bool active);
|
|
||||||
|
|
||||||
// Toggle Group control, returns active toggle index
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GuiToggleGroup(Rectangle bounds, string text, int active);
|
|
||||||
|
|
||||||
// Check Box control, returns true when active
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiCheckBox(Rectangle bounds, string text, bool isChecked);
|
|
||||||
|
|
||||||
// Combo Box control, returns selected item index
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GuiComboBox(Rectangle bounds, string text, int active);
|
|
||||||
|
|
||||||
// Dropdown Box control, returns selected item
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiDropdownBox(Rectangle bounds, string text, ref int active, bool editMode);
|
|
||||||
|
|
||||||
// Spinner control, returns selected value
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiSpinner(Rectangle bounds, string text, ref int value, int minValue, int maxValue, bool editMode);
|
|
||||||
|
|
||||||
// Value Box control, updates input text with numbers
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiValueBox(Rectangle bounds, string text, ref int value, int minValue, int maxValue, bool editMode);
|
|
||||||
|
|
||||||
// Text Box control, updates input text
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiTextBox(Rectangle bounds, StringBuilder text, int textSize, bool freeEdit);
|
|
||||||
|
|
||||||
// Text Box control with multiple lines
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiTextBoxMulti(Rectangle bounds, StringBuilder text, int textSize, bool editMode);
|
|
||||||
|
|
||||||
// Slider control, returns selected value
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern float GuiSlider(Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue);
|
|
||||||
|
|
||||||
// Slider Bar control, returns selected value
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern float GuiSliderBar(Rectangle bounds, float value, float minValue, float maxValue);
|
|
||||||
|
|
||||||
// Progress Bar control, shows current progress value
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern float GuiProgressBar(Rectangle bounds, float value, float minValue, float maxValue);
|
|
||||||
|
|
||||||
// Status Bar control, shows info text
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiStatusBar(Rectangle bounds, string text);
|
|
||||||
|
|
||||||
// Dummy control for placeholders
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiDummyRec(Rectangle bounds, string text);
|
|
||||||
|
|
||||||
// Scroll Bar control
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue);
|
|
||||||
|
|
||||||
// Grid
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs);
|
|
||||||
|
|
||||||
|
|
||||||
// Advance controls set
|
|
||||||
|
|
||||||
// List View control, returns selected list element index
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GuiListView(Rectangle bounds, string text, ref int scrollIndex, ref int active);
|
|
||||||
|
|
||||||
// List View with extended parameters
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GuiListViewEx(Rectangle bounds, string text, int count, ref int focus, ref int scrollIndex, ref int active);
|
|
||||||
|
|
||||||
// Message Box control, displays a message
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GuiMessageBox(Rectangle bounds, string title, string message);
|
|
||||||
|
|
||||||
// Text Input Box control, ask for text
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern int GuiTextInputBox(Rectangle bounds, string windowTitle, string message, string buttons, string text);
|
|
||||||
|
|
||||||
// Color Picker control
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Color GuiColorPicker(Rectangle bounds, Color color);
|
|
||||||
|
|
||||||
// Color Panel control
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Color GuiColorPanel(Rectangle bounds, Color color);
|
|
||||||
|
|
||||||
// Color Bar Alpha control
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern float GuiColorBarAlpha(Rectangle bounds, float alpha);
|
|
||||||
|
|
||||||
// Color Bar Hue control
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern float GuiColorBarHue(Rectangle bounds, float value);
|
|
||||||
|
|
||||||
|
|
||||||
// Styles loading functions
|
|
||||||
|
|
||||||
// Load style file (.rgs)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiLoadStyle(string fileName);
|
|
||||||
|
|
||||||
// Load style default over global style
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiLoadStyleDefault();
|
|
||||||
|
|
||||||
// Get text with icon id prepended (if supported)
|
|
||||||
[DllImport(nativeLibName, EntryPoint = "GetMonitorName", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
private static extern IntPtr INTERNAL_GuiIconText(int iconId, string text);
|
|
||||||
public static string GuiIconText(int iconId, string text)
|
|
||||||
{
|
|
||||||
return Marshal.PtrToStringUTF8(INTERNAL_GuiIconText(iconId, text));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Gui icons functionality
|
|
||||||
|
|
||||||
// Get full icons data pointer
|
|
||||||
// IntPtr refers to a unsigned int *
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern IntPtr GuiGetIcons();
|
|
||||||
|
|
||||||
// Get icon bit data
|
|
||||||
// IntPtr refers to a unsigned int *
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern IntPtr GuiGetIconData(int iconId, string text);
|
|
||||||
|
|
||||||
// Set icon bit data
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiSetIconData(int iconId, uint[] data);
|
|
||||||
|
|
||||||
// Set icon pixel value
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiSetIconPixel(int iconId, int x, int y);
|
|
||||||
|
|
||||||
// Clear icon pixel value
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern void GuiClearIconPixel(int iconId, int x, int y);
|
|
||||||
|
|
||||||
// Check icon pixel value
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
|
||||||
public static extern bool GuiCheckIconPixel(int iconId, int x, int y);
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user