public override void Draw(SpriteBatch spriteBatch, Camera camera) { //spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, effect, // camera.CalculateTransformMatrix(Parallax)); //foreach (Sprite sprite in Sprites) //{ // sprite.Draw(spriteBatch); //} //spriteBatch.End(); }
public void Draw(SpriteBatch spriteBatch, Camera camera) { spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, _terrainEffect, camera.CalculateTransformMatrix(Vector2.One)); foreach (TerrainChunk chunk in _chunks) { _terrainEffect.Parameters["heightmap"].SetValue(chunk.Heightmap); _terrainEffect.Parameters["verticesCount"].SetValue(chunk.VerticesCount); spriteBatch.Draw(_blankTexture, chunk.Bounds.ToPixels(), Color.White); } spriteBatch.End(); }
public void Draw(SpriteBatch spriteBatch, Camera camera) { if (!PhysicsDebugEnabled) return; Matrix physicsProjection = Matrix.CreateOrthographicOffCenter( left: 0, right: camera.Viewport.Dimensions.X.ToMeters(), bottom: camera.Viewport.Dimensions.Y.ToMeters(), top: 0, zNearPlane: 0, zFarPlane: 1); Matrix physicsView = Matrix.CreateTranslation(new Vector3(-camera.Viewport.TopLeft.ToMeters(), 0))* Matrix.CreateTranslation(new Vector3(-camera.Viewport.Pivot.ToMeters(), 0))* Matrix.CreateRotationZ(camera.Viewport.Rotation)* Matrix.CreateScale(camera.Viewport.Scale.X, camera.Viewport.Scale.Y, 1)* Matrix.CreateTranslation(new Vector3(camera.Viewport.Pivot.ToMeters(), 0)); _physicsDebug.RenderDebugData(ref physicsProjection, ref physicsView); }
public CameraOperator(Rectangle viewportBounds) { Camera = new Camera(); Camera.Setup(new Vector2(viewportBounds.Width, viewportBounds.Height)); //Camera.Limits.Down = (TerrainChunk.VerticalPosition + TerrainChunk.Dimensions.Y).ToPixels(); }
public void Draw(SpriteBatch spriteBatch, Camera camera) { spriteBatch.Begin(); _sprite.Draw(spriteBatch); spriteBatch.End(); }
public void Draw(SpriteBatch spriteBatch, Camera camera) { }