Exemple #1
0
 /// <summary>
 /// Do stuff like:
 /// call OnClick if window cliked, make it focued, drag etc.
 /// used only by GuiManager
 /// m in front of he name added to obscure
 /// returns wheter window is being dragged or not
 /// </summary>
 public void ExecuteMouseRoutine()
 {
     Hover();
     if (Mouse.ButtonPushed(MouseButtons.LeftButton))
     {
         if (zParent == null)
         {
             Functions.ClipCursorInGameWindow();
         }
         Focus();
         Globals.GuiManager.zDoGetWindows = false;
         Globals.EventManager.AddEvent(ClickRoutine, "WindowMouseRoutine");
     }
 }
Exemple #2
0
 private int TypingRoutine()
 {
     if (Collect)
     {
         zTypinRoutineRunning = false;
         return(0);
     }
     input += Keyboard.GetStringTyped();
     //limit
     if (input.Length > MaxLength)
     {
         input = input.Remove((int)MaxLength);
     }
     //backspace if length > 0
     if (input.Length > 0 &&
         Keyboard.KeyTyped(Keys.Back))
     {
         input = input.Remove(input.Length - 1);
     }
     zText.DisplayText = input;
     CarretActivity();
     //end routine if clicked
     if (Mouse.ButtonPushed(MouseButtons.LeftButton))
     {
         RemoveCarret();
         zTypinRoutineRunning = false;
         return(0);
     }
     //escape cancels typing
     if (Keyboard.KeyPushed(Keys.Escape))
     {
         Keyboard.IgnoreKeyForOneFrame(Keys.Escape);
         Text = string.Empty;
         zTypinRoutineRunning = false;
         return(0);
     }
     //onenter
     if (Keyboard.KeyPushed(Keys.Enter))
     {
         RemoveCarret();
         OnEnter();
         zTypinRoutineRunning = false;
         return(0);
     }
     return(1);
 }