actortemplate hax

This commit is contained in:
Chris Forbes
2010-05-10 17:49:11 +12:00
parent 22afe4f80b
commit 0673fc23bf
3 changed files with 24 additions and 6 deletions

View File

@@ -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;
}
}

View File

@@ -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<RenderSimpleInfo>().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<Building>() };
}
}

View File

@@ -50,6 +50,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ActorTemplate.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>