Beispiel #1
0
        private static void SetIntersection(UserInterfaceElement uiElement, Action <int> doEvent)
        {
            const int pos = 32325; // Just some insane random value that's almost guaranteed to not be in use

            uiElement.SetIntersectPoint(pos, pos);
            doEvent(pos);
        }
Beispiel #2
0
 public Label MakeLabel(string text, UserInterfaceElement parent = null)
 {
     return(new MonoGameLabel(content, spriteBatch, mouse, parent)
     {
         Text = text
     });
 }
 public static void SetIntersectPoint(this UserInterfaceElement ui, int x, int y)
 {
     ui.X      = x;
     ui.Y      = y;
     ui.Width  = x + 1;
     ui.Height = y + 1;
 }
Beispiel #4
0
 public static void Lift(this IMouse mouse, UserInterfaceElement uiElement, MouseButton button)
 {
     SetIntersection(uiElement, pos =>
     {
         mouse.ButtonLift += Raise.EventWith(new MouseButtonInteraction(pos, pos, button));
     });
 }
Beispiel #5
0
 public static void Enter(this IMouse mouse, UserInterfaceElement uiElement)
 {
     SetIntersection(uiElement, pos =>
     {
         mouse.Move += Raise.EventWith(new MouseMove(pos, pos));
     });
 }
        public Label MakeLabel(string text, UserInterfaceElement parent = null)
        {
            var label = Substitute.For <Label>(mouse, parent);

            label.Text = text;
            return(label);
        }
Beispiel #7
0
        private static void OnMouseButtonLift(object s, MouseButtonInteraction e, UserInterfaceElement ui, Action action)
        {
            if (!ui.Intersects(e.X, e.Y))
            {
                return;
            }

            action();
        }
Beispiel #8
0
 public StackPanel MakeStackPanel(UserInterfaceElement parent = null)
 {
     return(new MonoGameStackPanel(mouse, parent));
 }
Beispiel #9
0
 public Image MakeImage(string source, UserInterfaceElement parent = null)
 {
     return(new MonoGameImage(source, mouse, logger, content, spriteBatch, parent));
 }
Beispiel #10
0
 public Button MakeButton(UserInterfaceElement parent = null)
 {
     return(new MonoGameButton(mouse, parent));
 }
Beispiel #11
0
 public Label MakeLabel(UserInterfaceElement parent = null) => MakeLabel(string.Empty, parent);
 public StackPanel MakeStackPanel(UserInterfaceElement parent = null)
 {
     return(Substitute.For <StackPanel>(mouse, parent));
 }
 public Image MakeImage(string source, UserInterfaceElement parent = null)
 {
     return(Substitute.For <Image>(source, mouse, parent));
 }
 public Button MakeButton(UserInterfaceElement parent = null)
 {
     return(Substitute.For <Button>(mouse, parent));
 }