示例#1
0
        public void DrawUI(CustomSpriteBatch g)
        {
            g.End();
            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

            GameScreen.DrawBox(g, new Vector2(0, 0), Width / 2, 84, Color.Red);
            int PosX = 0;

            GameScreen.DrawBar(g, sprBarExtraLargeBackground, sprBarExtraLargeHP, new Vector2(PosX + 75, 30), 100, 100);
            GameScreen.DrawBar(g, sprBarExtraLargeBackground, sprBarExtraLargeEN, new Vector2(PosX + 75, 50), 100, 100);
            g.DrawString(fntFinlanderFont, "HP", new Vector2(PosX + 40, 20), Color.Yellow);
            g.DrawStringRightAligned(fntFinlanderFont, "5000/5000", new Vector2(PosX + 242, 17), Color.White);
            g.DrawString(fntFinlanderFont, "EN", new Vector2(PosX + 40, 40), Color.Yellow);
            g.DrawStringRightAligned(fntFinlanderFont, "200/200", new Vector2(PosX + 242, 37), Color.White);
            g.Draw(GameScreen.sprPixel, new Rectangle(PosX + 7, 30, 32, 32), Color.White);

            PosX = Width / 2 + 68;
            GameScreen.DrawBox(g, new Vector2(Width / 2, 0), Width / 2, 84, Color.Blue);
            GameScreen.DrawBar(g, sprBarExtraLargeBackground, sprBarExtraLargeHP, new Vector2(PosX + 75, 30), 100, 100);
            GameScreen.DrawBar(g, sprBarExtraLargeBackground, sprBarExtraLargeEN, new Vector2(PosX + 75, 50), 100, 100);
            g.DrawString(fntFinlanderFont, "HP", new Vector2(PosX + 40, 20), Color.Yellow);
            g.DrawStringRightAligned(fntFinlanderFont, "5000/5000", new Vector2(PosX + 242, 17), Color.White);
            g.DrawString(fntFinlanderFont, "EN", new Vector2(PosX + 40, 40), Color.Yellow);
            g.DrawStringRightAligned(fntFinlanderFont, "200/200", new Vector2(PosX + 242, 37), Color.White);
            g.Draw(GameScreen.sprPixel, new Rectangle(PosX + 7, 30, 32, 32), Color.White);
            g.Draw(sprInfinity, new Vector2((Width - sprInfinity.Width) / 2, 15), Color.White);

            GameScreen.DrawBox(g, new Vector2(0, Constants.Height - AnimationClass.VNBoxHeight), Width, AnimationClass.VNBoxHeight, Color.White);

            g.End();
            g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
        }
        private void DrawMap()
        {
            GraphicsDevice.Clear(Color.Black);

            for (int S = ActiveMap.ListGameScreen.Count - 1; S >= 0; --S)
            {
                if (ActiveMap.Alive)
                {
                    ActiveMap.BeginDraw(g);
                }
            }

            GraphicsDevice.SetRenderTarget(null);
            g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);

            if (ActiveMap.ListTileSet.Count > 0)
            {
                ActiveMap.Draw(g);
            }

            g.End();
            g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);

            ActiveMap.EndDraw(g);
            g.End();
        }
示例#3
0
        public override void BeginDraw(CustomSpriteBatch g)
        {
            for (int L = 0; L < ListAnimationLayer.Count; L++)
            {
                var ActiveLayer = ListAnimationLayer[L];

                for (int A = 0; A < ActiveLayer.ListVisibleObject.Count; A++)
                {
                    ActiveLayer.ListVisibleObject[A].BeginDraw(g);
                }
            }

            g.End();

            if (ActiveCharacter != null && ActiveCharacter.IsAnimated)
            {
                ActiveCharacter.ActiveAnimation.BeginDraw(g);
            }

            for (int L = 0; L < ListAnimationLayer.Count; L++)
            {
                if (ListAnimationLayer[L].renderTarget.Width != GraphicsDevice.PresentationParameters.BackBufferWidth ||
                    ListAnimationLayer[L].renderTarget.Height != GraphicsDevice.PresentationParameters.BackBufferHeight)
                {
                    ListAnimationLayer[L].renderTarget = new RenderTarget2D(
                        GraphicsDevice,
                        GraphicsDevice.PresentationParameters.BackBufferWidth,
                        GraphicsDevice.PresentationParameters.BackBufferHeight);
                }

                GraphicsDevice.SetRenderTarget(ListAnimationLayer[L].renderTarget);
                GraphicsDevice.Clear(Color.Transparent);

                if (ListAnimationLayer[L].LayerBlendState == AnimationLayer.LayerBlendStates.Add)
                {
                    g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, ListAnimationLayer[L].SamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, TransformationMatrix);
                }
                else if (ListAnimationLayer[L].LayerBlendState == AnimationLayer.LayerBlendStates.Substract)
                {
                    g.Begin(SpriteSortMode.BackToFront, NegativeBlendState, ListAnimationLayer[L].SamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, TransformationMatrix);
                }

                for (int M = 0; M < ListAnimationLayer[L].ListActiveMarker.Count; M++)
                {
                    if (ListAnimationLayer[L].ListActiveMarker[M].Sprite != null)
                    {
                        g.Draw(ListAnimationLayer[L].ListActiveMarker[M].Sprite, new Vector2(ListAnimationLayer[L].ListActiveMarker[M].Position.X, ListAnimationLayer[L].ListActiveMarker[M].Position.Y),
                               null, Color.White, 0, Vector2.Zero, ListAnimationLayer[L].ListActiveMarker[M].ScaleFactor, SpriteEffects.None, 1);
                    }
                }

                g.End();

                DrawLayer(g, ListAnimationLayer[L], false, null);
            }

            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
        }
示例#4
0
        public override void Draw(CustomSpriteBatch g)
        {
            g.End();
            g.Begin();
            g.Draw(sprBackground, Vector2.Zero, Color.White);

            int LeftSideWidth = (int)(Constants.Width * 0.7);
            int TopSectionHeight = (int)(Constants.Height * 0.1);
            int MiddleSectionY = TopSectionHeight;
            int MiddleSectionHeight = (int)(Constants.Height * 0.6);
            int RoomSectionY = (int)(MiddleSectionY + MiddleSectionHeight * 0.2);
            int RoomSectionHeight = MiddleSectionHeight - (RoomSectionY - MiddleSectionY);
            int BottomSectionY = MiddleSectionY + MiddleSectionHeight;

            //Left side
            DrawBox(g, new Vector2(0, 0), LeftSideWidth, TopSectionHeight, Color.White);
            g.DrawString(fntArial12, "Player 1", new Vector2(10, 15), Color.White);
            g.DrawString(fntArial12, "Player 2", new Vector2(110, 15), Color.White);
            g.DrawString(fntArial12, "Player 3", new Vector2(210, 15), Color.White);
            g.DrawString(fntArial12, "Player 4", new Vector2(310, 15), Color.White);
            DrawBox(g, new Vector2(0, MiddleSectionY), LeftSideWidth, MiddleSectionHeight - RoomSectionHeight, Color.White);
            DrawBox(g, new Vector2(0, RoomSectionY), LeftSideWidth, RoomSectionHeight, Color.White);
            DrawBox(g, new Vector2(0, BottomSectionY), LeftSideWidth, Constants.Height - BottomSectionY, Color.White);

            int RightSideWidth = Constants.Width - LeftSideWidth;
            int PlayerInfoHeight = (int)(Constants.Height * 0.2);
            int PlayerListY = PlayerInfoHeight;
            int PlayerListHeight = (int)(Constants.Height * 0.6);
            int InventoryShopListY = PlayerListY + PlayerListHeight;
            int InventoryShopListHeight = Constants.Height - InventoryShopListY;

            //Right side
            DrawBox(g, new Vector2(LeftSideWidth, 0), RightSideWidth, PlayerListY, Color.White);
            DrawBox(g, new Vector2(LeftSideWidth, PlayerListY), RightSideWidth, PlayerListHeight, Color.White);
            DrawBox(g, new Vector2(LeftSideWidth, InventoryShopListY), RightSideWidth, InventoryShopListHeight, Color.White);
            g.DrawString(fntArial12, "Inventory*Shop", new Vector2(LeftSideWidth + 5, InventoryShopListY + 5), Color.White);


            g.DrawString(fntArial12, "Lv." + PlayerManager.OnlinePlayerLevel, new Vector2(610, 17), Color.White);
            g.DrawString(fntArial12, PlayerManager.OnlinePlayerName, new Vector2(670, 15), Color.White);

            g.End();
            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

            DrawRooms(g);
            if (OnlineCommunicationClient != null)
            {
                ChatHelper.DrawChat(g, fntArial12, OnlineCommunicationClient.Chat, ChatInput);
            }
            DrawPlayers(g);

            foreach (IUIElement ActiveButton in ArrayMenuButton)
            {
                ActiveButton.Draw(g);
            }
        }
            public override void Draw(CustomSpriteBatch g)
            {
                g.End();
                g.Begin(SpriteSortMode.Immediate, null);
                float YOffset = 0;
                int   XPos    = 320;

                if (TextAlign == TextAligns.Left)
                {
                    XPos -= TextMaxWidthInPixel / 2;
                    foreach (string ActiveLine in ListText)
                    {
                        GameScreen.DrawText(g, ActiveLine, new Microsoft.Xna.Framework.Vector2(XPos, 630 + Progression + YOffset), Microsoft.Xna.Framework.Color.White);
                        YOffset += GameScreen.fntShadowFont.LineSpacing;
                    }
                }
                else if (TextAlign == TextAligns.Right)
                {
                    XPos += TextMaxWidthInPixel / 2;
                    foreach (string ActiveLine in ListText)
                    {
                        GameScreen.DrawTextRightAligned(g, ActiveLine, new Microsoft.Xna.Framework.Vector2(XPos, 630 + Progression + YOffset), Microsoft.Xna.Framework.Color.White);
                        YOffset += GameScreen.fntShadowFont.LineSpacing;
                    }
                }
                else if (TextAlign == TextAligns.Center)
                {
                    foreach (string ActiveLine in ListText)
                    {
                        GameScreen.DrawTextMiddleAligned(g, ActiveLine, new Microsoft.Xna.Framework.Vector2(XPos, 630 + Progression + YOffset), Microsoft.Xna.Framework.Color.White);
                        YOffset += GameScreen.fntShadowFont.LineSpacing;
                    }
                }
                else if (TextAlign == TextAligns.Justified)
                {
                    XPos -= TextMaxWidthInPixel / 2;

                    foreach (string ActiveLine in ListText)
                    {
                        float TextWidth   = GameScreen.fntShadowFont.MeasureString(ActiveLine).X;
                        float ScaleFactor = TextMaxWidthInPixel / TextWidth;
                        for (int C = 0; C < ActiveLine.Length; ++C)
                        {
                            float Offset = GameScreen.fntShadowFont.MeasureString(ActiveLine.Substring(0, C)).X;
                            GameScreen.DrawText(g, ActiveLine[C].ToString(), new Microsoft.Xna.Framework.Vector2(XPos + Offset * ScaleFactor, 630 + Progression + YOffset), Microsoft.Xna.Framework.Color.White);
                        }
                        YOffset += GameScreen.fntShadowFont.LineSpacing;
                    }
                }
                g.End();
                g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            }
示例#6
0
            public override void Draw(CustomSpriteBatch g)
            {
                g.End();
                g.Begin(SpriteSortMode.Immediate, null);

                float XPos = 320;
                float YPos = 400 + Progression;

                TextHelper.DrawTextMultiline(g, ListText, _TextAlign, XPos, YPos, TextMaxWidthInPixel);

                g.End();
                g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
            }
示例#7
0
        public void Draw(CustomSpriteBatch g)
        {
            if (ListBackgrounds.Count > 0)
            {
                g.End();
                for (int B = 0; B < ListBackgrounds.Count; B++)
                {
                    ListBackgrounds[B].Draw(g, Constants.Width, Constants.Height);
                }
                g.Begin();
            }

            for (int X = ArrayTile.GetLength(0) - 1; X >= 0; --X)
            {
                for (int Y = ArrayTile.GetLength(1) - 1; Y >= 0; --Y)
                {
                    g.Draw(ListTileSet[ArrayTile[X, Y].Tileset],
                           new Vector2((X - CameraPosition.X) * TileSize.X, (Y - CameraPosition.Y) * TileSize.Y),
                           ArrayTile[X, Y].Origin, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, Depth);
                }
            }

            if (ListForegrounds.Count > 0)
            {
                g.End();
                for (int F = 0; F < ListForegrounds.Count; F++)
                {
                    ListForegrounds[F].Draw(g, Constants.Width, Constants.Height);
                }
                g.Begin();
            }

            if (ShowUnits)
            {
                DrawDrawablePoints(g);

                DrawPlayers(g);

                if (ShowUnits && MapOverlay != null)
                {
                    MapOverlay.Draw(g);

                    DrawNightOverlay(g);

                    MapOverlay.EndDraw(g);
                }

                DrawCursor(g);
            }
        }
示例#8
0
        public void Draw(CustomSpriteBatch g)
        {
            BlendState blendState = new BlendState();

            blendState.AlphaDestinationBlend = Blend.SourceAlpha;
            blendState.ColorDestinationBlend = Blend.SourceColor;
            blendState.AlphaSourceBlend      = Blend.Zero;
            blendState.ColorSourceBlend      = Blend.Zero;

            g.End();
            g.Begin(SpriteSortMode.Deferred, blendState);
            g.Draw(renderTarget, Vector2.Zero, Color.White);
            g.End();
            g.Begin();
        }
        public override void Draw(CustomSpriteBatch g)
        {
            g.End();
            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            g.DrawString(fntFinlanderFont, "Unit Parts", new Vector2(10, 10), Color.White);

            switch (Stage)
            {
            case -1:
                DrawMenu(g);
                break;

            case 0:
                DrawPartMenu(g, false);
                break;

            case 1:
                DrawPartMenu(g, true);
                break;

            case 2:
                DrawPartLinkedUnits(g);
                break;
            }
        }
示例#10
0
        public override void Draw(CustomSpriteBatch g)
        {
            g.Draw(sprBackground, Vector2.Zero, Color.White);
            if (RoomType == RoomInformations.RoomTypeMission)
            {
                g.Draw(sprLicenseAll, new Rectangle(572, 16, 24, 24), new Rectangle(1 * 24, 0, 24, 24), Color.White);
            }
            else
            {
                g.Draw(sprTitleBattle, new Vector2(160, 16), Color.White);
                g.Draw(sprLicenseAll, new Rectangle(572, 16, 24, 24), new Rectangle(2 * 24, 0, 24, 24), Color.White);
            }

            g.DrawString(fntArial12, "Lv." + PlayerManager.OnlinePlayerLevel, new Vector2(610, 17), Color.White);
            g.DrawString(fntArial12, PlayerManager.OnlinePlayerName, new Vector2(670, 15), Color.White);

            g.End();
            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

            DrawRooms(g);
            if (OnlineCommunicationClient != null)
            {
                ChatHelper.DrawChat(g, sprTabChat, fntArial12, OnlineCommunicationClient.Chat, ChatInput);
            }
            DrawPlayers(g);

            foreach (IUIElement ActiveButton in ArrayMenuButton)
            {
                ActiveButton.Draw(g);
            }
        }
示例#11
0
 public override void Draw(CustomSpriteBatch g)
 {
     g.End();
     aspectRatio = GraphicsDevice.Viewport.AspectRatio;
     GraphicsDevice.Clear(Color.CornflowerBlue);
     // Copy any parent transforms.
     Matrix[] transforms = new Matrix[MyModel.Bones.Count];
     MyModel.CopyAbsoluteBoneTransformsTo(transforms);
     GraphicsDevice.DepthStencilState = new DepthStencilState()
     {
         DepthBufferEnable = true
     };
     // Draw the model. A model can have multiple meshes, so loop.
     foreach (ModelMesh mesh in MyModel.Meshes)
     {
         // This is where the mesh orientation is set, as well
         // as our camera and projection.
         foreach (BasicEffect effect in mesh.Effects)
         {
             effect.EnableDefaultLighting();
             effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(modelRotation) * Matrix.CreateTranslation(modelPosition);
             effect.View  = Matrix.CreateLookAt(cameraPosition,
                                                Vector3.Zero, Vector3.Up);
             effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                 MathHelper.ToRadians(45.0f), aspectRatio,
                 1.0f, 10000.0f);
         }
         // Draw the mesh, using the effects set above.
         mesh.Draw();
     }
     g.Begin();
 }
        public void DrawHUD(CustomSpriteBatch g, bool IsInEditMode, bool ShowBorderBoxes, bool ShowNextPositions)
        {
            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise);

            DrawBox(g, new Vector2(0, 0), Width / 2, 84, Color.Red);
            int PosX = 0;

            DrawBar(g, sprBarExtraLargeBackground, sprBarExtraLargeHP, new Vector2(PosX + 75, 30), 100, 100);
            DrawBar(g, sprBarExtraLargeBackground, sprBarExtraLargeEN, new Vector2(PosX + 75, 50), 100, 100);
            g.DrawString(fntFinlanderFont, "HP", new Vector2(PosX + 40, 20), Color.Yellow);
            g.DrawStringRightAligned(fntFinlanderFont, "5000/5000", new Vector2(PosX + 242, 17), Color.White);
            g.DrawString(fntFinlanderFont, "EN", new Vector2(PosX + 40, 40), Color.Yellow);
            g.DrawStringRightAligned(fntFinlanderFont, "200/200", new Vector2(PosX + 242, 37), Color.White);
            g.Draw(sprPixel, new Rectangle(PosX + 7, 30, 32, 32), Color.White);

            PosX = Width / 2 + 68;
            DrawBox(g, new Vector2(Width / 2, 0), Width / 2, 84, Color.Blue);
            DrawBar(g, sprBarExtraLargeBackground, sprBarExtraLargeHP, new Vector2(PosX + 75, 30), 100, 100);
            DrawBar(g, sprBarExtraLargeBackground, sprBarExtraLargeEN, new Vector2(PosX + 75, 50), 100, 100);
            g.DrawString(fntFinlanderFont, "HP", new Vector2(PosX + 40, 20), Color.Yellow);
            g.DrawStringRightAligned(fntFinlanderFont, "5000/5000", new Vector2(PosX + 242, 17), Color.White);
            g.DrawString(fntFinlanderFont, "EN", new Vector2(PosX + 40, 40), Color.Yellow);
            g.DrawStringRightAligned(fntFinlanderFont, "200/200", new Vector2(PosX + 242, 37), Color.White);
            g.Draw(sprPixel, new Rectangle(PosX + 7, 30, 32, 32), Color.White);
            g.Draw(sprInfinity, new Vector2((Width - sprInfinity.Width) / 2, 15), Color.White);

            DrawBox(g, new Vector2(0, Height - VNBoxHeight), Width, VNBoxHeight, Color.White);

            g.End();
        }
示例#13
0
        /// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            if (DrawScripts)
            {
                g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

                // Clear to the default control background color.
                Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B);
                GraphicsDevice.Clear(backColor);
                DrawScriptEditor();
            }
            else
            {
                ActiveVisualNovel.Update(new GameTime());
                ActiveVisualNovel.BeginDraw(g);

                GraphicsDevice.SetRenderTarget(null);
                g.Begin(SpriteSortMode.Deferred, null);

                // Clear to the default control background color.
                Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B);
                GraphicsDevice.Clear(backColor);

                ActiveVisualNovel.Draw(g);
            }

            g.End();

            Thread.Sleep(13);
        }
示例#14
0
 public override void Draw(CustomSpriteBatch g)
 {
     g.End();
     g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
     DrawMenu(g);
     g.DrawString(fntFinlanderFont, "Pilot Status", new Vector2(120, 10), Color.White);
 }
示例#15
0
        public override void Draw(CustomSpriteBatch g)
        {
            g.End();
            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            switch (Stage)
            {
            case 0:
                DrawMenu(g);
                g.DrawString(fntFinlanderFont, "Pilot Status", new Vector2(120, 10), Color.White);
                break;

            case 1:
                Character ActiveCharacter = ListPresentCharacter[PilotChoice];

                DrawBox(g, new Vector2(10, 20), 104, 150, Color.White);
                g.Draw(sprPixel, new Rectangle(20, 13, 84, 84), Color.Gray);
                g.Draw(sprPixel, new Rectangle(22, 15, 80, 80), Color.White);
                g.Draw(ActiveCharacter.sprPortrait, new Vector2(22, 15), Color.White);
                DrawText(g, ActiveCharacter.Name, new Vector2(20, 100), Color.Yellow);
                DrawText(g, "Lv", new Vector2(20, 120), Color.Yellow);
                DrawText(g, ActiveCharacter.Level.ToString(), new Vector2(60, 120), Color.White);
                DrawText(g, "SP", new Vector2(20, 140), Color.Yellow);
                DrawText(g, ActiveCharacter.SP.ToString(), new Vector2(60, 140), Color.White);

                DrawBox(g, new Vector2(10, 180), 150, 100, Color.White);
                DrawText(g, "Current PP", new Vector2(20, 190), Color.Yellow);
                DrawTextRightAligned(g, ActiveCharacter.PilotPoints.ToString(), new Vector2(150, 190), Color.White);
                DrawText(g, "Skill PP Cost", new Vector2(20, 220), Color.Yellow);
                DrawTextRightAligned(g, ActiveCharacter.PilotPoints.ToString(), new Vector2(150, 220), Color.White);
                DrawText(g, "Remaining PP", new Vector2(20, 250), Color.Yellow);
                DrawTextRightAligned(g, ActiveCharacter.PilotPoints.ToString(), new Vector2(150, 250), Color.White);

                DrawBox(g, new Vector2(120, 10), 510, 100, Color.White);
                DrawText(g, "Skill Description", new Vector2(125, 15), Color.Yellow);
                DrawBox(g, new Vector2(170, 120), 200, 160, Color.White);
                DrawText(g, "Pilot Skills", new Vector2(180, 125), Color.Yellow);
                for (int S = 0; S < 6; ++S)
                {
                    if (S < ActiveCharacter.ArrayPilotSkill.Length)
                    {
                        DrawText(g, ActiveCharacter.ArrayPilotSkill[S].Name, new Vector2(180, 150 + S * 20), Color.White);
                    }
                    else
                    {
                        DrawText(g, "-------", new Vector2(180, 150 + S * 20), Color.White);
                    }
                }
                DrawBox(g, new Vector2(375, 120), 255, 160, Color.White);
                DrawText(g, "Available Skills", new Vector2(385, 125), Color.Yellow);
                DrawTextRightAligned(g, "1/4", new Vector2(530, 125), Color.LightBlue);
                DrawTextRightAligned(g, "Required PP", new Vector2(620, 125), Color.Yellow);
                for (int S = 0; S < 6; ++S)
                {
                    DrawText(g, "-------", new Vector2(385, 150 + S * 20), Color.White);
                    DrawTextRightAligned(g, "0", new Vector2(620, 150 + S * 20), Color.White);
                }
                break;
            }
        }
示例#16
0
 public override void Draw(CustomSpriteBatch g)
 {
     g.End();
     //Move everything relative to the camera position.
     g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Matrix.CreateTranslation(new Vector3(-CameraPos.X, -CameraPos.Y, 0)));
     //Draw the FightSprite
     for (int i = 0; i < ListFightSprite.Count; i++)
     {
         g.Draw(ListTexture[ListFightSprite[i].SpriteIndex], ListFightSprite[i].Position, ListFightSprite[i].Origin, Color.White, ListFightSprite[i].Angle, ListFightSprite[i].RotationPoint, 1f, SpriteEffects.None, 0);
     }
     //Replace the drawing surface to a normal position.
     g.End();
     g.Begin();
     //Draw the text.
     g.Draw(sprRectangle, new Rectangle(0, Constants.Height - 150, Constants.Width, 150), Color.DarkBlue);
     g.DrawString(fntArial, TextLines[TextIndex], new Vector2(10, Constants.Height - 150), Color.White);
 }
        public override void Draw(CustomSpriteBatch g)
        {
            if (ActiveAnimationBackground != null)
            {
                g.End();
                ActiveAnimationBackground.Draw(g, Constants.Width, Constants.Height);
                g.Begin();
            }

            for (int A = 0; A < ListAnimationLayer.BasicLayerCount; A++)
            {
                if (ListAnimationLayer[A].ListPolygonCutter.Count > 0)
                {
                    PolygonEffect.Texture = ListAnimationLayer[A].renderTarget;
                    PolygonEffect.CurrentTechnique.Passes[0].Apply();

                    GraphicsDevice.RasterizerState = RasterizerState.CullNone;

                    for (int P = 0; P < ListAnimationLayer[A].ListPolygonCutter.Count; P++)
                    {
                        ListAnimationLayer[A].ListPolygonCutter[P].Draw(g, false);
                    }
                }
                else
                {
                    if (IsLeftAttacking)
                    {
                        g.Draw(ListAnimationLayer[A].renderTarget, new Rectangle(Constants.Width / 2, Constants.Height / 2, Constants.Width, Constants.Height), null, Color.White, 0, new Vector2(ScreenWidth / 2, ScreenHeight / 2), SpriteEffects.FlipHorizontally, 0);
                    }
                    else
                    {
                        g.Draw(ListAnimationLayer[A].renderTarget, new Rectangle(0, 0, Constants.Width, Constants.Height), null, Color.White);
                    }
                }

                if (A == 0 && ActiveAnimationForeground != null)
                {
                    if (ActiveAnimationForeground != null)
                    {
                        g.End();
                        ActiveAnimationForeground.Draw(g, Constants.Width, Constants.Height);
                        g.Begin();
                    }
                }
            }
        }
