protected override void Initialize() { graphics.PreferMultiSampling = true; graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; graphics.SynchronizeWithVerticalRetrace = true; graphics.PreferMultiSampling = true; graphics.ApplyChanges(); Utility.Initialize(graphics, Content, "content"); testSprite = Sprite.LoadSprite("characters/elisa-spritesheet.png"); var tmxMap = TmxMap.Load("content/maps/twilight_test/twilight_test.json"); world = new World(this, tmxMap); worldRenderer = new WorldRenderer(this, world); Components.Add(world); Components.Add(worldRenderer); Components.Add(new SpritebatchEnder(this, Utility.SpriteBatch, Utility.GuiSpritebatch) {DrawOrder = Int32.MaxValue}); fontTest = new BMFont(GraphicsDevice, "content/fonts/open_sans", false); Utility.Camera.Position = world.Map.Layers.First(layer => layer.Type == TmxLayerType.Object).Objects["PlayerSpawn"][0].Position * world.Scale; oldState = state = Keyboard.GetState(); base.Initialize(); }
public TileWorldRenderer(WorldRenderer worldRenderer, uint chunkSize) { this.worldRenderer = worldRenderer; this.chunkSize = (int)chunkSize; spriteBatch = new SpriteBatch(worldRenderer.Game.GraphicsDevice); }