Esempio n. 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);
        }
Esempio n. 2
0
        protected override void Render()
        {
            UpdatePosition();

            RenderTarget2D.Clear(new Color(1.0f, 0, 1.0f));
            RenderTarget2D.FillEllipse(new Ellipse(_position, 20, 20), _circleColor);
        }
Esempio n. 3
0
        protected override void Draw(DemoTime time)
        {
            base.Draw(time);

            if (gameState.State == EGameState.MainMenu)
            {
                mainMenu.Draw(time);
                return;
            }

            if (gameState.State == EGameState.Game)
            {
                base.Draw(time);
                RenderTarget2D.Clear(Color4.Black);

                if (time.ElapseTime < 2)
                {
                    RenderTarget2D.DrawBitmap(_infoGamePanel,
                                              new SharpDX.RectangleF(RESOLUTION.Width / 2 - _infoGamePanel.Size.Width / 2, RESOLUTION.Height / 2 - _infoGamePanel.Size.Height / 2, _infoGamePanel.Size.Width, _infoGamePanel.Size.Height),
                                              1.0f, BitmapInterpolationMode.Linear);
                }

                BuildingsFactory.Draw(time);
                MobsFactory.Draw(time);
                _myCharacter.Draw(time);

                GameInterface.Draw(time);
                _timeLastDraw = time.ElapseTime;

                return;
            }
        }
Esempio n. 4
0
        protected override void Render()
        {
            UpdatePosition();


            RenderTarget2D.Clear(Color.Orange);
            RenderTarget2D.FillEllipse(new Ellipse(_position, 20, 20), _circleColor);
        }
Esempio n. 5
0
        protected override void Draw(DemoTime time)
        {
            base.Draw(time);

            RenderTarget2D.Clear(Color.White);

            RenderTarget2D.DrawText("Hello World using DirectWrite!", TextFormat, ClientRectangle, SceneColorBrush);
        }
Esempio n. 6
0
        protected override void Draw(Time time)
        {
            base.Draw(time);

            RenderTarget2D.Clear(backgroundColor);

            bar.Draw(this, brush, time);
            ball.Draw(this, brush, time);
        }
Esempio n. 7
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 { }
        }
Esempio n. 8
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);
            }
        }
Esempio n. 9
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 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);
            }
        }
Esempio n. 10
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);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// This method is called once per game loop after calling Update. Like Update, the Render()
        /// method is also called from the main class. This is the method where the graphics pipeline
        /// is constructed and processed for the frame using methods on the ID3D11DeviceContext instance.
        ///
        /// It’s important to understand that this call (or other similar Draw* calls defined on
        /// ID3D11DeviceContext) actually executes the pipeline.
        /// https://msdn.microsoft.com/en-us/library/windows/desktop/dn643746(v=vs.85).aspx
        ///
        /// Specifically, this is when Direct3D communicates with the GPU to set drawing state, runs
        /// each pipeline stage, and writes the pixel results into the render-target buffer resource
        /// for display by the swap chain.
        ///
        /// Since communication between the CPU and GPU incurs overhead, combine multiple draw calls
        /// into a single one if you can, especially if your scene has a lot of rendered objects.
        /// </summary>
        ///
        /// OnRender will Call each Active GameObjects to be Rendered
        protected override void OnRender()
        {
            //clear previous frame
            RenderTarget2D.Clear(null);

            //if display mouse coords  -- add a checkbox or option menu later \

            //Display Mouse coordinates:  top left corner : (0,0)
            TextLayout.Dispose();
            TextLayout = new TextLayout(FactoryDWrite, _mousePosition.GetMouseCoordinates(), TextFormat, 400, 40);
            RenderTarget2D.DrawTextLayout(new Vector2(0, 0), TextLayout, SceneColorBrush, DrawTextOptions.None);

            //and all added lines
            foreach (IRenderableItem item in _drawings)
            {
                item.Render(RenderTarget2D);
            }

            //Render current line if not null "?." operator
            ((IRenderableItem)_currentDrawing)?.Render(RenderTarget2D);

            //At last, display GUI on top of everything
            _guiManager.Render(RenderTarget2D);
        }
Esempio n. 12
0
 protected override void Draw(TimeHandler time)
 {
     base.Draw(time);
     RenderTarget2D.Clear(ColorUtils.MakeColor(Color.DarkGray));
     RenderTarget2D.FillRectangle(new SharpDX.Mathematics.Interop.RawRectangleF(MX - 5f, MY - 5f, MX + 5f, MY + 5f), SceneColorBrush);
 }