2011-11-16 14:27:53 +00:00
|
|
|
using ANX.Framework.NonXNA;
|
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
// This file is part of the ANX.Framework created by the
|
|
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
|
|
// For details see: http://anxframework.codeplex.com/license
|
2011-11-16 14:27:53 +00:00
|
|
|
|
2012-02-19 11:24:23 +00:00
|
|
|
namespace ANX.InputDevices.Standard
|
2011-11-16 14:27:53 +00:00
|
|
|
{
|
2012-08-09 09:45:04 +00:00
|
|
|
public class Creator : IInputSystemCreator
|
|
|
|
{
|
|
|
|
private IKeyboard keyboard;
|
|
|
|
private IMouse mouse;
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return "Standard";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public int Priority
|
|
|
|
{
|
|
|
|
get { return 0; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsSupported
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void RegisterCreator(AddInSystemFactory factory)
|
|
|
|
{
|
|
|
|
Logger.Info("adding Standard InputSystem creator to creator collection of AddInSystemFactory");
|
|
|
|
factory.AddCreator(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
public IGamePad GamePad
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
Logger.Info("returning a new GamePad device");
|
|
|
|
AddInSystemFactory.Instance.PreventSystemChange(
|
|
|
|
AddInType.InputSystem);
|
|
|
|
return InputDeviceFactory.Instance.GetDefaultGamePad();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public IMouse Mouse
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (this.mouse == null)
|
|
|
|
{
|
|
|
|
this.mouse = InputDeviceFactory.Instance.GetDefaultMouse();
|
|
|
|
if (this.mouse == null)
|
|
|
|
{
|
|
|
|
throw new NoInputDeviceException("couldn't find a default mouse device creator. Unable to create a mouse instance.");
|
|
|
|
}
|
|
|
|
Logger.Info("created a new Mouse device");
|
|
|
|
AddInSystemFactory.Instance.PreventSystemChange(
|
|
|
|
AddInType.InputSystem);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.mouse;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public IKeyboard Keyboard
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (this.keyboard == null)
|
|
|
|
{
|
|
|
|
this.keyboard = InputDeviceFactory.Instance.GetDefaultKeyboard();
|
|
|
|
if (this.keyboard == null)
|
|
|
|
{
|
|
|
|
throw new NoInputDeviceException("couldn't find a default keyboard device creator. Unable to create a keyboard instance.");
|
|
|
|
}
|
|
|
|
Logger.Info("created a new Keyboard device");
|
|
|
|
AddInSystemFactory.Instance.PreventSystemChange(
|
|
|
|
AddInType.InputSystem);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.keyboard;
|
|
|
|
}
|
|
|
|
}
|
2011-11-16 14:27:53 +00:00
|
|
|
|
2011-11-18 11:04:26 +00:00
|
|
|
#if XNAEXT
|
2012-08-09 09:45:04 +00:00
|
|
|
public IMotionSensingDevice MotionSensingDevice
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
Logger.Info("returning a new MotionSensingDevice device");
|
|
|
|
AddInSystemFactory.Instance.PreventSystemChange(
|
|
|
|
AddInType.InputSystem);
|
|
|
|
return InputDeviceFactory.Instance.GetDefaultMotionSensingDevice();
|
|
|
|
}
|
|
|
|
}
|
2011-11-18 11:04:26 +00:00
|
|
|
#endif
|
2012-08-09 09:45:04 +00:00
|
|
|
}
|
2011-11-16 14:27:53 +00:00
|
|
|
}
|