コード例 #1
0
        //void DrawGroud(Ground ground)
        //{
        //    foreach (var mesh in ground.Model.Meshes)
        //    {
        //        foreach (BasicEffect effect in mesh.Effects)
        //        {
        //            effect.EnableDefaultLighting();
        //            effect.PreferPerPixelLighting = true;

        //            effect.World = ground.WorldMatrix;
        //            effect.View = player.Camera.View;
        //            effect.Projection = player.Camera.Projection;
        //        }
        //        mesh.Draw();
        //    }
        //}

        public void Draw()
        {
            if (gameManager.IsGameRunning)
            {
                screenManager.Graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
                screenManager.Graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
                screenManager.Graphics.GraphicsDevice.RasterizerState   = new RasterizerState()
                {
                    MultiSampleAntiAlias = true
                };
                screenManager.Graphics.GraphicsDevice.SamplerStates[0] = new SamplerState()
                {
                    Filter = TextureFilter.Anisotropic
                };
                if (gameManager.Type == LabiryntType.Prim)
                {
                    labirynth.VertexMap.Where(m => frustum.Contains(m.BoundingBox) != ContainmentType.Disjoint).ToList().ForEach(i => i.Draw(player.Camera.View, player.Camera.Projection, basicEffect));
                }
                else if (gameManager.Type == LabiryntType.Recursive)
                {
                    labirynth.ModelMap.ForEach(i => i.Draw(player.Camera.View, player.Camera.Projection));
                }

                skyBox.Draw(player.Camera.View, player.Camera.Projection);
                finishPoint.Draw(player.Camera.View, player.Camera.Projection, basicEffect);
                ground.Draw(player.Camera.View, player.Camera.Projection, basicEffect);
                keys.ForEach(i => i.Draw(player.Camera.View, player.Camera.Projection, basicEffect));
                minimap.Draw(new Vector2(player.position.X, player.position.Z));
                //DrawGroud(ground);
            }
        }
コード例 #2
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(Color.CornflowerBlue);

            spriteBatch.Begin();

            spriteBatch.Draw(background, new Rectangle(0, 0, 1280, 720), Color.White);
            ground.Draw(spriteBatch);
            target.Draw(spriteBatch);

            foreach (Projectile p in projectiles)
            {
                if (!p.IsFired)
                {
                    DrawLineBetween(spriteBatch, strapTexture, p.Center, slingshot.FarBranchPosition, Color.White);
                    p.Draw(spriteBatch);
                    DrawLineBetween(spriteBatch, strapTexture, p.Center, slingshot.NearBranchPosition, Color.White);
                }
                else
                {
                    p.Draw(spriteBatch);
                }
            }

            slingshot.Draw(spriteBatch);

            spriteBatch.Draw(cursorCurrent, new Vector2(currentMouseState.X, currentMouseState.Y), Color.White);

            spriteBatch.End();

            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
コード例 #3
0
 public void Draw(SharpDX.Direct2D1.RenderTarget target)
 {
     target.PushAxisAlignedClip(new SharpDX.Mathematics.Interop.RawRectangleF(this.bounds.Left, this.bounds.Top, this.bounds.Right, this.bounds.Bottom), SharpDX.Direct2D1.AntialiasMode.PerPrimitive);
     Ground.Draw(target, this.bounds);
     //this.containedObject?.Draw(target);
     target.PopAxisAlignedClip();
     IsChanged = false;
 }
コード例 #4
0
        public override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

            ground.Draw(spriteBatch, scene);
            foreach (var tree in World.DeadTrees.Keys)
            {
                tree.Draw(spriteBatch);
            }
            foreach (var building in World.DeadBuildings.Keys)
            {
                building.Draw(spriteBatch);
            }
            foreach (var unit in World.DeadUnits.Keys)
            {
                unit.Draw(spriteBatch);
            }
            for (int i = 0; i <= World.TObjects.Count - 1; i++)
            {
                World.TObjects[i].Draw(spriteBatch, gameTime, scene);
            }
            World.Flag.Image.Draw(spriteBatch);
            BuildingRectangle.Draw(spriteBatch);

            #region Debug

            spriteBatch.DrawString(arial, FocusObjects.Count.ToString(), new Vector2(50, 50), Color.Brown);
            //spriteBatch.DrawString(arial, World.TObjects.Count.ToString(), new Vector2(100, 100), Color.White);
            //spriteBatch.DrawString(arial, World.TUnits.Count.ToString(), new Vector2(500, 500), Color.Red);
            //spriteBatch.DrawString(arial, new Point(MS.X, MS.Y).ToString(), new Vector2(100, 150), Color.Red);
            //spriteBatch.DrawString(arial, "Scene Location: " + (scene.Rect.Location).ToString(), new Vector2(100, 170), Color.Blue);
            //spriteBatch.DrawString(arial, "Field Right and Field Bottom " + (World.Field.Right).ToString() + " " + (World.Field.Bottom).ToString(), new Vector2(100, 190), Color.Blue);
            //spriteBatch.DrawString(arial, "Scene Right and Scene Bottom: " + (scene.Rect.Right).ToString() + " " + (scene.Rect.Bottom).ToString(), new Vector2(100, 210), Color.Blue);
            //if (FocusObject != null) {
            ////    spriteBatch.DrawString(arial, FocusObject.IsFocused.ToString(), new Vector2(100, 115), Color.White);
            ////    spriteBatch.DrawString(arial, "image pos: " + FocusObject.Image.Position.ToString(), new Vector2(100, 225), Color.Black);
            ////    spriteBatch.DrawString(arial, "obj location: " + FocusObject.Position.ToString() + FocusObject.Visible.ToString(), new Vector2(100, 250), Color.Black);
            ////    spriteBatch.DrawString(arial, "intersect?: " + scene.Contains(FocusObject).ToString(), new Vector2(100, 275), Color.Black);
            ////    if (FocusObject is TUnit)
            ////        spriteBatch.DrawString(arial, (FocusObject as TUnit).Aim.ToString(), new Vector2(100, 300), Color.Red);
            //    spriteBatch.DrawString(arial, ((FocusObject as TUnit).Target != null).ToString(), new Vector2(100, 130), Color.Red);
            //}
            //spriteBatch.DrawString(arial, BuildingRectangle.Visible.ToString(), new Vector2(300, 300), Color.Red);
            //spriteBatch.DrawString(arial, BuildingRectangle.Position.ToString(), new Vector2(300, 320), Color.Red);
            //spriteBatch.DrawString(arial, BuildingRectangle.Size.ToString(), new Vector2(300, 340), Color.Red);
            //spriteBatch.DrawString(arial, BuildingRectangle.box.ToString(), new Vector2(300, 300), Color.Red);

            #endregion

            base.Draw(gameTime);

            spriteBatch.End();
        }
コード例 #5
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(Color.CornflowerBlue);
            GraphicsDevice.BlendState        = BlendState.Opaque;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            effect.View  = camera.ViewMatrix;
            effect.World = Matrix.Identity;
            effect.CurrentTechnique.Passes[0].Apply();

            Matrix identity = Matrix.Identity;

            ground.Draw(effect);
            airplane.Draw(ref effect, ref identity);
            houses.Draw(effect);

            base.Draw(gameTime);
        }
コード例 #6
0
        public override void Draw(GameTime gameTime)
        {
            Game.GraphicsDevice.SetRenderTarget(render);
            Game.GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            ground.Draw(spriteBatch, camera);
            spriteBatch.End();
            Game.GraphicsDevice.SetRenderTarget(null);

            GraphicsDevice.Clear(Color.Gray);

            spriteBatch.Begin();
            spriteBatch.Draw(render, camera.Viewport, Color.White);
            mainPanelSprite.Draw(spriteBatch);
            base.Draw(gameTime);
            minimap.Draw(spriteBatch);

            spriteBatch.End();
        }