示例#18
0
        public void Draw(CustomSpriteBatch g)
        {
            PolygonEffect.View = Camera.View;
            g.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            g.GraphicsDevice.SamplerStates[0]  = SamplerState.PointClamp;
            g.GraphicsDevice.RasterizerState   = RasterizerState.CullCounterClockwise;

            foreach (KeyValuePair <Texture2D, List <Tile3D> > ActiveTileSet in DicTile3D)
            {
                PolygonEffect.Texture = ActiveTileSet.Key;
                PolygonEffect.CurrentTechnique.Passes[0].Apply();

                foreach (Tile3D ActiveTile in ActiveTileSet.Value)
                {
                    ActiveTile.Draw(g.GraphicsDevice);
                }
            }

            PolygonEffect.Texture = sprCursor;
            PolygonEffect.CurrentTechnique.Passes[0].Apply();

            Cursor.Draw(g.GraphicsDevice);

            g.End();
            GameScreen.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            for (int P = 0; P < Map.ListPlayer.Count; P++)
            {
                //If the selected unit have the order to move, draw the possible positions it can go to.
                for (int U = 0; U < Map.ListPlayer[P].ListSquad.Count; U++)
                {//If it's dead, don't draw it unless it's an event unit.
                    if ((Map.ListPlayer[P].ListSquad[U].CurrentLeader == null && !Map.ListPlayer[P].ListSquad[U].IsEventSquad) || Map.ListPlayer[P].ListSquad[U].IsDead)
                    {
                        continue;
                    }

                    Color UnitColor;
                    if (Constants.UnitRepresentationState == Constants.UnitRepresentationStates.Colored)
                    {
                        UnitColor = Map.ListPlayer[P].Color;
                    }
                    else
                    {
                        UnitColor = Color.White;
                    }

                    Map.ListPlayer[P].ListSquad[U].Unit3D.SetViewMatrix(Camera.View);

                    Map.ListPlayer[P].ListSquad[U].Unit3D.SetPosition(
                        -Map.MapSize.X / 2 + 0.5f + Map.ListPlayer[P].ListSquad[U].Position.X,
                        Radius,
                        -Map.MapSize.Y / 2 + 0.5f + Map.ListPlayer[P].ListSquad[U].Y);

                    Map.ListPlayer[P].ListSquad[U].Unit3D.Draw(GameScreen.GraphicsDevice);
                }
            }
            g.Begin();
        }
示例#19
0
        public void InitScript(MapScript NewScript)
        {
            RenderTarget2D ScriptBuffer = new RenderTarget2D(GraphicsDevice, NewScript.ScriptSize.Width, NewScript.ScriptSize.Height);

            GraphicsDevice.SetRenderTarget(ScriptBuffer);
            GraphicsDevice.Clear(Color.Transparent);
            g.Begin();

            g.Draw(imgScriptTopLeft, Vector2.Zero, Color.White);
            g.Draw(imgScriptMiddleLeft, new Rectangle(0, imgScriptTopLeft.Height, 1, NewScript.ScriptSize.Height - imgScriptTopMiddle.Height - imgScriptBottomMiddle.Height - 1), Color.White);
            g.Draw(imgScriptBottomLeft, new Vector2(0, NewScript.ScriptSize.Height - imgScriptBottomLeft.Height), Color.White);

            g.Draw(imgScriptTopMiddle, new Rectangle(imgScriptTopLeft.Width, 0, NewScript.ScriptSize.Width - imgScriptTopRight.Width - 1, imgScriptTopMiddle.Height), Color.White);

            g.Draw(imgScriptMiddleMiddle, new Rectangle(imgScriptMiddleLeft.Width,
                                                        imgScriptTopLeft.Height,
                                                        NewScript.ScriptSize.Width - imgScriptMiddleLeft.Width - imgScriptMiddleRight.Width,
                                                        NewScript.ScriptSize.Height - imgScriptTopMiddle.Height - imgScriptBottomMiddle.Height), Color.White);

            g.Draw(imgScriptBottomMiddle, new Rectangle(imgScriptBottomLeft.Width,
                                                        NewScript.ScriptSize.Height - imgScriptBottomMiddle.Height,
                                                        NewScript.ScriptSize.Width - imgScriptBottomLeft.Width - imgScriptBottomRight.Width,
                                                        imgScriptBottomMiddle.Height), Color.White);

            g.Draw(imgScriptTopRight, new Vector2(NewScript.ScriptSize.Width - imgScriptTopRight.Width, 0), Color.White);
            g.Draw(imgScriptMiddleRight, new Rectangle(NewScript.ScriptSize.Width - imgScriptMiddleRight.Width, imgScriptTopRight.Height, 1, NewScript.ScriptSize.Height - imgScriptTopMiddle.Height - imgScriptBottomMiddle.Height), Color.White);
            g.Draw(imgScriptBottomRight, new Vector2(NewScript.ScriptSize.Width - imgScriptBottomRight.Width, NewScript.ScriptSize.Height - imgScriptBottomRight.Height), Color.White);

            g.DrawString(fntScriptName, NewScript.ToString(), Vector2.Zero, Color.Black);

            for (int T = NewScript.ArrayNameTrigger.Length - 1; T >= 0; --T)
            {
                g.DrawString(fntScriptName, NewScript.ArrayNameTrigger[T], new Vector2(0, 15 + T * 12), Color.Black);
            }
            for (int E = NewScript.ArrayNameCondition.Length - 1; E >= 0; --E)
            {
                g.DrawString(fntScriptName, NewScript.ArrayNameCondition[E], new Vector2(
                                 NewScript.ScriptSize.Width - 5 - fntScriptName.MeasureString(NewScript.ArrayNameCondition[E]).X,
                                 NewScript.ScriptSize.Height - NewScript.ArrayNameCondition.Length * 12 - 4 + E * 12), Color.Black);
            }
            g.End();

            NewScript.ScriptTexture = ScriptBuffer;
            GraphicsDevice.SetRenderTarget(null);
        }
