Added missing summeries #1
This commit is contained in:
parent
03d99ea28e
commit
8665b5b709
104 changed files with 1165 additions and 821 deletions
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Documents;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
using SM.Base.Windows;
|
||||
using SM.Base.Window;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -14,7 +13,6 @@ namespace SM.Base.Controls
|
|||
/// <summary>
|
||||
/// Mouse controller
|
||||
/// </summary>
|
||||
/// <typeparam name="TWindow">The type of window this controller is connected to.</typeparam>
|
||||
public class Mouse
|
||||
{
|
||||
internal static MouseState? _mouseState;
|
||||
|
|
@ -37,7 +35,7 @@ namespace SM.Base.Controls
|
|||
internal static void MouseMoveEvent(MouseMoveEventArgs mmea, IGenericWindow window)
|
||||
{
|
||||
InScreen = new Vector2(mmea.X, mmea.Y);
|
||||
InScreenNormalized = new Vector2(mmea.X / (float)window.Width, mmea.Y / (float)window.Height);
|
||||
InScreenNormalized = new Vector2(mmea.X / (float) window.Width, mmea.Y / (float) window.Height);
|
||||
}
|
||||
|
||||
internal static void SetState()
|
||||
|
|
@ -47,19 +45,21 @@ namespace SM.Base.Controls
|
|||
_lastButtonsPressed = new List<MouseButton>();
|
||||
|
||||
foreach (object o in Enum.GetValues(typeof(MouseButton)))
|
||||
{
|
||||
if (_mouseState.Value[(MouseButton)o]) _lastButtonsPressed.Add((MouseButton)o);
|
||||
}
|
||||
if (_mouseState.Value[(MouseButton) o])
|
||||
_lastButtonsPressed.Add((MouseButton) o);
|
||||
}
|
||||
|
||||
_mouseState = OpenTK.Input.Mouse.GetState();
|
||||
|
||||
}
|
||||
|
||||
public static bool IsDown(MouseButton button, bool once = false) => _mouseState?[button] == true && !(once && _lastButtonsPressed.Contains(button));
|
||||
|
||||
public static bool IsUp(MouseButton button, bool once = false) =>
|
||||
_mouseState?[button] == false && !(once && !_lastButtonsPressed.Contains(button));
|
||||
public static bool IsDown(MouseButton button, bool once = false)
|
||||
{
|
||||
return _mouseState?[button] == true && !(once && _lastButtonsPressed.Contains(button));
|
||||
}
|
||||
|
||||
public static bool IsUp(MouseButton button, bool once = false)
|
||||
{
|
||||
return _mouseState?[button] == false && !(once && !_lastButtonsPressed.Contains(button));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue