Split CBool from utils
This commit is contained in:
parent
cfef858a0f
commit
fb6c60cfc2
1 changed files with 30 additions and 0 deletions
30
Raylib-cs/types/native/CBool.cs
Normal file
30
Raylib-cs/types/native/CBool.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Raylib_cs;
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public readonly struct CBool
|
||||||
|
{
|
||||||
|
private readonly byte value;
|
||||||
|
|
||||||
|
private CBool(bool value)
|
||||||
|
{
|
||||||
|
this.value = Convert.ToByte(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator CBool(bool value)
|
||||||
|
{
|
||||||
|
return new CBool(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator bool(CBool x)
|
||||||
|
{
|
||||||
|
return Convert.ToBoolean(x.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Convert.ToBoolean(value).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue