Merge pull request #9638 from JoppyFurr/bleed

Change mouse cursors while joystick scrolling
This commit is contained in:
Matthias Mailänder
2015-10-17 09:07:56 +02:00
5 changed files with 117 additions and 1 deletions

View File

@@ -48,6 +48,18 @@ namespace OpenRA.Mods.Common.Widgets
{ ScrollDirection.Right, "scroll-r" },
};
static readonly Dictionary<ScrollDirection, string> JoystickCursors = new Dictionary<ScrollDirection, string>
{
{ ScrollDirection.Up | ScrollDirection.Left, "joystick-tl-blocked" },
{ ScrollDirection.Up | ScrollDirection.Right, "joystick-tr-blocked" },
{ ScrollDirection.Down | ScrollDirection.Left, "joystick-bl-blocked" },
{ ScrollDirection.Down | ScrollDirection.Right, "joystick-br-blocked" },
{ ScrollDirection.Up, "joystick-t-blocked" },
{ ScrollDirection.Down, "joystick-b-blocked" },
{ ScrollDirection.Left, "joystick-l-blocked" },
{ ScrollDirection.Right, "joystick-r-blocked" },
};
static readonly Dictionary<ScrollDirection, float2> ScrollOffsets = new Dictionary<ScrollDirection, float2>
{
{ ScrollDirection.Up, new float2(0, -1) },
@@ -147,10 +159,20 @@ namespace OpenRA.Mods.Common.Widgets
public override string GetCursor(int2 pos)
{
if (!Game.Settings.Game.ViewportEdgeScroll || Ui.MouseOverWidget != this)
if (!IsJoystickScrolling &&
(!Game.Settings.Game.ViewportEdgeScroll || Ui.MouseOverWidget != this))
return null;
var blockedDirections = worldRenderer.Viewport.GetBlockedDirections();
if (IsJoystickScrolling)
{
foreach (var dir in JoystickCursors)
if (blockedDirections.Includes(dir.Key))
return dir.Value;
return "joystick-all";
}
foreach (var dir in ScrollCursors)
if (edgeDirections.Includes(dir.Key))
return dir.Value + (blockedDirections.Includes(dir.Key) ? "-blocked" : "");

View File

@@ -71,6 +71,22 @@ Cursors:
c4-minimap:
Start: 127
Length: 3
joystick-t-blocked:
Start: 130
joystick-tr-blocked:
Start: 131
joystick-r-blocked:
Start: 132
joystick-br-blocked:
Start: 133
joystick-b-blocked:
Start: 134
joystick-bl-blocked:
Start: 135
joystick-l-blocked:
Start: 136
joystick-tl-blocked:
Start: 137
# Cursors that need minimap variants
deploy:
@@ -105,6 +121,10 @@ Cursors:
Start: 0
X: -16
Y: -12
joystick-all:
Start: 0
X: -16
Y: -12
deploy-blocked:
Start: 1
Length: 1

View File

@@ -207,6 +207,42 @@ Cursors:
Length: 8
X: 24
Y: 24
joystick-all:
Start: 0
X: 24
Y: 24
joystick-t-blocked:
Start: 180
X: 24
Y: 24
joystick-tr-blocked:
Start: 188
X: 24
Y: 24
joystick-r-blocked:
Start: 196
X: 24
Y: 24
joystick-br-blocked:
Start: 204
X: 24
Y: 24
joystick-b-blocked:
Start: 212
X: 24
Y: 24
joystick-bl-blocked:
Start: 220
X: 24
Y: 24
joystick-l-blocked:
Start: 228
X: 24
Y: 24
joystick-tl-blocked:
Start: 236
X: 24
Y: 24
# Cursors that need minimap variants
deploy:

View File

@@ -122,6 +122,26 @@ Cursors:
ability-minimap:
Start: 214
Length: 8
joystick-all:
Start: 0
X: -16
Y: -12
joystick-t-blocked:
Start: 124
joystick-tr-blocked:
Start: 125
joystick-r-blocked:
Start: 126
joystick-br-blocked:
Start: 127
joystick-b-blocked:
Start: 128
joystick-bl-blocked:
Start: 129
joystick-l-blocked:
Start: 130
joystick-tl-blocked:
Start: 131
# Cursors that need minimap variants
deploy:

View File

@@ -176,4 +176,22 @@ Cursors:
powerdown:
Start: 329
Length: 15
joystick-all:
Start: 378
joystick-t-blocked:
Start: 379
joystick-tr-blocked:
Start: 380
joystick-r-blocked:
Start: 381
joystick-br-blocked:
Start: 382
joystick-b-blocked:
Start: 383
joystick-bl-blocked:
Start: 384
joystick-l-blocked:
Start: 385
joystick-tl-blocked:
Start: 386