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);
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
public static void HandleModifierKeys(Modifiers mods)
|
||||
{
|
||||
controller.SetModifiers(mods);
|
||||
}
|
||||
static Modifiers modifiers;
|
||||
public static Modifiers GetModifierKeys() { return modifiers; }
|
||||
public static void HandleModifierKeys(Modifiers mods) { modifiers = mods; }
|
||||
|
||||
static Size GetResolution(Settings settings, WindowMode windowmode)
|
||||
{
|
||||
|
||||
@@ -78,9 +78,13 @@ namespace OpenRA.Graphics
|
||||
cursorFrame += 0.5f;
|
||||
}
|
||||
|
||||
public float2 ViewToWorld(int2 loc)
|
||||
{
|
||||
return (1f / Game.CellSize) * (loc.ToFloat2() + Location);
|
||||
}
|
||||
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)
|
||||
|
||||
@@ -14,6 +14,7 @@ using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
@@ -54,7 +55,7 @@ namespace OpenRA
|
||||
|
||||
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 );
|
||||
|
||||
// Linebuild for walls.
|
||||
|
||||
@@ -387,7 +387,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
Sound.Play(unit.Traits.Contains<BuildingInfo>() ? eva.BuildingSelectAudio : eva.UnitSelectAudio);
|
||||
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>
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
Location = pos,
|
||||
Button = MouseButton.Right,
|
||||
Modifiers = Game.controller.GetModifiers()
|
||||
Modifiers = Game.GetModifierKeys()
|
||||
};
|
||||
|
||||
return Game.controller.orderGenerator.GetCursor( world, Game.viewport.ViewToWorld(mi).ToInt2(), mi );
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
Location = loc,
|
||||
Button = MouseButton.Right,
|
||||
Modifiers = Game.controller.GetModifiers()
|
||||
Modifiers = Game.GetModifierKeys()
|
||||
};
|
||||
|
||||
var cursor = Game.controller.orderGenerator.GetCursor( world, loc, mi );
|
||||
|
||||
Reference in New Issue
Block a user