End() public method

Flushes all batched text and sprites to the screen.
This command should be called after Begin and drawing commands.
public End ( ) : void
return void
Example #1
5
 public override void ReflectionRender(SpriteBatch spriteBatch)
 {
     if (this.txTexture == RenderMaster.txNullTex)
     {
         return;
     }
     this.txToUse = this.txTexture;
     if (this.dentxAlternateTextures.ContainsKey(RenderMaster.enCurrentPass))
     {
         this.txToUse = this.dentxAlternateTextures[RenderMaster.enCurrentPass];
     }
     if (base.xEffectWrapper == null)
     {
         spriteBatch.Draw(this.txToUse, Utility.Vector2_ToInts(this.xTransform.v2Pos - this.v2OffsetRenderPos) - Utility.Vector2_ToInts(this.xCamera.v2TopLeft * this.v2ParallaxFactor), null, this.cColor * this.fAlpha, this.fRotation, new Vector2(this.v2Offset.X, (float)this.txTexture.Height - this.v2Offset.Y), this.v2Scale, this.enSpriteEffect | SpriteEffects.FlipVertically, 0f);
         return;
     }
     spriteBatch.End();
     foreach (KeyValuePair<string, float> kvp in this.dsfFloatShaderParameters)
     {
         base.xEffectWrapper.xEffect.Parameters[kvp.Key].SetValue(kvp.Value);
     }
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, base.xEffectWrapper.xEffect);
     spriteBatch.Draw(this.txToUse, Utility.Vector2_ToInts(this.xTransform.v2Pos - this.v2OffsetRenderPos) - Utility.Vector2_ToInts(this.xCamera.v2TopLeft * this.v2ParallaxFactor), null, this.cColor * this.fAlpha, this.fRotation, new Vector2(this.v2Offset.X, (float)this.txTexture.Height - this.v2Offset.Y), this.v2Scale, this.enSpriteEffect | SpriteEffects.FlipVertically, 0f);
     spriteBatch.End();
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
 }
Example #2
0
        public override void Draw(SpriteBatch batch)
        {
            batch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.Transform);

            world.Map.Draw(batch);

            world.BulletManager.Draw(batch);

            world.Player.Draw(batch);

            foreach (var enemy in world.Enemies)
            {
                enemy.Draw(batch);
            }

            foreach (var power in world.Powers)
            {
                power.Draw(batch);
            }

            batch.End();

            batch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, hudCamera.Transform);
            hud.Render(batch);
            batch.End();
        }
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();
            spriteBatch.Draw(TextureManager.Instance.GetTextureByString("pixel"), _outLine, Color.Azure);
            spriteBatch.Draw(TextureManager.Instance.GetTextureByString("pixel"), _inLine, _bgColor);
            spriteBatch.Draw(TextureManager.Instance.GetTextureByString("pixel"), _scrollUp, Color.FloralWhite);
            spriteBatch.Draw(TextureManager.Instance.GetTextureByString("pixel"), _scrollDown, Color.FloralWhite);
            spriteBatch.End();

            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied, null, null, null, null, _camera.GetTransformMatrix());
            if (_rowList.Count > 0 && _scrollIndex < _rowList.Count-1)
                for (int i = _rowList[_scrollIndex]; i < _rowList[_scrollIndex + 1]; i++)
                    _spriteList[i].Draw(spriteBatch);

            if (_scrollIndex == _rowList.Count-1)
                for (int i = _rowList[_scrollIndex]; i < _spriteList.Count; i++)
                    _spriteList[i].Draw(spriteBatch);
            spriteBatch.End();

            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied, null, null, null, null, _camera.GetTransformMatrix());
            if (_selectedSprite != null)
                _selectedSprite.Draw(spriteBatch, Color.Red, 0.5f);
                

            spriteBatch.End();
            base.Draw(spriteBatch);
        }
Example #4
0
        public override void Draw(SpriteBatch batch)
        {
            int tilesWide = (int)(currentLayer.LayerTexture.Width / map.TileDimensions.Width);
            int tilesHigh = (int)(currentLayer.LayerTexture.Height / map.TileDimensions.Height);

            batch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
            batch.Draw (backgroundTexture, new Rectangle (0, 0, Moxy.ScreenWidth, Moxy.ScreenHeight), null, Color.Black);
            batch.End();

            batch.Begin (SpriteSortMode.Texture, BlendState.AlphaBlend);

            for (int x = 0; x < tilesWide; x++)
            {
                for (int y = 0; y < tilesHigh; y++)
                {
                    var tileID = (y * tilesWide) + x;
                    var tileLocation = new Vector2(x * (map.TileDimensions.Width * scale), y * (map.TileDimensions.Height * scale))
                        + tileDisplayOffset;

                    // Draw the tile at it's respective location
                    batch.Draw (currentLayer.LayerTexture, tileLocation, currentLayer.LayerBounds[tileID], Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 1f);

                    // Highlight if it's currently selected
                    if (tileID == mapState.currentTileID)
                        batch.Draw (mapState.highlightTexture, tileLocation, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 1f);
                }
            }

            batch.End();
        }
        public void Draw(SpriteBatch sb)
        {
            sb.Begin();
            sb.Draw(background, new Rectangle(0, 0, 1920, 1080), Color.Black);
            sb.End();

            sb.Begin();
            if (counter >= 0)
            {
                sb.DrawString(font, health, new Vector2(150, 150), Color.White);
            }
            if (counter >= 1)
            {
                sb.DrawString(font, charge, new Vector2(300, 300), Color.White);
            }
            if (counter >= 2)
            {
                sb.DrawString(font, level, new Vector2(450, 450), Color.White);
            }
            if (counter >= 3)
            {
                sb.DrawString(font, enemy, new Vector2(600, 600), Color.White);
            }
            sb.End();

            sb.Begin();
            if (counter == 4)
            {
                sb.Draw(readyText, new Rectangle(0, 0, 1920, 1080), Color.White);
            }
            sb.End();
        }
Example #6
0
        public override void applyEffect(SpriteBatch spriteBatch)
        {
            Texture2D scene;
            scene = (Texture2D)_buffer;

            // do the horizontal pass
            _device.SetRenderTarget(_horzBuffer);
            setBlurEffectParameters(1.0f / _horzBuffer.Width, 0f);
            spriteBatch.Begin(0, BlendState.Opaque, null, null, null, _blur);
            spriteBatch.Draw(scene, _horzBuffer.Bounds, Color.White);
            spriteBatch.End();
            // do the vertical pass
            _device.SetRenderTarget(_vertBuffer);
            setBlurEffectParameters(0f, 1.0f / _horzBuffer.Height);
            spriteBatch.Begin(0, BlendState.Opaque, null, null, null, _blur);
            spriteBatch.Draw((Texture2D)_horzBuffer, _vertBuffer.Bounds, Color.White);
            spriteBatch.End();
            // draw the blured scene whith the original one on the screen
            _device.SetRenderTarget(null);

            /*spriteBatch.Begin();
            spriteBatch.Draw(scene, new Vector2(0, 0), Color.White);
            spriteBatch.End();*/
            spriteBatch.Begin(0, BlendState.Opaque);
            spriteBatch.Draw((Texture2D)_vertBuffer, _buffer.Bounds, Color.White);
            spriteBatch.End();
        }
        public override void draw(SpriteBatch sb)
        {
            if (m_unitHealth > 0)
            {
                sb.Begin();
                sb.Draw(m_baseTexture, m_position, null, Color.White, 0, m_origin, 0.5f, SpriteEffects.None, 0);
                sb.End();

                sb.Begin();

                foreach (Bullet curB in bullets)
                {
                    curB.draw(sb);
                }

                sb.Draw(m_texture, m_position, null, Color.White, m_rotation, m_origin, 0.5f, SpriteEffects.None, 0);

                if (m_displayInfo)
                {
                    drawDisplayInfo(sb);
                }

                sb.End();
            }
        }
        public override void Draw(GameTime gameTime, GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
        {
            if (!end)
            {
                spriteBatch.Begin();
                StringTool.DrawString(spriteBatch, DataSystem.fontCourierNew, "White: " + white.HP.ToString(), new Rectangle(0, 0, 200, 60), StringTool.Alignment.Right, Color.White);
                StringTool.DrawString(spriteBatch, DataSystem.fontCourierNew, "Black: " + black.HP.ToString(), new Rectangle(Util.screenWidth - 200, 0, Util.screenWidth, 60), StringTool.Alignment.Left, Color.White);
                spriteBatch.End();
                graphicsDevice.DepthStencilState = DepthStencilState.Default;

                spriteBatch.Begin();
                white.Draw(camera);
                black.Draw(camera);
                landscape.Draw(gameTime, graphicsDevice, camera);
                spriteBatch.End();
                graphicsDevice.DepthStencilState = DepthStencilState.Default;
            }
            else
            {
                spriteBatch.Begin();
                if (dieSide == 0)
                    StringTool.DrawString(spriteBatch, DataSystem.fontDavida, "Black WIN this battle", new Rectangle(0, 0, Util.screenWidth, Util.screenHeight), StringTool.Alignment.Center, new Color(t * 4, t * 4, t * 4));
                else
                    StringTool.DrawString(spriteBatch, DataSystem.fontDavida, "White WIN this battle", new Rectangle(0, 0, Util.screenWidth, Util.screenHeight), StringTool.Alignment.Center, new Color(t * 4, t * 4, t * 4));
                spriteBatch.End();
                graphicsDevice.DepthStencilState = DepthStencilState.Default;
            }
        }
Example #9
0
        public static Texture2D ConvertToPreMultipliedAlphaGPU(Texture2D texture)
        {
            // code borrowed from http://jakepoz.com/jake_poznanski__speeding_up_xna.html

            // Set up a render target to hold our final texture which will have premulitplied alpha values
            RenderTarget2D result = new RenderTarget2D(device, texture.Width, texture.Height);

            device.SetRenderTarget(result);
            device.Clear(Color.Black);

            // Multiply each color by the source alpha, and write in just the color values into the final texture
            SpriteBatch spriteBatch = new SpriteBatch(device);
            spriteBatch.Begin(SpriteSortMode.Immediate, blendColor);
            spriteBatch.Draw(texture, texture.Bounds, Color.White);
            spriteBatch.End();

            // Now copy over the alpha values from the PNG source texture to the final one, without multiplying them
            spriteBatch.Begin(SpriteSortMode.Immediate, blendAlpha);
            spriteBatch.Draw(texture, texture.Bounds, Color.White);
            spriteBatch.End();

            // Release the GPU back to drawing to the screen
            device.SetRenderTarget(null);

            return result as Texture2D;
        }
        public void Draw(SpriteBatch batch)
        {
            if (enabled && render)
            {
                Main.graphics.GraphicsDevice.SetRenderTarget(swapTarget);
                Main.graphics.GraphicsDevice.Clear(Color.Transparent);
                batch.End();
                batch.Begin();
                batch.Draw(visualGridSprites[focus], Main.screenRect, Color.White);

                for (int i = 0; i < width; i++)
                    for (int j = 0; j < height; j++)
                    {
                        if (grid[i, j].inhabitants.Count > 0)
                        {
                            batch.Draw(Main.sprites["filledGrid"], new Rectangle((int)(i * gridSize.X), (int)(j * gridSize.Y), (int)gridSize.X, (int)gridSize.Y), (grid[i, j].inhabitants[0] as IDrawableGridAsset).gridColor);
                        }

                    }
                batch.End();
                batch.Begin();

                Main.graphics.GraphicsDevice.SetRenderTarget(null);
                visualGrid = new DrawableAsset<RenderTarget2D>(new Vector2(Main.windowSize.X / 2, Main.windowSize.Y / 2), new Vector2(0, -1), Main.windowSize, swapTarget);
                visualGrid.Draw(batch);
            }
        }
Example #11
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

        //TODO: Add your Draw logic here
                spriteBatch.Begin(SpriteSortMode.Texture, BlendState.Additive);
            EntityManager.Draw(spriteBatch);
            spriteBatch.End();

            spriteBatch.Begin(0, BlendState.Additive);

            spriteBatch.DrawString(Art.Font, "Lives: " + PlayerStatus.Lives, new Vector2(5), Color.White);
            drawRightAlignedString("Score: " + PlayerStatus.Score, 5, Color.White);
            drawRightAlignedString("Multiplier: " + PlayerStatus.Multiplier, 35, Color.White);


            if (PlayerStatus.IsGameOver)
            {
                string text = "Game Over\n" +
                    "Your Score: " + PlayerStatus.Score + "\n" +
                    "High Score: " + PlayerStatus.HighScore;

                drawCentertAlignedString(text, Color.White);
            }

            // draw the custom mouse cursor
            spriteBatch.Draw(Art.Pointer, Input.MousePosition, Color.White);

            spriteBatch.End();
        }
Example #12
0
        public static void draw(SpriteBatch sb,Texture2D tex1)
        {
            sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
            //shaders.MainMenuBlurBegin();
            sb.Draw(tex1, Vector2.Zero, Color.White);
            //shaders.MainMenuBlurEnd();
            sb.End();

            sb.Begin();
            if (timeWaited < 3)
            {
                if (timeWaited > 0.5f)
                {
                    if (Controller.is_a_pressed(PlayerIndex.One))
                        timeWaited = 3;
                }

                sb.Draw(howtoTex, Vector2.Zero, Color.White);
            }
            else
            {
                if (Controller.is_a_pressed(PlayerIndex.One))
                    timeWaited = 5;
                sb.Draw(controls, Vector2.Zero, Color.White);
            }
            timeWaited += 0.005f;
            if (timeWaited > 5)
            {
                Game1.currentMenu = Game1.activeMenu.main;
                timeWaited = 0;
            }

            sb.End();
        }
Example #13
0
 public override void Render(SpriteBatch spriteBatch)
 {
     if (this.bRenderShadow)
     {
         if (this.bCustomShadow)
         {
             spriteBatch.Draw(this.txShadowTexture, Utility.Vector2_ToInts(this.xTransform.v2Pos) - this.xCamera.v2TopLeft, null, this.cColor * this.fAlpha, 0f, this.v2Offset, base.fScale, SpriteEffects.None, 0f);
         }
         else
         {
             spriteBatch.Draw(ItemRenderComponent.txGenericShadow, Utility.Vector2_ToInts(this.xTransform.v2Pos) - this.xCamera.v2TopLeft, null, this.cColor * 0.6f, 0f, ItemRenderComponent.v2ShadowOffset, 1f, SpriteEffects.None, 0f);
         }
     }
     if (base.xEffectWrapper == null)
     {
         spriteBatch.Draw(this.txTexture, Utility.Vector2_ToInts(this.xTransform.v2Pos + this.v2OffsetRenderPos) - this.xCamera.v2TopLeft, null, this.cColor * this.fAlpha, this.fRotation, this.v2Offset, base.fScale, SpriteEffects.None, 0f);
         return;
     }
     spriteBatch.End();
     foreach (KeyValuePair<string, float> kvp in this.dsfFloatShaderParameters)
     {
         base.xEffectWrapper.xEffect.Parameters[kvp.Key].SetValue(kvp.Value);
     }
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, base.xEffectWrapper.xEffect);
     spriteBatch.Draw(this.txTexture, Utility.Vector2_ToInts(this.xTransform.v2Pos + this.v2OffsetRenderPos) - this.xCamera.v2TopLeft, null, this.cColor * this.fAlpha, this.fRotation, this.v2Offset, base.fScale, SpriteEffects.None, 0f);
     spriteBatch.End();
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
 }
Example #14
0
        public override void Render(SpriteBatch spriteBatch)
        {
            View view = player.View;

            int x = view.ScreenX + view.Width - MaxTextLength - MaxNameLength - Margin;
            int y = view.ScreenY + Margin;

            bool alreadyStarted = true;
            try {
                spriteBatch.End();
            } catch (InvalidOperationException) {
                alreadyStarted = false;
            }

            spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);

            foreach (Resource resource in player.Resources) {
                drawText(resource.Type + ": ", font, x, y, spriteBatch);
                drawText(resource.Quantity.ToString(), font, x + MaxNameLength, y, spriteBatch);
                y += Margin + TextHeight;
            }

            spriteBatch.End();

            if (alreadyStarted)
                spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.BackToFront, SaveStateMode.None);
        }
Example #15
0
        public static void Draw(SpriteBatch spriteBatch)
        {
            //gsm.game.GraphicsDevice.SetRenderTarget(overlayTarget);
            //gsm.game.GraphicsDevice.Clear(Color.Transparent);

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

            words1.Draw(spriteBatch);
            words2.Draw(spriteBatch);
            words3.Draw(spriteBatch);
            words4.Draw(spriteBatch);
            words5.Draw(spriteBatch);
            words6.Draw(spriteBatch);

            spriteBatch.End();

            if (fadeOverlay.color == Color.Black)
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
            else if (fadeOverlay.color == Color.White)
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);
            else
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
            fadeOverlay.Draw(spriteBatch);
            spriteBatch.End();

            //gsm.game.GraphicsDevice.SetRenderTarget(null);
            //spriteBatch.Begin();
            //spriteBatch.Draw(overlayTarget, Vector2.Zero, Color.White);
            //spriteBatch.End();
        }
 public void StarDraw(SpriteBatch spriteBatch, Vector2 location)
 {
     Rectangle sourceRectangle = new Rectangle((int)MarioSpriteConstants.FIRELEFTJUMPSOURCE.X, (int)MarioSpriteConstants.FIRELEFTJUMPSOURCE.Y,
         (int)MarioSpriteConstants.FIRELEFTJUMPWIDTHHEIGHT.X, (int)MarioSpriteConstants.FIRELEFTJUMPWIDTHHEIGHT.Y);
     Rectangle destinationRectangle = new Rectangle((int)location.X, (int)location.Y,
         (int)MarioSpriteConstants.FIRELEFTJUMPWIDTHHEIGHT.X, (int)MarioSpriteConstants.FIRELEFTJUMPWIDTHHEIGHT.Y);
     if (starDrawCounter < MarioSpriteConstants.STARDRAWBROWNCOUNTER)
     {
         spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenScaler.ScalingMatrix);
         spriteBatch.Draw(spriteSheet, destinationRectangle, sourceRectangle, Color.Brown);
         spriteBatch.End();
         starDrawCounter++;
     }
     else if (starDrawCounter > MarioSpriteConstants.STARDRAWBROWNCOUNTER && starDrawCounter < MarioSpriteConstants.STARDRAWYELLOWGREENCOUNTER)
     {
         spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenScaler.ScalingMatrix);
         spriteBatch.Draw(spriteSheet, destinationRectangle, sourceRectangle, Color.YellowGreen);
         spriteBatch.End();
         starDrawCounter++;
     }
     else
     {
         spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenScaler.ScalingMatrix);
         spriteBatch.Draw(spriteSheet, destinationRectangle, sourceRectangle, Color.Orange);
         spriteBatch.End();
         if (starDrawCounter < MarioSpriteConstants.STARDRAWORANGECOUNTER)
         {
             starDrawCounter++;
         }
         else
         {
             starDrawCounter = MarioSpriteConstants.RESETTOZERO;
         }
     }
 }
        public override void Draw(GameTime gameTime)
        {
            if (starting)
                return;
            SpriteBatch spriteBatch = new SpriteBatch(Game.GraphicsDevice); // draw pulsing success/failure
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
            Rectangle playerRegion = player.GetRegion();
            Rectangle relative = player.GetRelativeRegion();
            spriteBatch.Draw(fadeTexture, player.GetRegion(), player.GetRelativeRegion(), puzzleSuccess?(new Color(64, 255, 64, fadeAlpha)):(new Color(255, 69, 0, fadeAlpha)));
            spriteBatch.End();

            base.Draw(gameTime); // draw status bars over fade

            if (!puzzleSuccess)
                return;

            // draw success plus
            if (this.countUpdates > 60)
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, this.matrix);
                spriteBatch.Draw(plusTexture, new Vector2(), player.ColorOf());
                spriteBatch.End();
            }

            Game.GraphicsDevice.ScissorRectangle = this.drawRegion;

            RasterizerState rs = new RasterizerState(); // draw success chevron
            rs.ScissorTestEnable = true;
            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, rs);
            spriteBatch.Draw(chevronTexture, chevronPosition + displacement, null, player.ColorOf(), player.ClockwiseAngle(), new Vector2(42,35), 1.0f, SpriteEffects.None, 0);
            spriteBatch.End();
        }
        public void DrawHUD(SpriteBatch batch)
        {
            batch.Begin(SpriteSortMode.BackToFront,
                          BlendState.AlphaBlend,
                          SamplerState.PointClamp,
                          null,
                          null,
                          null,
                          Matrix.CreateTranslation(2, 2 + endVectorNames ,0));
            batch.Draw(pointsName, Vector2.Zero, Color.White);
            batch.End();
            batch.Begin(SpriteSortMode.BackToFront,
                          BlendState.AlphaBlend,
                          SamplerState.PointClamp,
                          null,
                          null,
                          null,
                          Matrix.CreateTranslation(2, 2, 0));
            DrawPoints(batch);
            batch.End();

            if (SurvivalManager.Get().GetCombo() > 1)
            {
                batch.Begin(SpriteSortMode.BackToFront,
                         BlendState.AlphaBlend,
                         SamplerState.PointClamp,
                         null,
                         null,
                         null,
                         Matrix.CreateTranslation(2, 21 + endVectorNames, 0));
                batch.Draw(comboName, Vector2.Zero, Color.White);
                DrawCombo(batch);
                batch.End();
            }
        }
Example #19
0
        public void Draw(SpriteBatch sb)
        {
            sb.Begin();
            sb.Draw(gameOverText, new Rectangle(0, 0, 1920, 1080), Color.White * gameOverOpacity);
            sb.End();

            if (titleButtonPosition != null && titleButtonPosition.Y > 0)
            {
                sb.Begin();
                sb.Draw(buttonTexture, new Rectangle(530, 780, 870, 100), c);
                sb.End();

                sb.Begin();
                sb.Draw(buttonTexture, new Rectangle(525, 775, 870, 100), Color.White);
                sb.End();

                sb.Begin();
                sb.Draw(buttonTexture, new Rectangle(525, 775, 870, 100), c);
                sb.End();

                sb.Begin();
                sb.DrawString(font, "RETURN TO TITLE SCREEN", titleButtonPosition, Color.White);
                sb.End();
            }
        }
        public override void draw(SpriteBatch spriteBatch)
        {
            Game1.graphics.GraphicsDevice.Clear(Color.Lerp(Color.DarkGray, Color.White, 0.4f));

            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, Game1.grayCheckerBoard, Matrix.CreateScale(720, 480, 0));
            spriteBatch.Draw(Game1.globalBlackPixel, Vector2.Zero, Color.White);
            spriteBatch.End();

            spriteBatch.Begin();
            for (int i = 0; i < menuList.Count; i++)
            {
                MBQG.drawGUIBox(spriteBatch, new Vector2((float)(144 + (25 * menuList[i].distanceOut)), 81 + i * 64), 28, 3, (i <= Game1.MagnetBoySaveData.furthestLevelUnlocked) ? Color.Purple : Color.Lerp(Color.Purple, Color.Black, 0.5f), AnimationFactory.DepthLayer3);
                spriteBatch.DrawString(Game1.gameFontText, Game1.levelNames[i], new Vector2((float)(152 + (25 * menuList[i].distanceOut)), 85 + i * 64), Color.Lerp(Color.Black, Color.White, (float)menuList[i].distanceOut));
                if (i <= Game1.MagnetBoySaveData.furthestLevelUnlocked)
                {
                    spriteBatch.DrawString(Game1.gameFontText, "BEST TIME COMPLETED IN " + (Game1.MagnetBoySaveData.levelBestTime(i) / 1000) , new Vector2((float)(168 + (25 * menuList[i].distanceOut)), 106 + i * 64), Color.Lerp(new Color(40, 40, 40), Color.DarkGray, (float)menuList[i].distanceOut));
                }
                else
                {
                    spriteBatch.DrawString(Game1.gameFontText, "LOCKED", new Vector2((float)(168 + (25 * menuList[i].distanceOut)), 106 + i * 64), Color.Lerp(new Color(40, 40, 40), Color.DarkGray, (float)menuList[i].distanceOut));
                }
            }

            AnimationFactory.drawAnimationFrame(spriteBatch, "xboxButtons", 0, new Vector2(220, 400), AnimationFactory.DepthLayer0);
            spriteBatch.DrawString(Game1.gameFontText, "Begin Level", new Vector2(245, 401), Color.Black);

            AnimationFactory.drawAnimationFrame(spriteBatch, "xboxButtons", 3, new Vector2(425, 400), AnimationFactory.DepthLayer0);
            spriteBatch.DrawString(Game1.gameFontText, "Back", new Vector2(450, 401), Color.Black);
            spriteBatch.End();
        }
 public void PreRender(SpriteBatch spriteBatch)
 {
     Vector2 v2TruPos = new Vector2(75f, 75f);
     PlayerAnimation arg_22_0 = this.dixAnimations[this.iActiveAnimation];
     RenderMaster.ChangeClothingSetInShader(Program.GetTheGame().dsxEffects["ColorReplace"].xEffect, this.av4ClothingColors);
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, Program.GetTheGame().dsxEffects["ColorReplace"].xEffect);
     spriteBatch.Draw(this.dixAnimations[this.iActiveAnimation].xTextureSet.txBase, v2TruPos, new Rectangle?(this.dixAnimations[this.iActiveAnimation].recCurrentFrame), this.cColor, this.fRotation, this.dixAnimations[this.iActiveAnimation].v2PositionOffset, base.fScale, this.enSpriteEffect, 0f);
     spriteBatch.End();
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
     if (!this.dixAnimations[this.iActiveAnimation].xTextureSet.bIgnoreHatStuff && this.xOwnerObject.Owner.xEquipment.xFacegear != null && !this.xOwnerObject.Owner.xEquipment.xFacegear.abOverHair[(int)this.dixAnimations[this.iActiveAnimation].byAnimationDirection])
     {
         this.RenderFacegear(spriteBatch);
     }
     byte byLol = this.dixAnimations[this.iActiveAnimation].byAnimationDirection;
     if (!this.dixAnimations[this.iActiveAnimation].xTextureSet.bIgnoreHatStuff && this.xOwnerObject.Owner.xEquipment.xHairdo != null && (this.xOwnerObject.Owner.xEquipment.DisplayHat == null || !this.xOwnerObject.Owner.xEquipment.DisplayHat.bHideHair))
     {
         HairdoInfo xHairdo = this.xOwnerObject.Owner.xEquipment.xHairdo;
         if (HatAnimation.dixLibrary.ContainsKey(this.iActiveAnimation))
         {
             Vector2 v2RenderPos = v2TruPos - this.dixAnimations[this.iActiveAnimation].v2PositionOffset + HatAnimation.dixLibrary[this.iActiveAnimation].av2Offsets[this.dixAnimations[this.iActiveAnimation].iRenderedFrame] * base.fScale;
             v2RenderPos = Utility.Vector2_ToInts(v2RenderPos);
             spriteBatch.End();
             Program.GetTheGame().dsxEffects["ColorReplace"].xEffect.Parameters["ReplacementPalette"].SetValue(this.av4HairdoColors);
             spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, Program.GetTheGame().dsxEffects["ColorReplace"].xEffect);
             if (this.xOwnerObject.Owner.xEquipment.DisplayHat == null || !this.xOwnerObject.Owner.xEquipment.DisplayHat.GetCurrentSet(this.xOwnerObject.Owner.xEquipment.xHairdo.enItemType).bObstructsTop || xHairdo.atxObstructedAlternatesTopSides[(int)byLol] == null)
             {
                 spriteBatch.Draw(xHairdo.atxTextures[(int)byLol], v2RenderPos, null, this.cColor, 0f, xHairdo.av2RenderOffsets[(int)byLol], base.fScale, SpriteEffects.None, 0f);
             }
             else
             {
                 spriteBatch.Draw(xHairdo.atxObstructedAlternatesTopSides[(int)byLol], v2RenderPos, null, this.cColor, 0f, xHairdo.av2RenderOffsets[(int)byLol], base.fScale, SpriteEffects.None, 0f);
             }
             spriteBatch.End();
             spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
         }
     }
     if (!this.dixAnimations[this.iActiveAnimation].xTextureSet.bIgnoreHatStuff && this.xOwnerObject.Owner.xEquipment.DisplayFacegear != null && this.xOwnerObject.Owner.xEquipment.DisplayFacegear.abOverHair[(int)this.dixAnimations[this.iActiveAnimation].byAnimationDirection])
     {
         this.RenderFacegear(spriteBatch);
     }
     if (!this.dixAnimations[this.iActiveAnimation].xTextureSet.bIgnoreHatStuff && this.xOwnerObject.Owner.xEquipment.DisplayHat != null)
     {
         HatInfo arg_4B0_0 = this.xOwnerObject.Owner.xEquipment.DisplayHat;
         HatInfo.VisualSet xUsedSet = this.xOwnerObject.Owner.xEquipment.DisplayHat.GetCurrentSet(this.xOwnerObject.Owner.xEquipment.xHairdo.enItemType);
         if (HatAnimation.dixLibrary.ContainsKey(this.iActiveAnimation))
         {
             Vector2 v2RenderPos2 = v2TruPos - this.dixAnimations[this.iActiveAnimation].v2PositionOffset + HatAnimation.dixLibrary[this.iActiveAnimation].av2Offsets[this.dixAnimations[this.iActiveAnimation].iRenderedFrame] * base.fScale;
             v2RenderPos2 = Utility.Vector2_ToInts(v2RenderPos2);
             spriteBatch.Draw(xUsedSet.atxTextures[(int)byLol], v2RenderPos2, null, this.cColor, 0f, xUsedSet.av2RenderOffsets[(int)byLol], base.fScale, SpriteEffects.None, 0f);
         }
     }
     spriteBatch.End();
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, Program.GetTheGame().dsxEffects["ColorReplace"].xEffect);
     foreach (Texture2D tx in this.dixAnimations[this.iActiveAnimation].xTextureSet.ltxRenderOnTop)
     {
         spriteBatch.Draw(tx, v2TruPos, new Rectangle?(this.dixAnimations[this.iActiveAnimation].recCurrentFrame), this.cColor, this.fRotation, this.dixAnimations[this.iActiveAnimation].v2PositionOffset, base.fScale, SpriteEffects.None, 0f);
     }
     spriteBatch.End();
 }
Example #22
0
		public override void Render(SpriteBatch spriteBatch)
		{
			spriteBatch.End();
			spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, null);
			spriteBatch.Draw(this.txTexture, Utility.Vector2_ToInts(Vector2.Zero) - Utility.Vector2_ToInts(this.xCamera.v2TopLeft * this.v2ParallaxFactor), new Rectangle?(new Rectangle(0, 0, 640, 360)), this.cColor * this.fAlpha, this.fRotation, Vector2.Zero, this.v2Scale, this.enSpriteEffect, 0f);
			spriteBatch.End();
			spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
		}
Example #23
0
		public override void Render(SpriteBatch spriteBatch)
		{
			spriteBatch.End();
			spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, null, null);
			spriteBatch.Draw(this.txTexture, Utility.Vector2_ToInts(this.v2TopLeftPosition) - Utility.Vector2_ToInts(this.xCamera.v2TopLeft), null, Color.White * this.fAlpha, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
			spriteBatch.End();
			spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, null);
		}
Example #24
0
		public override void Render(SpriteBatch spriteBatch)
		{
			spriteBatch.End();
			RenderMaster.ChangeClothingSetInShader(Program.GetTheGame().dsxEffects["ColorReplace"].xEffect, this.xView.xEntity.xRenderComponent.av4ClothingColors);
			spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, Program.GetTheGame().dsxEffects["ColorReplace"].xEffect);
			this.xParentComponent.Render(spriteBatch);
			spriteBatch.End();
			spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
		}
Example #25
0
 public void draw(SpriteBatch sprite,Camera cam,WorldScreen screen)
 {
     sprite.End();
     sprite.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null);
     sprite.Draw(texture,new Vector2(0,0),new Rectangle(0,0,texture.Width,texture.Height),Color.White,0f,Vector2.Zero,Global.zoom,SpriteEffects.None,1f);
     drawlife(sprite,screen);
     sprite.End();
     sprite.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null,cam.Transform);
 }
Example #26
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.End();
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);
     foreach (ExplosionParticle particle in particles)
         particle.Draw(spriteBatch);
     spriteBatch.End();
     spriteBatch.Begin();
 }
Example #27
0
		public override void Render(SpriteBatch spriteBatch)
		{
			spriteBatch.End();
			Program.game.dsxEffects["Desaturate"].xEffect.Parameters["Desaturation"].SetValue(1);
			spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null, Program.game.dsxEffects["Desaturate"].xEffect);
			spriteBatch.Draw(this.xDisplay.rt2dPreRender, Utility.Vector2_ToInts(this.xTransform.v2Pos - this.xCamera.v2TopLeft), null, Color.White * 1f, this.fRotation, new Vector2(75f, 75f), this.v2Scale, this.enSpriteEffect, 0f);
			spriteBatch.End();
			spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, null);
		}
Example #28
0
        public override void Draw(GameTime gameTime, GraphicsDeviceManager graphics,Texture2D firstbackground,SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();

            spriteBatch.Draw(firstbackground, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White);
            spriteBatch.End();
            spriteBatch.End();
            base.Draw(gameTime);
        }
Example #29
0
        public static void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, null, null, RasterizerState.CullNone, null, Camera.GetMatrix(spriteBatch.GraphicsDevice));
            MapEngine.Draw(spriteBatch);
            spriteBatch.End(); // Finish drawing character/map/etc..

            spriteBatch.Begin();
            InterfaceEngine.Draw(spriteBatch);
            spriteBatch.End(); // Finish drawing user interface..
        }
Example #30
0
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.Opaque, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone);
                spriteBatch.Draw(_texture, _position, Color.White);
            spriteBatch.End();

            spriteBatch.Begin();
                spriteBatch.DrawString(_font, _text, new Vector2(_position.X, _position.Y), _color);
            spriteBatch.End();
        }
Example #31
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            sb.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, gui.Game.CurrentWorld.WorldCamera.Projection * gui.Game.Resolution.Projection);
            gui.Game.CurrentWorld.Draw(sb);
            sb.End();

            sb.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, gui.Game.Resolution.Projection);
            debug.Draw(sb);
            //drawHealth(sb);
            sb.End();
        }
Example #32
0
        private void Load(LTexture texture)
        {
            lastTexture = texture;
            int type = -1;

            if (texture.isExt)
            {
                type = 0;
            }
            else if (color.A != 255)
            {
                type = 1;
            }
            else
            {
                type = 2;
            }
            if (mode != type)
            {
                if (idx > 0)
                {
                    batch.End();
                    idx = 0;
                }
                if (lastBlendState == BlendState.NonPremultiplied)
                {
                    switch (type)
                    {
                    case 0:
                        batch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, GLEx.device.RasterizerState, null, GLEx.cemera.viewMatrix);
                        break;

                    case 1:
                        batch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, GLEx.device.RasterizerState, null, GLEx.cemera.viewMatrix);
                        break;

                    case 2:
                        batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, GLEx.device.RasterizerState, null, GLEx.cemera.viewMatrix);
                        break;
                    }
                    mode = type;
                }
                else
                {
                    batch.Begin(SpriteSortMode.Deferred, lastBlendState, null, null, GLEx.device.RasterizerState, null, GLEx.cemera.viewMatrix);
                }
            }
        }
Example #33
0
 void IDisposable.Dispose()
 {
     if (!_isChild)
     {
         SpriteBatch.End();
     }
 }
 public override void  draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     Game1.self.GraphicsDevice.Clear(Color.White);
     spriteBatch.Begin();
     spriteBatch.Draw(texture, Vector2.Zero, Color.White);
     spriteBatch.End();
 }
Example #35
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();
 }
Example #36
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);
        }
 public override void  draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     Game1.self.GraphicsDevice.Clear(backgroundColor);
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone);
     spriteBatch.Draw(texture, Game1.self.GraphicsDevice.Viewport.Bounds, backgroundColor);
     spriteBatch.End();
 }
Example #38
0
        public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager graphics, ref Microsoft.Xna.Framework.Graphics.SpriteFont font)
        {
            sp.Begin();

            g.Clear(Color.Black);

            /// Logic for drawing the ActiveBackground
            ActiveBackground.DrawSky();
            ActiveBackground.DrawSunrays();
            ActiveBackground.DrawFlowers();
            ActiveBackground.DrawGrass();
            ActiveBackground.DrawSun();
            ActiveBackground.DrawCloud1();
            ActiveBackground.DrawCloud2();
            ActiveBackground.DrawCloud3();
            ActiveBackground.DrawCloud4();
            ActiveBackground.DrawCloud5();

            // Draws the Background-Image
            // sp.Draw(background, new Rectangle(0, 0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height), Color.White);

            // sp.DrawString(font, "Options", new Vector2(20, 20), Color.White);

            foreach (Button btn in bl)
            {
                sp.Draw(btn.Texture, btn.Position, btn.SourceRectangle, btn.Color, btn.Rotation, btn.Origin, btn.Scale, btn.Effect, btn.LayerDepth);
            }

            sp.End();
        }
Example #39
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            TileSet tileset = gui.Game.CurrentWorld.Level.TileSet;

            sb.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone);

            for (int y = 0; y < tileset.Height - TileMenu_StartY; y++)
            {
                for (int x = 0; x < tileset.Width - TileMenu_StartX; x++)
                {
                    Color c = Color.White;

                    if (new Rectangle(gui.Game.GraphicsDevice.Viewport.Width - 32 * 6 + x * 32, y * 32, 32, 32).Contains((int)gui.InputManager.MousePosition.X, (int)gui.InputManager.MousePosition.Y))
                    {
                        c = Color.Gray;
                    }

                    if (pattern.contains(x + TileMenu_StartX, y + TileMenu_StartY))
                    {
                        c = Color.Red;
                    }

                    sb.Draw(tileset.Texture, new Vector2(gui.Game.GraphicsDevice.Viewport.Width - 32 * 6 + x * 32, y * 32), tileset[x + TileMenu_StartX, y + TileMenu_StartY].Source, c);
                }
            }

            sb.End();
        }
Example #40
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sB, GraphicsDeviceManager gM, bool drawHUD)
        {
            sB.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            sB.GraphicsDevice.Clear(Color.White);
            if (textures.GetLoadPercent() > 65)
            {
                controls.Draw(sB, Vector2.Zero, null);
            }
            else
            {
                logo.Draw(sB, Vector2.Zero, null);
            }

            if (textures.GetLoadPercent() != 100)
            {
                textures.DrawString(sB, "Loading " + textures.GetLoadPercent() + "%", new Vector2(624, 624), Color.Gray, TextureManager.FontSizes.small, true);
            }
            else
            {
                textures.DrawString(sB, "Finished Loading\n   Press Start", new Vector2(624, 624), Color.Gray, TextureManager.FontSizes.small, true);
            }
            sB.End();

            theStage = stage.loading;
        }
        public override void render(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            AnimationLib.GraphicsDevice.SetRenderTarget(textureScreen);
            AnimationLib.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Transparent, 1.0f, 0);
            renderGUI(sb2, 1.0f);
            AnimationLib.GraphicsDevice.SetRenderTarget(null);
            screenResult = (Texture2D)textureScreen;

            AnimationLib.GraphicsDevice.SetRenderTarget(halfTextureScreen);
            AnimationLib.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Transparent, 1.0f, 0);
            renderGUI(sb2, 0.5f);
            AnimationLib.GraphicsDevice.SetRenderTarget(null);
            halfSizeTexture = (Texture2D)halfTextureScreen;

            AnimationLib.GraphicsDevice.SetRenderTarget(quarterTextureScreen);
            AnimationLib.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Transparent, 1.0f, 0);
            renderGUI(sb2, 0.25f);
            AnimationLib.GraphicsDevice.SetRenderTarget(null);
            quarterSizeTexture = (Texture2D)quarterTextureScreen;

            AnimationLib.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Transparent, 1.0f, 0);

            Game1.BloomFilter.Parameters["halfResMap"].SetValue(halfSizeTexture);
            Game1.BloomFilter.Parameters["quarterResMap"].SetValue(quarterSizeTexture);
            Game1.BloomFilter.Parameters["Threshold"].SetValue(0.3f);
            Game1.BloomFilter.Parameters["BlurDistanceX"].SetValue(0.00175f);
            Game1.BloomFilter.Parameters["BlurDistanceY"].SetValue(0.00175f);

            sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null, Game1.BloomFilter, Matrix.Identity);
            sb.Draw(screenResult, new Vector2(0), Color.White);
            sb.End();
        }
Example #42
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, _rasterizerScissorsState);

            sb.Draw(frameText, new Rectangle(X, Y, width, height), Color.White);

            //if (new Rectangle(X, Y, width, height).Contains((int)GUI.InputManager.MousePosition.X, (int)GUI.InputManager.MousePosition.Y))
            //    if(GUI.InputManager.MouseManager.State.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            //        sb.Draw(backText, ClientArea, Color.Gray);
            //    else
            //        sb.Draw(backText, ClientArea, Color.LightGray);
            //else

            sb.Draw(backText, ClientArea, topColor);
            topColor = Color.White;

            Rectangle oldsc = sb.GraphicsDevice.ScissorRectangle;

            sb.GraphicsDevice.ScissorRectangle = ClientArea;

            sb.DrawString(Parent.Font, drawText, new Vector2(ClientArea.X + 3, ClientArea.Y + 3 - text_y_scroll), Color.Black); //, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
            //sb.DrawString(font, drawString, new Vector2(destination.X, destination.Y - yoffset), color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0);

            sb.GraphicsDevice.ScissorRectangle = oldsc;

            sb.End();
        }
Example #43
0
        public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager g, ref Microsoft.Xna.Framework.Graphics.SpriteFont font)
        {
            sp.Begin();

            /// Logic for drawing the ActiveBackground
            ActiveBackground.DrawSky();
            ActiveBackground.DrawSunrays();
            ActiveBackground.DrawFlowers();
            ActiveBackground.DrawGrass();
            ActiveBackground.DrawSun();
            ActiveBackground.DrawCloud1();
            ActiveBackground.DrawCloud2();
            ActiveBackground.DrawCloud3();
            ActiveBackground.DrawCloud4();
            ActiveBackground.DrawCloud5();

            // Draws the Background-Image
            // sp.Draw(background, new Rectangle(0, 0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height), Color.White);

            // Draws the player-picture in question to detailview
            // sp.Draw(player_picture, detailPictureOutlines, Color.White);

            sp.Draw(player_picture, new Rectangle((int)(bZero * 0.300), (int)(hZero * 0.200), (int)(bZero * 0.400), (int)(hZero * 0.600)), Color.White);

            // Draws the caption in the Topleft-Corner
            // sp.DrawString(font, "Detailview - Click anywhere to return", new Vector2(20, 20), Color.Black);

            // Draws the caption that tells the player how to return to the highscore-tablescreen
            sp.DrawString(font, "Click on the Background to return", new Vector2((int)(bZero * 0.300), 40), Color.White);
            sp.End();
        }
Example #44
0
        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();
        }
Example #45
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();
 }
Example #46
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();
        }
Example #47
0
        public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spritebatch)
        {
            Texture2D border = GameEngine.GetInstance().ResourceManager.GetTexture("p");


            spritebatch.Begin();
            spritebatch.Draw(border, new Vector2(95, 50), null, Color.SaddleBrown * 0.5f, 0.0f, Vector2.Zero, new Vector2(200, 400), SpriteEffects.None, 0.0f);

            foreach (KeyValuePair <int, String> kvp in GameEngine.GetInstance().Client.ConnectedClients)
            {
                spritebatch.DrawString(font, kvp.Value.ToString(), new Vector2(110, 50 * kvp.Key), Color.White);
            }
            spritebatch.End();

            spritebatch.Begin();
            terrainGenerator.Draw(spritebatch, new Vector2(983, 200));
            spritebatch.End();

            gui.Draw(spritebatch);
        }
Example #48
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sprite)
 {
     sprite.Begin();
     for (int i = 0; i < 5; i++)
     {
         sprite.DrawString(fuente, mensajes[i], posicionMensaje[i], new Color(0, 0, 0, transparencia[i]));
     }
     //sprite.DrawString();
     sprite.End();
     //base.Draw(sprite);
 }
Example #49
0
        public void Draw(Microsoft.Xna.Framework.GameTime gametime, Microsoft.Xna.Framework.Graphics.SpriteBatch spritebatch)
        {
            spritebatch.Begin();
            spritebatch.Draw(background, Vector2.Zero, Color.White);
            buildings.Back_Draw(spritebatch);
            nukes.Draw(spritebatch);

            spritebatch.End();

            spritebatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Deferred, SaveStateMode.None);
            nukes.Particle_Draw(spritebatch);
            spritebatch.End();

            spritebatch.Begin();
            spritebatch.Draw(clouds, new Vector2(0, -250), Color.White);
            buildings.Draw(spritebatch);
            pause.Draw(spritebatch);
            spritebatch.DrawString(font, "Score:" + Score, Vector2.Zero, Color.Black);
            spritebatch.End();
        }
Example #50
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
 {
     batch.Draw(texture, Area, Color.White);
     batch.End();
     graph.Draw(new Rectangle(
                    Area.X + 2,
                    Area.Y + label.Area.Height + 2,
                    Area.Width - 4,
                    Area.Height - label.Area.Height - value.Area.Height - 4));
     batch.Begin();
 }
Example #51
0
        protected override void OnDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb, ref Point offect)
        {
            if (color.A == 0)
            {
                return;
            }
            if (bTrans == false)
            {
                sb.End();
                sb.Begin(SpriteSortMode.Deferred, BlendState.Opaque, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone);
            }
            float     width  = (seedsize.X * this.scenescale.X);
            float     height = seedsize.Y * this.scenescale.Y;
            float     x      = this.scenepos.X + offect.X;
            float     y      = this.scenepos.Y + offect.Y;
            Rectangle dest   = new Rectangle((int)x, (int)y, (int)width, (int)height);

            Rectangle src = new Rectangle((int)(srcuv.X * tex.Width),
                                          (int)(srcuv.Y * tex.Height),
                                          (int)(srcuv.Width * tex.Width),
                                          (int)(srcuv.Height * tex.Height));
            Vector2 orient = seedorient;

            orient.X *= src.Width / seedsize.X;
            orient.Y *= src.Height / seedsize.Y;

#if XNA
#else
            //monogame orient 实现有bug...
            //orient.X *= (float)tex.Width /src.Width;
            //orient.Y *=  (float)tex.Height/src.Height;
#endif
            //float rotate = rotate * Math.Sign(scenescale.X) * Math.Sign(scenescale.Y);
            sb.Draw(tex, dest, src, color, rotate, orient, SpriteEffects.None, 0);
            //sb.Draw(d.block.parent.texture, new Rectangle((int)(pos.X - 2), (int)(pos.Y - 2), 4, 4), Color.Red);
            if (bTrans == false)
            {
                sb.End();
                sb.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone);
            }
        }
Example #52
0
        public void Draw(Microsoft.Xna.Framework.GameTime gametime, Microsoft.Xna.Framework.Graphics.SpriteBatch spritebatch)
        {
            spritebatch.Begin();
            spritebatch.Draw(background, Vector2.Zero, Color.White);
            nukes.Draw(spritebatch);
            nukes.Particle_Draw(spritebatch);
            spritebatch.Draw(clouds, Vector2.Zero, Color.White);
            buildings.Draw(spritebatch);
            spritebatch.Draw(Billboard, Vector2.Zero, Color.White);
            switch (MenuSwitch)
            {
            case Menu_Switch.HighScore:
            {
                int y = 0;
                foreach (HighScores.Score s in highScores.Scores)
                {
                    menu.SpriteBatch(spritebatch);
                    spritebatch.DrawString(font, s.ToString(), new Vector2(100, 100 + (y * 20)), Color.Black);
                    y += 1;
                    if (y > 20)
                    {
                        y = 0;
                    }
                }
            }
            break;

            case Menu_Switch.Logo:
                if (Logo != null)
                {
                    spritebatch.Draw(Logo[logo_Value], new Vector2(75, 80), Color.White);
                }
                break;

            case Menu_Switch.MainMenu:
                Start.SpriteBatch(spritebatch);
                Help.SpriteBatch(spritebatch);
                Quit.SpriteBatch(spritebatch);
                Highscores.SpriteBatch(spritebatch);
                spritebatch.Draw(Title, new Vector2(400, 20), null, new Color(255, 255, 255, Menu_Alpha), 0.0f, new Vector2(200, 0), 0.9f, SpriteEffects.None, 0);
                spritebatch.DrawString(font, credits, new Vector2(0, credit_Y), Color.Black);

                break;

            case Menu_Switch.Help:
                spritebatch.Draw(Help_front, new Vector2(51, 50), Color.White);
                menu.SpriteBatch(spritebatch);
                break;
            }
            spritebatch.Draw(Lights_Billboard, Vector2.Zero, Color.White);

            spritebatch.End();
        }
Example #53
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sprite)
 {
     colorActual   = new Color(0, 0, 0, 20);
     base.posicion = new Vector2((anchoVentana - (anchoMensaje / 2) / 2), 100 /*(((altoVentana) - altoMensaje) / 2) - altoMensaje*/);
     sprite.Begin();
     crearSombra(sprite);
     colorActual = Color.Silver;
     efecto(sprite);
     sprite.DrawString(base.Fuente, base.Texto, base.Posicion, new Color(Red, Green, Blue));
     sprite.End();
     //base.Draw(sprite);
 }
Example #54
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,
                               Camera.Camera.camera.getMatrix());

            if (Camera.Camera.camera.Target != null)
            {
                Map.World.World.world.draw(_GraphicsDevice, _SpriteBatch, 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();

            _SpriteBatch.Begin();
            base.draw(_GraphicsDevice, _SpriteBatch);
            _SpriteBatch.End();
        }
Example #55
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            if (isActive == false)
            {
                return;
            }

            spriteBatch.Begin();
            spriteBatch.Draw(bullet_texture, position, Color.Yellow);
            spriteBatch.End();

            base.Draw(spriteBatch);
        }
Example #56
0
 /// <summary>Отрисовывает</summary>
 /// <param name="spriteBatch">The sprite batch.</param>
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     spriteBatch.Begin();
     if (mAlphaValue != 0)
     {
         spriteBatch.Draw(Background, Rect, new Color(255, 255, 255, MathHelper.Clamp(mAlphaValue, 0, 255)));
     }
     else if (Cycle > 100)
     {
         spriteBatch.Draw(Background, Rect, new Color(fadeOut, 0, 0));
     }
     else
     {
         spriteBatch.Draw(Background, Rect, Color.White);
     }
     spriteBatch.End();
 }
        public override void RenderBatch(float[] vertexData, int vertexCount)
        {
            var j = 0;

            _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null);

            //for (var i = 0; i < vertexCount; i++)
            //{
            var position = new Microsoft.Xna.Framework.Vector2(vertexData[j + 0], vertexData[j + 1]);
            var color    = new Microsoft.Xna.Framework.Color(vertexData[j + 4], vertexData[j + 5], vertexData[j + 6], vertexData[j + 7]);

            _spriteBatch.Draw(_currentTexture, position, color);
            j += 8;
            //

            _spriteBatch.End();
        }
Example #58
0
        public override void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            base.draw(sb);
            sb.Begin();
            Vector2 pos = new Vector2(300, 50);

            if (myTemp.Seconds >= 10)
            {
                sb.DrawString(myFont, ("Time Left: " + myTemp.Minutes + ":" + myTemp.Seconds), pos, Color.Black);
            }
            else
            {
                sb.DrawString(myFont, ("Time Left: " + myTemp.Minutes + ":" + 0 + myTemp.Seconds), pos, Color.Black);
            }

            sb.End();
            //base.draw(sb);
        }
Example #59
0
        public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager graphics, ref Microsoft.Xna.Framework.Graphics.SpriteFont font)
        {
            sp.Begin();
            g.Clear(Color.Black);

            /// Logic for drawing the ActiveBackground
            ActiveBackground.DrawSky();
            ActiveBackground.DrawSunrays();
            ActiveBackground.DrawFlowers();
            ActiveBackground.DrawGrass();
            ActiveBackground.DrawSun();
            ActiveBackground.DrawCloud1();
            ActiveBackground.DrawCloud2();
            ActiveBackground.DrawCloud3();
            ActiveBackground.DrawCloud4();
            ActiveBackground.DrawCloud5();

            // Draws the Background-Image
            // sp.Draw(background, new Rectangle(0, 0, bZero, hZero), Color.White);

            // Top-Left corner caption
            // sp.DrawString(font, "Endgame", new Vector2(20, 20), Color.White);

            // The Scoreboard
            sp.DrawString(GameSpecs.scoreFont, Convert.ToInt32(Timer.Score).ToString(), new Vector2((int)(bZero * 0.38), (int)(hZero * 0.011)), Color.OrangeRed);

            // The Placeholder-graphic for the KinectStream
            sp.Draw(placeholder, new Rectangle((int)(bZero * 0.300), (int)(hZero * 0.200), (int)(bZero * 0.400), (int)(hZero * 0.600)), Color.White);

            // The Countdown for taking the photo
            sp.DrawString(GameSpecs.scoreFont, Math.Round(Countdown.Counter).ToString(), new Vector2((float)(bZero / 2) - 80, (float)(hZero - 160)), Color.Turquoise);

            if (Session.PhotoTaken == true)
            {
                // Draw the Button(s)
                foreach (Button btn in bl)
                {
                    sp.Draw(btn.Texture, btn.Position, btn.SourceRectangle, btn.Color, btn.Rotation, btn.Origin, btn.Scale, btn.Effect, btn.LayerDepth);
                }
            }

            sp.End();
        }
Example #60
0
        public override void draw(
            Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch,
            Microsoft.Xna.Framework.Graphics.GraphicsDevice device,
            Microsoft.Xna.Framework.Graphics.RenderTarget2D[] render_targets)
        {
            base.draw(spriteBatch, device, render_targets);

            device.SetRenderTarget(render_targets[0]);
            device.Clear(Color.Transparent);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            Splash.draw(spriteBatch);

            if (DisclaimerIndex < DISCLAIMERS.Length)
                PreviewString.draw(spriteBatch);

            BlackScreen.draw(spriteBatch);
            spriteBatch.End();
        }