Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New Function GetReleased #55

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Update GetPressedStrategy.cs
  • Loading branch information
Frenchy62620 committed Jun 8, 2015
commit 8571c9e485668665275369933a1f8533e8ed1f67
10 changes: 4 additions & 6 deletions FreePIE.Core.Plugins/Strategies/GetPressedStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;

namespace FreePIE.Core.Plugins.Strategies
Expand All @@ -17,12 +17,10 @@ public GetPressedStrategy(Predicate<T> isDown)
public bool IsPressed(T code)
{
bool previouslyPressed = pressed.ContainsKey(code) && pressed[code];
pressed[code] = isDown(code);
pressed[code] = isDown(code);

if (previouslyPressed)
return false;

return pressed[code];
return !previouslyPressed && pressed[code]; // Pressed = false before and true now
}
}
}