public Zone(Shape Owner) { _owner = Owner; }
public Pixels(Shape shape) { _shape = shape; }
private void ShowShape(Shape shape) { frmShape frmShape = new frmShape(); frmShape.MdiParent = this; frmShape.Shape = shape; if(shape.WindowPosition != null) frmShape.Bounds = shape.WindowPosition; frmShape.Show(); }
private void Open(StreamReader stream, TreeNode parentNode) { int zc; int cc; Shape shape = new Shape(parentNode.Nodes.Add(stream.ReadLine())); shape.Node.SelectedImageIndex = shape.Node.ImageIndex = 1; shape.Node.EnsureVisible(); shape.SID = uint.Parse(stream.ReadLine()); shape.Type = (TypesOfShape)(int.Parse(stream.ReadLine())); shape.Dampen = float.Parse(stream.ReadLine()); shape.Width = int.Parse(stream.ReadLine()); shape.Height = int.Parse(stream.ReadLine()); shape.HBound = int.Parse(stream.ReadLine()); shape.VBound = int.Parse(stream.ReadLine()); shape.WindowPosition = new Rectangle ( int.Parse(stream.ReadLine()), int.Parse(stream.ReadLine()), int.Parse(stream.ReadLine()), int.Parse(stream.ReadLine()) ); shape.ZoneReverse = bool.Parse(stream.ReadLine()); shape.ZoneAnyStart = bool.Parse(stream.ReadLine()); zc = int.Parse(stream.ReadLine()); cc = int.Parse(stream.ReadLine()); for(int y = 0; y < shape.Height; y++) for(int x = 0; x < shape.Width; x++) { shape.Pixels.Pixel[x, y].Weight = float.Parse(stream.ReadLine()); shape.Pixels.Pixel[x, y].Radius = float.Parse(stream.ReadLine()); shape.Pixels.Pixel[x, y].Falloff = float.Parse(stream.ReadLine()); } for(int zi = 0; zi < zc; zi++) { Zone zone = new Zone(shape); zone.X = float.Parse(stream.ReadLine()); zone.Y = float.Parse(stream.ReadLine()); zone.EnterRadius = float.Parse(stream.ReadLine()); zone.ExitRadius = float.Parse(stream.ReadLine()); zone.EnterAngle = float.Parse(stream.ReadLine()); zone.ExitAngle = float.Parse(stream.ReadLine()); zone.EnterArc = float.Parse(stream.ReadLine()); zone.ExitArc = float.Parse(stream.ReadLine()); shape.Zones.Add(zone); } for(int ci = 0; ci < cc; ci++) Open(stream, shape.Node); }
private void mnuShapeNew_Click(object sender, EventArgs e) { if(tvwShapes.Nodes.Count == 0) tvwShapes.Nodes.Add("Shapes"); Shape shape = new Shape(tvwShapes.Nodes[0].Nodes.Add("SID_*")); shape.Node.SelectedImageIndex = shape.Node.ImageIndex = 1; ShowShape(shape); SelectShape(shape.Node); }
private void mnuShapeNewChild_Click(object sender, EventArgs e) { TreeNode node = tvwShapes.SelectedNode; if(node.Parent != null && node.Parent.Parent != null) node = node.Parent; if(node.ImageIndex == 1) { Shape shape = new Shape(node.Nodes.Add("SID_*")); shape.Node.SelectedImageIndex = shape.Node.ImageIndex = 2; shape.Type = TypesOfShape.Speed; ShowShape(shape); SelectShape(shape.Node); } }
private void CompileKFile(BinaryWriter stream, Shape shape) { float DimWeight; shape.Pixels.CalculateNeighbours(); DimWeight = shape.CalculateDimmingWeight(); for(int y = 0; y < shape.Height; y++) for(int x = 0; x < shape.Width; x++) stream.Write ( (byte)(shape.Pixels.Pixel[x, y].CalculateWeight ( DimWeight, 0.0f, 1.0f ) * 255) ); }