OSDN Git Service

DeviceConstantConverter にメソッドを実装。
authorFROM <from@alto.ocn.ne.jp>
Sun, 7 May 2017 14:24:16 +0000 (23:24 +0900)
committerFROM <from@alto.ocn.ne.jp>
Sun, 7 May 2017 14:24:16 +0000 (23:24 +0900)
Dictionary だけだといちいち Contains() するのが面倒なので。

DTXManiaプロジェクト/コード/全体/CDTXMania.cs
FDK17プロジェクト/コード/02.入力/CInputKeyboard.cs
FDK17プロジェクト/コード/02.入力/DeviceConstantConverter.cs
実行時フォルダ/DTXCreator.exe
実行時フォルダ/DTXManiaGR.exe
実行時フォルダ/dll/FDK.dll
実行時フォルダ/ja-JP/DTXCreator.resources.dll
実行時フォルダ/ja-JP/DTXManiaGR.resources.dll

index 4ddd7fc..eee7448 100644 (file)
@@ -2762,8 +2762,7 @@ namespace DTXMania
                                        var captureCode = (SlimDX.DirectInput.Key) ConfigIni.KeyAssign[ EPad.Capture ][ i ].コード;\r
 \r
                                        if( (int) captureCode > 0 &&\r
-                                               DeviceConstantConverter.KeyToKeys.ContainsKey( captureCode ) &&\r
-                                               e.KeyCode == DeviceConstantConverter.KeyToKeys[ captureCode ] )\r
+                                               e.KeyCode == DeviceConstantConverter.KeyToKeys( captureCode ) )\r
                                        {\r
                                                // Debug.WriteLine( "capture: " + string.Format( "{0:2x}", (int) e.KeyCode ) + " " + (int) e.KeyCode );\r
                                                string strFullPath =\r
index 3be2584..c1d8845 100644 (file)
@@ -5,6 +5,9 @@ using System.Diagnostics;
 using SharpDX;\r
 using SharpDX.DirectInput;\r
 \r
+using SlimDXKey = SlimDX.DirectInput.Key;\r
+using SharpDXKey = SharpDX.DirectInput.Key;\r
+\r
 namespace FDK\r
 {\r
        public class CInputKeyboard : IInputDevice, IDisposable\r
@@ -20,7 +23,7 @@ namespace FDK
                        {\r
                                this.devKeyboard = new Keyboard( directInput );\r
                                this.devKeyboard.SetCooperativeLevel( hWnd, CooperativeLevel.NoWinKey | CooperativeLevel.Foreground | CooperativeLevel.NonExclusive );\r
-                               this.devKeyboard.Properties.BufferSize = 0x20;\r
+                               this.devKeyboard.Properties.BufferSize = 32;\r
                                Trace.TraceInformation( this.devKeyboard.Information.ProductName + " を生成しました。" );\r
                        }\r
                        catch\r
index 8ad399b..3a1cbbd 100644 (file)
@@ -10,10 +10,41 @@ namespace FDK
 {\r
        public class DeviceConstantConverter\r
        {\r
+               /// <returns>\r
+               ///             対応する値がなければ SlimDX.DirectInput.Unknown を返す。\r
+               /// </returns>\r
+               public static SlimDXKey DIKtoKey( SharpDXKey key )\r
+               {\r
+                       if( _DIKtoKey.ContainsKey( key ) )\r
+                       {\r
+                               return _DIKtoKey[ key ];\r
+                       }\r
+                       else\r
+                       {\r
+                               return SlimDXKey.Unknown;\r
+                       }\r
+               }\r
+\r
+               /// <returns>\r
+               ///             対応する値がなければ System.Windows.Forms.Keys.None を返す。\r
+               /// </returns>\r
+               public static WindowsKey KeyToKeys( SlimDXKey key )\r
+               {\r
+                       if( _KeyToKeys.ContainsKey( key ) )\r
+                       {\r
+                               return _KeyToKeys[ key ];\r
+                       }\r
+                       else\r
+                       {\r
+                               return WindowsKey.None;\r
+                       }\r
+               }\r
+\r
+\r
                /// <summary>\r
                ///             DIK (SharpDX.DirectInput.Key) から SlimDX.DirectInput.Key への変換表。\r
                /// </summary>\r
-               public static readonly Dictionary<SharpDXKey, SlimDXKey> DIKtoKey = new Dictionary<SharpDXKey, SlimDXKey>() {\r
+               private static readonly Dictionary<SharpDXKey, SlimDXKey> _DIKtoKey = new Dictionary<SharpDXKey, SlimDXKey>() {\r
                        #region [ *** ]\r
                        { SharpDXKey.Unknown, SlimDXKey.Unknown },\r
                        { SharpDXKey.Escape, SlimDXKey.Escape },\r
@@ -164,7 +195,7 @@ namespace FDK
                /// <summary>\r
                ///             SlimDX.DirectInput.Key から System.Windows.Form.Keys への変換表。\r
                /// </summary>\r
-               public static readonly Dictionary<SlimDXKey, WindowsKey> KeyToKeys = new Dictionary<SlimDXKey, WindowsKey>() {\r
+               private static readonly Dictionary<SlimDXKey, WindowsKey> _KeyToKeys = new Dictionary<SlimDXKey, WindowsKey>() {\r
                        #region [ *** ]\r
                        { SlimDXKey.D0, WindowsKey.D0 },\r
                        { SlimDXKey.D1, WindowsKey.D1 },\r
index db8a473..db016b4 100644 (file)
Binary files a/実行時フォルダ/DTXCreator.exe and b/実行時フォルダ/DTXCreator.exe differ
index 9781f48..7a6a380 100644 (file)
Binary files a/実行時フォルダ/DTXManiaGR.exe and b/実行時フォルダ/DTXManiaGR.exe differ
index bc9bd13..dcb01a5 100644 (file)
Binary files a/実行時フォルダ/dll/FDK.dll and b/実行時フォルダ/dll/FDK.dll differ
index cc41e05..46765ef 100644 (file)
Binary files a/実行時フォルダ/ja-JP/DTXCreator.resources.dll and b/実行時フォルダ/ja-JP/DTXCreator.resources.dll differ
index 29092c1..720c918 100644 (file)
Binary files a/実行時フォルダ/ja-JP/DTXManiaGR.resources.dll and b/実行時フォルダ/ja-JP/DTXManiaGR.resources.dll differ