1
0
mirror of synced 2024-12-04 20:08:00 +01:00
Switch-Toolbox/Switch_Toolbox_Library/OpenGL/STRectangle.cs
KillzXGaming 871fc44178 More additions.
More progress on the basic pane animation editor. It can add and clear entries for frames, groups, etc.
Add the latest muunt editor files. A wip editor which is currently disabled. Planned to edit object placement paths paths supporting both 2D and 3D views.
2019-10-20 12:57:48 -04:00

47 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Toolbox.Library
{
public class STRectangle
{
public int LeftPoint;
public int RightPoint;
public int TopPoint;
public int BottomPoint;
public STRectangle(float posX, float posY, float width, float height)
{
LeftPoint = (int)(posX - (width / 2));
RightPoint = (int)(posX + (width / 2));
TopPoint = (int)(posY + (height / 2));
BottomPoint = (int)(posY - (height / 2));
}
public STRectangle(int left, int right, int top, int bottom)
{
LeftPoint = left;
RightPoint = right;
TopPoint = top;
BottomPoint = bottom;
}
public bool IsHit(int X, int Y)
{
bool isInBetweenX = (X > LeftPoint) && (X < RightPoint) ||
(X < LeftPoint) && (X > RightPoint);
bool isInBetweenY = (Y > BottomPoint) && (Y < TopPoint) ||
(Y < BottomPoint) && (Y > TopPoint);
if (isInBetweenX && isInBetweenY)
return true;
else
return false;
}
}
}