コード例 #7
0
        public override void Draw(GameTime gameTime)
        {
            //spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Game1.globalTransformation);
            bg.Draw(gameTime);

            flock.draw(gameTime);
            foreach (Player p in players)
            {
                p.Draw(gameTime);
            }
            DrawText();
            if (Rocket.rocketFlying)
            {
                _rocket.Draw(gameTime);
            }
            //DrawSmoke();
            _explosion.Draw(gameTime);

            //spriteBatch.End();

            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(Color.CornflowerBlue);
            GraphicsDevice.SetVertexBuffer(vertexBuffer);
            GraphicsDevice.BlendState        = BlendState.Opaque;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            effect.View  = camera.ViewMatrix;
            effect.World = worldRotation * worldTranslation;
            effect.VertexColorEnabled = true;

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                ground.Draw(camera, effect);
                airplane.Draw(camera, effect);
                //houses.Draw(camera, effect);
            }

            base.Draw(gameTime);
        }
コード例 #9
0
 public void Draw(SpriteBatch spriteBatch)
 {
     //spriteBatch.Draw(TextureLoader.Fun, new Rectangle(0, 0, 10 * Ground.CellSize, 10 * Ground.CellSize), Color.White);
     ground.Draw(spriteBatch);
 }
コード例 #10
0
ファイル: Game1.cs プロジェクト: Sovic381/LastArena
        /// <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(Color.CornflowerBlue);

            // TODO: Add your drawing code here

            //affichage
            spriteBatch.Begin();

            //Terrain
            Ground.Draw(spriteBatch);

            //tir
            for (int i = 0; i < Shots.Count; i++)
            {
                spriteBatch.Draw(Shots[i].Texture, new Vector2(Shots[i].Position.X, Shots[i].Position.Y), Color.White);
            }

            //ennemis
            foreach (BigEnemy iEnemy in BigEnemies)
            {
                iEnemy.Draw(spriteBatch);
            }
            foreach (Enemy iEnemy in Enemies)
            {
                iEnemy.Draw(spriteBatch);
            }


            //Joueur
            if (Player.TimeInvincible >= 0)
            {
                spriteBatch.Draw(imgPlayerInvincible, new Vector2(Player.Position.X, Player.Position.Y), Color.White);
            }
            else
            {
                spriteBatch.Draw(Player.Texture, new Vector2(Player.Position.X, Player.Position.Y), Color.White);
            }

            //Tir des ennemis
            foreach (Enemy iEnemy in Enemies)
            {
                for (int i = 0; i < iEnemy.EnemyShots.Count; i++)
                {
                    spriteBatch.Draw(iEnemy.EnemyShots[i].Texture, new Vector2(iEnemy.EnemyShots[i].Position.X, iEnemy.EnemyShots[i].Position.Y), Color.White);
                }
            }
            foreach (BigEnemy iEnemy in BigEnemies)
            {
                for (int i = 0; i < iEnemy.EnemyShots.Count; i++)
                {
                    spriteBatch.Draw(iEnemy.EnemyShots[i].Texture, new Vector2(iEnemy.EnemyShots[i].Position.X, iEnemy.EnemyShots[i].Position.Y), Color.White);
                }
            }

            //Texte
            spriteBatch.DrawString(Font, "VIE : " + Player.iLife, new Vector2(300, 10), Color.White);
            spriteBatch.DrawString(Font, "Vague : " + iNbWave, new Vector2(300, 30), Color.White);

            //Curseur
            if (StateMouse.X >= 0 || StateMouse.X <= Window.ClientBounds.Width || StateMouse.Y >= 0 || StateMouse.Y <= Window.ClientBounds.Height)
            {
                spriteBatch.Draw(MouseTexture, new Vector2(StateMouse.X, StateMouse.Y), Color.White);
            }


            //GameOver
            if (Player.iLife <= 0)
            {
                spriteBatch.Draw(imgGameOver, new Vector2(0, 0), Color.White);
            }

            spriteBatch.End();


            base.Draw(gameTime);
        }