Ejemplo n.º 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);
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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));
     });
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 7
0
        private static void OnMouseButtonLift(object s, MouseButtonInteraction e, UserInterfaceElement ui, Action action)
        {
            if (!ui.Intersects(e.X, e.Y))
            {
                return;
            }

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