mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-24 10:02:08 -05:00
Use proper key press, instead of looking for KeyDown event.
This commit is contained in:
parent
ebe79603d3
commit
d4fcdf3199
2 changed files with 6 additions and 10 deletions
|
@ -93,9 +93,9 @@ namespace ClassicalSharp {
|
|||
LocalPlayer p = game.LocalPlayer;
|
||||
bool noGlobalHacks = !p.CanAnyHacks || !p.HacksEnabled;
|
||||
buttons[3].Disabled = noGlobalHacks || !p.CanSpeed;
|
||||
buttons[5].Disabled = noGlobalHacks || !p.CanSpeed;
|
||||
buttons[4].Disabled = noGlobalHacks || !p.CanSpeed;
|
||||
buttons[6].Disabled = noGlobalHacks || !p.CanPushbackBlocks;
|
||||
buttons[6].Disabled = true; // TODO: get this working
|
||||
buttons[4].Disabled = true; // TODO: get this working
|
||||
}
|
||||
|
||||
ButtonWidget Make( int x, int y, string text, Action<Game, Widget> onClick,
|
||||
|
|
|
@ -7,14 +7,12 @@ using System.Windows.Forms;
|
|||
namespace ClassicalSharp {
|
||||
|
||||
public sealed partial class TextInputWidget : Widget {
|
||||
|
||||
bool supressNextPress = false;
|
||||
|
||||
public override bool HandlesKeyPress( char key ) {
|
||||
if( game.HideGui || supressNextPress ) {
|
||||
supressNextPress = false;
|
||||
return true;
|
||||
if( key == '`' ) {
|
||||
TildeKey(); return true; // TODO: use tab instead of tilde
|
||||
}
|
||||
if( game.HideGui ) return true;
|
||||
|
||||
if( chatInputText.Length < len && IsValidInputChar( key ) && key != '&' ) {
|
||||
if( caretPos == -1 ) {
|
||||
|
@ -35,8 +33,7 @@ namespace ClassicalSharp {
|
|||
return key < Key.F1 || key > Key.F35;
|
||||
bool controlDown = game.IsKeyDown( Key.ControlLeft ) || game.IsKeyDown( Key.ControlRight );
|
||||
|
||||
/*if( key == Key.Tilde ) TildeKey(); TODO: Support properly on non-standard keyboard layouts.
|
||||
else*/ if( key == Key.Down ) DownKey( controlDown );
|
||||
if( key == Key.Down ) DownKey( controlDown );
|
||||
else if( key == Key.Up ) UpKey( controlDown );
|
||||
else if( key == Key.Left ) LeftKey( controlDown );
|
||||
else if( key == Key.Right ) RightKey( controlDown );
|
||||
|
@ -56,7 +53,6 @@ namespace ClassicalSharp {
|
|||
int pos = caretPos == -1 ? chatInputText.Length - 1 : caretPos;
|
||||
int start = pos;
|
||||
char[] value = chatInputText.value;
|
||||
supressNextPress = true;
|
||||
|
||||
while( start >= 0 && Char.IsLetterOrDigit( value[start] ) )
|
||||
start--;
|
||||
|
|
Loading…
Add table
Reference in a new issue