コード例 #1
0
        public void Draw(SpriteBatch aBatch)
        {
            myBackground.Draw(aBatch);

            aBatch.Draw(myPlayerShip, new Vector2(((Game1.mySelf.Window.ClientBounds.Width / 2) - myPlayerShip.Width / 2), (Game1.mySelf.Window.ClientBounds.Height / 2) - myPlayerShip.Height / 2), null, Colour, 0, Vector2.Zero, 1.5f, SpriteEffects.None, 0f); // Draws out my player

            string  tempText         = "MAP " + (MapManager.GetMap() + 1);
            float   tempScale        = 0.75f;
            Vector2 tempSize         = myFont.MeasureString(tempText);
            Vector2 tempTextPosition = new Vector2((Game1.mySelf.Window.ClientBounds.Width / 2), 40);
            //Vector2 tempTextPosition = new Vector2(
            //    ((((Game1.mySelf.Window.ClientBounds.Width) - tempSize.X) * tempScale)),
            //    ((((Game1.mySelf.Window.ClientBounds.Height) - tempSize.Y) * tempScale)/2)
            //    ); //Sets the positions of the Text.
            Vector2 tempPosition = new Vector2
                                   (
                (tempTextPosition.X - ((tempSize.X * tempScale) / 2)),
                (tempTextPosition.Y - ((tempSize.Y * tempScale) / 2))
                                   );

            //Vector2 tempTextPosition = new Vector2((((Game1.mySelf.Window.ClientBounds.X + tempSize.X) * tempScale)) * 2 + 50, (((Game1.mySelf.Window.ClientBounds.Y - tempSize.Y) * tempScale)) / 2 - 20); //Sets the positions of the Text.
            aBatch.DrawString(myFont, tempText, tempPosition, Microsoft.Xna.Framework.Color.Azure, 0f, Vector2.Zero, tempScale, SpriteEffects.None, 0f);

            #region Button

            foreach (Button button in myButtons)
            {
                button.Draw(aBatch); //Used to draw button.
            }

            #endregion
        }
コード例 #2
0
ファイル: Load.cs プロジェクト: TxJson/space-shooter
 public void Draw(SpriteBatch aBatch)
 {
     myBackground.Draw(aBatch);
     foreach (Button button in myButtons)
     {
         button.Draw(aBatch); //Used to draw button.
     }
 }
コード例 #3
0
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred,
                              BlendState.AlphaBlend,
                              null, null, null, null,
                              camera.get_transformation());
            background.Draw(spriteBatch);

            marcoPlayer.Draw(spriteBatch, gameTime);
        }
コード例 #4
0
ファイル: Menu.cs プロジェクト: TxJson/space-shooter
        public void Draw(SpriteBatch aBatch)
        {
            myBackground.Draw(aBatch);
            foreach (Button button in myButtons)
            {
                button.Draw(aBatch); //Used to draw button.
            }
            string tempBalance = "Hex Balance: " + UserInterface.Money();

            aBatch.DrawString(myFont, tempBalance, new Vector2(10, 10), Color.Green, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
        }
コード例 #5
0
        public void DrawBloom(Camera2D camera, BloomComponent bloom, bool isBloom)
        {
            _background.Draw(false, Camera.Pos);

            _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend,
                               null,
                               null,
                               null,
                               null,
                               Camera.GetTransformation(_spriteBatch.GraphicsDevice));

            _spaceManager.Draw(_spriteBatch, Camera.Pos, Camera.Zoom);


            _spriteBatch.End();

            // Draw particles in different spritebatch. Otherwise they look absolutely awful.
            _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.Additive,
                               null,
                               null,
                               null,
                               null,
                               Camera.GetTransformation(_spriteBatch.GraphicsDevice));

            _particleManager.Draw(camera);

            _spriteBatch.End();

            _spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend,
                               null,
                               null,
                               null,
                               null,
                               Camera.GetTransformation(_spriteBatch.GraphicsDevice));

            foreach (var s in _spaceViewModel.Structures)
            {
                switch (s.StructureType)
                {
                default:
                    s.Draw(camera);
                    break;
                }
            }

            _floatyAreaObjectManager.Draw(_spriteBatch, camera);
            _projectileManager.Draw(camera);
            _clientShipManager.Draw(camera);
            _drawShipNames();

            _spriteBatch.End();
        }
