示例#1
0
 public void Update(GameTime gameTime)
 {
     if (rectangle.Contains(GameCursor.MousePosition()))
     {
         if (GameCursor.LeftMouseState(gameTime) == MouseAction.CLICK)
         {
             foreach (ButtonListener listener in listeners)
             {
                 listener.Clicked(this);
             }
         }
         isFocused = true;
     }
     else
     {
         isFocused = false;
     }
 }
示例#2
0
 public virtual void Update(GameTime gameTime)
 {
     foreach (Button button in buttons)
     {
         button.Update(gameTime);
     }
     foreach (TextField field in textFields)
     {
         if (field.Contains(GameCursor.MousePosition()) && GameCursor.LeftMouseState(gameTime) == MouseAction.CLICK)
         {
             field.Focused = true;
         }
         else if (!field.Contains(GameCursor.MousePosition()) && GameCursor.LeftMouseState(gameTime) == MouseAction.CLICK)
         {
             field.Focused = false;
         }
         field.Update(gameTime);
     }
     foreach (Label label in labels)
     {
         label.Update(gameTime);
     }
 }