示例#1
0
            public void Paint(MObject obj)
            {
                int x2 = Math.Min(obj.X - obj.Center.X + obj.Width + obj.Parent.X - X, Width);
                int y2 = Math.Min(obj.Y - obj.Center.Y + obj.Height + obj.Parent.Y - Y, Height);
                int x;
                int y = -Math.Min(0, obj.Y - obj.Center.Y + obj.Parent.Y - Y);

                for (int i = Math.Max(obj.Y - obj.Center.Y + obj.Parent.Y - Y, 0); i < y2; i++)
                {
                    x = -Math.Min(0, obj.X - obj.Center.X + obj.Parent.X - X);
                    for (int j = Math.Max(obj.X - obj.Center.X + obj.Parent.X - X, 0); j < x2; j++)
                    {
                        if (obj.Char(y, x) != ' ')
                        {
                            if (obj.Char(y, x) == '')
                            {
                                matrix[i, j].S = ' ';
                            }
                            else
                            {
                                matrix[i, j].S = obj.Char(y, x);
                            }
                        }
                        x++;
                    }
                    y++;
                }
                for (int i = 0; i < obj.Posterity.Count; i++)
                {
                    Paint(obj.Posterity[i]);
                }
            }