resize support working

This commit is contained in:
Chris Forbes
2010-05-09 13:35:27 +12:00
parent b7e6dc90c3
commit 5be3da3d12
4 changed files with 30 additions and 3 deletions

View File

@@ -140,7 +140,16 @@ namespace OpenRA.Editor
if (DialogResult.OK != rd.ShowDialog())
return;
surface1.Bind(surface1.Map, surface1.TileSet, surface1.Palette); // rebind it to invalidate all caches
surface1.Map.TopLeft = new int2((int)rd.cordonLeft.Value, (int)rd.cordonTop.Value);
surface1.Map.BottomRight = new int2((int)rd.cordonRight.Value, (int)rd.cordonBottom.Value);
if ((int)rd.width.Value != surface1.Map.MapSize.X || (int)rd.height.Value != surface1.Map.MapSize.Y)
{
surface1.Map.Resize((int)rd.width.Value, (int)rd.height.Value);
surface1.Bind(surface1.Map, surface1.TileSet, surface1.Palette); // rebind it to invalidate all caches
}
surface1.Invalidate();
}
}
}

View File

@@ -196,6 +196,7 @@
this.Controls.Add(this.width);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "ResizeDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Resize Map";
((System.ComponentModel.ISupportInitialize)(this.width)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cordonLeft)).EndInit();

View File

@@ -136,8 +136,8 @@ namespace OpenRA.Editor
if (Map == null) return;
if (TileSet == null) return;
for( var u = 0; u <= Map.BottomRight.X; u += ChunkSize )
for (var v = 0; v <= Map.BottomRight.Y; v += ChunkSize)
for( var u = 0; u < Map.MapSize.X; u += ChunkSize )
for (var v = 0; v < Map.MapSize.Y; v += ChunkSize)
{
var x = new int2(u/ChunkSize,v/ChunkSize);
if (!Chunks.ContainsKey(x)) Chunks[x] = RenderChunk(u / ChunkSize, v / ChunkSize);