Exemple #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));
     }
 }
        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;
        }
Exemple #3
0
 private void _OnMousePressed(int vmID, IntPtr jevent, IntPtr ac) => OnMousePressed?.Invoke(vmID, jevent, ac);
Exemple #4
0
 internal void InvokeMousePressed(float x, float y, int button, bool isTouch)
 {
     OnMousePressed?.Invoke(x, y, button, isTouch);
     MousePressed(x, y, button, isTouch);
 }