Route screen size queries via Game.Renderer.
This commit is contained in:
@@ -71,7 +71,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
// Mask to prevent any clicks from being sent to other widgets
|
||||
fullscreenMask = new MaskWidget();
|
||||
fullscreenMask.Bounds = new Rectangle(0, 0, Game.viewport.Width, Game.viewport.Height);
|
||||
fullscreenMask.Bounds = new Rectangle(0, 0, Game.Renderer.Resolution.Width, Game.Renderer.Resolution.Height);
|
||||
fullscreenMask.OnMouseDown += mi => RemovePanel();
|
||||
if (onCancel != null)
|
||||
fullscreenMask.OnMouseDown += _ => onCancel();
|
||||
|
||||
4
OpenRA.Game/Widgets/TooltipContainerWidget.cs
Executable file → Normal file
4
OpenRA.Game/Widgets/TooltipContainerWidget.cs
Executable file → Normal file
@@ -54,8 +54,8 @@ namespace OpenRA.Widgets
|
||||
var pos = Viewport.LastMousePos + CursorOffset;
|
||||
if (tooltip != null)
|
||||
{
|
||||
if (pos.X + tooltip.Bounds.Right > Game.viewport.Width)
|
||||
pos.X = Game.viewport.Width - tooltip.Bounds.Right;
|
||||
if (pos.X + tooltip.Bounds.Right > Game.Renderer.Resolution.Width)
|
||||
pos.X = Game.Renderer.Resolution.Width - tooltip.Bounds.Right;
|
||||
}
|
||||
|
||||
return pos;
|
||||
|
||||
4
OpenRA.Game/Widgets/ViewportControllerWidget.cs
Executable file → Normal file
4
OpenRA.Game/Widgets/ViewportControllerWidget.cs
Executable file → Normal file
@@ -206,9 +206,9 @@ namespace OpenRA.Widgets
|
||||
directions |= ScrollDirection.Left;
|
||||
if (Viewport.LastMousePos.Y < EdgeScrollThreshold)
|
||||
directions |= ScrollDirection.Up;
|
||||
if (Viewport.LastMousePos.X >= Game.viewport.Width - EdgeScrollThreshold)
|
||||
if (Viewport.LastMousePos.X >= Game.Renderer.Resolution.Width - EdgeScrollThreshold)
|
||||
directions |= ScrollDirection.Right;
|
||||
if (Viewport.LastMousePos.Y >= Game.viewport.Height - EdgeScrollThreshold)
|
||||
if (Viewport.LastMousePos.Y >= Game.Renderer.Resolution.Height - EdgeScrollThreshold)
|
||||
directions |= ScrollDirection.Down;
|
||||
|
||||
return directions;
|
||||
|
||||
@@ -188,15 +188,15 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
// Parse the YAML equations to find the widget bounds
|
||||
var parentBounds = (Parent == null)
|
||||
? new Rectangle(0, 0, Game.viewport.Width, Game.viewport.Height)
|
||||
? new Rectangle(0, 0, Game.Renderer.Resolution.Width, Game.Renderer.Resolution.Height)
|
||||
: Parent.Bounds;
|
||||
|
||||
var substitutions = args.ContainsKey("substitutions") ?
|
||||
new Dictionary<string, int>((Dictionary<string, int>)args["substitutions"]) :
|
||||
new Dictionary<string, int>();
|
||||
|
||||
substitutions.Add("WINDOW_RIGHT", Game.viewport.Width);
|
||||
substitutions.Add("WINDOW_BOTTOM", Game.viewport.Height);
|
||||
substitutions.Add("WINDOW_RIGHT", Game.Renderer.Resolution.Width);
|
||||
substitutions.Add("WINDOW_BOTTOM", Game.Renderer.Resolution.Height);
|
||||
substitutions.Add("PARENT_RIGHT", parentBounds.Width);
|
||||
substitutions.Add("PARENT_LEFT", parentBounds.Left);
|
||||
substitutions.Add("PARENT_TOP", parentBounds.Top);
|
||||
|
||||
Reference in New Issue
Block a user