Example #1
0
        /// <summary>
        /// Start a new pass to draw sprites
        /// </summary>
        /// <remarks>
        /// Once a pass has begin, you cannot change attributes or draw polygons
        /// until it has ended.
        /// </remarks>
        /// <param name="blend">Blending mode for combining sprites</param>
        public void BeginSpritePass(BlendState blend, Camera camera)
        {
            // Check that state invariant is satisfied.
            Debug.Assert(state == DrawState.Inactive, "Drawing state is invalid (expected Inactive)");
            state = DrawState.SpritePass;

            // Set up the drawing canvas to use the appropriate blending.
            // Deferred sorting guarantees Sprites are drawn in order given.

            transform = camera.TransformMatrix;
            spriteBatch.Begin(SpriteSortMode.Deferred, blend, null, null, null, null, transform);
        }
Example #2
0
 public GameEngine()
 {
     canvas = new GameCanvas(this);
     factory = new ContentFactory(new ContentManager(Services));
     camera = new Camera(canvas.Width, canvas.Height);
 }