示例#20
0
        public void BeginDraw(CustomSpriteBatch g)
        {
            g.End();
            g.GraphicsDevice.SetRenderTarget(renderTarget);
            g.GraphicsDevice.Clear(Color.White);
            g.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

            DrawSurface(g);
        }
        public override void BeginDraw(CustomSpriteBatch g)
        {
            g.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            g.GraphicsDevice.Clear(Color.Black);

            Map.GlobalSorcererStreetBattleContext.InvaderCard.BeginDraw(g);
            Map.GlobalSorcererStreetBattleContext.DefenderCard.BeginDraw(g);

            g.End();
        }
        public virtual void DrawEditor(CustomSpriteBatch g, int ScreenWidth, int ScreenHeight, bool IsInEditMode, bool ShowBorderBoxes, bool ShowNextPositions)
        {
            GraphicsDevice.SetRenderTarget(null);
            GraphicsDevice.Clear(Color.White);

            if (ActiveAnimationBackground != null)
            {
                ActiveAnimationBackground.Draw(g, ScreenWidth, ScreenHeight);
            }

            g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise);

            for (int L = 0; L < ListAnimationLayer.Count; L++)
            {
                AnimationLayer ActiveLayer = ListAnimationLayer[L];

                if (ActiveLayer.ListPolygonCutter.Count > 0)
                {
                    g.End();
                    g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise);

                    PolygonEffect.Texture = ActiveLayer.renderTarget;
                    PolygonEffect.CurrentTechnique.Passes[0].Apply();

                    GraphicsDevice.RasterizerState = RasterizerState.CullNone;

                    for (int P = 0; P < ActiveLayer.ListPolygonCutter.Count; P++)
                    {
                        ActiveLayer.ListPolygonCutter[P].Draw(g, IsInEditMode);
                    }
                }

                if (IsInEditMode || ActiveLayer.ListPolygonCutter.Count <= 0)
                {
                    g.Draw(ActiveLayer.renderTarget, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.1f);
                }
            }

            g.End();

            //Draw HUD
            DrawOverlay(g);
        }
        public override void BeginDraw(CustomSpriteBatch g)
        {
            g.End();
            Matrix OriginalMatrix = TransformationMatrix;

            while (ListRenderTarget.Count < ListAnimationLayer.BasicLayerCount)
            {
                ListRenderTarget.Add(new RenderTarget2D(
                                         GraphicsDevice,
                                         GraphicsDevice.PresentationParameters.BackBufferWidth,
                                         GraphicsDevice.PresentationParameters.BackBufferHeight));
            }

            for (int L = 0; L < ListAnimationLayer.BasicLayerCount; L++)
            {
                if (ListRenderTarget[L].Width != GraphicsDevice.PresentationParameters.BackBufferWidth ||
                    ListRenderTarget[L].Height != GraphicsDevice.PresentationParameters.BackBufferHeight)
                {
                    ListRenderTarget[L] = new RenderTarget2D(
                        GraphicsDevice,
                        GraphicsDevice.PresentationParameters.BackBufferWidth,
                        GraphicsDevice.PresentationParameters.BackBufferHeight);
                }

                GraphicsDevice.SetRenderTarget(ListRenderTarget[L]);
                GraphicsDevice.Clear(Color.Transparent);

                DrawLayer(g, ListAnimationLayer[L], false, null);

                for (int A = 0; A < ListActivePartialAnimation.Count; A++)
                {
                    TransformationMatrix = ListActivePartialAnimation[A].TransformationMatrix;

                    if (L < ListActivePartialAnimation[A].ListAnimationLayer.BasicLayerCount)
                    {
                        DrawLayer(g, ListActivePartialAnimation[A].ListAnimationLayer[L], false, null);
                    }
                }
            }

            for (int A = 0; A < ListActivePartialAnimation.Count; A++)
            {
                TransformationMatrix = ListActivePartialAnimation[A].TransformationMatrix;

                for (int L = ListAnimationLayer.BasicLayerCount; L < ListActivePartialAnimation[A].ListAnimationLayer.BasicLayerCount; L++)
                {
                    DrawLayer(g, ListActivePartialAnimation[A].ListAnimationLayer[L], false, null);
                }
            }

            TransformationMatrix = OriginalMatrix;

            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
        }
示例#24
0
        /// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            // Clear to the default control background color.
            Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B);

            GraphicsDevice.Clear(backColor);

            if (OldWidth != ClientSize.Width || OldHeight != ClientSize.Height)
            {
                Matrix Projection      = Matrix.CreateOrthographicOffCenter(0, ClientSize.Width, ClientSize.Height, 0, 0, 1);
                Matrix HalfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0);

                PolygonEffect.Projection = HalfPixelOffset * Projection;

                OldWidth  = ClientSize.Width;
                OldHeight = ClientSize.Height;
            }

            g.Begin();

            if (EditOrigin && sprSource != null)
            {
                g.Draw(sprSource, new Vector2(0, 0), Color.White);
            }
            else
            {
                PolygonEffect.Texture = sprSource;
                PolygonEffect.CurrentTechnique.Passes[0].Apply();
                GraphicsDevice.RasterizerState = RasterizerState.CullNone;

                foreach (Polygon ActivePolygon in ListPolygon)
                {
                    ActivePolygon.Draw(GraphicsDevice);
                }
            }

            //Draw selected polygons.
            PolygonEffect.Texture = sprRedTexture;
            PolygonEffect.CurrentTechnique.Passes[0].Apply();
            GraphicsDevice.RasterizerState = RasterizerState.CullNone;
            foreach (Polygon ActivePolygon in ListSelectedPolygon)
            {
                ActivePolygon.Draw(GraphicsDevice);
            }

            DrawPolygons(g);

            if (SplittingPoint1 != SplittingPoint2)
            {
                DrawLine(g, SplittingPoint1, SplittingPoint2, Color.Black);
            }

            g.End();
        }
        public override void Draw(CustomSpriteBatch g, int ScreenWidth, int ScreenHeight)
        {
            g.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);

            for (int B = ListBackground.Count - 1; B >= 0; --B)
            {
                ListBackground[B].Draw(g, CameraPosition.X, CameraPosition.Y, ScreenWidth, ScreenHeight);
            }

            g.End();
        }
示例#26
0
        public override void Draw(CustomSpriteBatch g)
        {
            g.End();
            g.Begin(SpriteSortMode.FrontToBack, BlendState.Opaque, SamplerState.LinearWrap,
                    DepthStencilState.Default, RasterizerState.CullNone);

            g.Draw(Background, Vector2.Zero, new Rectangle(0, 0, Constants.Width, Constants.Height), Color.White);
            g.End();
            g.Begin();
            g.Draw(TopBar, new Vector2(0, 25), Color.White);
            g.Draw(Description, new Vector2(410, 62), Color.White);

            for (int C = 0; C < ListChoice.Count; C++)
            {
                g.Draw(Choice, new Vector2(30, 62 + C * 99), Color.White);
                g.DrawString(fntTitle, ListChoice[C].Title, new Vector2(35, 65 + C * 99), Color.White);
                g.DrawString(fntTitle, ListChoice[C].Summary, new Vector2(35, 90 + C * 99), Color.White);
            }

            g.Draw(Highlight, new Vector2(30, 85 + CursorSelection * 99), Color.White);
        }
示例#27
0
        public override void Draw(CustomSpriteBatch g)
        {
            g.Draw(BackgroundLeft, new Rectangle(0, 0, Constants.Width / 2, Constants.Height), Color.White);
            g.Draw(BackgroundRight, new Rectangle(Constants.Width / 2, 0, Constants.Width / 2, Constants.Height), Color.White);

            DrawLine(g, new Vector2(Constants.Width / 2, 0), new Vector2(Constants.Width / 2, Constants.Height), Color.Black, 3);
            ActiveUnitAnimation.Draw(g);
            EnemyUnitAnimation.Draw(g);

            g.End();
            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
        }
示例#28
0
        public override void Draw(CustomSpriteBatch g)
        {
            g.End();
            g.Begin(SpriteSortMode.Deferred, null);

            if (IsOnTop)
            {
                if (ListActionMenuChoice.HasMainPanel)
                {
                    ListActionMenuChoice.Last().Draw(g);
                }
            }
        }
示例#29
0
        public override void Draw(CustomSpriteBatch g)
        {
            g.End();
            g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            g.Draw(sprMapMenuBackground, new Vector2(0, 0), Color.White);
            g.DrawString(fntFinlanderFont, "Data", new Vector2(120, 10), Color.White);
            DrawBox(g, new Vector2(10, 45), 420, 300, Color.White);
            g.DrawString(fntFinlanderFont, "Save", new Vector2(20, 50), Color.White);
            g.DrawString(fntFinlanderFont, "Load", new Vector2(20, 80), Color.White);
            g.DrawString(fntFinlanderFont, "Exit", new Vector2(20, 110), Color.White);

            g.Draw(sprPixel, new Rectangle(17, 52 + CursorIndex * 30, 100, 30), Color.FromNonPremultiplied(255, 255, 255, 127));
        }
示例#30
0
 public override void Draw(CustomSpriteBatch g)
 {
     g.End();
     g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
     if (Stage == 0)
     {
         DrawMenu(g);
         g.DrawString(fntFinlanderFont, "Unit List", new Vector2(120, 10), Color.White);
     }
     else if (Stage == 1)
     {
         StatusMenu.Draw(g);
     }
 }