mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Beefy2D updates
This commit is contained in:
parent
2a85806580
commit
7db915cb4e
4 changed files with 12 additions and 1 deletions
|
@ -481,6 +481,7 @@ namespace Beefy
|
|||
public static Image GetAnimFrame(Image[] images, float pct)
|
||||
{
|
||||
int frameNum = (int)(images.Count * (pct - 0.000001f));
|
||||
frameNum %= images.Count;
|
||||
return images[frameNum];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,11 @@ namespace Beefy.geom
|
|||
return Vector2((float)Math.Cos(angle) * length, (float)Math.Sin(angle) * length);
|
||||
}
|
||||
|
||||
public static Vector2 operator -(Vector2 vec1)
|
||||
{
|
||||
return Vector2(-vec1.mX, -vec1.mY);
|
||||
}
|
||||
|
||||
public static Vector2 operator +(Vector2 vec1, Vector2 vec2)
|
||||
{
|
||||
return Vector2(vec1.mX + vec2.mX, vec1.mY + vec2.mY);
|
||||
|
|
|
@ -168,6 +168,11 @@ namespace Beefy.gfx
|
|||
return Point(tx + a * point.x + c * point.y, ty + b * point.x + d * point.y);
|
||||
}
|
||||
|
||||
public Vector2 Multiply(Vector2 point)
|
||||
{
|
||||
return Vector2(tx + a * point.mX + c * point.mY, ty + b * point.mX + d * point.mY);
|
||||
}
|
||||
|
||||
public void Invert() mut
|
||||
{
|
||||
float _a = a;
|
||||
|
|
|
@ -633,7 +633,7 @@ namespace Beefy.widgets
|
|||
|
||||
if (targetWidget.mParent == mParent)
|
||||
{
|
||||
mParent.ParentToSelfTranslate(transX, transY, out transX, out transY);
|
||||
targetWidget.ParentToSelfTranslate(transX, transY, out transX, out transY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue