コード例 #1
0
ファイル: PCanvas.cs プロジェクト: templeblock/fyri2deditor
        /// <summary>
        /// Construct a canvas with the basic scene graph consisting of a root, camera,
        /// and layer. Event handlers for zooming and panning are automatically
        /// installed.
        /// </summary>
        public PCanvas()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
            //Xna Init
            //Initialize();

            CURRENT_PCANVAS          = this;
            cursorStack              = new Stack();
            Camera                   = CreateBasicScenegraph();
            DefaultRenderQuality     = RenderQuality.HighQuality;
            AnimatingRenderQuality   = RenderQuality.LowQuality;
            InteractingRenderQuality = RenderQuality.LowQuality;
            PanEventHandler          = new PPanEventHandler();
            ZoomEventHandler         = new PZoomEventHandler();
            BackColor                = System.Drawing.Color.White;

                        #if (!WEB_DEPLOY)
            AllowDrop = true;
                        #endif

            RegionManagement = true;

            //SetStyle(ControlStyles.DoubleBuffer, true);
            //SetStyle(ControlStyles.Selectable, true);
            //SetStyle(ControlStyles.UserPaint, true);
            //SetStyle(ControlStyles.AllPaintingInWmPaint, true);
        }
コード例 #2
0
 /// <summary>
 /// Process the given windows event from the camera.
 /// </summary>
 /// <param name="e">The windows event to be processed.</param>
 /// <param name="type">The type of windows event being processed.</param>
 /// <param name="camera">The camera from which to process the windows event.</param>
 /// <param name="canvas">The source of the windows event being processed.</param>
 public virtual void ProcessEventFromCamera(EventArgs e, PInputType type, PCamera camera, PCanvas canvas)
 {
     nextInput         = e;
     nextType          = type;
     nextInputSource   = camera;
     nextWindowsSource = canvas;
     camera.Root.ProcessInputs();
 }
コード例 #3
0
ファイル: PCamera.cs プロジェクト: templeblock/fyri2deditor
        //****************************************************************
        // Serialization - Cameras conditionally serialize their layers.
        // This means that only the layer references that were unconditionally
        // (using GetObjectData) serialized by someone else will be restored
        // when the camera is deserialized.
        //****************************************************************/

        /// <summary>
        /// Read this this camera and all its children from the given SerializationInfo.
        /// </summary>
        /// <param name="info">The SerializationInfo to read from.</param>
        /// <param name="context">
        /// The StreamingContext of this serialization operation.
        /// </param>
        /// <remarks>
        /// This constructor is required for Deserialization.
        /// </remarks>
        protected PCamera(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            layers = new PLayerList();

            int count = info.GetInt32("layerCount");

            for (int i = 0; i < count; i++)
            {
                PLayer layer = (PLayer)info.GetValue("layer" + i, typeof(PLayer));
                if (layer != null)
                {
                    layers.Add(layer);
                }
            }
            canvas = (PCanvas)info.GetValue("canvas", typeof(PCanvas));
        }
コード例 #4
0
ファイル: PRoot.cs プロジェクト: templeblock/fyri2deditor
        /// <summary>
        /// If something in the scene graph needs to be updated, this method will schedule
        /// ProcessInputs run at a later time.
        /// </summary>
        public virtual void ScheduleProcessInputsIfNeeded()
        {
            PDebug.ScheduleProcessInputs();

            if (!Application.MessageLoop)
            {
                // Piccolo is not thread safe and should almost always be called from the
                // event dispatch thread. It should only reach this point when a new canvas
                // is being created.
                return;
            }

            if (!processInputsScheduled && !processingInputs &&
                (FullBoundsInvalid || ChildBoundsInvalid || PaintInvalid || ChildPaintInvalid))
            {
                PCanvas canvas = InvokeCanvas;
                if (canvas != null && canvas.IsHandleCreated &&
                    processScheduledInputsDelegate != null)
                {
                    processInputsScheduled = true;
                    canvas.BeginInvoke(processScheduledInputsDelegate);
                }
            }
        }