Remove more cruft from Game.controller
This commit is contained in:
@@ -70,11 +70,5 @@ namespace OpenRA
|
|||||||
return Pair.New(Game.CellSize * dragStart, Game.CellSize * dragEnd);
|
return Pair.New(Game.CellSize * dragStart, Game.CellSize * dragEnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float2 MousePosition { get { return dragEnd; } }
|
|
||||||
Modifiers modifiers;
|
|
||||||
|
|
||||||
public void SetModifiers(Modifiers mods) { modifiers = mods; }
|
|
||||||
public Modifiers GetModifiers() { return modifiers; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -456,10 +456,9 @@ namespace OpenRA
|
|||||||
throw new InvalidOperationException("Desync in OnKeyPress");
|
throw new InvalidOperationException("Desync in OnKeyPress");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void HandleModifierKeys(Modifiers mods)
|
static Modifiers modifiers;
|
||||||
{
|
public static Modifiers GetModifierKeys() { return modifiers; }
|
||||||
controller.SetModifiers(mods);
|
public static void HandleModifierKeys(Modifiers mods) { modifiers = mods; }
|
||||||
}
|
|
||||||
|
|
||||||
static Size GetResolution(Settings settings, WindowMode windowmode)
|
static Size GetResolution(Settings settings, WindowMode windowmode)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,9 +78,13 @@ namespace OpenRA.Graphics
|
|||||||
cursorFrame += 0.5f;
|
cursorFrame += 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float2 ViewToWorld(int2 loc)
|
||||||
|
{
|
||||||
|
return (1f / Game.CellSize) * (loc.ToFloat2() + Location);
|
||||||
|
}
|
||||||
public float2 ViewToWorld(MouseInput mi)
|
public float2 ViewToWorld(MouseInput mi)
|
||||||
{
|
{
|
||||||
return (1f / Game.CellSize) * (new float2(mi.Location.X, mi.Location.Y) + Location);
|
return ViewToWorld(mi.Location);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Center(int2 loc)
|
public void Center(int2 loc)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using System.Linq;
|
|||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
@@ -54,7 +55,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public void DrawBuildingGrid( World world, string name, BuildingInfo bi )
|
public void DrawBuildingGrid( World world, string name, BuildingInfo bi )
|
||||||
{
|
{
|
||||||
var position = Game.controller.MousePosition.ToInt2();
|
var position = Game.viewport.ViewToWorld(Widget.LastMousePos).ToInt2();
|
||||||
var topLeft = position - Footprint.AdjustForBuildingSize( bi );
|
var topLeft = position - Footprint.AdjustForBuildingSize( bi );
|
||||||
|
|
||||||
// Linebuild for walls.
|
// Linebuild for walls.
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
Sound.Play(unit.Traits.Contains<BuildingInfo>() ? eva.BuildingSelectAudio : eva.UnitSelectAudio);
|
Sound.Play(unit.Traits.Contains<BuildingInfo>() ? eva.BuildingSelectAudio : eva.UnitSelectAudio);
|
||||||
Game.IssueOrder(Order.StartProduction(world.LocalPlayer, item,
|
Game.IssueOrder(Order.StartProduction(world.LocalPlayer, item,
|
||||||
Game.controller.GetModifiers().HasModifier(Modifiers.Shift) ? 5 : 1));
|
Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Dictionary<string, string> CategoryNameRemaps = new Dictionary<string, string>
|
static Dictionary<string, string> CategoryNameRemaps = new Dictionary<string, string>
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
Location = pos,
|
Location = pos,
|
||||||
Button = MouseButton.Right,
|
Button = MouseButton.Right,
|
||||||
Modifiers = Game.controller.GetModifiers()
|
Modifiers = Game.GetModifierKeys()
|
||||||
};
|
};
|
||||||
|
|
||||||
return Game.controller.orderGenerator.GetCursor( world, Game.viewport.ViewToWorld(mi).ToInt2(), mi );
|
return Game.controller.orderGenerator.GetCursor( world, Game.viewport.ViewToWorld(mi).ToInt2(), mi );
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
Location = loc,
|
Location = loc,
|
||||||
Button = MouseButton.Right,
|
Button = MouseButton.Right,
|
||||||
Modifiers = Game.controller.GetModifiers()
|
Modifiers = Game.GetModifierKeys()
|
||||||
};
|
};
|
||||||
|
|
||||||
var cursor = Game.controller.orderGenerator.GetCursor( world, loc, mi );
|
var cursor = Game.controller.orderGenerator.GetCursor( world, loc, mi );
|
||||||
|
|||||||
Reference in New Issue
Block a user