Finished Task #539 and implemented some VideoPlayer logic

This commit is contained in:
SND\AstrorEnales_cp 2012-09-30 07:43:41 +00:00 committed by Konstantin Koch
parent 2e581c6d53
commit 3bf2261cd0
21 changed files with 346 additions and 466 deletions

View File

@ -11,7 +11,7 @@ namespace ANX.Framework.Input
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public static class GamePad public static class GamePad
{ {
private static IGamePad gamePad; private static readonly IGamePad gamePad;
static GamePad() static GamePad()
{ {

View File

@ -70,7 +70,7 @@ namespace ANX.Framework.Input
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj != null && obj.GetType() == typeof(GamePadDPad)) if (obj is GamePadDPad)
return this == (GamePadDPad)obj; return this == (GamePadDPad)obj;
return false; return false;

View File

@ -86,7 +86,7 @@ namespace ANX.Framework.Input
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj != null && obj.GetType() == typeof(GamePadState)) if (obj is GamePadState)
return this == (GamePadState)obj; return this == (GamePadState)obj;
return false; return false;

View File

@ -12,22 +12,15 @@ namespace ANX.Framework.Input
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public static class Keyboard public static class Keyboard
{ {
private static IKeyboard keyboard; private static readonly IKeyboard keyboard;
internal static IntPtr WindowHandle internal static IntPtr WindowHandle
{ {
get get { return keyboard.WindowHandle; }
{ set { keyboard.WindowHandle = value; }
return keyboard != null ? keyboard.WindowHandle : IntPtr.Zero; }
}
set
{
if (keyboard != null)
keyboard.WindowHandle = value;
}
}
static Keyboard() static Keyboard()
{ {
keyboard = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>().Keyboard; keyboard = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>().Keyboard;
} }

View File

@ -15,39 +15,22 @@ namespace ANX.Framework.Input.MotionSensing
{ {
public class MotionSensingDevice public class MotionSensingDevice
{ {
private static IMotionSensingDevice motionSensingDevice; private static readonly IMotionSensingDevice motionSensingDevice;
static MotionSensingDevice()
{
motionSensingDevice = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>().MotionSensingDevice;
}
public static GraphicsDevice GraphicsDevice public static GraphicsDevice GraphicsDevice
{ {
get get { return motionSensingDevice.GraphicsDevice; }
{ set { motionSensingDevice.GraphicsDevice = value; }
if (motionSensingDevice != null)
{
return motionSensingDevice.GraphicsDevice;
}
return null;
}
set
{
if (motionSensingDevice != null)
{
motionSensingDevice.GraphicsDevice = value;
}
}
} }
public static MotionSensingDeviceType DeviceType public static MotionSensingDeviceType DeviceType
{ {
get get { return motionSensingDevice.DeviceType; }
{ }
return motionSensingDevice.DeviceType;
} static MotionSensingDevice()
{
motionSensingDevice = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>().MotionSensingDevice;
} }
public static MotionSensingDeviceState GetState() public static MotionSensingDeviceState GetState()

View File

@ -12,35 +12,27 @@ namespace ANX.Framework.Input
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public static class Mouse public static class Mouse
{ {
private static IMouse mouse; private static readonly IMouse mouse;
public static IntPtr WindowHandle public static IntPtr WindowHandle
{ {
get get { return mouse.WindowHandle; }
{ set { mouse.WindowHandle = value; }
return mouse != null ? mouse.WindowHandle : IntPtr.Zero; }
}
set
{
if (mouse != null)
mouse.WindowHandle = value;
}
}
static Mouse() static Mouse()
{ {
mouse = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>().Mouse; mouse = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>().Mouse;
} }
public static MouseState GetState() public static MouseState GetState()
{ {
return (mouse != null) ? mouse.GetState() : new MouseState(); return mouse.GetState();
} }
public static void SetPosition(int x, int y) public static void SetPosition(int x, int y)
{ {
if (mouse != null) mouse.SetPosition(x, y);
mouse.SetPosition(x, y);
} }
} }
} }

View File

@ -1,7 +1,6 @@
using System; using System;
using ANX.Framework.NonXNA; using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
using ANX.Framework.NonXNA.InputSystem;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -13,106 +12,63 @@ namespace ANX.Framework.Input.Touch
[TestState(TestStateAttribute.TestState.Untested)] [TestState(TestStateAttribute.TestState.Untested)]
public static class TouchPanel public static class TouchPanel
{ {
#region Private private static readonly ITouchPanel nativeTouchPanel;
private static ITouchPanel nativeTouchPanel;
#endregion
#region Public #region Public
public static GestureType EnabledGestures public static GestureType EnabledGestures
{ {
get get { return nativeTouchPanel.EnabledGestures; }
{ set { nativeTouchPanel.EnabledGestures = value; }
return nativeTouchPanel.EnabledGestures; }
}
set
{
nativeTouchPanel.EnabledGestures = value;
}
}
public static bool IsGestureAvailable public static bool IsGestureAvailable
{ {
get get { return nativeTouchPanel.IsGestureAvailable; }
{ }
return nativeTouchPanel.IsGestureAvailable;
}
}
public static IntPtr WindowHandle public static IntPtr WindowHandle
{ {
get get { return nativeTouchPanel.WindowHandle; }
{ set { nativeTouchPanel.WindowHandle = value; }
return nativeTouchPanel.WindowHandle; }
}
set
{
nativeTouchPanel.WindowHandle = value;
}
}
public static DisplayOrientation DisplayOrientation public static DisplayOrientation DisplayOrientation
{ {
get get { return nativeTouchPanel.DisplayOrientation; }
{ set { nativeTouchPanel.DisplayOrientation = value; }
return nativeTouchPanel.DisplayOrientation; }
}
set
{
nativeTouchPanel.DisplayOrientation = value;
}
}
public static int DisplayWidth public static int DisplayWidth
{ {
get get { return nativeTouchPanel.DisplayWidth; }
{ set { nativeTouchPanel.DisplayWidth = value; }
return nativeTouchPanel.DisplayWidth; }
}
set
{
nativeTouchPanel.DisplayWidth = value;
}
}
public static int DisplayHeight public static int DisplayHeight
{ {
get get { return nativeTouchPanel.DisplayHeight; }
{ set { nativeTouchPanel.DisplayHeight = value; }
return nativeTouchPanel.DisplayHeight; }
} #endregion
set
{
nativeTouchPanel.DisplayHeight = value;
}
}
#endregion
#region Constructor
static TouchPanel() static TouchPanel()
{ {
nativeTouchPanel = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>().TouchPanel; nativeTouchPanel = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>().TouchPanel;
} }
#endregion
#region GetCapabilities
public static TouchPanelCapabilities GetCapabilities() public static TouchPanelCapabilities GetCapabilities()
{ {
return nativeTouchPanel.GetCapabilities(); return nativeTouchPanel.GetCapabilities();
} }
#endregion
#region ReadGesture
public static GestureSample ReadGesture() public static GestureSample ReadGesture()
{ {
return nativeTouchPanel.ReadGesture(); return nativeTouchPanel.ReadGesture();
} }
#endregion
#region GetState
public static TouchCollection GetState() public static TouchCollection GetState()
{ {
return nativeTouchPanel.GetState(); return nativeTouchPanel.GetState();
} }
#endregion
} }
} }

View File

@ -6,11 +6,11 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Input.Touch namespace ANX.Framework.Input.Touch
{ {
[PercentageComplete(100)] [PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public struct TouchPanelCapabilities public struct TouchPanelCapabilities
{ {
public bool IsConnected { get; set; } public bool IsConnected { get; set; }
public int MaximumTouchCount { get; set; } public int MaximumTouchCount { get; set; }
} }
} }

View File

@ -10,31 +10,21 @@ namespace ANX.Framework.Media
{ {
public sealed class ArtistCollection : IEnumerable<Artist>, IEnumerable, IDisposable public sealed class ArtistCollection : IEnumerable<Artist>, IEnumerable, IDisposable
{ {
private List<Artist> artists; private readonly List<Artist> artists;
public bool IsDisposed public bool IsDisposed { get; private set; }
{
get;
private set;
}
public int Count public int Count
{ {
get get { return artists.Count; }
{ }
return artists.Count;
}
}
public Artist this[int index] public Artist this[int index]
{ {
get get { return artists[index]; }
{ }
return artists[index];
}
}
internal ArtistCollection() internal ArtistCollection()
{ {
artists = new List<Artist>(); artists = new List<Artist>();
IsDisposed = false; IsDisposed = false;

View File

@ -10,31 +10,21 @@ namespace ANX.Framework.Media
{ {
public sealed class GenreCollection : IEnumerable<Genre>, IEnumerable, IDisposable public sealed class GenreCollection : IEnumerable<Genre>, IEnumerable, IDisposable
{ {
private List<Genre> genres; private readonly List<Genre> genres;
public bool IsDisposed public bool IsDisposed { get; private set; }
{
get;
private set;
}
public int Count public int Count
{ {
get get { return genres.Count; }
{ }
return genres.Count;
}
}
public Genre this[int index] public Genre this[int index]
{ {
get get { return genres[index]; }
{ }
return genres[index];
}
}
internal GenreCollection() internal GenreCollection()
{ {
genres = new List<Genre>(); genres = new List<Genre>();
IsDisposed = false; IsDisposed = false;

View File

@ -1,6 +1,5 @@
using System; using System;
using System.IO; using System.IO;
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.PlatformSystem; using ANX.Framework.NonXNA.PlatformSystem;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
@ -13,94 +12,61 @@ namespace ANX.Framework.Media
{ {
private INativeMediaLibrary nativeLibrary; private INativeMediaLibrary nativeLibrary;
#region Public #region Public
public MediaSource MediaSource public bool IsDisposed { get; private set; }
{ public MediaSource MediaSource { get; private set; }
get;
private set;
}
public PictureCollection Pictures public PictureCollection Pictures
{ {
get get { return nativeLibrary.GetPictures(); }
{ }
return nativeLibrary.GetPictures();
}
}
public PictureAlbum RootPictureAlbum
{
get
{
return nativeLibrary.GetRootPictureAlbum();
}
}
public PictureCollection SavedPictures
{
get
{
return nativeLibrary.GetSavedPictures();
}
}
public SongCollection Songs
{
get
{
return nativeLibrary.GetSongs();
}
}
public ArtistCollection Artists
{
get
{
return nativeLibrary.GetArtists();
}
}
public AlbumCollection Albums
{
get
{
return nativeLibrary.GetAlbums();
}
}
public PlaylistCollection Playlists
{
get
{
return nativeLibrary.GetPlaylists();
}
}
public GenreCollection Genres
{
get
{
return nativeLibrary.GetGenres();
}
}
public bool IsDisposed public PictureAlbum RootPictureAlbum
{ {
get; get { return nativeLibrary.GetRootPictureAlbum(); }
private set; }
}
#endregion public PictureCollection SavedPictures
{
get { return nativeLibrary.GetSavedPictures(); }
}
public SongCollection Songs
{
get { return nativeLibrary.GetSongs(); }
}
public ArtistCollection Artists
{
get { return nativeLibrary.GetArtists(); }
}
public AlbumCollection Albums
{
get { return nativeLibrary.GetAlbums(); }
}
public PlaylistCollection Playlists
{
get { return nativeLibrary.GetPlaylists(); }
}
public GenreCollection Genres
{
get { return nativeLibrary.GetGenres(); }
}
#endregion
#region Constructor #region Constructor
public MediaLibrary() public MediaLibrary()
{ {
nativeLibrary = PlatformSystem.Instance.CreateMediaPlayer(); nativeLibrary = PlatformSystem.Instance.CreateMediaLibrary();
MediaSource = MediaSource.GetAvailableMediaSources()[0]; MediaSource = MediaSource.GetAvailableMediaSources()[0];
} }
public MediaLibrary(MediaSource setSource) public MediaLibrary(MediaSource setSource)
{ {
nativeLibrary = PlatformSystem.Instance.CreateMediaPlayer(); nativeLibrary = PlatformSystem.Instance.CreateMediaLibrary();
MediaSource = setSource; MediaSource = setSource;
} }
@ -113,13 +79,12 @@ namespace ANX.Framework.Media
#region Dispose #region Dispose
public void Dispose() public void Dispose()
{ {
if (IsDisposed == false) if (IsDisposed)
{ return;
IsDisposed = true;
nativeLibrary.Dispose(); IsDisposed = true;
nativeLibrary = null; nativeLibrary.Dispose();
} nativeLibrary = null;
} }
#endregion #endregion

View File

@ -8,37 +8,19 @@ namespace ANX.Framework.Media
{ {
public sealed class Video public sealed class Video
{ {
#region Public internal TimeSpan PlayPosition
public TimeSpan Duration {
{ get { throw new NotImplementedException(); }
get; //get { return nativeVideo.PlayPosition; }
private set; }
}
#region Public
public int Width public TimeSpan Duration { get; private set; }
{ public int Width { get; private set; }
get; public int Height { get; private set; }
private set; public float FramesPerSecond { get; private set; }
} public VideoSoundtrackType VideoSoundtrackType { get; private set; }
#endregion
public int Height
{
get;
private set;
}
public float FramesPerSecond
{
get;
private set;
}
public VideoSoundtrackType VideoSoundtrackType
{
get;
private set;
}
#endregion
#region Constructor #region Constructor
internal Video(int duration, int width, int height, float framesPerSecond, VideoSoundtrackType soundtrackType) internal Video(int duration, int width, int height, float framesPerSecond, VideoSoundtrackType soundtrackType)
@ -50,5 +32,29 @@ namespace ANX.Framework.Media
VideoSoundtrackType = soundtrackType; VideoSoundtrackType = soundtrackType;
} }
#endregion #endregion
internal void Play()
{
// TODO: nativeVideo.Play();
throw new NotImplementedException();
}
internal void Pause()
{
// TODO: nativeVideo.Pause();
throw new NotImplementedException();
}
internal void Resume()
{
// TODO: nativeVideo.Resume();
throw new NotImplementedException();
}
internal void Stop()
{
// TODO: nativeVideo.Stop();
throw new NotImplementedException();
}
} }
} }

View File

@ -9,34 +9,31 @@ namespace ANX.Framework.Media
{ {
public sealed class VideoPlayer : IDisposable public sealed class VideoPlayer : IDisposable
{ {
public bool IsDisposed private float volume;
{ internal float VolumeToUse
get; {
private set; get { return IsMuted ? 0f : volume; }
} }
public TimeSpan PlayPosition public Video Video { get; private set; }
public bool IsMuted { get; set; }
public bool IsDisposed { get; private set; }
public TimeSpan PlayPosition
{ {
get get { return Video == null ? TimeSpan.Zero : Video.PlayPosition; }
{
throw new NotImplementedException();
}
} }
public float Volume public float Volume
{ {
get get { return volume; }
{ set
throw new NotImplementedException(); {
} if (value < 0f || value > 1f)
} throw new ArgumentOutOfRangeException("value");
public bool IsMuted volume = value;
{ }
get
{
throw new NotImplementedException();
}
} }
public bool IsLooped public bool IsLooped
@ -46,15 +43,7 @@ namespace ANX.Framework.Media
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public Video Video
{
get
{
throw new NotImplementedException();
}
}
public MediaState State public MediaState State
{ {
get get
@ -65,6 +54,8 @@ namespace ANX.Framework.Media
public VideoPlayer() public VideoPlayer()
{ {
IsMuted = false;
volume = 1f;
IsDisposed = false; IsDisposed = false;
} }
@ -75,31 +66,38 @@ namespace ANX.Framework.Media
public void Dispose() public void Dispose()
{ {
if (IsDisposed == false) if (IsDisposed)
{ return;
IsDisposed = true;
throw new NotImplementedException(); IsDisposed = true;
} Video = null;
} }
public void Play(Video video) public void Play(Video video)
{ {
throw new NotImplementedException(); if (video == null)
throw new ArgumentNullException("video");
Video = video;
video.Play();
} }
public void Pause() public void Pause()
{ {
throw new NotImplementedException(); if (Video != null)
Video.Pause();
} }
public void Resume() public void Resume()
{ {
throw new NotImplementedException(); if (Video != null)
Video.Resume();
} }
public void Stop() public void Stop()
{ {
throw new NotImplementedException(); if (Video != null)
Video.Stop();
} }
public Texture2D GetTexture() public Texture2D GetTexture()

View File

@ -82,9 +82,10 @@ namespace ANX.Framework.NonXNA
public ITouchPanel GetDefaultTouchPanel() public ITouchPanel GetDefaultTouchPanel()
{ {
ValidateWindowHandle(); ValidateWindowHandle();
var touchPanel = GetDefaultCreator<ITouchPanelCreator>().CreateDevice(); var touchPanel = GetDefaultCreator<ITouchPanelCreator>().CreateDevice();
touchPanel.WindowHandle = WindowHandle; #if !WINDOWSMETRO
touchPanel.WindowHandle = WindowHandle;
#endif
return touchPanel; return touchPanel;
} }
#endregion #endregion
@ -99,11 +100,8 @@ namespace ANX.Framework.NonXNA
#region CreateDefaultMouse #region CreateDefaultMouse
public IMouse CreateDefaultMouse() public IMouse CreateDefaultMouse()
{ {
#if !WINDOWSMETRO
ValidateWindowHandle(); ValidateWindowHandle();
#endif
var mouse = GetDefaultCreator<IMouseCreator>().CreateDevice(); var mouse = GetDefaultCreator<IMouseCreator>().CreateDevice();
#if !WINDOWSMETRO #if !WINDOWSMETRO
mouse.WindowHandle = WindowHandle; mouse.WindowHandle = WindowHandle;
#endif #endif
@ -139,7 +137,7 @@ namespace ANX.Framework.NonXNA
{ {
var creators = deviceCreators[creatorType]; var creators = deviceCreators[creatorType];
if (creators.Count > 0) if (creators.Count > 0)
return (T)creators.Values.First<IInputDeviceCreator>(); return (T)creators.Values.First();
} }
throw new Exception("Unable to find a default creator for type " + creatorType); throw new Exception("Unable to find a default creator for type " + creatorType);
@ -149,8 +147,10 @@ namespace ANX.Framework.NonXNA
#region ValidateWindowHandle #region ValidateWindowHandle
private void ValidateWindowHandle() private void ValidateWindowHandle()
{ {
#if !WINDOWSMETRO
if (WindowHandle == IntPtr.Zero) if (WindowHandle == IntPtr.Zero)
throw new Exception("Unable to create a mouse instance because the WindowHandle was not set."); throw new Exception("Unable to create a mouse instance because the WindowHandle was not set.");
#endif
} }
#endregion #endregion
} }

View File

@ -20,7 +20,7 @@ namespace ANX.Framework.NonXNA.PlatformSystem
Stream OpenReadFilestream(string filepath); Stream OpenReadFilestream(string filepath);
INativeMediaLibrary CreateMediaPlayer(); INativeMediaLibrary CreateMediaLibrary();
IList<MediaSource> GetAvailableMediaSources(); IList<MediaSource> GetAvailableMediaSources();
} }
} }

View File

@ -165,14 +165,14 @@ namespace ANX.Framework.NonXNA.PlatformSystem
return runtimeInstance.OpenReadFilestream(filepath); return runtimeInstance.OpenReadFilestream(filepath);
} }
public INativeMediaLibrary CreateMediaPlayer() public INativeMediaLibrary CreateMediaLibrary()
{ {
if (runtimeInstance == null) if (runtimeInstance == null)
{ {
throw new PlatformSystemInstanceException(); throw new PlatformSystemInstanceException();
} }
return runtimeInstance.CreateMediaPlayer(); return runtimeInstance.CreateMediaLibrary();
} }
public IList<MediaSource> GetAvailableMediaSources() public IList<MediaSource> GetAvailableMediaSources()

View File

@ -6,118 +6,125 @@ using ANX.Framework.NonXNA;
namespace ANX.InputSystem.Standard namespace ANX.InputSystem.Standard
{ {
public class Creator : IInputSystemCreator public class Creator : IInputSystemCreator
{ {
private IKeyboard keyboard; private const string CreationLogMessage = "Creating a new {0} device.";
private IMouse mouse; private const string CreationThrowMessage =
private IGamePad gamePad; "Couldn't find a default {0} device creator. Unable to create a {0} instance.";
private ITouchPanel touchPanel;
public string Name
{
get
{
return "Standard";
}
}
public int Priority
{
get
{
return 0;
}
}
public bool IsSupported
{
get
{
return true;
}
}
public ITouchPanel TouchPanel
{
get
{
if (touchPanel == null)
{
Logger.Info("Creating a new TouchPanel device.");
PreventSystemChange();
touchPanel = InputDeviceFactory.Instance.GetDefaultTouchPanel();
}
return touchPanel;
}
}
public IGamePad GamePad
{
get
{
if (gamePad == null)
{
Logger.Info("Creating a new GamePad device.");
PreventSystemChange();
gamePad = InputDeviceFactory.Instance.CreateDefaultGamePad();
}
return gamePad;
}
}
public IMouse Mouse
{
get
{
if (mouse == null)
{
mouse = InputDeviceFactory.Instance.CreateDefaultMouse();
if (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");
PreventSystemChange();
}
return this.mouse;
}
}
public IKeyboard Keyboard
{
get
{
if (keyboard == null)
{
keyboard = InputDeviceFactory.Instance.CreateDefaultKeyboard();
if (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");
PreventSystemChange();
}
return this.keyboard;
}
}
#if XNAEXT #if XNAEXT
public IMotionSensingDevice MotionSensingDevice private IMotionSensingDevice motionSensingDevice;
{ #endif
get private IKeyboard keyboard;
{ private IMouse mouse;
Logger.Info("Creating a new MotionSensingDevice device."); private IGamePad gamePad;
PreventSystemChange(); private ITouchPanel touchPanel;
return InputDeviceFactory.Instance.CreateDefaultMotionSensingDevice();
} public string Name
} {
get { return "Standard"; }
}
public int Priority
{
get { return 0; }
}
public bool IsSupported
{
get { return true; }
}
public ITouchPanel TouchPanel
{
get
{
if (touchPanel == null)
{
Logger.Info(string.Format(CreationLogMessage, "TouchPanel"));
PreventSystemChange();
touchPanel = InputDeviceFactory.Instance.GetDefaultTouchPanel();
if (touchPanel == null)
throw new NoInputDeviceException(string.Format(CreationThrowMessage, "touchPanel"));
}
return touchPanel;
}
}
public IGamePad GamePad
{
get
{
if (gamePad == null)
{
Logger.Info(string.Format(CreationLogMessage, "GamePad"));
PreventSystemChange();
gamePad = InputDeviceFactory.Instance.CreateDefaultGamePad();
if (gamePad == null)
throw new NoInputDeviceException(string.Format(CreationThrowMessage, "gamePad"));
}
return gamePad;
}
}
public IMouse Mouse
{
get
{
if (mouse == null)
{
Logger.Info(string.Format(CreationLogMessage, "Mouse"));
PreventSystemChange();
mouse = InputDeviceFactory.Instance.CreateDefaultMouse();
if (mouse == null)
throw new NoInputDeviceException(string.Format(CreationThrowMessage, "mouse"));
}
return mouse;
}
}
public IKeyboard Keyboard
{
get
{
if (keyboard == null)
{
Logger.Info(string.Format(CreationLogMessage, "Keyboard"));
PreventSystemChange();
keyboard = InputDeviceFactory.Instance.CreateDefaultKeyboard();
if (keyboard == null)
throw new NoInputDeviceException(string.Format(CreationThrowMessage, "keyboard"));
}
return keyboard;
}
}
#if XNAEXT
public IMotionSensingDevice MotionSensingDevice
{
get
{
if (motionSensingDevice == null)
{
Logger.Info(string.Format(CreationLogMessage, "MotionSensing"));
PreventSystemChange();
motionSensingDevice = InputDeviceFactory.Instance.CreateDefaultMotionSensingDevice();
if (motionSensingDevice == null)
throw new NoInputDeviceException(string.Format(CreationThrowMessage, "motionSensing"));
}
return motionSensingDevice;
}
}
#endif #endif
private void PreventSystemChange() private static void PreventSystemChange()
{ {
AddInSystemFactory.Instance.PreventSystemChange(AddInType.InputSystem); AddInSystemFactory.Instance.PreventSystemChange(AddInType.InputSystem);
} }
} }
} }

View File

@ -64,7 +64,7 @@ namespace ANX.PlatformSystem.Linux
#endregion #endregion
#region CreateMediaPlayer (TODO) #region CreateMediaPlayer (TODO)
public INativeMediaLibrary CreateMediaPlayer() public INativeMediaLibrary CreateMediaLibrary()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -71,7 +71,7 @@ namespace ANX.PlatformSystem.Metro
throw new NotImplementedException(); throw new NotImplementedException();
} }
public INativeMediaLibrary CreateMediaPlayer() public INativeMediaLibrary CreateMediaLibrary()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -67,7 +67,7 @@ namespace ANX.PlatformSystem.PsVita
#endregion #endregion
#region CreateMediaPlayer (TODO) #region CreateMediaPlayer (TODO)
public INativeMediaLibrary CreateMediaPlayer() public INativeMediaLibrary CreateMediaLibrary()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -64,7 +64,7 @@ namespace ANX.PlatformSystem.Windows
#endregion #endregion
#region CreateMediaPlayer (TODO) #region CreateMediaPlayer (TODO)
public INativeMediaLibrary CreateMediaPlayer() public INativeMediaLibrary CreateMediaLibrary()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }