30.09.2020

+ Mouse support
+ Started to add summaries to SM.Base
This commit is contained in:
Michel Fedde 2020-09-30 21:26:42 +02:00
parent 16366fa015
commit 7acdba92f8
21 changed files with 325 additions and 58 deletions

View file

@ -0,0 +1,39 @@
using System;
using OpenTK;
using OpenTK.Input;
namespace SM.Base.Controls
{
/// <summary>
/// Mouse controller
/// </summary>
/// <typeparam name="TWindow">The type of window this controller is connected to.</typeparam>
public class Mouse<TWindow>
where TWindow : GenericWindow
{
/// <summary>
/// The window it is connected to.
/// </summary>
protected TWindow _window;
/// <summary>
/// The current position of the mouse in the screen.
/// </summary>
public Vector2 InScreen { get; private set; }
/// <summary>
/// The current position of the mouse in the screen from 0..1.
/// </summary>
public Vector2 InScreenNormalized { get; private set; }
protected internal Mouse(TWindow window)
{
_window = window;
}
protected void MouseMoveEvent(MouseMoveEventArgs mmea)
{
InScreen = new Vector2(mmea.X, mmea.Y);
InScreenNormalized = new Vector2(mmea.X / (float)_window.Width, mmea.Y / (float)_window.Height);
}
}
}