2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-04-05 11:19:39 -04:00

Add .editorconfig and apply formatting

This commit is contained in:
ChrisDill 2023-08-27 15:20:26 +01:00
parent d1f0b9fd91
commit 696955463f
32 changed files with 7217 additions and 7194 deletions

51
.editorconfig Normal file
View File

@ -0,0 +1,51 @@
# EditorConfig is awesome: http://EditorConfig.org
root = true
[*]
indent_style = space
# General
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
# C# styles
[*.cs]
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
csharp_style_namespace_declarations = file_scoped:warning
# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Spacing
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_around_binary_operators = before_and_after
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
# Blocks are allowed
csharp_prefer_braces = true:error
csharp_preserve_single_line_blocks = false
csharp_preserve_single_line_statements = false

View File

@ -30,10 +30,10 @@ using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace Raylib_cs.Tests
namespace Raylib_cs.Tests;
public static class BlittableHelper
{
public static class BlittableHelper
{
public static bool IsBlittable<T>()
{
return IsBlittableCache<T>.VALUE;
@ -66,5 +66,4 @@ namespace Raylib_cs.Tests
{
public static readonly bool VALUE = IsBlittable(typeof(T));
}
}
}

View File

@ -1,10 +1,10 @@
using System;
using Xunit;
namespace Raylib_cs.Tests
namespace Raylib_cs.Tests;
public class RaylibTests
{
public class RaylibTests
{
private unsafe void CheckType<T>() where T : unmanaged
{
Assert.True(BlittableHelper.IsBlittable<T>());
@ -42,5 +42,4 @@ namespace Raylib_cs.Tests
CheckType<VrStereoConfig>();
CheckType<RenderBatch>();
}
}
}

View File

@ -3,11 +3,11 @@ using System.Numerics;
using System.Runtime.InteropServices;
using System.Security;
namespace Raylib_cs
namespace Raylib_cs;
[SuppressUnmanagedCodeSecurity]
public static unsafe partial class Raylib
{
[SuppressUnmanagedCodeSecurity]
public static unsafe partial class Raylib
{
/// <summary>
/// Used by DllImport to load the native library
/// </summary>
@ -2682,5 +2682,4 @@ namespace Raylib_cs
public static extern void DetachAudioMixedProcessor(
delegate* unmanaged[Cdecl]<void*, uint, void> processor
);
}
}

View File

@ -2,22 +2,22 @@ using System.Numerics;
using System.Runtime.InteropServices;
using System.Security;
namespace Raylib_cs
namespace Raylib_cs;
// NOTE: Helper types to be used instead of array return types for *ToFloat functions
public unsafe struct Float3
{
// NOTE: Helper types to be used instead of array return types for *ToFloat functions
public unsafe struct Float3
{
public fixed float v[3];
}
}
public unsafe struct Float16
{
public unsafe struct Float16
{
public fixed float v[16];
}
}
[SuppressUnmanagedCodeSecurity]
public static unsafe partial class Raymath
{
[SuppressUnmanagedCodeSecurity]
public static unsafe partial class Raymath
{
/// <summary>
/// Used by DllImport to load the native library
/// </summary>
@ -540,5 +540,4 @@ namespace Raylib_cs
/// <summary>Check whether two given quaternions are almost equal</summary>
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int QuaternionEquals(Quaternion p, Quaternion q);
}
}

View File

@ -2,11 +2,11 @@ using System.Numerics;
using System.Runtime.InteropServices;
using System.Security;
namespace Raylib_cs
namespace Raylib_cs;
[SuppressUnmanagedCodeSecurity]
public static unsafe partial class Rlgl
{
[SuppressUnmanagedCodeSecurity]
public static unsafe partial class Rlgl
{
/// <summary>
/// Used by DllImport to load the native library
/// </summary>
@ -803,5 +803,4 @@ namespace Raylib_cs
/// <summary>Load and draw a quad</summary>
[DllImport(NativeLibName, EntryPoint = "rlLoadDrawQuad", CallingConvention = CallingConvention.Cdecl)]
public static extern void LoadDrawQuad();
}
}

View File

@ -1,14 +1,14 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Wave type, defines audio wave data
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Wave
{
/// <summary>
/// Wave type, defines audio wave data
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Wave
{
/// <summary>
/// Number of samples
/// </summary>
@ -34,15 +34,15 @@ namespace Raylib_cs
/// Buffer data pointer
/// </summary>
public void* Data;
}
}
/// <summary>
/// Audio stream type<br/>
/// NOTE: Useful to create custom audio streams not bound to a specific file
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct AudioStream
{
/// <summary>
/// Audio stream type<br/>
/// NOTE: Useful to create custom audio streams not bound to a specific file
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct AudioStream
{
//TODO: convert
/// <summary>
/// Pointer to internal data(rAudioBuffer *) used by the audio system
@ -68,14 +68,14 @@ namespace Raylib_cs
/// Number of channels (1-mono, 2-stereo)
/// </summary>
public uint Channels;
}
}
/// <summary>
/// Sound source type
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Sound
{
/// <summary>
/// Sound source type
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Sound
{
/// <summary>
/// Audio stream
/// </summary>
@ -85,15 +85,15 @@ namespace Raylib_cs
/// Total number of frames (considering channels)
/// </summary>
public uint FrameCount;
}
}
/// <summary>
/// Music stream type (audio file streaming from memory)<br/>
/// NOTE: Anything longer than ~10 seconds should be streamed
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Music
{
/// <summary>
/// Music stream type (audio file streaming from memory)<br/>
/// NOTE: Anything longer than ~10 seconds should be streamed
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Music
{
/// <summary>
/// Audio stream
/// </summary>
@ -119,5 +119,4 @@ namespace Raylib_cs
/// Audio context data, depends on type
/// </summary>
public void* CtxData;
}
}

View File

@ -1,12 +1,12 @@
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>Bounding box type</summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct BoundingBox
{
/// <summary>Bounding box type</summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct BoundingBox
{
/// <summary>
/// Minimum vertex box-corner
/// </summary>
@ -22,5 +22,4 @@ namespace Raylib_cs
this.Min = min;
this.Max = max;
}
}
}

