Files
Dashboard/Dashboard/Mouse.cs
H. Utku Maden a1f4e6a4dc Rename from QUIK to Dashboard
Due to unforseen naming conflicts, the project has been rebranded under the ReFuel
umbrealla and will now be referred to as Dashboard from now on. Other changes will
occur to suit the library more for the engine whilst keeping the freestanding
nature of the library.

Rename folder.

Rename to Dashboard.OpenTK

Rename to Dashboard.Media.Defaults.

Do the last renames and path fixes.
2024-07-17 23:26:58 +03:00

74 lines
1.9 KiB
C#

using System;
namespace Dashboard
{
public enum MouseButton : byte
{
Primary = 1 << 0,
Secondary = 1 << 1,
Tertiary = 1 << 2,
Auxilliary1 = 1 << 3,
Auxilliary2 = 1 << 4,
Auxilliary3 = 1 << 5,
Auxilliary4 = 1 << 6,
Auxilliary5 = 1 << 7,
}
public struct MouseState
{
public readonly QVec2 AbsolutePosition;
public readonly MouseButton ButtonsDown;
public MouseState(QVec2 position, MouseButton down)
{
AbsolutePosition = position;
ButtonsDown = down;
}
}
public class MouseButtonEventArgs : EventArgs
{
public QVec2 AbsolutePosition { get; }
public MouseButton Buttons { get; }
public MouseButtonEventArgs(QVec2 position, MouseButton buttons)
{
AbsolutePosition = position;
Buttons = buttons;
}
public QVec2 RelativePosition(QVec2 origin)
{
return AbsolutePosition - origin;
}
// public QVec2 RelativePosition(Controls.Control control)
// {
// return AbsolutePosition - control.AbsoluteBounds.Min;
// }
}
public class MouseMoveEventArgs : EventArgs
{
public QVec2 AbsolutePosition { get; }
public QVec2 LastPosition { get; }
public QVec2 Motion { get; }
public MouseMoveEventArgs(QVec2 position, QVec2 lastPosition)
{
AbsolutePosition = position;
LastPosition = lastPosition;
Motion = position - lastPosition;
}
public QVec2 RelativePosition(QVec2 origin)
{
return AbsolutePosition - origin;
}
// public QVec2 RelativePosition(Controls.Control control)
// {
// return AbsolutePosition - control.AbsoluteBounds.Min;
// }
}
}