示例#1
0
        public void LoadContent()
        {
            LineBatch = new LineBatch(graphicsDevice);
            PointBatch = new PointBatch(graphicsDevice);
            SpriteBatch = new SpriteBatch(graphicsDevice);
            bloom = new Bloom(graphicsDevice, SpriteBatch);

            foreach (GameObject gameObject in gameObjects)
                gameObject.LoadContent();
        }
        public void Draw(PointBatch pointBatch, Camera camera)
        {
            // Draw the starfield
            pointBatch.Begin(Matrix.Identity, camera);

            for (int s = 0; s < starCount; s++)
            {
                pointBatch.Draw(points[s], starRadius, new Color(brightnesses[s], brightnesses[s], brightnesses[s]));
            }

            pointBatch.End();
        }
        public void Draw(Ship ship, LineBatch lineBatch, PointBatch pointBatch, Camera camera)
        {
            // Draw the ship
            Matrix rotation = Matrix.CreateRotationZ(ship.Movement.Rotation);
            Matrix translation = Matrix.CreateTranslation(new Vector3(ship.Movement.Position.X, ship.Movement.Position.Y, 0.0f));

            lineBatch.Begin(rotation * translation, camera);

            for (int v = 0; v < vertices.Count; v++)
            {
                lineBatch.Draw(vertices[v], vertices[(v + 1) % vertices.Count], lineWidth, color);
            }

            lineBatch.End();

            pointBatch.Begin(translation, camera);
            pointBatch.Draw(Vector3.Zero, lightRadius, lightColor);
            pointBatch.End();
        }
 /// <summary>
 /// Loads graphics content needed to display the world
 /// </summary>
 /// <param name="graphicsDevice"></param>
 public void LoadContent(GraphicsDevice graphicsDevice)
 {
     lineBatch = new LineBatch(graphicsDevice);
     pointBatch = new PointBatch(graphicsDevice);
     spriteBatch = new SpriteBatch(graphicsDevice);
     bloom = new Bloom(graphicsDevice, spriteBatch);
 }