git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1238 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -52,16 +52,16 @@ namespace OpenRa.Game
|
||||
p.Y += 48;
|
||||
}
|
||||
|
||||
void Fill(Size clientSize, float2 p)
|
||||
void Fill(float height, float2 p)
|
||||
{
|
||||
while (p.Y < clientSize.Height)
|
||||
while (p.Y < height)
|
||||
DrawSprite(blank, ref p);
|
||||
}
|
||||
|
||||
public void Paint()
|
||||
{
|
||||
float2 buildPos = viewport.Location + new float2(viewport.ClientSize.Width - 128, 0);
|
||||
float2 unitPos = viewport.Location + new float2(viewport.ClientSize.Width - 64, 0);
|
||||
float2 buildPos = viewport.Location + new float2(viewport.Size.X - 128, 0);
|
||||
float2 unitPos = viewport.Location + new float2(viewport.Size.X - 64, 0);
|
||||
|
||||
foreach (Item i in techTree.BuildableItems)
|
||||
{
|
||||
@@ -74,8 +74,8 @@ namespace OpenRa.Game
|
||||
DrawSprite( sprite, ref unitPos );
|
||||
}
|
||||
|
||||
Fill(viewport.ClientSize, buildPos);
|
||||
Fill(viewport.ClientSize, unitPos);
|
||||
Fill(viewport.Size.Y, buildPos);
|
||||
Fill(viewport.Size.Y, unitPos);
|
||||
|
||||
spriteRenderer.Flush();
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ namespace OpenRa.Game
|
||||
int indicesPerRow = map.Width * 6;
|
||||
int verticesPerRow = map.Width * 4;
|
||||
|
||||
int visibleRows = (int)(viewport.ClientSize.Height / 24.0f + 2);
|
||||
int visibleRows = (int)(viewport.Size.Y / 24.0f + 2);
|
||||
|
||||
int firstRow = (int)(viewport.ScrollPosition.Y / 24.0f);
|
||||
int firstRow = (int)(viewport.Location.Y / 24.0f);
|
||||
int lastRow = firstRow + visibleRows;
|
||||
|
||||
if (lastRow < 0 || firstRow > map.Height)
|
||||
|
||||
@@ -14,15 +14,15 @@ namespace OpenRa.Game
|
||||
float2 scrollPosition;
|
||||
readonly Renderer renderer;
|
||||
|
||||
public PointF ScrollPosition { get { return scrollPosition.ToPointF(); } }
|
||||
public Size ClientSize { get { return clientSize; } }
|
||||
|
||||
public float2 Location { get { return scrollPosition; } }
|
||||
public float2 Size { get { return scrollPosition + new float2(ClientSize); } }
|
||||
public float2 Size { get { return new float2(ClientSize); } }
|
||||
|
||||
public void Scroll(float2 delta)
|
||||
{
|
||||
scrollPosition = (scrollPosition + delta).Constrain(new Range<float2>(float2.Zero, mapSize));
|
||||
scrollPosition = (scrollPosition + delta).Constrain(
|
||||
new Range<float2>(float2.Zero, mapSize));
|
||||
}
|
||||
|
||||
public Viewport(Size clientSize, float2 mapSize, Renderer renderer)
|
||||
@@ -56,7 +56,7 @@ namespace OpenRa.Game
|
||||
|
||||
public void DrawRegions()
|
||||
{
|
||||
float2 r1 = new float2(2.0f / clientSize.Width, -2.0f / clientSize.Height);
|
||||
float2 r1 = new float2(2, -2) / Size;
|
||||
float2 r2 = new float2(-1, 1);
|
||||
|
||||
renderer.BeginFrame(r1, r2, scrollPosition);
|
||||
|
||||
Reference in New Issue
Block a user