Ejemplo n.º 1
0
        protected override void DrawSprite(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
        {
            batch.End();

            batch.Begin(SpriteSortMode.Immediate,
                        null, SamplerState.LinearWrap, null, null);
            batch.Draw(texture, Vector2.Zero,
                       new Rectangle(0, (int) Position.Y, Width, Height), Color.White);
            batch.End();
            batch.Begin();
        }
Ejemplo n.º 2
0
 public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     spriteBatch.End();
     spriteBatch.Begin();
     foreach (Star s in _Stars)
     {
         spriteBatch.Draw(_CloudTexture, s.Position, null, s.Color, 0, Vector2.Zero, s.Scale, SpriteEffects.None, 0);
     }
     spriteBatch.End();
     spriteBatch.Begin();
 }
Ejemplo n.º 3
0
        public override void DrawWorld(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
        {
            batch.Begin();
            nBuild.DrawLaser(batch, Screen.RelationToPosition(owner.Position), Screen.RelationToPosition(new Vector2(-Screen.X, owner.Position.Y)), lastHit, 0.05f * Screen.Height);

            batch.End();
        }
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            String text = mode ? "True" : "False";
            Color color = !GetSelected() ? colorA : colorB;

            Rectangle numRect = this.ToRectangle();
            numRect.Width = boolWidth;

            Rectangle rect = this.ToRectangle();

            this.width = (rect.Width = (int)fontHandler.GetVerdana().MeasureString(" " + text + " ").X + 3) + boolWidth;

            rect.X += boolWidth;
            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, color);
            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, new Color(0x3D, 0x70, 0xBC));
            Vector2 vector = this.GetVector();

            vector.X += 3;
            vector.Y += 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " Bool ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);

            vector.X += boolWidth - 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " " + text + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);
            spriteBatch.End();
            spriteBatch.Begin();
        }
Ejemplo n.º 5
0
 public override void draw(Microsoft.Xna.Framework.Graphics.GraphicsDevice _GraphicsDevice, Microsoft.Xna.Framework.Graphics.SpriteBatch _SpriteBatch)
 {
     _SpriteBatch.Begin();
     base.draw(_GraphicsDevice, _SpriteBatch);
     this.playerObject.draw(_GraphicsDevice, _SpriteBatch, Vector3.Zero, Color.White);
     _SpriteBatch.End();
 }
Ejemplo n.º 6
0
        public override void Draw(Microsoft.Xna.Framework.GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            UIManager.Draw(time, spriteBatch);
            ActiveMap.WorldObjects.ForEach(
                obj => ((WorldCore.IDrawable)obj).Draw(time, spriteBatch));

            spriteBatch.End();

            // Draw Particles
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);
            PhysicsManager.PSystems.ForEach(ps => ps.Draw());
            spriteBatch.End();
            // End Drawing Particles

            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
        }
Ejemplo n.º 7
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch SB)
 {
     SB.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied);
     _Background.Draw(SB);
     Managers.EntityManager.Instance.Draw(SB);
     SB.End();
 }
Ejemplo n.º 8
0
 public override void DrawWorld(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
 {
     batch.Begin();
     //batch.Draw(texture, Position, Color.Red);
     nBuild.nGon(batch, Screen.RelationToPosition(Position), 10, 3, (float)Math.Atan2(Velocity.Y, Velocity.X));
     batch.End();
 }
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            if(varLink != null)
            {
                Vector2 vec = this.GetVector();
                this.varLink.SetVector(ref vec);
                this.SetWidth(varLink.GetWidth());
                this.SetHeight(varLink.GetHeight());

                varLink.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice);
            }
            else
            {
                primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, colorA);
                Vector2 ve = fontHandler.GetVerdana().MeasureString(this.typeOfVariable);

                this.width = (int)ve.X + 3;
                this.height = 30;

                Vector2 vec = this.GetVector();
                vec.Y += 3;
                vec.X += 3;

                spriteBatch.DrawString(fontHandler.GetVerdana(), this.typeOfVariable, vec + TetrisGameRunner.GetOffsetVector(), Color.White);
                spriteBatch.End();
                spriteBatch.Begin();
            }
        }
        public override void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, publicStatics.spriteScale);
            //Background
            spriteBatch.Draw(Image.howToPlayMenu, new Rectangle(0, 0, publicStatics.screenSize.Width, publicStatics.screenSize.Height), Color.White);

            //Draw all labels
            for(int i = 0; i < labels.Count; i++)
            {
                labels[i].Draw(spriteBatch);
            }

            //Draw all Buttons
            for (int i = 0; i < buttons.Count; i++)
            {
                buttons[i].Draw(spriteBatch);
            }

            //Draw all Checkboxes
            for (int i = 0; i < checkboxes.Count; i++)
            {
                checkboxes[i].Draw(spriteBatch);
            }

            //Draw Mouse Cursor
            cursor.drawTexture(spriteBatch, graphicsDevice);
            spriteBatch.End();
        }
Ejemplo n.º 11
0
        public override void draw(Microsoft.Xna.Framework.Graphics.GraphicsDevice _GraphicsDevice, Microsoft.Xna.Framework.Graphics.SpriteBatch _SpriteBatch)
        {
            _SpriteBatch.Begin(SpriteSortMode.Deferred,
                    BlendState.AlphaBlend, null, null, null, null,
                    GameLibrary.Camera.Camera.camera.getMatrix());

            if (GameLibrary.Camera.Camera.camera.Target != null)
            {
                GameLibrary.Model.Map.World.World.world.draw(_GraphicsDevice, _SpriteBatch, GameLibrary.Camera.Camera.camera.Target);
            }
            else
            {
                _SpriteBatch.DrawString(GameLibrary.Ressourcen.RessourcenManager.ressourcenManager.Fonts["Arial"], "Dein Charakter ist leider gestorben :(", new Vector2(50, 50), Color.White);
            }

            _SpriteBatch.End();

            if (this.inventoryMenu.IsActive)
            {
                this.inventoryMenu.checkItems();
            }

            _SpriteBatch.Begin();
            base.draw(_GraphicsDevice, _SpriteBatch);
            _SpriteBatch.End();
        }
Ejemplo n.º 12
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch pSpriteBatch)
        {
            pSpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);

            pSpriteBatch.DrawString(m_pFont, "#", new Vector2(200, 50), Color.White);
            pSpriteBatch.DrawString(m_pFont, "Name", new Vector2(250, 50), Color.White);
            pSpriteBatch.DrawString(m_pFont, "Waves", new Vector2(500, 50), Color.White);
            pSpriteBatch.DrawString(m_pFont, "Play time", new Vector2(650, 50), Color.White);
            pSpriteBatch.DrawString(m_pFont, "Score", new Vector2(800, 50), Color.White);

            for (int i = 0; i < 10; i++)
            {
                pSpriteBatch.DrawString(m_pFont, (i + 1).ToString(), new Vector2(200, 100 + (i*30)), Color.White);
                pSpriteBatch.DrawString(m_pFont, m_pManager.List[i].PlayerName, new Vector2(250, 100 + (i * 30)), Color.White);
                pSpriteBatch.DrawString(m_pFont, m_pManager.List[i].Wave.ToString(), new Vector2(500, 100 + (i * 30)), Color.White);
                pSpriteBatch.DrawString(m_pFont, m_pManager.List[i].PlayTime.ToString()+" sec", new Vector2(650, 100 + (i * 30)), Color.White);
                pSpriteBatch.DrawString(m_pFont, m_pManager.List[i].Score.ToString(), new Vector2(800, 100 + (i * 30)), Color.White);

            }

            pSpriteBatch.Draw(Constants.BUTTON_B, new Vector2(1100, 600), Color.White);
            pSpriteBatch.DrawString(m_pFont, "Back", new Vector2(1050, 600), Color.White);

            pSpriteBatch.End();

            base.Draw(pSpriteBatch);
        }
Ejemplo n.º 13
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            Rectangle numRect = this.ToRectangle();
            numRect.Width = strWidth;

            Rectangle rect = this.ToRectangle();
            this.width = (rect.Width = (int)fontHandler.GetVerdana().MeasureString(" " + formatText(fontHandler) + " ").X + 3) + strWidth;
            rect.X += strWidth;

            if (this.text.Length > 0 || GetSelected())
                if (selected)
                {
                    primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, colorB);
                }
                else
                {
                    primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, colorA);
                }

            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, storedColor);

            Vector2 vector = this.GetVector();

            vector.X += 3;

            vector.Y += 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " Code ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);

            vector.X += strWidth;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " " + formatText(fontHandler) + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);
            spriteBatch.End();
            spriteBatch.Begin();
        }
Ejemplo n.º 14
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch _spritebatch)
 {
     _spritebatch.Begin();
     this.m_lp_extractor.Draw(_spritebatch);
     base.Draw(_spritebatch);
     _spritebatch.End();
 }
Ejemplo n.º 15
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch pSpriteBatch)
 {
     pSpriteBatch.Begin();
     pSpriteBatch.DrawString(m_pFont, "LOADING", new Microsoft.Xna.Framework.Vector2(100, 100), Color.White);
     pSpriteBatch.End();
     base.Draw(pSpriteBatch);
 }
        public override void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, publicStatics.spriteScale);
            //Background
            spriteBatch.Draw(Image.pauseMenu, new Rectangle(0, 0, publicStatics.screenSize.Width, publicStatics.screenSize.Height), Color.White);

            //Draw all labels
            for(int i = 0; i < labels.Count; i++)
            {
                labels[i].Draw(spriteBatch);
            }

            //Draw Bullet Points
            if (buttons[0].mouseHover())
                spriteBatch.Draw(imageRBC, new Rectangle(publicStatics.screenSize.Center.X - (int)(Font.cooper48.MeasureString("Resume").X / 2) - 52, publicStatics.screenSize.Center.Y - 36, 48, 48), Color.White);
            if (buttons[1].mouseHover())
                spriteBatch.Draw(imageRBC, new Rectangle(publicStatics.screenSize.Center.X - (int)(Font.cooper48.MeasureString("Main Menu").X / 2) - 52, publicStatics.screenSize.Center.Y - 26 + 90, 48, 48), Color.White);

            //Draw all Buttons
            for (int i = 0; i < buttons.Count; i++)
            {
                buttons[i].Draw(spriteBatch);
            }

            //Draw all Checkboxes
            for (int i = 0; i < checkboxes.Count; i++)
            {
                checkboxes[i].Draw(spriteBatch);
            }

            //Draw Mouse Cursor
            cursor.drawTexture(spriteBatch, graphicsDevice);
            spriteBatch.End();
        }
Ejemplo n.º 17
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch Sb, Graphics.PrimitiveRenderer Pr)
        {
            StringBuilder str = new StringBuilder();

            if (Left.Damage == Right.Damage)
                str.AppendLine("Draw!");
            else {
                str.Append("Winrar: ");
                if (Left.Damage < Right.Damage)
                    str.AppendLine("Player 1!");
                else
                    str.AppendLine("Player 2!");
            }
            str.AppendLine("Press Enter to return to track select...");
            Sb.Begin();
            Sb.DrawString(sysFont, str, resultsTextPosition, Color.White);

            str.Clear();
            str.AppendLine("Player 1\n");
            str.AppendFormat("Result score: {0}\n", Left.Score);
            str.AppendFormat("Final health: {0}\n", Left.Health);
            str.AppendFormat("Damage dealt: {0}\n", Left.Damage);
            Sb.DrawString(sysFont, str, LeftResultPosition, Color.White);

            str.Clear();
            str.AppendLine("Player 2\n");
            str.AppendFormat("Result score: {0}\n", Right.Score);
            str.AppendFormat("Final health: {0}\n", Right.Health);
            str.AppendFormat("Damage dealt: {0}\n", Right.Damage);
            Sb.DrawString(sysFont, str, RightResultPosition, Color.White);

            Sb.End();
        }
Ejemplo n.º 18
0
        public override void DrawWorld(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
        {
            batch.Begin();
               //batch.Draw(texture, Position, Color.Purple);
               nBuild.nGon(batch, Screen.RelationToPosition(Position), radius * 300, Health+2, Rotation);

               batch.End();
        }
Ejemplo n.º 19
0
        protected override void DrawAbovePlayers(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, null, null, null, null, World.CamTransform);

            sb.DrawString(ArtAssets.WorldFont, "Blah", Vector2.Zero, Color.White, 0.0f, Vector2.Zero, WorldData.ZoomScaleAmount[World.CurrentZoom], SpriteEffects.None, 1.0f);

            sb.End();
        }
Ejemplo n.º 20
0
        protected override void DrawEffect(Microsoft.Xna.Framework.Graphics.Texture2D tex, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Graphics.GraphicsDevice device)
        {
            frameCount++;
            //if (frameCount % 3 == 0)
            {

                //device.ResolveBackBuffer(resolvedTex);
                //3_1
                //resolvedTex = new ResolveTexture2D(device, device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight, device.PresentationParameters.BackBufferCount, device.PresentationParameters.BackBufferFormat);
                //device.ResolveBackBuffer(resolvedTex);
                resolvedTex = (RenderTarget2D)device.GetRenderTargets()[0].RenderTarget;
                //if (traces[0] != null)
                //    traces[0].Dispose();
                Color[] data=new Color[traces[0].Width*traces[0].Height];
                for (int i = 0; i < traces.Length - 1; i++)
                {
                    //3_1
                    //traces[i] = traces[i + 1];
                    //traces[i+1].GetData(data);
                    //traces[i].SetData(data);
                }
                for (int i = 0; i < alphas.Length - 1; i++)
                {
                    alphas[i] = alphas[i + 1];
                    alphas[i] -= alphaReductionPerFrame;
                }
                //device.SetRenderTarget(null);

                //resolvedTex.GetData(data);
                //device.SetRenderTarget(resolvedTex);
                //traces[traces.Length - 1].SetData(data);
                //traces[traces.Length - 1] = resolvedTex;
                alphas[alphas.Length - 1] = baseAlpha-alphaReductionPerFrame;
            }

            //device.SetRenderTarget(0, target);
            //device.DepthStencilBuffer = GraphicEffect.CreateDepthStencilBuffer(target);

            //3_1
            //spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.SaveState);
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            //spriteBatch.Draw(tex, Vector2.Zero, Color.White);

            for (int i = traces.Length -1; i >= 0; i--)
            {
                if (traces[i] != null)
                    spriteBatch.Draw(traces[i], new Vector2(0), new Color(1-alphas[i],0f, 0f, alphas[i]*Alpha));
            }
            spriteBatch.End();
            //device.DepthStencilBuffer = GraphicEffect.CreateDepthStencilBuffer(RenderTarget);
            //device.SetRenderTarget(0, RenderTarget);

            //blurTex = target.GetTexture();
            //spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.SaveState);
            //spriteBatch.Draw(tex, Vector2.Zero, Color.White);
            //spriteBatch.Draw(blurTex, new Vector2(100), new Color(Color.White, 1f));
            //spriteBatch.End();
        }
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, InventoryItem item, bool selected)
        {
            base.Draw(spriteBatch, item, selected);
            spriteBatch.Begin();

            Graphics.DrawString(spriteBatch, "Fuel", new Vector2(base.X + 196f, base.Y + 130f), _textColor);

            spriteBatch.End();
        }
Ejemplo n.º 22
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sprite)
 {
     //base.Draw(sprite);
     sprite.Begin();
     sprite.Draw(texture, drawVector, Color.White);
     sprite.Draw(texture, drawVector + new Vector2(width/2, height/2), null, Color.White, -degree, new Vector2(width/2, height/2), new Vector2(1, 1), SpriteEffects.None, 0);
     //sprite.Draw(texture, drawVector + new Vector2(-48,-48), null, Color.White, -degree, new Vector2(48,48), new Vector2(1, 1), SpriteEffects.None, 0);
     sprite.End();
 }
Ejemplo n.º 23
0
        public override void DrawWorld(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
        {
            batch.Begin();

            //batch.Draw(texture, Position, Color.Purple);
            nBuild.nGon(batch, Screen.RelationToPosition(Position), 30, Health+2, (float)Math.PI * Time.WorldTime);

            batch.End();
        }
Ejemplo n.º 24
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch Sb, Graphics.PrimitiveRenderer Pr)
 {
     Sb.Begin();
     StringBuilder str = new StringBuilder();
     str.AppendLine("Accent");
     str.AppendLine("Press 'space' to start!");
     Sb.DrawString(sysFont, str, titlePos, Color.White);
     Sb.End();
 }
Ejemplo n.º 25
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch SB)
 {
     SB.Begin();
     CResourceManager.GetInstance().GetResource(IDResource.BLACK).Draw(SB);
     CResourceManager.GetInstance().GetResource(IDResource.INTRO_1).Draw(SB);
     CResourceManager.GetInstance().GetResource(IDResource.INTRO_2).Draw(SB);
     SB.End();
     base.Draw(SB);
 }
        public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Vector2 location)
        {
            Rectangle destinationRectangle = new Rectangle((int)location.X, (int)location.Y,
                (int)BlockSpriteConstants.GENERICBLOCKDIMENSIONS.X, (int)BlockSpriteConstants.GENERICBLOCKDIMENSIONS.Y);

            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenScaler.ScalingMatrix);
            spriteBatch.Draw(spriteSheet, destinationRectangle, sourceRectangle, Color.White);
            spriteBatch.End();
        }
Ejemplo n.º 27
0
 public override void DrawWorld(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
 {
     if (startup <= 1)
     {
         builder.PolyColor = Color.Lerp(Color.White, Color.Transparent, 0.5f + (float)Math.Sin(startup * Math.PI * 6 + (Math.PI / 2))/2.0f);
         batch.Begin();
         builder.nGon(batch, Screen.RelationToPosition(Position), 10f, 4, 0);
         batch.End();
     }
 }
Ejemplo n.º 28
0
        public override void DrawWorld(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
        {
            batch.Begin();

            Vector2 shapePos = new Vector2(Screen.X - 0.15f, Screen.Y - 0.20f);
            Vector2 textPos = new Vector2(-Screen.X + 0.05f, Screen.Y - 0.15f);
            //batch.DrawString(font, IntermissionScreen[levelNo], Screen.RelationToPosition(textPos), Color.White);

            batch.End();
        }
Ejemplo n.º 29
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch SB)
 {
     SB.Begin();
     CResourceManager.GetInstance().GetResource(IDResource.OPTION).Draw(SB);
     for (int i = 0; i < ListButtons.Count; i++)
         ListButtons[i].Draw(SB);
     CResourceManager.GetInstance().GetResource(IDResource.ICON).Draw(SB);
     SB.End();
     base.Draw(SB);
 }
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            SetWidth((int)fontHandler.GetVerdana().MeasureString(this.eventName).X + 8);
            Vector2 adjust = GetVector();
            adjust.X += 4;
            spriteBatch.DrawString(fontHandler.GetVerdana(), this.eventName, adjust + TetrisGameRunner.GetOffsetVector(), Color.White);

            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, Color.Green);
            spriteBatch.End();
            spriteBatch.Begin();
        }