コード例 #1
0
ファイル: MG-Test.cs プロジェクト: JBeighel/MDLN.MGTools
        /// <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)
        {
            Color Overlay = new Color(255, 255, 255, Transparency);

            GraphicsDevice.Clear(Color.Blue);

            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);

            switch (FrameNum)
            {
            case 1:
                spriteBatch.Draw(background, GraphicsDevice.Viewport.Bounds, new Rectangle(0, 0, 114, 114), Overlay);
                break;

            case 2:
                spriteBatch.Draw(background, GraphicsDevice.Viewport.Bounds, new Rectangle(115, 0, 114, 114), Overlay);
                break;

            case 3:
                spriteBatch.Draw(background, GraphicsDevice.Viewport.Bounds, new Rectangle(230, 0, 114, 114), Overlay);
                break;

            case 4:
                spriteBatch.Draw(background, GraphicsDevice.Viewport.Bounds, new Rectangle(345, 0, 114, 114), Overlay);
                break;

            case 5:
                spriteBatch.Draw(background, GraphicsDevice.Viewport.Bounds, new Rectangle(0, 115, 114, 114), Overlay);
                break;

            case 6:
                spriteBatch.Draw(background, GraphicsDevice.Viewport.Bounds, new Rectangle(115, 115, 114, 114), Overlay);
                break;
            }

            spriteBatch.Draw(CardBack, new Rectangle(10, 10, CardBack.Width, CardBack.Height), Color.White);

            spriteBatch.Draw(CardImage, new Rectangle(20, 40, 14 * 16, 195 - 40 - 10), Color.White);

            cFont.WriteText(spriteBatch, "Card Name", 20, 20, Color.DarkBlue);
            cFont.WriteText(spriteBatch, "Card Details 1", 195, 20, Color.DarkBlue);
            cFont.WriteText(spriteBatch, "Line 2", 195 + cFont.CharacterHeight, 20, Color.DarkBlue);
            cFont.WriteText(spriteBatch, "Line 3", 195 + (cFont.CharacterHeight * 2), 20, Color.DarkBlue);
            cFont.WriteText(spriteBatch, "Line 4", 195 + (cFont.CharacterHeight * 3), 20, Color.DarkBlue);
            cFont.WriteText(spriteBatch, "Line 5", 195 + (cFont.CharacterHeight * 4), 20, Color.DarkBlue);
            cFont.WriteText(spriteBatch, "Line 6", 195 + (cFont.CharacterHeight * 5), 20, Color.DarkBlue);
            cFont.WriteText(spriteBatch, "Line 7", 195 + (cFont.CharacterHeight * 6), 20, Color.DarkBlue);
            cFont.WriteText(spriteBatch, "Line 8", 195 + (cFont.CharacterHeight * 7), 20, Color.DarkBlue);
            cFont.WriteText(spriteBatch, "Line 9", 195 + (cFont.CharacterHeight * 8), 20, Color.DarkBlue);
            cFont.WriteText(spriteBatch, "Line 10", 195 + (cFont.CharacterHeight * 9), 20, Color.DarkBlue);

            cFont.WriteText(spriteBatch, "Small Text", 5, 50, 300, Color.OrangeRed);
            cFont.WriteText(spriteBatch, "Big Text", 40, 60, 300, Color.OrangeRed);

            if (cShipShow == true)
            {
                if (cShipDir == ShipDirection.Straight)
                {
                    spriteBatch.Draw(cShip, new Vector2(300f, 200f), new Rectangle(0, 0, 200, 200), Color.White);
                }
                else if (cShipDir == ShipDirection.Left)
                {
                    spriteBatch.Draw(cShip, new Vector2(300f, 200f), null, new Rectangle(200, 0, 200, 200), null, 0, null, Color.White, SpriteEffects.FlipHorizontally, 0);
                }
                else                     //right
                {
                    spriteBatch.Draw(cShip, new Vector2(300f, 200f), new Rectangle(200, 0, 200, 200), Color.White);
                }
            }

            spriteBatch.End();

            TestCard.Draw();
            TestCont.Draw();

            NestedCont.Draw();

            cTextTest.Draw();

            DevConsole.Draw();

            base.Draw(gameTime);
        }