diff --git a/OpenRA.Game/Graphics/CursorProvider.cs b/OpenRA.Game/Graphics/CursorProvider.cs index d84fc07ee7..042e3164d2 100644 --- a/OpenRA.Game/Graphics/CursorProvider.cs +++ b/OpenRA.Game/Graphics/CursorProvider.cs @@ -22,6 +22,8 @@ namespace OpenRA.Graphics Dictionary cursors; Cache palettes; + public static bool CursorViewportZoomed { get { return Game.Settings.Graphics.CursorDouble && Game.Settings.Graphics.PixelDouble; } } + public CursorProvider(ModData modData) { var sequenceFiles = modData.Manifest.Cursors; @@ -72,12 +74,17 @@ namespace OpenRA.Graphics { var cursorSequence = GetCursorSequence(cursorName); var cursorSprite = cursorSequence.GetSprite(cursorFrame); + var cursorSize = CursorViewportZoomed ? 2.0f * cursorSprite.size : cursorSprite.size; + + var cursorOffset = CursorViewportZoomed ? + (2 * cursorSequence.Hotspot) + cursorSprite.size.ToInt2() : + cursorSequence.Hotspot + (0.5f * cursorSprite.size).ToInt2(); renderer.SetPalette(palette); renderer.SpriteRenderer.DrawSprite(cursorSprite, - lastMousePos - cursorSequence.Hotspot - (0.5f * cursorSprite.size).ToInt2(), - palettes[cursorSequence.Palette], - cursorSprite.size); + lastMousePos - cursorOffset, + palettes[cursorSequence.Palette], + cursorSize); } public CursorSequence GetCursorSequence(string cursor) diff --git a/OpenRA.Game/Settings.cs b/OpenRA.Game/Settings.cs index a4ad4e612c..aadc6cad82 100644 --- a/OpenRA.Game/Settings.cs +++ b/OpenRA.Game/Settings.cs @@ -86,6 +86,7 @@ namespace OpenRA public int2 FullscreenSize = new int2(0, 0); public int2 WindowedSize = new int2(1024, 768); public bool PixelDouble = false; + public bool CursorDouble = false; public bool CapFramerate = true; public int MaxFramerate = 60; diff --git a/OpenRA.Game/Widgets/TooltipContainerWidget.cs b/OpenRA.Game/Widgets/TooltipContainerWidget.cs index 1db982594d..c3c75cea00 100644 --- a/OpenRA.Game/Widgets/TooltipContainerWidget.cs +++ b/OpenRA.Game/Widgets/TooltipContainerWidget.cs @@ -47,7 +47,7 @@ namespace OpenRA.Widgets { get { - var pos = Viewport.LastMousePos + CursorOffset; + var pos = Viewport.LastMousePos + (CursorProvider.CursorViewportZoomed ? CursorOffset * 2 : CursorOffset); if (tooltip != null) { if (pos.X + tooltip.Bounds.Right > Game.Renderer.Resolution.Width) diff --git a/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs index 6d9c0a2d0b..6a00c809b0 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/SettingsLogic.cs @@ -149,6 +149,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic var gs = Game.Settings.Game; BindCheckboxPref(panel, "PIXELDOUBLE_CHECKBOX", ds, "PixelDouble"); + BindCheckboxPref(panel, "CURSORDOUBLE_CHECKBOX", ds, "CursorDouble"); BindCheckboxPref(panel, "FRAME_LIMIT_CHECKBOX", ds, "CapFramerate"); BindCheckboxPref(panel, "SHOW_SHELLMAP", gs, "ShowShellmap"); BindCheckboxPref(panel, "ALWAYS_SHOW_STATUS_BARS_CHECKBOX", gs, "AlwaysShowStatusBars"); @@ -165,13 +166,16 @@ namespace OpenRA.Mods.RA.Widgets.Logic // Update zoom immediately var pixelDoubleCheckbox = panel.Get("PIXELDOUBLE_CHECKBOX"); - var oldOnClick = pixelDoubleCheckbox.OnClick; + var pixelDoubleOnClick = pixelDoubleCheckbox.OnClick; pixelDoubleCheckbox.OnClick = () => { - oldOnClick(); + pixelDoubleOnClick(); worldRenderer.Viewport.Zoom = ds.PixelDouble ? 2 : 1; }; + var cursorDoubleCheckbox = panel.Get("CURSORDOUBLE_CHECKBOX"); + cursorDoubleCheckbox.IsDisabled = () => !ds.PixelDouble; + panel.Get("WINDOW_RESOLUTION").IsVisible = () => ds.Mode == WindowMode.Windowed; var windowWidth = panel.Get("WINDOW_WIDTH"); windowWidth.Text = ds.WindowedSize.X.ToString(); @@ -218,6 +222,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic ds.WindowedSize = dds.WindowedSize; ds.PixelDouble = dds.PixelDouble; + ds.CursorDouble = dds.CursorDouble; worldRenderer.Viewport.Zoom = ds.PixelDouble ? 2 : 1; }; } diff --git a/mods/cnc/chrome/settings.yaml b/mods/cnc/chrome/settings.yaml index e5cf54d542..35e289d2e4 100644 --- a/mods/cnc/chrome/settings.yaml +++ b/mods/cnc/chrome/settings.yaml @@ -113,6 +113,13 @@ Container@SETTINGS_PANEL: Height: 20 Font: Regular Text: Enable Pixel Doubling + Checkbox@CURSORDOUBLE_CHECKBOX: + X: 355 + Y: 135 + Width: 200 + Height: 20 + Font: Regular + Text: Also Double Cursor Label@FRAME_LIMIT_DESC_A: X: 45 Y: 132 @@ -133,7 +140,7 @@ Container@SETTINGS_PANEL: Text: FPS Checkbox@TEAM_HEALTH_COLORS_CHECKBOX: X: 310 - Y: 135 + Y: 170 Width: 200 Height: 20 Font: Regular @@ -147,7 +154,7 @@ Container@SETTINGS_PANEL: Text: Show Shellmap Checkbox@ALWAYS_SHOW_STATUS_BARS_CHECKBOX: X: 310 - Y: 170 + Y: 205 Width: 200 Height: 20 Font: Regular diff --git a/mods/ra/chrome/settings.yaml b/mods/ra/chrome/settings.yaml index d81d63fddd..c34e3d248d 100644 --- a/mods/ra/chrome/settings.yaml +++ b/mods/ra/chrome/settings.yaml @@ -126,6 +126,13 @@ Background@SETTINGS_PANEL: Height: 20 Font: Regular Text: Enable Pixel Doubling + Checkbox@CURSORDOUBLE_CHECKBOX: + X: 355 + Y: 135 + Width: 200 + Height: 20 + Font: Regular + Text: Also Double Cursor Label@FRAME_LIMIT_DESC_A: X: 45 Y: 132 @@ -146,7 +153,7 @@ Background@SETTINGS_PANEL: Text: FPS Checkbox@TEAM_HEALTH_COLORS_CHECKBOX: X: 310 - Y: 135 + Y: 170 Width: 200 Height: 20 Font: Regular @@ -160,7 +167,7 @@ Background@SETTINGS_PANEL: Text: Show Shellmap Checkbox@ALWAYS_SHOW_STATUS_BARS_CHECKBOX: X: 310 - Y: 170 + Y: 205 Width: 200 Height: 20 Font: Regular