Overhaul cursor double setting.
This commit is contained in:
@@ -20,6 +20,7 @@ namespace OpenRA.Graphics
|
||||
{
|
||||
public readonly IReadOnlyDictionary<string, CursorSequence> Cursors;
|
||||
public readonly IReadOnlyDictionary<string, ImmutablePalette> Palettes;
|
||||
public readonly bool DoubleCursorSize;
|
||||
|
||||
public CursorProvider(ModData modData)
|
||||
{
|
||||
@@ -47,9 +48,10 @@ namespace OpenRA.Graphics
|
||||
cursors.Add(sequence.Key, new CursorSequence(frameCache, sequence.Key, s.Key, s.Value.Value, sequence.Value));
|
||||
|
||||
Cursors = cursors.AsReadOnly();
|
||||
}
|
||||
|
||||
public static bool CursorViewportZoomed { get { return Game.Settings.Graphics.CursorDouble && Game.Settings.Graphics.PixelDouble; } }
|
||||
// Cursor size changes are applied on game start
|
||||
DoubleCursorSize = Game.Settings.Graphics.CursorDouble;
|
||||
}
|
||||
|
||||
public bool HasCursorSequence(string cursor)
|
||||
{
|
||||
|
||||
@@ -81,11 +81,12 @@ namespace OpenRA.Graphics
|
||||
if (cursorName == null)
|
||||
return;
|
||||
|
||||
var doubleCursor = cursorProvider.DoubleCursorSize && cursorName != "default";
|
||||
var cursorSequence = cursorProvider.GetCursorSequence(cursorName);
|
||||
var cursorSprite = sprites[cursorName][(int)cursorFrame % cursorSequence.Length];
|
||||
var cursorSize = CursorProvider.CursorViewportZoomed ? 2.0f * cursorSprite.Size : cursorSprite.Size;
|
||||
var cursorSize = doubleCursor ? 2.0f * cursorSprite.Size : cursorSprite.Size;
|
||||
|
||||
var cursorOffset = CursorProvider.CursorViewportZoomed ?
|
||||
var cursorOffset = doubleCursor ?
|
||||
(2 * cursorSequence.Hotspot) + cursorSprite.Size.XY.ToInt2() :
|
||||
cursorSequence.Hotspot + (0.5f * cursorSprite.Size.XY).ToInt2();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user