Пример #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            GraphicsDevice.PresentationParameters.MultiSampleCount = 12;
            spriteBatch.Begin();

            DrawManager.Draw_Box(new Vector2(fileOpDraw.Left, fileOpDraw.Top), new Vector2(fileOpDraw.Right, fileOpDraw.Bottom), Color.Black, spriteBatch, 0f, 200);
            DrawManager.Draw_Outline(new Vector2(fileOpDraw.Left, fileOpDraw.Top), new Vector2(fileOpDraw.Right, fileOpDraw.Bottom), Color.White, spriteBatch);

            DrawManager.Draw_Box(new Vector2(patchInfoDraw.Left, patchInfoDraw.Top), new Vector2(patchInfoDraw.Right, patchInfoDraw.Bottom), Color.Black, spriteBatch, 0f, 200);
            DrawManager.Draw_Outline(new Vector2(patchInfoDraw.Left, patchInfoDraw.Top), new Vector2(patchInfoDraw.Right, patchInfoDraw.Bottom), Color.White, spriteBatch);

            DrawManager.Draw_Box(new Vector2(patchDisplayDraw.Left, patchDisplayDraw.Top), new Vector2(patchDisplayDraw.Right, patchDisplayDraw.Bottom), Color.Black, spriteBatch, 0f, 200);
            DrawManager.Draw_Outline(new Vector2(patchDisplayDraw.Left, patchDisplayDraw.Top), new Vector2(patchDisplayDraw.Right, patchDisplayDraw.Bottom), Color.White, spriteBatch);

            DrawManager.Draw_Box(new Vector2(patchTextureDraw.Left, patchTextureDraw.Top), new Vector2(patchTextureDraw.Right, patchTextureDraw.Bottom), Color.Black, spriteBatch, 0f, 200);
            DrawManager.Draw_Outline(new Vector2(patchTextureDraw.Left, patchTextureDraw.Top), new Vector2(patchTextureDraw.Right, patchTextureDraw.Bottom), Color.White, spriteBatch);

            DrawManager.Draw_Box(new Vector2(testDrawing.Left, testDrawing.Top), new Vector2(testDrawing.Right, testDrawing.Bottom), Color.Black, spriteBatch, 0f, 200);
            DrawManager.Draw_Outline(new Vector2(testDrawing.Left, testDrawing.Top), new Vector2(testDrawing.Right, testDrawing.Bottom), Color.White, spriteBatch);

            loadNinepatch.Draw(spriteBatch);
            saveNinepatchAs.Draw(spriteBatch);

            xStart.Draw(spriteBatch);
            xEnd.Draw(spriteBatch);
            yStart.Draw(spriteBatch);
            yEnd.Draw(spriteBatch);
            refreshNinepatch.Draw(spriteBatch);
            scaleX.Draw(spriteBatch);
            scaleY.Draw(spriteBatch);
            scaleXY.Draw(spriteBatch);
            drawContent.Draw(spriteBatch);

            if (curTexture != null)
            {
                spriteBatch.Draw(curTexture, ConversionManager.PToV(patchTextureDraw.Center), null, Color.White, 0f, new Vector2(curTexture.Width / 2, curTexture.Height / 2), 1f, SpriteEffects.None, 0f);
            }

            Vector2 drawPos = ConversionManager.PToV(patchDisplayDraw.Center);

            if (curNinepatch.texture != null)
            {
                computeScale();
                patchScale.Draw(spriteBatch);
                int height = curNinepatch.bottomMostPatch - curNinepatch.topMostPatch;
                int width  = curNinepatch.rightMostPatch - curNinepatch.leftMostPatch;

                if (scaleX.selected)
                {
                    curNinepatch.Draw(spriteBatch, drawPos - curNinepatch.getCenter(width + patchScale.getNumber(), height), width + (patchScale.getNumber()), height);
                    if (drawContent.GetChecked())
                    {
                        curNinepatch.DrawContent(spriteBatch, drawPos - curNinepatch.getCenter(width + patchScale.getNumber(), height), width + (patchScale.getNumber()), height, Color.Red);
                    }
                }
                else if (scaleY.selected)
                {
                    curNinepatch.Draw(spriteBatch, drawPos - curNinepatch.getCenter(width, height + patchScale.getNumber()), width, height + (patchScale.getNumber()));
                    if (drawContent.GetChecked())
                    {
                        curNinepatch.DrawContent(spriteBatch, drawPos - curNinepatch.getCenter(width, height + patchScale.getNumber()), width, height + (patchScale.getNumber()), Color.Red);
                    }
                }
                else if (scaleXY.selected)
                {
                    curNinepatch.Draw(spriteBatch, drawPos - curNinepatch.getCenter(width + patchScale.getNumber(), height + patchScale.getNumber()), width + (patchScale.getNumber()), height + (patchScale.getNumber()));
                    if (drawContent.GetChecked())
                    {
                        curNinepatch.DrawContent(spriteBatch, drawPos - curNinepatch.getCenter(width + patchScale.getNumber(), height + patchScale.getNumber()), width + (patchScale.getNumber()), height + (patchScale.getNumber()), Color.Red);
                    }
                }
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }