unsnarled the input a bit

This commit is contained in:
Chris Forbes
2009-10-06 22:03:24 +13:00
parent 924c515f57
commit 108d799b29
9 changed files with 92 additions and 30 deletions

View File

@@ -1,4 +1,6 @@
using System.Collections.Generic;
using System;
using System.Linq;
namespace OpenRa.Game.Graphics
{
@@ -44,6 +46,18 @@ namespace OpenRa.Game.Graphics
renderer.EndFrame();
}
public IEnumerable<Region> Regions { get { return regions; } }
Region dragRegion = null;
public void DispatchMouseInput(MouseInput mi)
{
if (dragRegion != null) {
dragRegion.HandleMouseInput( mi );
if (mi.Event == MouseInputEvent.Up) dragRegion = null;
return;
}
dragRegion = regions.FirstOrDefault(r => r.Contains(mi.Location) && r.HandleMouseInput(mi));
if (mi.Event != MouseInputEvent.Down)
dragRegion = null;
}
}
}