public void Input() { //handled more gracefully in the future, hopefully... bool passClickToWorld = true; Vector2i hovered = ScreenToGrid(Engine.MousePosition); if (Engine.ButtonPressed(0)) { foreach (Widget w in Widgets) { if (w.IsHovered) { w.OnClick(); passClickToWorld = false; } } } if (Engine.ButtonPressed(2)) { if (Mode != InterfaceMode.Normal) { Mode = InterfaceMode.Normal; } else if (SelectedUnit != null && hovered != null) { if (SelectedUnit.CanMoveTo(hovered)) { EventHandler.Push( new UnitMoveEvent( SelectedUnit.ID, hovered.X, hovered.Y, true //local, we generated it ) ); } } } if (Engine.ButtonPressed(0) && passClickToWorld) { if (Engine.Active && Engine.MouseInside) { Click(); } } }