View File

@ -1,14 +1,14 @@
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Camera2D, defines position/orientation in 2d space
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Camera2D
{
/// <summary>
/// Camera2D, defines position/orientation in 2d space
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Camera2D
{
/// <summary>
/// Camera offset (displacement from target)
/// </summary>
@ -36,5 +36,4 @@ namespace Raylib_cs
this.Rotation = rotation;
this.Zoom = zoom;
}
}
}

View File

@ -1,35 +1,35 @@
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Camera system modes
/// </summary>
public enum CameraMode
{
/// <summary>
/// Camera system modes
/// </summary>
public enum CameraMode
{
CAMERA_CUSTOM = 0,
CAMERA_FREE,
CAMERA_ORBITAL,
CAMERA_FIRST_PERSON,
CAMERA_THIRD_PERSON
}
}
/// <summary>
/// Camera projection
/// </summary>
public enum CameraProjection
{
/// <summary>
/// Camera projection
/// </summary>
public enum CameraProjection
{
CAMERA_PERSPECTIVE = 0,
CAMERA_ORTHOGRAPHIC
}
}
/// <summary>
/// Camera3D, defines position/orientation in 3d space
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Camera3D
{
/// <summary>
/// Camera3D, defines position/orientation in 3d space
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Camera3D
{
/// <summary>
/// Camera position
/// </summary>
@ -63,5 +63,4 @@ namespace Raylib_cs
this.FovY = fovY;
this.Projection = projection;
}
}
}

View File

@ -1,14 +1,14 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Color type, RGBA (32bit)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Color
{
/// <summary>
/// Color type, RGBA (32bit)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Color
{
public byte R;
public byte G;
public byte B;
@ -63,5 +63,4 @@ namespace Raylib_cs
{
return $"{{R:{R} G:{G} B:{B} A:{A}}}";
}
}
}

View File

@ -1,15 +1,15 @@
using System;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// System config flags<br/>
/// NOTE: Every bit registers one state (use it with bit masks)<br/>
/// By default all flags are set to 0
/// </summary>
[Flags]
public enum ConfigFlags : uint
{
/// <summary>
/// System config flags<br/>
/// NOTE: Every bit registers one state (use it with bit masks)<br/>
/// By default all flags are set to 0
/// </summary>
[Flags]
public enum ConfigFlags : uint
{
/// <summary>
/// Set to try enabling V-Sync on GPU
/// </summary>
@ -84,14 +84,14 @@ namespace Raylib_cs
/// Set to try enabling interlaced video format (for V3D)
/// </summary>
FLAG_INTERLACED_HINT = 0x00010000,
}
}
/// <summary>
/// Trace log level<br/>
/// NOTE: Organized by priority level
/// </summary>
public enum TraceLogLevel
{
/// <summary>
/// Trace log level<br/>
/// NOTE: Organized by priority level
/// </summary>
public enum TraceLogLevel
{
/// <summary>
/// Display all logs
/// </summary>
@ -131,13 +131,13 @@ namespace Raylib_cs
/// Disable logging
/// </summary>
LOG_NONE
}
}
/// <summary>
/// Color blending modes (pre-defined)
/// </summary>
public enum BlendMode
{
/// <summary>
/// Color blending modes (pre-defined)
/// </summary>
public enum BlendMode
{
/// <summary>
/// Blend textures considering alpha (default)
/// </summary>
@ -177,5 +177,4 @@ namespace Raylib_cs
/// Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate())
/// </summary>
BLEND_CUSTOM_SEPARATE
}
}

View File

@ -1,12 +1,12 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Font type, defines generation method
/// </summary>
public enum FontType
{
/// <summary>
/// Font type, defines generation method
/// </summary>
public enum FontType
{
/// <summary>
/// Default font generation, anti-aliased
/// </summary>
@ -21,14 +21,14 @@ namespace Raylib_cs
/// SDF font generation, requires external shader
/// </summary>
FONT_SDF
}
}
/// <summary>
/// GlyphInfo, font characters glyphs info
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct GlyphInfo
{
/// <summary>
/// GlyphInfo, font characters glyphs info
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct GlyphInfo
{
/// <summary>
/// Character value (Unicode)
/// </summary>
@ -53,14 +53,14 @@ namespace Raylib_cs
/// Character image data
/// </summary>
public Image Image;
}
}
/// <summary>
/// Font, font texture and GlyphInfo array data
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Font
{
/// <summary>
/// Font, font texture and GlyphInfo array data
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Font
{
/// <summary>
/// Base size (default chars height)
/// </summary>
@ -90,5 +90,4 @@ namespace Raylib_cs
/// Glyphs info data
/// </summary>
public GlyphInfo* Glyphs;
}
}

View File

@ -1,13 +1,13 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Pixel formats<br/>
/// NOTE: Support depends on OpenGL version and platform
/// </summary>
public enum PixelFormat
{
/// <summary>
/// Pixel formats<br/>
/// NOTE: Support depends on OpenGL version and platform
/// </summary>
public enum PixelFormat
{
/// <summary>
/// 8 bit per pixel (no alpha)
/// </summary>
@ -112,14 +112,14 @@ namespace Raylib_cs
/// 2 bpp
/// </summary>
PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA
}
}
/// <summary>
/// Image, pixel data stored in CPU memory (RAM)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Image
{
/// <summary>
/// Image, pixel data stored in CPU memory (RAM)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Image
{
/// <summary>
/// Image raw data
/// </summary>
@ -144,5 +144,4 @@ namespace Raylib_cs
/// Data format (PixelFormat type)
/// </summary>
public PixelFormat Format;
}
}

View File