コード例 #6
0
ファイル: Upgrade.cs プロジェクト: TxJson/space-shooter
        public void Draw(SpriteBatch aBatch)
        {
            myBackground.Draw(aBatch);
            foreach (Button button in myButtons)
            {
                button.Draw(aBatch);
            }

            string tempBalance = "Hex Balance: " + UserInterface.Money();

            Vector2 tempSize         = myFont.MeasureString(tempBalance);
            Vector2 tempTextPosition = new Vector2
                                           ((Game1.mySelf.Window.ClientBounds.Width - tempSize.X) / 2,
                                           (Game1.mySelf.Window.ClientBounds.Top - tempSize.Y)); //Sets the positions of the Text.
            Vector2 tempSpeedText  = new Vector2(650, 300);
            Vector2 tempHealthText = new Vector2(650, 350);

            aBatch.DrawString(myFont, tempBalance, tempTextPosition, Color.Green, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
            aBatch.DrawString(ContentManager.Font[1], "Speed Points: " + myTemporarySpeedPoints, tempSpeedText, Color.Green, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
            aBatch.DrawString(ContentManager.Font[1], "Health Points: " + myTemporaryHealthPoints, tempHealthText, Color.Green, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
        }
コード例 #7
0
        protected override void Draw(GameTime gameTime)
        {
            // Makes new SpriteBatch
            var sb = new SpriteBatch(GraphicsDevice);

            GraphicsDevice.Clear(Color.CornflowerBlue);

            // Starts the Batch
            sb.Begin();

            bm.Draw(sb);
            em.Draw(sb);

            // Ends Batch
            sb.End();

            // Disposes the batch
            sb.Dispose();

            base.Draw(gameTime);
        }
コード例 #8
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(new Color(31, 31, 31));

            spriteBatch.Begin();

            switch (_state)
            {
            case CGameState.MainScreen:
                _mainscreen.Draw(spriteBatch);
                break;

            case CGameState.CreditsScreen:
                _creditsScreen.Draw(spriteBatch);
                break;

            case CGameState.Playing:
                _background_manager.Draw(spriteBatch);
                _portal_manager.Draw(spriteBatch);
                _bullet_manager.Draw(spriteBatch);
                _enemy_managers.Values
                .ToList()
                .ForEach(x => x.Draw(spriteBatch));
                _player.Draw(spriteBatch);
                _energy_storage_manager.Draw(spriteBatch);
                _bullet_hits_enemy.Draw(spriteBatch);
                _powerup_manager.Draw(spriteBatch);

                break;

            case CGameState.Gameover:
                _gameoverscreen.Draw(spriteBatch);
                break;
            }

            spriteBatch.End();


            base.Draw(gameTime);
        }
コード例 #9
0
        public override void Draw(GameTime gameTime, SpriteBatch _spriteBatch)
        {
            Graphics.Clear(Color.Black);

            //Batch 1 Stationary: BG + text
            _spriteBatch.Begin();

            bg.Draw(gameTime, _spriteBatch);
            BackgroundManager.Draw(gameTime, _spriteBatch);

            _spriteBatch.End();

            _spriteBatch.Begin(SpriteSortMode.FrontToBack,
                               BlendState.AlphaBlend,
                               SamplerState.PointClamp,
                               null, null, null, _camera.Transform);
            //PlanetManager.Draw(gameTime, _spriteBatch);
            foreach (var st in _stations)
            {
                st.Draw(gameTime, _spriteBatch);
            }
            shipYard.Draw(gameTime, _spriteBatch, _player.ControlledShip.Position);
            foreach (var sprite in _sprites)
            {
                sprite.Draw(gameTime, _spriteBatch);
            }
            foreach (var ship in _convoy)
            {
                ship.Draw(gameTime, _spriteBatch);
            }
            foreach (var ship in _enemies)
            {
                ship.Draw(gameTime, _spriteBatch);
            }
            foreach (var co in UI)
            {
                co.Draw(gameTime, _spriteBatch);
            }
            _combatManager.Draw(gameTime, _spriteBatch);



            if (ver == 0)
            {
                throw new System.Exception("Not loaded");
            }

            _spriteBatch.End();
            _spriteBatch.Begin();

            _spriteBatch.DrawString(font, currencyDisplay.value, new Vector2(currencyDisplay.x, currencyDisplay.y), Color.White);

            _spriteBatch.DrawString(_font,
                                    string.Format("posX={0} posY={1}",
                                                  _player.ControlledShip.Position.X, _player.ControlledShip.Position.Y),
                                    new Vector2(30, 80),
                                    Color.White,
                                    0f,
                                    new Vector2(0, 0),
                                    1f,
                                    SpriteEffects.None,
                                    0.1f);
            if (toolTipTradeVis)
            {
                _spriteBatch.DrawString(_font,
                                        "Press F to open trade",
                                        new Vector2(Game1.ScreenWidth / 2, 3 * Game1.ScreenHeight / 4),
                                        Color.White,
                                        0f,
                                        Vector2.Zero,
                                        1f,
                                        SpriteEffects.None,
                                        0.1f);
            }
            _spriteBatch.End();


            //base.Draw(gameTime);
        }