Exemple #1
0
        public override void MainLoop()
        {
            InputCheck();
            RenderTarget2D?.BeginDraw();
            // 画面を特定の色(例.灰色)で初期化
            RenderTarget2D?.Clear(SharpDX.Color.LightGray);

            // 図形描画位置
            if (RenderTarget2D != null && Initialized && field != null)
            {
                size = this.Height / Column - 1;
                RenderFlame(Row, Column, 10, 10);
                RenderBlocks(10, 10);
                if (field.Object != null)
                {
                    RenderObject(field.Object, 10, 10);
                }
                RenderNextObject(size * Row + 50, 10);
                RenderGameState(size * Row + 50, 10);
                RenderObjectAxis(10, 10);
                RenderPlaceablePosition(10, 10);
                RenderHoles(10, 10);
                RenderDeadSpace(10, 10);
                RenderWells(10, 10);
            }

            RenderTarget2D?.EndDraw();
            _SwapChain?.Present(0, PresentFlags.None);
        }
Exemple #2
0
        //called when data for any output pin is requested
        public void Evaluate(int SpreadMax)
        {
            RenderTarget2D.BeginDraw();

            ClipsOut[0] = FPlay[0];


            RenderTarget2D.Clear(new RawColor4(1.0f, 0.0f, 0.0f, 1.0f));

            try { RenderTarget2D.EndDraw(); }
            catch { }
        }
Exemple #3
0
        /// <summary>
        /// Handles the Paint event of the renderControl control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
        void RenderControlPaint(object sender, PaintEventArgs e)
        {
            try
            {
                RenderTarget2D.BeginDraw();

                RenderTarget2D.Clear(Color.White);

                RenderTarget2D.DrawTextLayout(new Vector2(0, 0), CurrentTextLayout, SceneColorBrush);

                RenderTarget2D.EndDraw();
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
Exemple #4
0
        public override void Render(IntPtr Resource, bool IsNewSurface)
        {
            if (IsNewSurface)
            {
                Context.OutputMerger.ResetTargets();
                InitRenderTargetSurface(Resource);
                Resize();
            }

            Context.ClearRenderTargetView(RenderTargetViewRef, Color.Gray);

            RenderTarget2D?.BeginDraw();
            OnRender?.Invoke();
            RenderTarget2D?.EndDraw();

            Context?.Flush();
        }
Exemple #5
0
        private void Render()
        {
            frameAccumulator += FrameDelta;
            ++frameCount;
            if (frameAccumulator >= 1.0f)
            {
                FPS = frameCount / frameAccumulator;

                form.Text        = FPS.ToString();
                frameAccumulator = 0.0f;
                frameCount       = 0;
            }

            RenderTarget2D.BeginDraw();
            BeginDraw();
            Draw(clock);
            EndDraw();
            RenderTarget2D.EndDraw();
        }
        /// <summary>
        /// Handles the Paint event of the renderControl control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
        void renderControl_Paint(object sender, PaintEventArgs e)
        {
            try
            {
                RenderTarget2D.BeginDraw();

                RenderTarget2D.Clear(Color.White);

                RenderTarget2D.DrawLine(new Vector2(0, 0), new Vector2(renderControl.ClientSize.Width, renderControl.ClientSize.Height), SceneColorBrush);
                RenderTarget2D.DrawLine(new Vector2(0, renderControl.ClientSize.Height), new Vector2(renderControl.ClientSize.Width, 0), SceneColorBrush);

                RenderTarget2D.DrawTextLayout(new Vector2(0, 0), CurrentTextLayout, SceneColorBrush);

                RenderTarget2D.EndDraw();
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
Exemple #7
0
        /// <summary>
        /// Handles the Paint event of the renderControl control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
        void RenderControlPaint(object sender, PaintEventArgs e)
        {
            try
            {
                RenderTarget2D.BeginDraw();

                RenderTarget2D.Clear(new Color4(1, 1, 1, 1));

                //RenderTarget2D.DrawTextLayout(new PointF(0, 0), CurrentTextLayout, SceneColorBrush);

                CurrentTextLayout.Draw(CustomTextRenderer, 0, 0);


                RenderTarget2D.EndDraw();
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
Exemple #8
0
 private void Render()
 {
     frameAccumulator += FrameDelta;
     ++frameCount;
     if (frameAccumulator >= 1.0f)
     {
         FPS = frameCount / frameAccumulator;
         frameAccumulator = 0;
         frameCount       = 0;
     }
     form.Text = "Test " + FPS.ToString();
     Device.ImmediateContext.Rasterizer.SetViewport(0, 0, 1280, 720);
     Device.ImmediateContext.OutputMerger.SetTargets(backBufferView);
     RenderTarget2D.BeginDraw();
     BeginDraw();
     Draw(clock);
     RenderTarget2D.EndDraw();
     EndDraw();
     swapChain.Present(0, PresentFlags.None);
 }
Exemple #9
0
        /// <summary>
        /// Local render. Performs timing calculations and debug rendering if required then calls <see cref="OnRendering"/> for inheriting controls. Presents the swap chain when ready.
        /// </summary>
        protected void Render(RenderTime renderTime)
        {
            if (!PresenterReady)
            {
                return;
            }
            // Update our derived control

            RenderTarget2D.BeginDraw();
            OnRendering(renderTime);

            lock (Layers)
            {
                Stopwatch sw = Stopwatch.StartNew();
                foreach (var layer in Layers)
                {
                    RenderProfile profile;
                    if (!ProfileStats.TryGetValue(layer.Name, out profile))
                    {
                        profile = new RenderProfile();
                        ProfileStats.Add(layer.Name, profile);
                    }

                    var start = sw.Elapsed;
                    layer.Render(renderTime);
                    profile.RenderTime = (float)(sw.Elapsed - start).TotalMilliseconds;
                }
                sw.Stop();
            }

            OnRendered(renderTime);
            RenderTarget2D.EndDraw();

            OnRender3D();

            _swapChain.Present(0, PresentFlags.None);
        }
Exemple #10
0
 protected override void EndDraw()
 {
     RenderTarget2D.EndDraw();
     base.EndDraw();
 }
Exemple #11
0
        protected virtual void EndDraw()
        {
            RenderTarget2D.EndDraw();

            swapChain.Present(Config.WaitVerticalBlanking ? 1 : 0, PresentFlags.None);
        }
Exemple #12
0
 public void EndDraw()
 {
     RenderTarget2D.EndDraw();
 }