Merge HardwareCursor and SoftwareCursor into CursorManager.

This commit is contained in:
Paul Chote
2020-01-17 22:48:57 +00:00
committed by Matthias Mailänder
parent d7f43b33c7
commit 847db5e59b
7 changed files with 291 additions and 356 deletions

View File

@@ -19,7 +19,6 @@ namespace OpenRA.Mods.Common.Widgets
public class TooltipContainerWidget : Widget
{
static readonly Action Nothing = () => { };
readonly CursorProvider cursorProvider;
public int2 CursorOffset = new int2(0, 20);
public int BottomEdgeYOffset = -5;
@@ -30,7 +29,6 @@ namespace OpenRA.Mods.Common.Widgets
public TooltipContainerWidget()
{
cursorProvider = Game.ModData.CursorProvider;
IsVisible = () => Game.RunTime > Viewport.LastMoveRunTime + TooltipDelayMilliseconds;
}
@@ -54,7 +52,7 @@ namespace OpenRA.Mods.Common.Widgets
{
get
{
var pos = Viewport.LastMousePos + (cursorProvider.DoubleCursorSize ? CursorOffset * 2 : CursorOffset);
var pos = Viewport.LastMousePos + (Game.Cursor.DoubleCursorSize ? CursorOffset * 2 : CursorOffset);
if (tooltip != null)
{
// If the tooltip overlaps the right edge of the screen, move it left until it fits
@@ -63,7 +61,7 @@ namespace OpenRA.Mods.Common.Widgets
// If the tooltip overlaps the bottom edge of the screen, switch tooltip above cursor
if (pos.Y + tooltip.Bounds.Bottom > Game.Renderer.Resolution.Height)
pos = pos.WithY(Viewport.LastMousePos.Y + (cursorProvider.DoubleCursorSize ? 2 : 1) * BottomEdgeYOffset - tooltip.Bounds.Height);
pos = pos.WithY(Viewport.LastMousePos.Y + (Game.Cursor.DoubleCursorSize ? 2 : 1) * BottomEdgeYOffset - tooltip.Bounds.Height);
}
return pos;