public void Dispose() { MapRenderer.Dispose(); TerrainAtlas.Dispose(); TerrainAtlas1D.Dispose(); ModelCache.Dispose(); Entities.Dispose(); WorldEvents.OnNewMap -= OnNewMapCore; WorldEvents.OnNewMapLoaded -= OnNewMapLoadedCore; Events.TextureChanged -= TextureChangedCore; for (int i = 0; i < Components.Count; i++) { Components[i].Dispose(); } Graphics.DeleteIb(ref defaultIb); Drawer2D.DisposeInstance(); Graphics.DeleteTexture(ref CloudsTex); Graphics.Dispose(); if (lastAtlas != null) { lastAtlas.Dispose(); } if (Options.OptionsChanged.Count == 0) { return; } Options.Load(); Options.Save(); }
void LoadAtlas(Bitmap bmp) { TerrainAtlas1D.Dispose(); TerrainAtlas.Dispose(); TerrainAtlas.UpdateState(BlockInfo, bmp); TerrainAtlas1D.UpdateState(TerrainAtlas); }
private void DrawToRT(SpriteBatch spr, int x, int y) { Rectangle pos = new Rectangle(x * TILE_SIZE, y * TILE_SIZE, TILE_SIZE, TILE_SIZE); Rectangle source = TerrainAtlas.GetSprite(GetTypeAt(x, y)); spr.Draw(TerrainAtlas.Texture, pos, source, GetColourAt(x, y)); }
public void Dispose() { foreach (var item in RT) { item.Dispose(); } RT = null; TerrainAtlas.Dispose(); }
void LoadAtlas(Bitmap bmp, Stream data) { TerrainAtlas1D.Dispose(); TerrainAtlas.Dispose(); if (lastAtlas != null) { lastAtlas.Dispose(); } TerrainAtlas.UpdateState(BlockInfo, bmp); TerrainAtlas1D.UpdateState(TerrainAtlas); lastAtlas = data; }
public override void Dispose() { MapRenderer.Dispose(); MapBordersRenderer.Dispose(); EnvRenderer.Dispose(); WeatherRenderer.Dispose(); SetNewScreen(null); fpsScreen.Dispose(); SelectionManager.Dispose(); TerrainAtlas.Dispose(); TerrainAtlas1D.Dispose(); ModelCache.Dispose(); Picking.Dispose(); ParticleManager.Dispose(); Players.Dispose(); AsyncDownloader.Dispose(); AudioPlayer.Dispose(); AxisLinesRenderer.Dispose(); Chat.Dispose(); if (activeScreen != null) { activeScreen.Dispose(); } Graphics.DeleteIb(defaultIb); Graphics.Dispose(); Drawer2D.DisposeInstance(); Animations.Dispose(); Graphics.DeleteTexture(ref CloudsTexId); Graphics.DeleteTexture(ref RainTexId); Graphics.DeleteTexture(ref SnowTexId); Graphics.DeleteTexture(ref GuiTexId); Graphics.DeleteTexture(ref GuiClassicTexId); if (Options.HasChanged) { Options.Save(); } base.Dispose(); }
public void Dispose() { MapRenderer.Dispose(); SetNewScreen(null); fpsScreen.Dispose(); TerrainAtlas.Dispose(); TerrainAtlas1D.Dispose(); ModelCache.Dispose(); Entities.Dispose(); WorldEvents.OnNewMap -= OnNewMapCore; WorldEvents.OnNewMapLoaded -= OnNewMapLoadedCore; foreach (IGameComponent comp in Components) { comp.Dispose(); } if (activeScreen != null) { activeScreen.Dispose(); } Graphics.DeleteIb(defaultIb); Drawer2D.DisposeInstance(); Graphics.DeleteTexture(ref CloudsTex); Graphics.DeleteTexture(ref GuiTex); Graphics.DeleteTexture(ref GuiClassicTex); Graphics.DeleteTexture(ref IconsTex); Graphics.Dispose(); foreach (WarningScreen screen in WarningOverlays) { screen.Dispose(); } if (Options.HasChanged) { Options.Load(); Options.Save(); } }
public void RedrawRT(SpriteBatch spr, int tx, int ty) { Main.Graphics.GraphicsDevice.SetRenderTarget(this.RT[tx, ty]); Main.Graphics.GraphicsDevice.Clear(Color.Black); spr.Begin(); int sx = tx * SectorWidth; int sy = ty * SectorHeight; int lx = 0, ly = 0; for (int x = sx; x < sx + SectorWidth; x++) { for (int y = sy; y < sy + SectorHeight; y++) { Rectangle pos = new Rectangle(lx * TILE_SIZE, ly * TILE_SIZE, TILE_SIZE, TILE_SIZE); Rectangle source = TerrainAtlas.GetSprite(GetTypeAt(x, y)); spr.Draw(TerrainAtlas.Texture, pos, source, GetColourAt(x, y)); ly++; } lx++; ly = 0; } spr.End(); Main.Graphics.GraphicsDevice.SetRenderTarget(null); }