CGFloat.cs 688 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. namespace Veldrid.MetalBindings
  4. {
  5. // TODO: Technically this should be "pointer-sized",
  6. // but there are no non-64-bit platforms that anyone cares about.
  7. public unsafe struct CGFloat
  8. {
  9. private readonly double _value;
  10. public CGFloat(double value)
  11. {
  12. _value = value;
  13. }
  14. public double Value
  15. {
  16. get => _value;
  17. }
  18. public static implicit operator CGFloat(double value) => new CGFloat(value);
  19. public static implicit operator double(CGFloat cgf) => cgf.Value;
  20. public override string ToString() => _value.ToString();
  21. }
  22. }