perf: Array/Dictionary Improvement
This commit is contained in:
parent
388e7f4788
commit
de10a859ae
|
@ -7,14 +7,14 @@ namespace Syntriax.Engine.Input;
|
||||||
|
|
||||||
public class KeyboardInputsBehaviour : BehaviourOverride, IKeyboardInputs
|
public class KeyboardInputsBehaviour : BehaviourOverride, IKeyboardInputs
|
||||||
{
|
{
|
||||||
private IDictionary<Keys, Action<IKeyboardInputs, Keys>> OnPressed = new Dictionary<Keys, Action<IKeyboardInputs, Keys>>(256);
|
private readonly Dictionary<Keys, Action<IKeyboardInputs, Keys>> OnPressed = new(256);
|
||||||
private IDictionary<Keys, Action<IKeyboardInputs, Keys>> OnReleased = new Dictionary<Keys, Action<IKeyboardInputs, Keys>>(256);
|
private readonly Dictionary<Keys, Action<IKeyboardInputs, Keys>> OnReleased = new(256);
|
||||||
|
|
||||||
private int cachePressedCurrentlyCount = 0;
|
private int cachePressedCurrentlyCount = 0;
|
||||||
private Keys[] cachePressedCurrently = new Keys[256];
|
private readonly Keys[] cachePressedCurrently = new Keys[256];
|
||||||
|
|
||||||
private int cachePressedPreviouslyCount = 0;
|
private int cachePressedPreviouslyCount = 0;
|
||||||
private Keys[] cachePressedPreviously = new Keys[256];
|
private readonly Keys[] cachePressedPreviously = new Keys[256];
|
||||||
|
|
||||||
public void RegisterOnPress(Keys key, Action<IKeyboardInputs, Keys> callback)
|
public void RegisterOnPress(Keys key, Action<IKeyboardInputs, Keys> callback)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue