Focus pr on explicit type and util changes
This commit is contained in:
parent
205e602080
commit
be91fe9120
15 changed files with 18 additions and 856 deletions
|
|
@ -10,7 +10,7 @@ namespace Raylib_cs;
|
|||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct AudioStream
|
||||
{
|
||||
//TODO: convert
|
||||
// TODO: convert
|
||||
/// <summary>
|
||||
/// Pointer to internal data(rAudioBuffer *) used by the audio system
|
||||
/// </summary>
|
||||
|
|
@ -35,73 +35,4 @@ public struct AudioStream
|
|||
/// Number of channels (1-mono, 2-stereo)
|
||||
/// </summary>
|
||||
public uint Channels;
|
||||
|
||||
public readonly CBool IsValid => Raylib.IsAudioStreamValid(this);
|
||||
public readonly CBool IsPlaying => Raylib.IsAudioStreamPlaying(this);
|
||||
public readonly CBool IsProcessed => Raylib.IsAudioStreamProcessed(this);
|
||||
|
||||
public static AudioStream Load(uint sampleRate, uint sampleSize, uint channels)
|
||||
{
|
||||
return Raylib.LoadAudioStream(sampleRate, sampleSize, channels);
|
||||
}
|
||||
|
||||
public readonly void Play()
|
||||
{
|
||||
Raylib.PlayAudioStream(this);
|
||||
}
|
||||
|
||||
public readonly void Pause()
|
||||
{
|
||||
Raylib.PauseAudioStream(this);
|
||||
}
|
||||
|
||||
public readonly void Resume()
|
||||
{
|
||||
Raylib.ResumeAudioStream(this);
|
||||
}
|
||||
|
||||
public unsafe void Update(void* data, int frameCount)
|
||||
{
|
||||
Raylib.UpdateAudioStream(this, data, frameCount);
|
||||
}
|
||||
|
||||
public readonly void Stop()
|
||||
{
|
||||
Raylib.StopAudioStream(this);
|
||||
}
|
||||
|
||||
public static void SetBufferSizeDefault(int size)
|
||||
{
|
||||
Raylib.SetAudioStreamBufferSizeDefault(size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set pan for this audio stream where 0.5 is centered
|
||||
/// </summary>
|
||||
/// <param name="pan"></param>
|
||||
public void SetPan(float pan)
|
||||
{
|
||||
Raylib.SetAudioStreamPan(this, pan);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set pitch for this audio stream where 1.0 si base level
|
||||
/// </summary>
|
||||
public void SetPitch(float pitch)
|
||||
{
|
||||
Raylib.SetAudioStreamPitch(this, pitch);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the volume from 0.0 to 1.0
|
||||
/// </summary>
|
||||
public void SetVolume(float volume)
|
||||
{
|
||||
Raylib.SetAudioStreamVolume(this, volume);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadAudioStream(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,6 @@ public unsafe struct AutomationEvent
|
|||
|
||||
/// <summary>Event parameters (if required)</summary>
|
||||
public fixed int Params[4];
|
||||
|
||||
public readonly void Play()
|
||||
{
|
||||
Raylib.PlayAutomationEvent(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Automation event list</summary>
|
||||
|
|
@ -37,20 +32,4 @@ public unsafe struct AutomationEventList
|
|||
|
||||
/// <inheritdoc cref="Events"/>
|
||||
public readonly ReadOnlySpan<AutomationEvent> EventsAsSpan => new ReadOnlySpan<AutomationEvent>(Events, (int)Count);
|
||||
|
||||
public static AutomationEventList Load(string fileName)
|
||||
{
|
||||
return Raylib.LoadAutomationEventList(fileName);
|
||||
}
|
||||
|
||||
public readonly CBool Export(string fileName)
|
||||
{
|
||||
return Raylib.ExportAutomationEventList(this, fileName);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadAutomationEventList(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,8 +90,4 @@ public unsafe struct Font
|
|||
/// Glyphs info data
|
||||
/// </summary>
|
||||
public GlyphInfo* Glyphs;
|
||||
|
||||
public readonly CBool IsValid => Raylib.IsFontValid(this);
|
||||
|
||||
public static Font Default => Raylib.GetFontDefault();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,121 +165,4 @@ public unsafe struct Image
|
|||
/// Get width and height packed in a Vector2
|
||||
/// </summary>
|
||||
public readonly Vector2 Dimensions => new Vector2(Width, Height);
|
||||
public readonly CBool IsValid => Raylib.IsImageValid(this);
|
||||
|
||||
public static Image Load(string fileName)
|
||||
{
|
||||
return Raylib.LoadImage(fileName);
|
||||
}
|
||||
|
||||
public static Image LoadAnim(string fileName, out int frames)
|
||||
{
|
||||
return Raylib.LoadImageAnim(fileName, out frames);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an image from text using the default font
|
||||
/// </summary>
|
||||
public static Image CreateFromText(string text, int fontSize, Color color)
|
||||
{
|
||||
return Raylib.ImageText(text, fontSize, color);
|
||||
}
|
||||
|
||||
public static Image CreateFromText(Font font, string text, int fontSize, float spacing, Color color)
|
||||
{
|
||||
return Raylib.ImageTextEx(font, text, fontSize, spacing, color);
|
||||
}
|
||||
|
||||
public static Image LoadFromMemory(string fileType, byte[] data)
|
||||
{
|
||||
return Raylib.LoadImageFromMemory(fileType, data);
|
||||
}
|
||||
|
||||
public static Image LoadFromTexture(Texture2D texture)
|
||||
{
|
||||
return Raylib.LoadImageFromTexture(texture);
|
||||
}
|
||||
|
||||
public static Image LoadRaw(string fileName, int width, int height, PixelFormat format, int headerSize)
|
||||
{
|
||||
return Raylib.LoadImageRaw(fileName, width, height, format, headerSize);
|
||||
}
|
||||
|
||||
public readonly void Unload()
|
||||
{
|
||||
Raylib.UnloadImage(this);
|
||||
}
|
||||
|
||||
public readonly unsafe Color[] GetPalette(int maxPaletteSize)
|
||||
{
|
||||
int colorCount = 0;
|
||||
Color* colors = Raylib.LoadImagePalette(this, maxPaletteSize, &colorCount);
|
||||
Color[] palette = new Color[colorCount];
|
||||
for (int i = 0; i < colorCount; i++)
|
||||
{
|
||||
palette[i] = colors[i];
|
||||
}
|
||||
Raylib.UnloadImagePalette(colors);
|
||||
return palette;
|
||||
}
|
||||
|
||||
public static Image LoadFromScreen()
|
||||
{
|
||||
return Raylib.LoadImageFromScreen();
|
||||
}
|
||||
|
||||
public void DrawLine(Vector2 start, Vector2 end, Color color)
|
||||
{
|
||||
Raylib.ImageDrawLineV(ref this, start, end, color);
|
||||
}
|
||||
|
||||
public void DrawLine(Vector2 start, Vector2 end, int thickness, Color color)
|
||||
{
|
||||
Raylib.ImageDrawLineEx(ref this, start, end, thickness, color);
|
||||
}
|
||||
|
||||
public void DrawCircle(Vector2 position, float radius, Color color)
|
||||
{
|
||||
Raylib.ImageDrawCircle(ref this, (int)position.X, (int)position.Y, (int)radius, color);
|
||||
}
|
||||
|
||||
public void DrawRectangle(Rectangle rectangle, Color color)
|
||||
{
|
||||
Raylib.ImageDrawRectangleRec(ref this, rectangle, color);
|
||||
}
|
||||
|
||||
public void DrawText(string text, Vector2 position, int fontSize, Color color)
|
||||
{
|
||||
Raylib.ImageDrawText(ref this, text, (int)position.X, (int)position.Y, fontSize, color);
|
||||
}
|
||||
|
||||
public void DrawText(Font font, string text, Vector2 position, int fontSize, float spacing, Color color)
|
||||
{
|
||||
Raylib.ImageDrawTextEx(ref this, font, text, position, fontSize, spacing, color);
|
||||
}
|
||||
|
||||
public unsafe void DrawCircleLines(Vector2 position, float radius, Color color)
|
||||
{
|
||||
Raylib.ImageDrawCircleLinesV(ref this, position, (int)radius, color);
|
||||
}
|
||||
|
||||
public void DrawTriangle(Vector2 p1, Vector2 p2, Vector2 p3, Color color)
|
||||
{
|
||||
Raylib.ImageDrawTriangle(ref this, p1, p2, p3, color);
|
||||
}
|
||||
|
||||
public void DrawTriangle(Vector2 p1, Vector2 p2, Vector2 p3, Color c1, Color c2, Color c3)
|
||||
{
|
||||
Raylib.ImageDrawTriangleEx(ref this, p1, p2, p3, c1, c2, c3);
|
||||
}
|
||||
|
||||
public void DrawRectangleLines(Rectangle rectangle, Color color)
|
||||
{
|
||||
Raylib.ImageDrawRectangleLines(ref this, rectangle, 1, color);
|
||||
}
|
||||
|
||||
public void DrawRectangleLines(Rectangle rectangle, int thickness, Color color)
|
||||
{
|
||||
Raylib.ImageDrawRectangleLines(ref this, rectangle, thickness, color);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public unsafe struct Material
|
|||
/// </summary>
|
||||
public Shader Shader;
|
||||
|
||||
//TODO: convert
|
||||
// TODO: convert
|
||||
/// <summary>
|
||||
/// Material maps
|
||||
/// </summary>
|
||||
|
|
@ -87,55 +87,4 @@ public unsafe struct Material
|
|||
/// Material generic parameters (if required)
|
||||
/// </summary>
|
||||
public fixed float Param[4];
|
||||
|
||||
public readonly CBool IsValid => Raylib.IsMaterialValid(this);
|
||||
|
||||
/// <summary>
|
||||
/// Load default material
|
||||
/// </summary>
|
||||
public static Material Load()
|
||||
{
|
||||
return Raylib.LoadMaterialDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load materials from model file
|
||||
/// </summary>
|
||||
public static Material[] Load(string fileName)
|
||||
{
|
||||
using AnsiBuffer buffer = fileName.ToAnsiBuffer();
|
||||
int count = 0;
|
||||
Material* materials = Raylib.LoadMaterials(buffer.AsPointer(), &count);
|
||||
Material[] output = new Material[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
output[i] = materials[i];
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static Material GetMaterial(ref Model model, int materialIndex)
|
||||
{
|
||||
return Raylib.GetMaterial(ref model, materialIndex);
|
||||
}
|
||||
|
||||
public static Texture2D GetTexture(ref Model model, int materialIndex, MaterialMapIndex mapIndex)
|
||||
{
|
||||
return Raylib.GetMaterialTexture(ref model, materialIndex, mapIndex);
|
||||
}
|
||||
|
||||
public void SetTexture(MaterialMapIndex mapIndex, Texture2D texture)
|
||||
{
|
||||
Raylib.SetMaterialTexture(ref this, mapIndex, texture);
|
||||
}
|
||||
|
||||
public static void SetShader(ref Model model, int materialIndex, ref Shader shader)
|
||||
{
|
||||
Raylib.SetMaterialShader(ref model, materialIndex, ref shader);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadMaterial(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,36 +30,6 @@ public unsafe struct Mesh
|
|||
/// </summary>
|
||||
public int TriangleCount;
|
||||
|
||||
public readonly void Draw(Material material, Matrix4x4 transform)
|
||||
{
|
||||
Raylib.DrawMesh(this, material, transform);
|
||||
}
|
||||
|
||||
public readonly void DrawInstanced(Material material, Matrix4x4[] transforms, int instances)
|
||||
{
|
||||
Raylib.DrawMeshInstanced(this, material, transforms, instances);
|
||||
}
|
||||
|
||||
public readonly void Export(string fileName)
|
||||
{
|
||||
Raylib.ExportMesh(this, fileName);
|
||||
}
|
||||
|
||||
public readonly void ExportAsCode(string fileName)
|
||||
{
|
||||
Raylib.ExportMeshAsCode(this, fileName);
|
||||
}
|
||||
|
||||
public void Upload(CBool dynamic)
|
||||
{
|
||||
Raylib.UploadMesh(ref this, dynamic);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadMesh(this);
|
||||
}
|
||||
|
||||
#region Default vertex data
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -73,98 +73,6 @@ public unsafe struct Model
|
|||
/// Bones base transformation (pose, Transform *)
|
||||
/// </summary>
|
||||
public Transform* BindPose;
|
||||
|
||||
public readonly CBool IsValid => Raylib.IsModelValid(this);
|
||||
|
||||
public static Model Load(string fileName)
|
||||
{
|
||||
return Raylib.LoadModel(fileName);
|
||||
}
|
||||
|
||||
public static Model LoadFromMesh(Mesh mesh)
|
||||
{
|
||||
return Raylib.LoadModelFromMesh(mesh);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector3 position)
|
||||
{
|
||||
Raylib.DrawModel(this, position, 1.0f, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector3 position, float scale)
|
||||
{
|
||||
Raylib.DrawModel(this, position, scale, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector3 position, float scale, Color color)
|
||||
{
|
||||
Raylib.DrawModel(this, position, scale, color);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector3 position, Vector3 rotationAxis, float rotationAngle)
|
||||
{
|
||||
Raylib.DrawModelEx(this, position, rotationAxis, rotationAngle, Vector3.One, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale)
|
||||
{
|
||||
Raylib.DrawModelEx(this, position, rotationAxis, rotationAngle, scale, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color color)
|
||||
{
|
||||
Raylib.DrawModelEx(this, position, rotationAxis, rotationAngle, scale, color);
|
||||
}
|
||||
|
||||
public readonly void DrawWires(Vector3 position, Color color)
|
||||
{
|
||||
Raylib.DrawModelWires(this, position, 1.0f, color);
|
||||
}
|
||||
|
||||
public readonly void DrawWires(Vector3 position, float scale)
|
||||
{
|
||||
Raylib.DrawModelWires(this, position, scale, Color.White);
|
||||
}
|
||||
|
||||
public readonly void DrawWires(Vector3 position, float scale, Color color)
|
||||
{
|
||||
Raylib.DrawModelWires(this, position, scale, color);
|
||||
}
|
||||
|
||||
public readonly void DrawWires(Vector3 position, Vector3 rotationAxis, float rotationAngle, Color color)
|
||||
{
|
||||
Raylib.DrawModelWiresEx(this, position, rotationAxis, rotationAngle, Vector3.One, color);
|
||||
}
|
||||
|
||||
public readonly void DrawWires(Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color color)
|
||||
{
|
||||
Raylib.DrawModelWiresEx(this, position, rotationAxis, rotationAngle, scale, color);
|
||||
}
|
||||
|
||||
public readonly void DrawPoints(Vector3 position, Color color)
|
||||
{
|
||||
Raylib.DrawModelPoints(this, position, 1.0f, color);
|
||||
}
|
||||
|
||||
public readonly void DrawPoints(Vector3 position, float scale, Color color)
|
||||
{
|
||||
Raylib.DrawModelPoints(this, position, scale, color);
|
||||
}
|
||||
|
||||
public readonly void DrawPoints(Vector3 position, Vector3 rotationAxis, float rotationAngle, Color color)
|
||||
{
|
||||
Raylib.DrawModelPointsEx(this, position, rotationAxis, rotationAngle, Vector3.One, color);
|
||||
}
|
||||
|
||||
public readonly void DrawPoints(Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color color)
|
||||
{
|
||||
Raylib.DrawModelPointsEx(this, position, rotationAxis, rotationAngle, scale, color);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadModel(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -223,31 +131,6 @@ public unsafe struct ModelAnimation
|
|||
this._boneCount = boneCount;
|
||||
}
|
||||
}
|
||||
|
||||
public static ModelAnimation[] LoadAnimations(string fileName)
|
||||
{
|
||||
int count = 0;
|
||||
ModelAnimation* animations = Raylib.LoadModelAnimations(fileName, ref count);
|
||||
ModelAnimation[] output = new ModelAnimation[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
output[i] = animations[i];
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static void UnloadAnimations(ModelAnimation[] modelAnimations)
|
||||
{
|
||||
fixed (ModelAnimation* ptr = modelAnimations)
|
||||
{
|
||||
Raylib.UnloadModelAnimations(ptr, modelAnimations.Length);
|
||||
}
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadModelAnimation(this);
|
||||
}
|
||||
}
|
||||
|
||||
public readonly unsafe struct FramePoses
|
||||
|
|
|
|||
|
|
@ -29,73 +29,9 @@ public unsafe struct Music
|
|||
/// </summary>
|
||||
public int CtxType;
|
||||
|
||||
//TODO span
|
||||
// TODO span
|
||||
/// <summary>
|
||||
/// Audio context data, depends on type
|
||||
/// </summary>
|
||||
public void* CtxData;
|
||||
|
||||
public readonly CBool IsValid => Raylib.IsMusicValid(this);
|
||||
|
||||
public static Music Load(string fileName)
|
||||
{
|
||||
return Raylib.LoadMusicStream(fileName);
|
||||
}
|
||||
|
||||
public readonly void Play()
|
||||
{
|
||||
Raylib.PlayMusicStream(this);
|
||||
}
|
||||
|
||||
public readonly void Pause()
|
||||
{
|
||||
Raylib.PauseMusicStream(this);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Raylib.UpdateMusicStream(this);
|
||||
}
|
||||
|
||||
public readonly void Stop()
|
||||
{
|
||||
Raylib.StopMusicStream(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set pan of this music where 0.5 is centered
|
||||
/// </summary>
|
||||
public void SetPan(float pan)
|
||||
{
|
||||
Raylib.SetMusicPan(this, pan);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set pitch for this music where 1.0 is base level
|
||||
/// </summary>}
|
||||
public void SetPitch(float pitch)
|
||||
{
|
||||
Raylib.SetMusicPitch(this, pitch);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set music volume from 0.0 to 1.0
|
||||
/// </summary>
|
||||
public void SetVolume(float volume)
|
||||
{
|
||||
Raylib.SetMusicVolume(this, volume);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Seek music to a position (in seconds)
|
||||
/// </summary>
|
||||
public void Seek(float position)
|
||||
{
|
||||
Raylib.SeekMusicStream(this, position);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadMusicStream(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,24 +14,6 @@ public struct Rectangle
|
|||
public float Width;
|
||||
public float Height;
|
||||
|
||||
public static Rectangle Grow(Rectangle rec, float growth)
|
||||
{
|
||||
rec.X -= growth;
|
||||
rec.Y -= growth;
|
||||
rec.Width += growth * 2.0f;
|
||||
rec.Height += growth * 2.0f;
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static Rectangle Shrink(Rectangle rec, float shrink)
|
||||
{
|
||||
rec.X += shrink;
|
||||
rec.Y += shrink;
|
||||
rec.Width-= shrink * 2.0f;
|
||||
rec.Height -= shrink * 2.0f;
|
||||
return rec;
|
||||
}
|
||||
|
||||
public Rectangle(float x, float y, float width, float height)
|
||||
{
|
||||
this.X = x;
|
||||
|
|
@ -101,21 +83,6 @@ public struct Rectangle
|
|||
}
|
||||
}
|
||||
|
||||
public readonly void Draw(Color color)
|
||||
{
|
||||
Raylib.DrawRectangleRec(this, color);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector2 origin, Color color)
|
||||
{
|
||||
Draw(origin, 0.0f, color);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector2 origin, float rotation, Color color)
|
||||
{
|
||||
Raylib.DrawRectanglePro(this, origin, rotation, color);
|
||||
}
|
||||
|
||||
public readonly void GetIntegerValues(out int x, out int y, out int width, out int height)
|
||||
{
|
||||
x = (int)this.X;
|
||||
|
|
@ -124,92 +91,20 @@ public struct Rectangle
|
|||
height = (int)this.Height;
|
||||
}
|
||||
|
||||
public readonly void DrawLines(Color color)
|
||||
{
|
||||
GetIntegerValues(out int x, out int y, out int w, out int h);
|
||||
Raylib.DrawRectangleLines(x, y, w, h, color);
|
||||
}
|
||||
|
||||
public readonly void DrawLines(float thickness, Color color)
|
||||
{
|
||||
Raylib.DrawRectangleLinesEx(this, thickness, color);
|
||||
}
|
||||
|
||||
public readonly void DrawGradient(Color topLeft, Color bottomLeft, Color topRight, Color bottomRight)
|
||||
{
|
||||
Raylib.DrawRectangleGradientEx(this, topLeft, bottomLeft, topRight, bottomRight);
|
||||
}
|
||||
|
||||
public readonly void DrawGradientV(Color top, Color bottom)
|
||||
{
|
||||
GetIntegerValues(out int x, out int y, out int w, out int h);
|
||||
Raylib.DrawRectangleGradientV(x, y, w, h, top, bottom);
|
||||
}
|
||||
|
||||
public readonly void DrawGradientH(Color left, Color right)
|
||||
{
|
||||
GetIntegerValues(out int x, out int y, out int w, out int h);
|
||||
Raylib.DrawRectangleGradientH(x, y, w, h, left, right);
|
||||
}
|
||||
|
||||
public readonly void DrawRounded(float roundness, Color color)
|
||||
{
|
||||
Raylib.DrawRectangleRounded(this, roundness, 10, color);
|
||||
}
|
||||
|
||||
public readonly void DrawRounded(float roundness, int segments, Color color)
|
||||
{
|
||||
Raylib.DrawRectangleRounded(this, roundness, segments, color);
|
||||
}
|
||||
|
||||
public readonly void DrawRoundedLines(float roundness, Color color)
|
||||
{
|
||||
Raylib.DrawRectangleRoundedLines(this, roundness, 10, color);
|
||||
}
|
||||
|
||||
public readonly void DrawRoundedLines(float roundness, int segments, Color color)
|
||||
{
|
||||
Raylib.DrawRectangleRoundedLines(this, roundness, segments, color);
|
||||
}
|
||||
|
||||
public readonly void DrawRoundedLines(float roundness, float thickness, Color color)
|
||||
{
|
||||
Raylib.DrawRectangleRoundedLinesEx(this, roundness, 10, thickness, color);
|
||||
}
|
||||
|
||||
public readonly void DrawRoundedLines(float roundness, int segments, float thickness, Color color)
|
||||
{
|
||||
Raylib.DrawRectangleRoundedLinesEx(this, roundness, segments, thickness, color);
|
||||
}
|
||||
|
||||
public readonly CBool CheckCollisionRec(Rectangle rectangle)
|
||||
{
|
||||
return Raylib.CheckCollisionRecs(this, rectangle);
|
||||
}
|
||||
|
||||
public readonly CBool CheckCollisionPoint(Vector2 point)
|
||||
{
|
||||
return Raylib.CheckCollisionPointRec(point, this);
|
||||
}
|
||||
|
||||
public readonly CBool CheckCollisionCircle(Vector2 center, float radius)
|
||||
{
|
||||
return Raylib.CheckCollisionCircleRec(center, radius, this);
|
||||
}
|
||||
|
||||
public readonly Rectangle GetCollisionRectangle(Rectangle rectangle2)
|
||||
{
|
||||
return Raylib.GetCollisionRec(this, rectangle2);
|
||||
}
|
||||
|
||||
public void Grow(float growth)
|
||||
{
|
||||
this = Rectangle.Grow(this, growth);
|
||||
X -= growth;
|
||||
Y -= growth;
|
||||
Width += growth * 2.0f;
|
||||
Height += growth * 2.0f;
|
||||
}
|
||||
|
||||
public void Shrink(float shrink)
|
||||
{
|
||||
this = Rectangle.Shrink(this, shrink);
|
||||
X += shrink;
|
||||
Y += shrink;
|
||||
Width -= shrink * 2.0f;
|
||||
Height -= shrink * 2.0f;
|
||||
}
|
||||
|
||||
public readonly override string ToString()
|
||||
|
|
|
|||
|
|
@ -22,16 +22,4 @@ public struct RenderTexture2D
|
|||
/// Depth buffer attachment texture
|
||||
/// </summary>
|
||||
public Texture2D Depth;
|
||||
|
||||
public readonly CBool IsValid => Raylib.IsRenderTextureValid(this);
|
||||
|
||||
public static RenderTexture2D Load(int width, int height)
|
||||
{
|
||||
return Raylib.LoadRenderTexture(width, height);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadRenderTexture(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,46 +87,4 @@ public unsafe struct Shader
|
|||
/// Shader locations array (MAX_SHADER_LOCATIONS, int *)
|
||||
/// </summary>
|
||||
public int* Locs;
|
||||
|
||||
public readonly CBool IsValid => Raylib.IsShaderValid(this);
|
||||
|
||||
public static Shader Load(string vsFileName, string fsFileName)
|
||||
{
|
||||
return Raylib.LoadShader(vsFileName, fsFileName);
|
||||
}
|
||||
|
||||
public static Shader LoadFromMemory(string vsCode, string fsCode)
|
||||
{
|
||||
return Raylib.LoadShaderFromMemory(vsCode, fsCode);
|
||||
}
|
||||
|
||||
public void GetLocationAttrib(string attribName)
|
||||
{
|
||||
Raylib.GetShaderLocationAttrib(this, attribName);
|
||||
}
|
||||
|
||||
public void SetValue<T>(int locationIndex, T value, ShaderUniformDataType uniformDataType) where T : unmanaged
|
||||
{
|
||||
Raylib.SetShaderValue(this, locationIndex, &value, uniformDataType);
|
||||
}
|
||||
|
||||
public void SetValues<T>(int locationIndex, T[] values, ShaderUniformDataType uniformDataType) where T : unmanaged
|
||||
{
|
||||
Raylib.SetShaderValueV(this, locationIndex, values, uniformDataType, values.Length);
|
||||
}
|
||||
|
||||
public void SetTexture(int locationIndex, Texture2D texture)
|
||||
{
|
||||
Raylib.SetShaderValueTexture(this, locationIndex, texture);
|
||||
}
|
||||
|
||||
public void SetMatrix(int locationIndex, System.Numerics.Matrix4x4 matrix)
|
||||
{
|
||||
Raylib.SetShaderValueMatrix(this, locationIndex, matrix);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadShader(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,61 +17,4 @@ public struct Sound
|
|||
/// Total number of frames (considering channels)
|
||||
/// </summary>
|
||||
public uint FrameCount;
|
||||
|
||||
public readonly CBool IsValid => Raylib.IsSoundValid(this);
|
||||
public readonly CBool IsPlaying => Raylib.IsSoundPlaying(this);
|
||||
|
||||
public static Sound Load(string fileName)
|
||||
{
|
||||
return Raylib.LoadSound(fileName);
|
||||
}
|
||||
|
||||
public static Sound LoadFromWave(Wave wave)
|
||||
{
|
||||
return Raylib.LoadSoundFromWave(wave);
|
||||
}
|
||||
|
||||
public readonly void Play()
|
||||
{
|
||||
Raylib.PlaySound(this);
|
||||
}
|
||||
|
||||
public readonly void Pause()
|
||||
{
|
||||
Raylib.PauseSound(this);
|
||||
}
|
||||
|
||||
public readonly void Resume()
|
||||
{
|
||||
Raylib.ResumeSound(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set pan where 0.5 is center
|
||||
/// </summary>
|
||||
public void SetPan(float pan)
|
||||
{
|
||||
Raylib.SetSoundPan(this, pan);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set pitch where 1.0 is base level
|
||||
/// </summary>
|
||||
public void SetPitch(float pitch)
|
||||
{
|
||||
Raylib.SetSoundPitch(this, pitch);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set volume from 0.0 to 1.0
|
||||
/// </summary>
|
||||
public void SetVolume(float volume)
|
||||
{
|
||||
Raylib.SetSoundVolume(this, volume);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadSound(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,123 +134,4 @@ public struct Texture2D
|
|||
/// Get width and height packed in a Vector2
|
||||
/// </summary>
|
||||
public readonly Vector2 Dimensions => new Vector2(Width, Height);
|
||||
public readonly CBool IsValid => Raylib.IsTextureValid(this);
|
||||
|
||||
public static Texture2D Load(string fileName)
|
||||
{
|
||||
return Raylib.LoadTexture(fileName);
|
||||
}
|
||||
|
||||
public static Texture2D LoadFromImage(Image image)
|
||||
{
|
||||
return Raylib.LoadTextureFromImage(image);
|
||||
}
|
||||
|
||||
public static Texture2D LoadFromMemory(string fileType, byte[] fileData)
|
||||
{
|
||||
Image img = Raylib.LoadImageFromMemory(fileType, fileData);
|
||||
Texture2D texture = Raylib.LoadTextureFromImage(img);
|
||||
Raylib.UnloadImage(img);
|
||||
return texture;
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadTexture(this);
|
||||
}
|
||||
|
||||
public void SetFilter(TextureFilter filter)
|
||||
{
|
||||
Raylib.SetTextureFilter(this, filter);
|
||||
}
|
||||
|
||||
public void SetWrap(TextureWrap wrap)
|
||||
{
|
||||
Raylib.SetTextureWrap(this, wrap);
|
||||
}
|
||||
|
||||
public void Update<T>(T[] pixels) where T : unmanaged
|
||||
{
|
||||
Raylib.UpdateTexture(this, pixels);
|
||||
}
|
||||
|
||||
public readonly void Draw(int x, int y)
|
||||
{
|
||||
Raylib.DrawTexture(this, x, y, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(int x, int y, Color color)
|
||||
{
|
||||
Raylib.DrawTexture(this, x, y, color);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector2 position)
|
||||
{
|
||||
Raylib.DrawTextureV(this, position, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector2 position, Color color)
|
||||
{
|
||||
Raylib.DrawTextureV(this, position, color);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector2 position, Vector2 origin)
|
||||
{
|
||||
Vector2 size = this.Dimensions;
|
||||
Rectangle source = new Rectangle(Vector2.Zero, size);
|
||||
Rectangle target = new Rectangle(position, size);
|
||||
Raylib.DrawTexturePro(this, source, target, origin, 0, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector2 position, Vector2 origin, Color color)
|
||||
{
|
||||
Vector2 size = this.Dimensions;
|
||||
Rectangle source = new Rectangle(Vector2.Zero, size);
|
||||
Rectangle target = new Rectangle(position, size);
|
||||
Raylib.DrawTexturePro(this, source, target, origin, 0, color);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector2 position, float rotation, float scale)
|
||||
{
|
||||
Raylib.DrawTextureEx(this, position, rotation, scale, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector2 position, float rotation, float scale, Color color)
|
||||
{
|
||||
Raylib.DrawTextureEx(this, position, rotation, scale, color);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector2 position, float rotation, Vector2 scale)
|
||||
{
|
||||
Draw(position, rotation, scale, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Vector2 position, float rotation, Vector2 scale, Color color)
|
||||
{
|
||||
Vector2 size = this.Dimensions;
|
||||
Rectangle source = new Rectangle(Vector2.Zero, size);
|
||||
Rectangle target = new Rectangle(position, size);
|
||||
target.Size *= scale;
|
||||
Raylib.DrawTexturePro(this, source, target, Vector2.Zero, rotation, color);
|
||||
}
|
||||
|
||||
public readonly void Draw(Rectangle source, Rectangle dest)
|
||||
{
|
||||
Raylib.DrawTexturePro(this, source, dest, Vector2.Zero, 0, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Rectangle source, Rectangle dest, Vector2 origin)
|
||||
{
|
||||
Raylib.DrawTexturePro(this, source, dest, origin, 0, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Rectangle source, Rectangle dest, Vector2 origin, float rotation)
|
||||
{
|
||||
Raylib.DrawTexturePro(this, source, dest, origin, rotation, Color.White);
|
||||
}
|
||||
|
||||
public readonly void Draw(Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color color)
|
||||
{
|
||||
Raylib.DrawTexturePro(this, source, dest, origin, rotation, color);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,41 +28,9 @@ public unsafe struct Wave
|
|||
/// </summary>
|
||||
public uint Channels;
|
||||
|
||||
//TODO: SPAN<byte> ?
|
||||
// TODO: SPAN<byte>?
|
||||
/// <summary>
|
||||
/// Buffer data pointer
|
||||
/// </summary>
|
||||
public void* Data;
|
||||
|
||||
public readonly CBool IsValid => Raylib.IsWaveValid(this);
|
||||
|
||||
public static Wave Load(string fileName)
|
||||
{
|
||||
return Raylib.LoadWave(fileName);
|
||||
}
|
||||
|
||||
public CBool Export(string fileName)
|
||||
{
|
||||
return Raylib.ExportWave(this, fileName);
|
||||
}
|
||||
|
||||
public CBool ExportAsCode(string fileName)
|
||||
{
|
||||
return Raylib.ExportWaveAsCode(this, fileName);
|
||||
}
|
||||
|
||||
public void Format(int sampleRate, int sampleSize, int channels)
|
||||
{
|
||||
Raylib.WaveFormat(ref this, sampleRate, sampleSize, channels);
|
||||
}
|
||||
|
||||
public void Crop(int initFrame, int finalFrame)
|
||||
{
|
||||
Raylib.WaveCrop(ref this, initFrame, finalFrame);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
Raylib.UnloadWave(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue