diff --git a/OpenRA.Editor/ActorTemplate.cs b/OpenRA.Editor/ActorTemplate.cs new file mode 100644 index 0000000000..c9c35c447f --- /dev/null +++ b/OpenRA.Editor/ActorTemplate.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Drawing; +using OpenRA.GameRules; +using System.Windows.Forms; + +namespace OpenRA.Editor +{ + class ActorTemplate + { + public Bitmap Bitmap; + public ActorInfo Info; + public bool Centered; + } +} diff --git a/OpenRA.Editor/Form1.cs b/OpenRA.Editor/Form1.cs index 7dc05a5d5c..46ffd2d6b8 100644 --- a/OpenRA.Editor/Form1.cs +++ b/OpenRA.Editor/Form1.cs @@ -84,12 +84,12 @@ namespace OpenRA.Editor try { var info = Rules.Info[a]; - var bitmap = RenderActor(info, tsinfo.First, palette); + var template = RenderActor(info, tsinfo.First, palette); var ibox = new PictureBox { - Image = bitmap, - Width = bitmap.Width / 2, - Height = bitmap.Height / 2, + Image = template.Bitmap, + Width = template.Bitmap.Width / 2, + Height = template.Bitmap.Height / 2, SizeMode = PictureBoxSizeMode.StretchImage }; @@ -160,7 +160,7 @@ namespace OpenRA.Editor return bitmap; } - static Bitmap RenderActor(ActorInfo info, string ext, Palette p) + static ActorTemplate RenderActor(ActorInfo info, string ext, Palette p) { var image = info.Traits.Get().Image ?? info.Name; using (var s = FileSystem.OpenWithExts(image, "." + ext, ".shp")) @@ -183,7 +183,7 @@ namespace OpenRA.Editor } bitmap.UnlockBits(data); - return bitmap; + return new ActorTemplate { Bitmap = bitmap, Info = info, Centered = !info.Traits.Contains() }; } } diff --git a/OpenRA.Editor/OpenRA.Editor.csproj b/OpenRA.Editor/OpenRA.Editor.csproj index d6203883ee..259f019c9a 100644 --- a/OpenRA.Editor/OpenRA.Editor.csproj +++ b/OpenRA.Editor/OpenRA.Editor.csproj @@ -50,6 +50,7 @@ + Form