mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-05-29 03:23:37 +02:00
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using MLEM.Cameras;
|
|
using MLEM.Extended.Extensions;
|
|
using MLEM.Extended.Tiled;
|
|
using MLEM.Startup;
|
|
using MonoGame.Extended.Tiled;
|
|
|
|
namespace Sandbox {
|
|
public class GameImpl : MlemGame {
|
|
|
|
private Camera camera;
|
|
private TiledMap map;
|
|
private IndividualTiledMapRenderer mapRenderer;
|
|
|
|
public GameImpl() {
|
|
this.IsMouseVisible = true;
|
|
}
|
|
|
|
protected override void LoadContent() {
|
|
base.LoadContent();
|
|
|
|
this.map = LoadContent<TiledMap>("Tiled/Map");
|
|
this.mapRenderer = new IndividualTiledMapRenderer(this.map);
|
|
|
|
this.camera = new Camera(this.GraphicsDevice) {
|
|
AutoScaleWithScreen = true,
|
|
Scale = 2,
|
|
LookingPosition = new Vector2(25, 25) * this.map.GetTileSize()
|
|
};
|
|
}
|
|
|
|
protected override void DoDraw(GameTime gameTime) {
|
|
this.GraphicsDevice.Clear(Color.Black);
|
|
this.SpriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, this.camera.ViewMatrix);
|
|
this.mapRenderer.Draw(this.SpriteBatch, this.camera.GetVisibleRectangle());
|
|
this.SpriteBatch.End();
|
|
base.DoDraw(gameTime);
|
|
}
|
|
|
|
}
|
|
} |