mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Fixed vector indexed access
This commit is contained in:
@@ -29,6 +29,21 @@ namespace GlitchyEngine.Math
|
||||
}
|
||||
|
||||
public ref float this[int index]
|
||||
{
|
||||
[Checked]
|
||||
get mut
|
||||
{
|
||||
if(index < 0 || index >= Length)
|
||||
Internal.ThrowIndexOutOfRange(1);
|
||||
|
||||
return ref (&X)[index];
|
||||
}
|
||||
|
||||
[Inline]
|
||||
get mut => ref (&X)[index];
|
||||
}
|
||||
|
||||
public float this[int index]
|
||||
{
|
||||
[Checked]
|
||||
get
|
||||
@@ -36,13 +51,41 @@ namespace GlitchyEngine.Math
|
||||
if(index < 0 || index >= Length)
|
||||
Internal.ThrowIndexOutOfRange(1);
|
||||
|
||||
#unwarn
|
||||
return ref (&X)[index];
|
||||
if(index == 0)
|
||||
return X;
|
||||
else
|
||||
return Y;
|
||||
}
|
||||
|
||||
[Inline]
|
||||
#unwarn
|
||||
get => ref (&X)[index];
|
||||
get
|
||||
{
|
||||
if(index == 0)
|
||||
return X;
|
||||
else
|
||||
return Y;
|
||||
}
|
||||
|
||||
[Checked]
|
||||
set mut
|
||||
{
|
||||
if(index < 0 || index >= Length)
|
||||
Internal.ThrowIndexOutOfRange(1);
|
||||
|
||||
if(index == 0)
|
||||
X = value;
|
||||
else
|
||||
Y = value;
|
||||
}
|
||||
|
||||
[Inline]
|
||||
set mut
|
||||
{
|
||||
if(index == 0)
|
||||
X = value;
|
||||
else
|
||||
Y = value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user