mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-06-10 04:29:29 +00:00
27a5e3ac89
Normalize text files.
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
namespace Jellyfish.Virtu.Services
|
|
{
|
|
public abstract class KeyboardService : MachineService
|
|
{
|
|
protected KeyboardService(Machine machine) :
|
|
base(machine)
|
|
{
|
|
}
|
|
|
|
public abstract bool IsKeyDown(int key);
|
|
|
|
public virtual void Update() // main thread
|
|
{
|
|
var keyboard = Machine.Keyboard;
|
|
|
|
if (IsResetKeyDown && !keyboard.DisableResetKey)
|
|
{
|
|
if (!_resetKeyDown)
|
|
{
|
|
_resetKeyDown = true; // entering reset; pause until key released
|
|
Machine.Pause();
|
|
Machine.Reset();
|
|
}
|
|
}
|
|
else if (_resetKeyDown)
|
|
{
|
|
_resetKeyDown = false; // leaving reset
|
|
Machine.Unpause();
|
|
}
|
|
}
|
|
|
|
public bool IsAnyKeyDown { get; protected set; }
|
|
public bool IsControlKeyDown { get; protected set; }
|
|
public bool IsShiftKeyDown { get; protected set; }
|
|
|
|
public bool IsOpenAppleKeyDown { get; protected set; }
|
|
public bool IsCloseAppleKeyDown { get; protected set; }
|
|
|
|
protected bool IsResetKeyDown { get; set; }
|
|
|
|
private bool _resetKeyDown;
|
|
}
|
|
}
|