mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-06-12 01:29:27 +00:00
2ba3146299
Cosmetic changes including using C# 4 named and optional parameters. --HG-- extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4046806
41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
using System;
|
|
|
|
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
|
|
{
|
|
if (IsResetKeyDown)
|
|
{
|
|
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 IsOpenAppleKeyDown { get; protected set; }
|
|
public bool IsCloseAppleKeyDown { get; protected set; }
|
|
|
|
protected bool IsResetKeyDown { get; set; }
|
|
|
|
private bool _resetKeyDown;
|
|
}
|
|
}
|