Make UI cursors configurable.
This commit is contained in:
committed by
Paul Chote
parent
96c4554644
commit
e7cfd2765c
@@ -190,7 +190,7 @@ namespace OpenRA
|
||||
OrderManager.LastTickTime = RunTime;
|
||||
OrderManager.StartGame();
|
||||
worldRenderer.RefreshPalette();
|
||||
Cursor.SetCursor("default");
|
||||
Cursor.SetCursor(ChromeMetrics.Get<string>("DefaultCursor"));
|
||||
|
||||
// Now loading is completed, now is the ideal time to run a GC and compact the LOH.
|
||||
// - All the temporary garbage created during loading can be collected.
|
||||
|
||||
@@ -13,11 +13,15 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Orders
|
||||
{
|
||||
public class UnitOrderGenerator : IOrderGenerator
|
||||
{
|
||||
readonly string worldSelectCursor = ChromeMetrics.Get<string>("WorldSelectCursor");
|
||||
readonly string worldDefaultCursor = ChromeMetrics.Get<string>("WorldDefaultCursor");
|
||||
|
||||
static Target TargetForInput(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
||||
{
|
||||
var actor = world.ScreenMap.ActorsAtMouse(mi)
|
||||
@@ -85,7 +89,7 @@ namespace OpenRA.Orders
|
||||
(mi.Modifiers.HasModifier(Modifiers.Shift) || !world.Selection.Actors.Any());
|
||||
}
|
||||
|
||||
return useSelect ? "select" : "default";
|
||||
return useSelect ? worldSelectCursor : worldDefaultCursor;
|
||||
}
|
||||
|
||||
public void Deactivate() { }
|
||||
|
||||
@@ -167,6 +167,8 @@ namespace OpenRA.Widgets
|
||||
|
||||
public abstract class Widget
|
||||
{
|
||||
string defaultCursor = null;
|
||||
|
||||
public readonly List<Widget> Children = new List<Widget>();
|
||||
|
||||
// Info defined in YAML
|
||||
@@ -235,6 +237,8 @@ namespace OpenRA.Widgets
|
||||
|
||||
public virtual void Initialize(WidgetArgs args)
|
||||
{
|
||||
defaultCursor = ChromeMetrics.Get<string>("DefaultCursor");
|
||||
|
||||
// Parse the YAML equations to find the widget bounds
|
||||
var parentBounds = (Parent == null)
|
||||
? new Rectangle(0, 0, Game.Renderer.Resolution.Width, Game.Renderer.Resolution.Height)
|
||||
@@ -347,7 +351,7 @@ namespace OpenRA.Widgets
|
||||
Ui.KeyboardFocusWidget = null;
|
||||
}
|
||||
|
||||
public virtual string GetCursor(int2 pos) { return "default"; }
|
||||
public virtual string GetCursor(int2 pos) { return defaultCursor; }
|
||||
public string GetCursorOuter(int2 pos)
|
||||
{
|
||||
// Is the cursor on top of us?
|
||||
|
||||
Reference in New Issue
Block a user