diff --git a/OpenRa.Game/MainWindow.cs b/OpenRa.Game/MainWindow.cs index f879fe2ca5..77a339d5f3 100644 --- a/OpenRa.Game/MainWindow.cs +++ b/OpenRa.Game/MainWindow.cs @@ -23,6 +23,8 @@ namespace OpenRa.Game Sidebar sidebar; Viewport viewport; + Mcv myUnit; + static Size GetResolution(Settings settings) { Size desktopResolution = Screen.PrimaryScreen.Bounds.Size; @@ -60,7 +62,7 @@ namespace OpenRa.Game world.Add(new Mcv(24 * new float2(5, 5), 3)); world.Add(new Mcv(24 * new float2(7, 5), 2)); - world.Add(new Mcv(24 * new float2(9, 5), 1)); + world.Add(myUnit = new Mcv(24 * new float2(9, 5), 1)); world.Add(new Refinery(24 * new float2(5, 7), 1)); @@ -82,13 +84,19 @@ namespace OpenRa.Game { base.OnMouseDown(e); lastPos = new float2(e.Location); + + if (e.Button == MouseButtons.Left) + { + MoveOrder order = new MoveOrder(lastPos + viewport.Location); + myUnit.Accept(order); + } } protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); - if (e.Button != 0) + if (e.Button == MouseButtons.Right) { float2 p = new float2(e.Location); viewport.Scroll(lastPos - p); diff --git a/OpenRa.Game/Mcv.cs b/OpenRa.Game/Mcv.cs index 480811cae0..ec63e68281 100644 --- a/OpenRa.Game/Mcv.cs +++ b/OpenRa.Game/Mcv.cs @@ -29,5 +29,11 @@ namespace OpenRa.Game return new Sprite[] { UnitSheetBuilder.sprites[GetFacing() + mcvRange.Value.Start] }; } } + + public void Accept(MoveOrder o) + { + // HACK HACK HACK TELEPORT + this.location = o.Destination; + } } } diff --git a/OpenRa.Game/MoveOrder.cs b/OpenRa.Game/MoveOrder.cs new file mode 100644 index 0000000000..7b6e679825 --- /dev/null +++ b/OpenRa.Game/MoveOrder.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenRa.Game +{ + class MoveOrder + { + public readonly float2 Destination; + + public MoveOrder(float2 destination) + { + this.Destination = destination; + } + } +} diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 5a012a8d96..6e38aa90fe 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -43,6 +43,7 @@ +