/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { handler = new IMEHandler(this); handler.onResultReceived += (s, e) => { switch ((int)e.result) { case 8: if (content.Length > 0) { content = content.Remove(content.Length - 1, 1); } break; case 27: case 13: content = ""; break; default: content += e.result; break; } }; base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { imeHandler = new IosIMEHandler(this, true); imeHandler.TextInput += (s, e) => { switch ((int)e.Character) { case 8: if (inputContent.Length > 0) { inputContent = inputContent.Remove(inputContent.Length - 1, 1); } break; case 27: case 13: inputContent = ""; break; default: inputContent += e.Character; break; } }; base.Initialize(); }
/// <summary> /// /// </summary> public Stage(Game game) { _inst = this; Stage.game = game; #if Windows handler = new IMEHandler(game); handler.onResultReceived += Handler_onResultReceived; #elif DesktopGL game.Window.TextInput += WindowOnTextInput; #endif soundVolume = 1; _batch = new FairyBatch(); _soundEnabled = true; _touchInfo = new TouchInfo(); _touchInfo.touchId = 0; _lastKeyDownTime = new Dictionary <Keys, float>(); _rollOutChain = new List <DisplayObject>(); _rollOverChain = new List <DisplayObject>(); _focusRemovedDelegate = OnFocusRemoved; }
protected override void OnLostFocus(object sender, RoutedEventArgs e) { base.OnLostFocus(sender, e); if (this.imeHandler != null) { this.imeHandler.onResultReceived -= ImeHandler_onResultReceived; this.imeHandler.onCompositionReceived -= ImeHandler_onCompositionReceived; this.imeHandler.Enabled = false; this.imeHandler = null; } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { imeHandler = IMEHandler.Create(this, true); imeHandler.TextInput += ImeHandler_TextInput; IsMouseVisible = true; textViewTitle = new TextView("Press F1 to toggle IME.", new Point(250, 260), 20) { TextColor = Color.Orange }; base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { imeHandler = new WinFormsIMEHandler(this, false); imeHandler.TextInput += (s, e) => { switch ((int)e.Character) { case 8: if (inputContent.Length > 0) { inputContent = inputContent.Remove(inputContent.Length - 1, 1); } break; case 27: case 13: inputContent = ""; break; default: if (e.Character > UnicodeSimplifiedChineseMax) { inputContent += DefaultChar; } else { inputContent += e.Character; } break; } inputContent = inputContent.Trim(); }; imeHandler.TextComposition += (o, e) => { var rect = new Rectangle(10, 50, 0, 0); imeHandler.SetTextInputRect(ref rect); }; IsMouseVisible = true; base.Initialize(); }
protected override void OnGotFocus(object sender, RoutedEventArgs e) { base.OnGotFocus(sender, e); if (this.IMEEnabled) { if (this.imeHandler == null) { this.imeHandler = this.GetIMEService(); } if (this.imeHandler != null) { this.imeHandler.Enabled = true; this.imeHandler.onResultReceived += ImeHandler_onResultReceived; this.imeHandler.onCompositionReceived += ImeHandler_onCompositionReceived; } } }
public Form1() { InitializeComponent(); imeHandler = new IMEHandler(this, false); Application.Idle += Application_Idle; imeHandler.ResultReceived += (s, e) => { switch ((int)e.Result) { case 8: if (inputContent.Length > 0) { inputContent = inputContent.Remove(inputContent.Length - 1, 1); } break; case 27: case 13: inputContent = ""; break; default: if (e.Result > UnicodeSimplifiedChineseMax) { inputContent += DefaultChar; } else { inputContent += e.Result; } break; } textBoxResult.Text = inputContent; }; this.KeyDown += Form1_KeyDown; this.CenterToScreen(); textBoxResult.Text = string.Empty; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { imeHandler = new SdlIMEHandler(this, true); imeHandler.TextInput += (s, e) => { switch ((int)e.Character) { case 8: if (inputContent.Length > 0) { inputContent = inputContent.Remove(inputContent.Length - 1, 1); } break; case 27: case 13: inputContent = ""; break; default: if (e.Character > UnicodeSimplifiedChineseMax) { inputContent += DefaultChar; } else { inputContent += e.Character; } break; } }; IsMouseVisible = true; base.Initialize(); }