예제 #1
0
        public override void Initialize()
        {
            PLayer l = new PLayer();
            PEllipse n = new PEllipse();
            n.SetBounds(0, 0, 100, 80);
            n.Brush = new SolidBrush(Color.Red);
            PBoundsHandle.AddBoundsHandlesTo(n);
            l.AddChild(n);
            n.TranslateBy(100, 100);

            PCamera c = new PCamera();
            c.SetBounds(0, 0, 100, 80);
            c.ScaleViewBy(0.1f);
            c.AddLayer(l);
            PBoundsHandle.AddBoundsHandlesTo(c);
            c.Brush = new SolidBrush(Color.Yellow);

            Canvas.Layer.AddChild(l);
            Canvas.Layer.AddChild(c);

            base.Initialize ();
        }
예제 #2
0
        /// <summary>
        /// Creates a basic scene graph.
        /// </summary>
        /// <returns>The main camera node in the new scene graph.</returns>
        /// <remarks>
        /// The scene graph will consist of  root node with two children, a layer and a
        /// camera.  Additionally, The camera will be set to view the layer.  Typically,
        /// you will want to add new nodes to the layer.
        /// </remarks>
        public static PCamera CreateBasicScenegraph()
        {
            PRoot r = new PRoot();
            PLayer l = new PLayer();
            PCamera c = new PCamera();

            r.AddChild(c);
            r.AddChild(l);
            c.AddLayer(l);

            return c;
        }