示例#1
0
文件: IME.cs 项目: JLChnToZ/IMEHelper
 /// <summary>
 /// Constructor. Must be called in <see cref="Microsoft.Xna.Framework.Game.Initialize()"/> function.
 /// </summary>
 /// <param name="game">Game instance</param>
 /// <param name="showDefaultIMEWindow">Should display system IME windows.</param>
 public IMEHandler(Game game, bool showDefaultIMEWindow = false)
 {
     this.GameInstance = game;
     Input = new InputRemapper(game);
     _nativeWnd = new IMENativeWindow(game.Window.Handle, showDefaultIMEWindow);
     _nativeWnd.onCandidatesReceived += (s, e) => { if (onCandidatesReceived != null) onCandidatesReceived(s, e); };
     _nativeWnd.onCompositionReceived += (s, e) => { if (onCompositionReceived != null) onCompositionReceived(s, e); };
     _nativeWnd.onResultReceived += (s, e) => { if (onResultReceived != null) onResultReceived(s, e); };
     game.Exiting += (o, e) => this.Dispose();
 }
示例#2
0
 /// <summary>
 /// Constructor. Must be called in <see cref="Microsoft.Xna.Framework.Game.Initialize()"/> function.
 /// </summary>
 /// <param name="game">Game instance</param>
 /// <param name="showDefaultIMEWindow">Should display system IME windows.</param>
 public IMEHandler(Game game, bool showDefaultIMEWindow = false)
 {
     this.GameInstance = game;
     Input             = new InputRemapper(game);
     _nativeWnd        = new IMENativeWindow(game.Window.Handle, showDefaultIMEWindow);
     _nativeWnd.onCandidatesReceived += (s, e) => { if (onCandidatesReceived != null)
                                                    {
                                                        onCandidatesReceived(s, e);
                                                    }
     };
     _nativeWnd.onCompositionReceived += (s, e) => { if (onCompositionReceived != null)
                                                     {
                                                         onCompositionReceived(s, e);
                                                     }
     };
     _nativeWnd.onResultReceived += (s, e) => { if (onResultReceived != null)
                                                {
                                                    onResultReceived(s, e);
                                                }
     };
     game.Exiting += (o, e) => this.Dispose();
 }