public void formMouseMove(object sender, _MouseEventArgs e) { try { FObject a = FObjects.First(f => f.x <= e.X && e.X - f.x <= f.window.Width && f.y <= e.Y && e.Y - f.y <= f.window.Height); if (focused == a) { focused?.callEvnt(Evnts.OnMouseHover, e.X, e.Y); return; } focused?.callEvnt(Evnts.OnMouseLeave, 0, 0); focused = a; focused?.callEvnt(Evnts.OnMouseHover, e.X, e.Y); } catch (Exception ex) { Console.WriteLine(e.X); Console.WriteLine(ex.Message); GC.Collect(); } }
public void formMouseClick(object sender, _MouseEventArgs e) { onMouseClick?.Invoke(e); if (e.Button == _MouseButtons.Left) { try { focused = FObjects.First(f => f.x <= e.X && e.X - f.x <= f.window.Width && f.y <= e.Y && e.Y - f.y <= f.window.Height); focused.callEvnt(Evnts.OnClick, e.X - focused.x, e.Y); } catch { focused = null; } } }