Ejemplo n.º 1
0
 internal protected virtual void TriggerOnMousePressed(Component sender, int x, int y, MouseButton button)
 {
     if (OnMousePressed != null)
     {
         OnMousePressed.Invoke(new MouseButtonEventArgs(sender, x, y, button));
     }
 }
Ejemplo n.º 2
0
        public Button(Vector2f Position, Vector2f Size, string str, OnMousePressed action)
        {
            button           = new RectangleShape();
            button.Size      = Size;
            button.Position  = Position;
            button.FillColor = Color.Cyan;
            this.action      = action;
            font             = new Font("res/arial.ttf");
            text             = new Text(str, font);
            text.FillColor   = Color.Black;
            // Centering text
            Vector2f textSize = new Vector2f(text.GetLocalBounds().Width + text.GetLocalBounds().Left,
                                             text.GetLocalBounds().Height + text.GetLocalBounds().Top);

            text.Position = button.Position + (button.Size - textSize) / 2;
        }
Ejemplo n.º 3
0
 private void _OnMousePressed(int vmID, IntPtr jevent, IntPtr ac) => OnMousePressed?.Invoke(vmID, jevent, ac);
Ejemplo n.º 4
0
 internal void InvokeMousePressed(float x, float y, int button, bool isTouch)
 {
     OnMousePressed?.Invoke(x, y, button, isTouch);
     MousePressed(x, y, button, isTouch);
 }