Add basic radar and weapon
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
|
||||
|
||||
namespace EvilSatellites
|
||||
{
|
||||
public class InputManager
|
||||
{
|
||||
private KeyboardState OldKeyState;
|
||||
private KeyboardState NewKeyState;
|
||||
public InputManager()
|
||||
{
|
||||
OldKeyState = Keyboard.GetState();
|
||||
NewKeyState = Keyboard.GetState();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
OldKeyState = NewKeyState;
|
||||
NewKeyState = Keyboard.GetState();
|
||||
}
|
||||
|
||||
public bool IsJustPressed(Keys key)
|
||||
{
|
||||
return (NewKeyState.IsKeyDown(key) && !OldKeyState.IsKeyDown(key));
|
||||
}
|
||||
|
||||
public bool IsJustReleased(Keys key)
|
||||
{
|
||||
return !NewKeyState.IsKeyDown(key) && OldKeyState.IsKeyDown(key);
|
||||
}
|
||||
|
||||
public bool IsPressed(Keys key)
|
||||
{
|
||||
return NewKeyState.IsKeyDown(key);
|
||||
}
|
||||
|
||||
public bool IsReleased(Keys key)
|
||||
{
|
||||
return NewKeyState.IsKeyUp(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user