@ -2,14 +2,14 @@ using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Keyboard keys (US keyboard layout)<br/>
/// NOTE: Use GetKeyPressed() to allow redefining required keys for alternative layouts
/// </summary>
public enum KeyboardKey
{
/// <summary>
/// Keyboard keys (US keyboard layout)<br/>
/// NOTE: Use GetKeyPressed() to allow redefining required keys for alternative layouts
/// </summary>
public enum KeyboardKey
{
/// <summary>
/// NULL, used for no key pressed
/// </summary>
@ -131,13 +131,13 @@ namespace Raylib_cs
KEY_MENU = 82,
KEY_VOLUME_UP = 24,
KEY_VOLUME_DOWN = 25
}
}
/// <summary>
/// Mouse buttons
/// </summary>
public enum MouseButton
{
/// <summary>
/// Mouse buttons
/// </summary>
public enum MouseButton
{
/// <summary>
/// Mouse button left
/// </summary>
@ -176,13 +176,13 @@ namespace Raylib_cs
MOUSE_LEFT_BUTTON = MOUSE_BUTTON_LEFT,
MOUSE_RIGHT_BUTTON = MOUSE_BUTTON_RIGHT,
MOUSE_MIDDLE_BUTTON = MOUSE_BUTTON_MIDDLE,
}
}
/// <summary>
/// Mouse cursor
/// </summary>
public enum MouseCursor
{
/// <summary>
/// Mouse cursor
/// </summary>
public enum MouseCursor
{
/// <summary>
/// Default pointer shape
/// </summary>
@ -237,11 +237,11 @@ namespace Raylib_cs
/// The operation-not-allowed shape
/// </summary>
MOUSE_CURSOR_NOT_ALLOWED = 10
}
}
/// <summary>Gamepad axis</summary>
public enum GamepadAxis
{
/// <summary>Gamepad axis</summary>
public enum GamepadAxis
{
/// <summary>
/// Gamepad left stick X axis
/// </summary>
@ -271,13 +271,13 @@ namespace Raylib_cs
/// Gamepad back trigger right, pressure level: [1..-1]
/// </summary>
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
}
}
/// <summary>
/// Gamepad buttons
/// </summary>
public enum GamepadButton
{
/// <summary>
/// Gamepad buttons
/// </summary>
public enum GamepadButton
{
/// <summary>
/// Unknown button, just for error checking
/// </summary>
@ -367,15 +367,15 @@ namespace Raylib_cs
/// Gamepad joystick pressed button right
/// </summary>
GAMEPAD_BUTTON_RIGHT_THUMB
}
}
/// <summary>
/// Gesture
/// NOTE: It could be used as flags to enable only some gestures
/// </summary>
[Flags]
public enum Gesture : uint
{
/// <summary>
/// Gesture
/// NOTE: It could be used as flags to enable only some gestures
/// </summary>
[Flags]
public enum Gesture : uint
{
GESTURE_NONE = 0,
GESTURE_TAP = 1,
GESTURE_DOUBLETAP = 2,
@ -387,14 +387,14 @@ namespace Raylib_cs
GESTURE_SWIPE_DOWN = 128,
GESTURE_PINCH_IN = 256,
GESTURE_PINCH_OUT = 512
}
}
/// <summary>
/// Head-Mounted-Display device parameters
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct VrDeviceInfo
{
/// <summary>
/// Head-Mounted-Display device parameters
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct VrDeviceInfo
{
/// <summary>
/// HMD horizontal resolution in pixels
/// </summary>
@ -444,14 +444,14 @@ namespace Raylib_cs
/// HMD chromatic aberration correction parameters
/// </summary>
public fixed float ChromaAbCorrection[4];
}
}
/// <summary>
/// VR Stereo rendering configuration for simulator
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct VrStereoConfig
{
/// <summary>
/// VR Stereo rendering configuration for simulator
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct VrStereoConfig
{
/// <summary>
/// VR projection matrices (per eye)
/// </summary>
@ -501,5 +501,4 @@ namespace Raylib_cs
/// VR distortion scale in
/// </summary>
public Vector2 ScaleIn;
}
}

View File

@ -4,10 +4,10 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
internal readonly struct Native
{
internal readonly struct Native
{
internal const string Msvcrt = "msvcrt";
internal const string Libc = "libc";
internal const string LibSystem = "libSystem";
@ -26,22 +26,22 @@ namespace Raylib_cs
[DllImport(Msvcrt, EntryPoint = "vsnprintf", CallingConvention = CallingConvention.Cdecl)]
public static extern int VsnPrintfWindows(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args);
}
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
struct VaListLinuxX64
{
[StructLayout(LayoutKind.Sequential, Pack = 4)]
struct VaListLinuxX64
{
uint _gpOffset;
uint _fpOffset;
IntPtr _overflowArgArea;
IntPtr _regSaveArea;
}
}
/// <summary>
/// Logging workaround for formatting strings from native code
/// </summary>
public static unsafe class Logging
{
/// <summary>
/// Logging workaround for formatting strings from native code
/// </summary>
public static unsafe class Logging
{
[UnmanagedCallersOnly(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
public static unsafe void LogConsole(int msgType, sbyte* text, sbyte* args)
{
@ -160,5 +160,4 @@ namespace Raylib_cs
}
return -1;
}
}
}

View File

@ -1,12 +1,12 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Material map index
/// </summary>
public enum MaterialMapIndex
{
/// <summary>
/// Material map index
/// </summary>
public enum MaterialMapIndex
{
/// <summary>
/// NOTE: Same as MATERIAL_MAP_DIFFUSE
/// </summary>
@ -42,14 +42,14 @@ namespace Raylib_cs
MATERIAL_MAP_DIFFUSE = MATERIAL_MAP_ALBEDO,
MATERIAL_MAP_SPECULAR = MATERIAL_MAP_METALNESS,
}
}
/// <summary>
/// Material texture map
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct MaterialMap
{
/// <summary>
/// Material texture map
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct MaterialMap
{
/// <summary>
/// Material map texture
/// </summary>
@ -64,14 +64,14 @@ namespace Raylib_cs
/// Material map value
/// </summary>
public float Value;
}
}
/// <summary>
/// Material type (generic)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Material
{
/// <summary>
/// Material type (generic)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Material
{
/// <summary>
/// Material shader
/// </summary>
@ -87,5 +87,4 @@ namespace Raylib_cs
/// Material generic parameters (if required)
/// </summary>
public fixed float Param[4];
}
}

View File

@ -1,14 +1,14 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Vertex data definning a mesh<br/>
/// NOTE: Data stored in CPU memory (and GPU)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Mesh
{
/// <summary>
/// Vertex data definning a mesh<br/>
/// NOTE: Data stored in CPU memory (and GPU)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Mesh
{
/// <summary>
/// Number of vertices stored in arrays
/// </summary>
@ -95,5 +95,4 @@ namespace Raylib_cs
public uint* VboId;
#endregion
}
}

View File

@ -2,14 +2,14 @@ using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Bone information
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct BoneInfo
{
/// <summary>
/// Bone information
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct BoneInfo
{
/// <summary>
/// Bone name (char[32])
/// </summary>
@ -19,14 +19,14 @@ namespace Raylib_cs
/// Bone parent
/// </summary>
public int Parent;
}
}
/// <summary>
/// Model type
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Model
{
/// <summary>
/// Model type
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Model
{
/// <summary>
/// Local transform matrix
/// </summary>
@ -73,14 +73,14 @@ namespace Raylib_cs
/// Bones base transformation (pose, Transform *)
/// </summary>
public Transform* BindPose;
}
}
/// <summary>
/// Model animation
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public readonly unsafe partial struct ModelAnimation
{
/// <summary>
/// Model animation
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public readonly unsafe partial struct ModelAnimation
{
/// <summary>
/// Number of bones
/// </summary>
@ -126,10 +126,10 @@ namespace Raylib_cs
this._boneCount = boneCount;
}
}
}
}
public unsafe struct FramePoses
{
public unsafe struct FramePoses
{
readonly Transform* _poses;
readonly int _count;
@ -141,5 +141,4 @@ namespace Raylib_cs
this._poses = poses;
this._count = count;
}
}
}

View File

@ -1,12 +1,12 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// N-patch layout
/// </summary>
public enum NPatchLayout
{
/// <summary>
/// N-patch layout
/// </summary>
public enum NPatchLayout
{
/// <summary>
/// Npatch defined by 3x3 tiles
/// </summary>
@ -21,14 +21,14 @@ namespace Raylib_cs
/// Npatch defined by 3x1 tiles
/// </summary>
NPATCH_THREE_PATCH_HORIZONTAL
}
}
/// <summary>
/// N-Patch layout info
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct NPatchInfo
{
/// <summary>
/// N-Patch layout info
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct NPatchInfo
{
/// <summary>
/// Texture source rectangle
/// </summary>
@ -58,5 +58,4 @@ namespace Raylib_cs
/// Layout of the n-patch: 3x3, 1x3 or 3x1
/// </summary>
public NPatchLayout Layout;
}
}

View File

@ -1,14 +1,14 @@
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Ray, ray for raycasting
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Ray
{
/// <summary>
/// Ray, ray for raycasting
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Ray
{
/// <summary>
/// Ray position (origin)
/// </summary>
@ -24,14 +24,14 @@ namespace Raylib_cs
this.Position = position;
this.Direction = direction;
}
}
}
/// <summary>
/// Raycast hit information
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct RayCollision
{
/// <summary>
/// Raycast hit information
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct RayCollision
{
/// <summary>
/// Did the ray hit something?
/// </summary>
@ -51,5 +51,4 @@ namespace Raylib_cs
/// Surface normal of hit
/// </summary>
public Vector3 Normal;
}
}

View File

@ -2,10 +2,10 @@ using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
public static unsafe partial class Raylib
{
public static unsafe partial class Raylib
{
/// <summary>Initialize window and OpenGL context</summary>
public static void InitWindow(int width, int height, string title)
{
@ -1102,5 +1102,4 @@ namespace Raylib_cs
{
model.Materials[materialIndex].Shader = shader;
}
}
}

View File

@ -1,13 +1,13 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Rectangle type
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Rectangle
{
/// <summary>
/// Rectangle type
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Rectangle
{
public float X;
public float Y;
public float Width;
@ -25,5 +25,4 @@ namespace Raylib_cs
{
return $"{{X:{X} Y:{Y} Width:{Width} Height:{Height}}}";
}
}
}

View File

@ -1,13 +1,13 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// RenderBatch type
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct RenderBatch
{
/// <summary>
/// RenderBatch type
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct RenderBatch
{
/// <summary>
/// Number of vertex buffers (multi-buffering support)
/// </summary>
@ -37,14 +37,14 @@ namespace Raylib_cs
/// Current depth value for next draw
/// </summary>
float _currentDepth;
}
}
/// <summary>
/// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct VertexBuffer
{
/// <summary>
/// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct VertexBuffer
{
/// <summary>
/// Number of elements in the buffer (QUADS)
/// </summary>
@ -81,14 +81,14 @@ namespace Raylib_cs
/// OpenGL Vertex Buffer Objects id (4 types of vertex data)
/// </summary>
public fixed uint VboId[4];
}
}
/// <summary>
/// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct DrawCall
{
/// <summary>
/// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct DrawCall
{
/// <summary>
/// Drawing mode: LINES, TRIANGLES, QUADS
/// </summary>
@ -108,19 +108,19 @@ namespace Raylib_cs
/// Texture id to be used on the draw -> Use to create new draw call if changes
/// </summary>
uint _textureId;
}
}
public enum GlVersion
{
public enum GlVersion
{
OPENGL_11 = 1,
OPENGL_21,
OPENGL_33,
OPENGL_43,
OPENGL_ES_20
}
}
public enum FramebufferAttachType
{
public enum FramebufferAttachType
{
RL_ATTACHMENT_COLOR_CHANNEL0 = 0,
RL_ATTACHMENT_COLOR_CHANNEL1,
RL_ATTACHMENT_COLOR_CHANNEL2,
@ -131,10 +131,10 @@ namespace Raylib_cs
RL_ATTACHMENT_COLOR_CHANNEL7,
RL_ATTACHMENT_DEPTH = 100,
RL_ATTACHMENT_STENCIL = 200,
}
}
public enum FramebufferAttachTextureType
{
public enum FramebufferAttachTextureType
{
RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0,
RL_ATTACHMENT_CUBEMAP_NEGATIVE_X,
RL_ATTACHMENT_CUBEMAP_POSITIVE_Y,
@ -143,13 +143,13 @@ namespace Raylib_cs
RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z,
RL_ATTACHMENT_TEXTURE2D = 100,
RL_ATTACHMENT_RENDERBUFFER = 200,
}
}
/// <summary>
/// Matrix Modes (equivalent to OpenGL)
/// </summary>
public enum MatrixMode
{
/// <summary>
/// Matrix Modes (equivalent to OpenGL)
/// </summary>
public enum MatrixMode
{
/// <summary>
/// GL_MODELVIEW
/// </summary>
@ -164,13 +164,13 @@ namespace Raylib_cs
/// GL_TEXTURE
/// </summary>
TEXTURE = 0x1702
}
}
/// <summary>
/// Primitive assembly draw modes
/// </summary>
public enum DrawMode
{
/// <summary>
/// Primitive assembly draw modes
/// </summary>
public enum DrawMode
{
/// <summary>
/// GL_LINES
/// </summary>
@ -185,13 +185,13 @@ namespace Raylib_cs
/// GL_QUADS
/// </summary>
QUADS = 0x0007
}
}
/// <summary>
/// Texture parameters (equivalent to OpenGL defines)
/// </summary>
public enum TextureFilters
{
/// <summary>
/// Texture parameters (equivalent to OpenGL defines)
/// </summary>
public enum TextureFilters
{
/// <summary>
/// RL_TEXTURE_FILTER_NEAREST
/// <br/>
@ -240,13 +240,13 @@ namespace Raylib_cs
/// Anisotropic filter (custom identifier)
/// </summary>
ANISOTROPIC = 0x3000
}
}
/// <summary>
/// GL Shader type
/// </summary>
public enum ShaderType
{
/// <summary>
/// GL Shader type
/// </summary>
public enum ShaderType
{
/// <summary>
/// RL_FRAGMENT_SHADER
/// <br/>
@ -267,5 +267,4 @@ namespace Raylib_cs
/// GL_COMPUTE_SHADER
/// </summary>
COMPUTE = 0x91b9
}
}

View File

@ -1,13 +1,13 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// RenderTexture2D type, for texture rendering
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct RenderTexture2D
{
/// <summary>
/// RenderTexture2D type, for texture rendering
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct RenderTexture2D
{
/// <summary>
/// OpenGL Framebuffer Object (FBO) id
/// </summary>
@ -22,5 +22,4 @@ namespace Raylib_cs
/// Depth buffer attachment texture
/// </summary>
public Texture2D Depth;
}
}

View File

@ -1,12 +1,12 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Shader location index
/// </summary>
public enum ShaderLocationIndex
{
/// <summary>
/// Shader location index
/// </summary>
public enum ShaderLocationIndex
{
SHADER_LOC_VERTEX_POSITION = 0,
SHADER_LOC_VERTEX_TEXCOORD01,
SHADER_LOC_VERTEX_TEXCOORD02,
@ -36,24 +36,24 @@ namespace Raylib_cs
SHADER_LOC_MAP_DIFFUSE = SHADER_LOC_MAP_ALBEDO,
SHADER_LOC_MAP_SPECULAR = SHADER_LOC_MAP_METALNESS,
}
}
/// <summary>
/// Shader attribute data types
/// </summary>
public enum ShaderAttributeDataType
{
/// <summary>
/// Shader attribute data types
/// </summary>
public enum ShaderAttributeDataType
{
SHADER_ATTRIB_FLOAT = 0,
SHADER_ATTRIB_VEC2,
SHADER_ATTRIB_VEC3,
SHADER_ATTRIB_VEC4
}
}
/// <summary>
/// Shader uniform data type
/// </summary>
public enum ShaderUniformDataType
{
/// <summary>
/// Shader uniform data type
/// </summary>
public enum ShaderUniformDataType
{
SHADER_UNIFORM_FLOAT = 0,
SHADER_UNIFORM_VEC2,
SHADER_UNIFORM_VEC3,
@ -63,14 +63,14 @@ namespace Raylib_cs
SHADER_UNIFORM_IVEC3,
SHADER_UNIFORM_IVEC4,
SHADER_UNIFORM_SAMPLER2D
}
}
/// <summary>
/// Shader type (generic)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Shader
{
/// <summary>
/// Shader type (generic)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Shader
{
/// <summary>
/// Shader program id
/// </summary>
@ -80,5 +80,4 @@ namespace Raylib_cs
/// Shader locations array (MAX_SHADER_LOCATIONS, int *)
/// </summary>
public int* Locs;
}
}

View File

@ -1,14 +1,14 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Texture parameters: filter mode<br/>
/// NOTE 1: Filtering considers mipmaps if available in the texture<br/>
/// NOTE 2: Filter is accordingly set for minification and magnification
/// </summary>
public enum TextureFilter
{
/// <summary>
/// Texture parameters: filter mode<br/>
/// NOTE 1: Filtering considers mipmaps if available in the texture<br/>
/// NOTE 2: Filter is accordingly set for minification and magnification
/// </summary>
public enum TextureFilter
{
/// <summary>
/// No filter, just pixel aproximation
/// </summary>
@ -38,13 +38,13 @@ namespace Raylib_cs
/// Anisotropic filtering 16x
/// </summary>
TEXTURE_FILTER_ANISOTROPIC_16X,
}
}
/// <summary>
/// Texture parameters: wrap mode
/// </summary>
public enum TextureWrap
{
/// <summary>
/// Texture parameters: wrap mode
/// </summary>
public enum TextureWrap
{
/// <summary>
/// Repeats texture in tiled mode
/// </summary>
@ -64,13 +64,13 @@ namespace Raylib_cs
/// Mirrors and clamps to border the texture in tiled mode
/// </summary>
TEXTURE_WRAP_MIRROR_CLAMP
}
}
/// <summary>
/// Cubemap layouts
/// </summary>
public enum CubemapLayout
{
/// <summary>
/// Cubemap layouts
/// </summary>
public enum CubemapLayout
{
/// <summary>
/// Automatically detect layout type
/// </summary>
@ -100,15 +100,15 @@ namespace Raylib_cs
/// Layout is defined by a panorama image (equirectangular map)
/// </summary>
CUBEMAP_LAYOUT_PANORAMA
}
}
/// <summary>
/// Texture2D type<br/>
/// NOTE: Data stored in GPU memory
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Texture2D
{
/// <summary>
/// Texture2D type<br/>
/// NOTE: Data stored in GPU memory
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Texture2D
{
/// <summary>
/// OpenGL texture id
/// </summary>
@ -133,5 +133,4 @@ namespace Raylib_cs
/// Data format (PixelFormat type)
/// </summary>
public PixelFormat Format;
}
}

View File

@ -1,14 +1,14 @@
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Transform, vectex transformation data
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Transform
{
/// <summary>
/// Transform, vectex transformation data
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public partial struct Transform
{
/// <summary>
/// Translation
/// </summary>
@ -23,5 +23,4 @@ namespace Raylib_cs
/// Scale
/// </summary>
public Vector3 Scale;
}
}

View File

@ -1,13 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Converts text to a Ansi buffer for passing to native code
/// </summary>
public readonly ref struct AnsiBuffer
{
/// <summary>
/// Converts text to a Ansi buffer for passing to native code
/// </summary>
public readonly ref struct AnsiBuffer
{
private readonly IntPtr _data;
public AnsiBuffer(string text)
@ -24,13 +24,12 @@ namespace Raylib_cs
{
Marshal.FreeHGlobal(_data);
}
}
}
public static class AnsiStringUtils
{
public static class AnsiStringUtils
{
public static AnsiBuffer ToAnsiBuffer(this string text)
{
return new AnsiBuffer(text);
}
}
}

View File

@ -1,11 +1,11 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
[StructLayout(LayoutKind.Sequential)]
public readonly struct CBool
{
[StructLayout(LayoutKind.Sequential)]
public readonly struct CBool
{
/* The values of booleans in C++ are stored in a single byte, which means it
* only supports values from -128 to 127. It is possible to argument that
* they only support a single bit, yes, but the minimum storage unit of a
@ -20,7 +20,10 @@ namespace Raylib_cs
*
* 'value' is visible and constructable (if necessary), but impossible to modify or access.
*/
public sbyte Value { init; private get; }
public sbyte Value
{
init; private get;
}
// Constructors for easier usage.
public CBool(bool value)
@ -83,5 +86,4 @@ namespace Raylib_cs
{
return ((bool)this).ToString();
}
}
}

View File

@ -1,13 +1,13 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// File path list
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe struct FilePathList
{
/// <summary>
/// File path list
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe struct FilePathList
{
/// <summary>
/// Filepaths max entries
/// </summary>
@ -22,5 +22,4 @@ namespace Raylib_cs
/// Filepaths entries
/// </summary>
public byte** Paths;
}
}

View File

@ -1,14 +1,14 @@
using System;
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Raylib_cs
namespace Raylib_cs;
/// <summary>
/// Converts text to a UTF8 buffer for passing to native code
/// </summary>
public readonly ref struct Utf8Buffer
{
/// <summary>
/// Converts text to a UTF8 buffer for passing to native code
/// </summary>
public readonly ref struct Utf8Buffer
{
private readonly IntPtr _data;
public Utf8Buffer(string text)
@ -25,10 +25,10 @@ namespace Raylib_cs
{
Marshal.ZeroFreeCoTaskMemUTF8(_data);
}
}
}
public static class Utf8StringUtils
{
public static class Utf8StringUtils
{
public static Utf8Buffer ToUtf8Buffer(this string text)
{
return new Utf8Buffer(text);
@ -59,5 +59,4 @@ namespace Raylib_cs
{
return Encoding.UTF8.GetBytes(text);
}
}
}