using System; using OpenTK; using OpenTK.Input; namespace SM.Base.Controls { /// /// Mouse controller /// /// The type of window this controller is connected to. public class Mouse where TWindow : GenericWindow { /// /// The window it is connected to. /// protected TWindow _window; /// /// The current position of the mouse in the screen. /// public Vector2 InScreen { get; private set; } /// /// The current position of the mouse in the screen from 0..1. /// public Vector2 InScreenNormalized { get; private set; } /// /// The constructor /// /// The window, its listen to. protected internal Mouse(TWindow window) { _window = window; } /// /// The event to update the values. /// /// The event args. 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); } } }