From 890973618dcd24a63487fe999fde8abdcf4a256c Mon Sep 17 00:00:00 2001 From: yyagi Date: Thu, 7 Apr 2011 16:36:49 +0000 Subject: [PATCH] =?utf8?q?#23708=20Alt=E3=81=8C=E6=8A=BC=E3=81=95=E3=82=8C?= =?utf8?q?=E3=81=A6=E3=81=84=E3=82=8B=E3=81=A8=E3=81=8D=E3=81=AF=E3=80=81S?= =?utf8?q?limDX=E5=86=85(DTXMania=E5=86=85=E9=83=A8=E3=81=A7=E6=8C=81?= =?utf8?q?=E3=81=A4=E3=82=AD=E3=83=BC=E3=83=90=E3=83=83=E3=83=95=E3=82=A1?= =?utf8?q?=E5=86=85)=E3=81=A7=E3=81=AFEnter=E3=82=92=E6=8A=BC=E3=81=97?= =?utf8?q?=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F=E3=81=93?= =?utf8?q?=E3=81=A8=E3=81=AB=E3=81=99=E3=82=8B=E3=81=93=E3=81=A8=E3=81=A7?= =?utf8?q?=E3=80=81Alt-Enter=E3=81=AB=E3=82=88=E3=82=8B=E3=83=95=E3=83=AB?= =?utf8?q?=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=BC=E3=83=B3=E3=81=A8=E3=82=A6?= =?utf8?q?=E3=82=A4=E3=83=B3=E3=83=89=E3=82=A6=E3=81=AE=E5=88=87=E3=82=8A?= =?utf8?q?=E6=9B=BF=E3=81=88=E6=99=82=E3=81=AB=E6=B1=BA=E5=AE=9A=E5=8B=95?= =?utf8?q?=E4=BD=9C=E3=81=8C=E5=85=A5=E3=81=A3=E3=81=A6=E3=81=8F=E3=82=8B?= =?utf8?q?=E3=81=93=E3=81=A8=E3=82=92=E5=9B=9E=E9=81=BF=E3=81=97=E3=81=9F?= =?utf8?q?=E3=80=82=20=E3=81=9F=E3=81=A0=E3=81=97=E3=80=81Alt=E3=82=92?= =?utf8?q?=E6=97=A9=E3=82=81=E3=81=AB=E9=9B=A2=E3=81=97=E3=81=A6=E3=81=97?= =?utf8?q?=E3=81=BE=E3=81=86=E3=81=A8=E3=80=81=E3=81=BE=E3=81=A0=E6=B1=BA?= =?utf8?q?=E5=AE=9A=E5=8B=95=E4=BD=9C=E3=81=8C=E8=B5=B0=E3=81=A3=E3=81=A6?= =?utf8?q?=E3=81=97=E3=81=BE=E3=81=86=E6=A8=A1=E6=A7=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.osdn.jp/svnroot/dtxmania/trunk@156 16f42ceb-6dc6-49c8-ba94-f2d53467949d --- .../コード/02.入力/CInputKeyboard.cs | 92 ++++++---------------- 1 file changed, 24 insertions(+), 68 deletions(-) diff --git a/FDK17プロジェクト/コード/02.入力/CInputKeyboard.cs b/FDK17プロジェクト/コード/02.入力/CInputKeyboard.cs index 5475197a..fa7c0f96 100644 --- a/FDK17プロジェクト/コード/02.入力/CInputKeyboard.cs +++ b/FDK17プロジェクト/コード/02.入力/CInputKeyboard.cs @@ -59,28 +59,28 @@ namespace FDK public void tポーリング( bool bWindowがアクティブ中, bool bバッファ入力を使用する ) { - for( int i = 0; i < 256; i++ ) + for ( int i = 0; i < 256; i++ ) { this.bKeyPushDown[ i ] = false; this.bKeyPullUp[ i ] = false; } - if( ( ( bWindowがアクティブ中 && ( this.devKeyboard != null ) ) && !this.devKeyboard.Acquire().IsFailure ) && !this.devKeyboard.Poll().IsFailure ) + if ( ( ( bWindowがアクティブ中 && ( this.devKeyboard != null ) ) && !this.devKeyboard.Acquire().IsFailure ) && !this.devKeyboard.Poll().IsFailure ) { this.list入力イベント = new List( 32 ); int posEnter = -1; - string d = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.ffff"); + string d = DateTime.Now.ToString( "yyyy/MM/dd HH:mm:ss.ffff" ); - if( bバッファ入力を使用する ) + if ( bバッファ入力を使用する ) { #region [ a.バッファ入力 ] //----------------------------- var bufferedData = this.devKeyboard.GetBufferedData(); - if( Result.Last.IsSuccess && bufferedData != null ) + if ( Result.Last.IsSuccess && bufferedData != null ) { - foreach( KeyboardState data in bufferedData ) + foreach ( KeyboardState data in bufferedData ) { - foreach( Key key in data.PressedKeys ) + foreach ( Key key in data.PressedKeys ) { STInputEvent item = new STInputEvent(); item.nKey = (int) key; @@ -92,17 +92,8 @@ namespace FDK this.bKeyState[ (int) key ] = true; this.bKeyPushDown[ (int) key ] = true; -#if TEST_CancelEnterCodeInAltEnter - if ( (int)key == (int)SlimDX.DirectInput.Key.Return ) - { - posEnter = this.list入力イベント.Count - 1; // #23708 2011.1.16 yyagi Enterのlist位置を記憶 - } -if ( (int)key == (int)SlimDX.DirectInput.Key.RightAlt) { -Debug.WriteLine( d + ": RAlt State/PushDown=true"); -} -#endif } - foreach( Key key in data.ReleasedKeys ) + foreach ( Key key in data.ReleasedKeys ) { STInputEvent event3 = new STInputEvent(); event3.nKey = (int) key; @@ -114,11 +105,6 @@ Debug.WriteLine( d + ": RAlt State/PushDown=true"); this.bKeyState[ (int) key ] = false; this.bKeyPullUp[ (int) key ] = true; -#if TEST_CancelEnterCodeInAltEnter -if ( (int)key == (int)SlimDX.DirectInput.Key.RightAlt) { -Debug.WriteLine( d + ": RAlt State = false PullUp=true"); -} -#endif } } } @@ -130,13 +116,14 @@ Debug.WriteLine( d + ": RAlt State = false PullUp=true"); #region [ b.状態入力 ] //----------------------------- KeyboardState currentState = this.devKeyboard.GetCurrentState(); - if( Result.Last.IsSuccess && currentState != null ) + if ( Result.Last.IsSuccess && currentState != null ) { - foreach( Key key in currentState.PressedKeys ) + foreach ( Key key in currentState.PressedKeys ) { - if( this.bKeyState[ (int) key ] == false ) + if ( this.bKeyState[ (int) key ] == false ) { - var ev = new STInputEvent() { + var ev = new STInputEvent() + { nKey = (int) key, b押された = true, b離された = false, @@ -147,20 +134,14 @@ Debug.WriteLine( d + ": RAlt State = false PullUp=true"); this.bKeyState[ (int) key ] = true; this.bKeyPushDown[ (int) key ] = true; - -#if TEST_CancelEnterCodeInAltEnter - if ( (int)key == (int)SlimDX.DirectInput.Key.Return ) - { - posEnter = this.list入力イベント.Count - 1; // #23708 2011.1.16 yyagi Enterのlist位置を記憶 - } -#endif } } - foreach( Key key in currentState.ReleasedKeys ) + foreach ( Key key in currentState.ReleasedKeys ) { - if( this.bKeyState[ (int) key ] == true ) + if ( this.bKeyState[ (int) key ] == true ) { - var ev = new STInputEvent() { + var ev = new STInputEvent() + { nKey = (int) key, b押された = false, b離された = true, @@ -177,41 +158,16 @@ Debug.WriteLine( d + ": RAlt State = false PullUp=true"); //----------------------------- #endregion } -#if TEST_CancelEnterCodeInAltEnter - #region [#23708 2011.1.16 yyagi Alt+Enter発生時、Enter押下情報を削除する] - if ( this.bKeyPushDown[ (int) SlimDX.DirectInput.Key.Return ] == true ) + #region [#23708 2011.4.8 yyagi Altが押されているときは、Enter押下情報を削除する] + if ( this.bKeyState[ (int) SlimDX.DirectInput.Key.RightAlt ] || + this.bKeyState[ (int) SlimDX.DirectInput.Key.LeftAlt ] ) { -Debug.WriteLine( d + ": Enter PushDown=true" ); - if ( this.bKeyPullUp[ (int) SlimDX.DirectInput.Key.Return ] == true ) - { -Debug.WriteLine( d + ": Enter PullUp=true" ); - // #23708 2011.1.16 yyagi - // フルスクリーンとウインドウを切り替える際、バッファ内でEnterのPushDownとPullUpが両方ともtrueとなることがある。 - // その際はどちらもfalseにして、Enter入力を無かったことにし、フルスクリーンとウインドウ切り替え時の - // 余分なEnter動作を回避する。(対処療法的なやり方だが・・・) - this.bKeyPushDown[ (int) SlimDX.DirectInput.Key.Return ] = - this.bKeyPullUp[ (int) SlimDX.DirectInput.Key.Return ] = false; - } - if ( this.bKeyState[ (int) SlimDX.DirectInput.Key.LeftAlt ] == true || this.bKeyState[ (int) SlimDX.DirectInput.Key.RightAlt ] == true ) - { -Debug.WriteLine( d + ": Alt LALTstate=" + this.bKeyState[ (int)SlimDX.DirectInput.Key.LeftAlt] + ", RALTstate=" + this.bKeyState[ (int)SlimDX.DirectInput.Key.RightAlt] ); -Debug.WriteLine( d + ": Alt LALTPushDown=" + this.bKeyPushDown[ (int) SlimDX.DirectInput.Key.LeftAlt ] + ", RALTPushDown=" + this.bKeyPushDown[ (int) SlimDX.DirectInput.Key.RightAlt ] ); -Debug.WriteLine( d + ": Alt LALTPullUp=" + this.bKeyPullUp[ (int) SlimDX.DirectInput.Key.LeftAlt ] + ", RALTPullUp=" + this.bKeyPullUp[ (int) SlimDX.DirectInput.Key.RightAlt ] ); - - // #23708 2011.1.16 yyagi - // alt-enter押下時は、DTXMania内部としては Enter押下を無かったことにする。 - // (しかしFormの処理としてはEnter押下が残るので、フルスクリーンとウインドウの切り替えのみ実行され、 - // 選曲画面等での実行動作は無くなる。) - if ( posEnter >= 0 ) - { - this.bKeyState[ (int) SlimDX.DirectInput.Key.Return ] = false; - this.bKeyPushDown[ (int) SlimDX.DirectInput.Key.Return ] = false; - this.list入力イベント.RemoveAt( posEnter ); - } - } + int cr = (int) SlimDX.DirectInput.Key.Return; + this.bKeyPushDown[ cr ] = false; + this.bKeyPullUp[ cr ] = false; + this.bKeyState[ cr ] = false; } #endregion -#endif } } public bool bキーが押された( int nKey ) -- 2.11.0