From 123576b5ecf6a65de2a640839a1ba076571c2bff Mon Sep 17 00:00:00 2001 From: chrisf Date: Sat, 14 Jul 2007 10:02:48 +0000 Subject: [PATCH] git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1246 993157c7-ee19-0410-b2c4-bb4e9862e678 --- OpenRa.Game/MainWindow.cs | 2 +- OpenRa.Game/Region.cs | 8 ++------ OpenRa.Game/Viewport.cs | 14 +++++++------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/OpenRa.Game/MainWindow.cs b/OpenRa.Game/MainWindow.cs index 3a108948d7..f879fe2ca5 100644 --- a/OpenRa.Game/MainWindow.cs +++ b/OpenRa.Game/MainWindow.cs @@ -43,7 +43,7 @@ namespace OpenRa.Game map = new Map(new IniFile(File.OpenRead("../../../" + settings.GetValue("map", "scm12ea.ini")))); - viewport = new Viewport(ClientSize, new float2(map.Size), renderer); + viewport = new Viewport(new float2(ClientSize), new float2(map.Size), renderer); SheetBuilder.Initialize(renderer.Device); diff --git a/OpenRa.Game/Region.cs b/OpenRa.Game/Region.cs index a3721aead0..940d69d0d3 100644 --- a/OpenRa.Game/Region.cs +++ b/OpenRa.Game/Region.cs @@ -31,21 +31,17 @@ namespace OpenRa.Game public static Region Create(Viewport v, DockStyle d, int size, MethodInvoker f) { - Point topLeft = new Point(0, 0); - Point bottomRight = new Point(v.Width, v.Height); - Size s = MakeSize(v, d, size); switch (d) { case DockStyle.Top: case DockStyle.Left: - return new Region(topLeft, s, f); + return new Region(new Point(0,0), s, f); case DockStyle.Right: case DockStyle.Bottom: - Point origin = bottomRight; origin.Offset( -s.Width, -s.Height ); - return new Region(origin, s, f); + return new Region(new Point( v.Width - s.Width, v.Height - s.Height ), s, f); default: throw new NotImplementedException(); diff --git a/OpenRa.Game/Viewport.cs b/OpenRa.Game/Viewport.cs index 5f15601c00..1af8da6cf1 100644 --- a/OpenRa.Game/Viewport.cs +++ b/OpenRa.Game/Viewport.cs @@ -9,16 +9,16 @@ namespace OpenRa.Game { class Viewport { - readonly Size clientSize; + readonly float2 size; readonly float2 mapSize; float2 scrollPosition; readonly Renderer renderer; public float2 Location { get { return scrollPosition; } } - public float2 Size { get { return new float2(clientSize); } } + public float2 Size { get { return size; } } - public int Width { get { return clientSize.Width; } } - public int Height { get { return clientSize.Height; } } + public int Width { get { return (int)size.X; } } + public int Height { get { return (int)size.Y; } } public void Scroll(float2 delta) { @@ -26,10 +26,10 @@ namespace OpenRa.Game new Range(float2.Zero, mapSize)); } - public Viewport(Size clientSize, float2 mapSize, Renderer renderer) + public Viewport(float2 size, float2 mapSize, Renderer renderer) { - this.clientSize = clientSize; - this.mapSize = 24 * mapSize - new float2(clientSize) + new float2(128, 0); + this.size = size; + this.mapSize = 24 * mapSize - size + new float2(128, 0); this.renderer = renderer; }