Konstantin Koch 930b2526f7 made the WindowsGame example work again with all available rendersystems.
Also made the recording inputsystem not selectable for that sample as that needs some code modification in the sample to make it work.
It was not possible to run it with openGL because the creation of the windowInfo object was faulty, it might have worked on linux, but it didn't work on windows.
Also updated a few deprecated calls for OpenGL.
Closing an OpenGL application did wrongly throw an exception when an effect gets disposed, this is fixed now and the memory usage was slightly reduced.
For DirectX 11, which didn't work for the samples out of the box, it was changed that the sharpdx effect dll's are now part of the directx 11 rendersystem so that they don't have to be copied over manually anymore.
Did some very small change to the RecordingGamePad class which makes it work if no data is recorded or played back.
2015-03-15 01:14:25 +01:00

78 lines
2.0 KiB
C#

using ANX.Framework;
using ANX.Framework.Input;
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.Development;
using System;
using System.Collections.Generic;
using Windows.System;
using Windows.UI.Core;
// 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
namespace ANX.InputDevices.Windows.ModernUI
{
[PercentageComplete(80)]
[TestState(TestStateAttribute.TestState.InProgress)]
[Developer("rene87")]
public class Keyboard : IKeyboard
{
private IntPtr windowHandle;
KeyboardState _state;
public IntPtr WindowHandle
{
get { return windowHandle; }
set
{
if (windowHandle != value)
{
windowHandle = value;
}
}
}
public Keyboard()
{
CoreWindow.GetForCurrentThread().KeyDown += Keyboard_KeyDown;
CoreWindow.GetForCurrentThread().KeyUp += Keyboard_KeyUp;
_state = new KeyboardState(Keys.None);
_state.RemovePressedKey(Keys.None);
}
void Keyboard_KeyUp(CoreWindow sender, KeyEventArgs args)
{
var key = FormatConverter.Translate(args.VirtualKey);
_state.RemovePressedKey(key);
}
void Keyboard_KeyDown(CoreWindow sender, KeyEventArgs args)
{
var key = FormatConverter.Translate(args.VirtualKey);
if (key != Keys.None)
{
_state.AddPressedKey(key);
}
}
public KeyboardState GetState()
{
return _state;
}
public KeyboardState GetState(PlayerIndex playerIndex)
{
throw new NotImplementedException();
}
public void Dispose()
{
throw new NotImplementedException();
}
}
}