コード例 #1
0
ファイル: Smoke.cs プロジェクト: ao222qc/1DV437_Assignments
 public void Draw(SpriteBatch spriteBatch, Camera cam, Texture2D smokeSprite)
 {
     Color color = new Color(fade, fade, fade, fade);
     Vector2 vec = cam.scaleSmoke(position.X, position.Y);
     spriteBatch.Draw(smokeSprite, vec,
     null, color, rotation, Vector2.Zero, this.size, SpriteEffects.None, 0f);
 }
コード例 #2
0
 public void Draw(SpriteBatch spriteBatch, Camera camera, Texture2D gameArea, Texture2D smokeSprite, float totalSeconds)
 {
     //smokeHandler.Update(totalSeconds);
     spriteBatch.Begin();
     spriteBatch.Draw(gameArea, camera.GetGameWindow(), Color.Transparent);
     smokeHandler.DrawAndUpdate(spriteBatch, camera, smokeSprite, totalSeconds);
     spriteBatch.End();
 }
コード例 #3
0
        public void DrawAndUpdate(SpriteBatch spriteBatch, Camera cam, Texture2D smokeSprite, float totalSeconds)
        {
            foreach (Smoke smoke in smokes)
            {
                smoke.Update(totalSeconds);

                if (smoke.IsParticleAlive())
                {
                    smoke.Draw(spriteBatch, cam, smokeSprite);
                }
            }
        }
コード例 #4
0
ファイル: Game1.cs プロジェクト: ao222qc/1DV437_Assignments
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            camera = new Camera(graphics.GraphicsDevice.Viewport);
            gameArea = new Texture2D(graphics.GraphicsDevice, 1, 1);
            gameArea.SetData<Color>(new Color[]
                {
                    Color.White
                });

            smokeHandler = new SmokeHandler();
            gameView = new GameView(smokeHandler, graphics);
            smokeSprite = Content.Load<Texture2D>("particlesmoke");
            // TODO: use this.Content to load your game content here
        }