mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 12:35:52 -04:00
Simple refactoring
This commit is contained in:
parent
0c0072025c
commit
c596e2df70
@ -95,9 +95,7 @@ namespace ClassicalSharp {
|
||||
|
||||
public static void Reset(Game game) {
|
||||
Init();
|
||||
// TODO: Make this part of TerrainAtlas2D maybe?
|
||||
using (FastBitmap fastBmp = new FastBitmap(game.TerrainAtlas.AtlasBitmap, true, true))
|
||||
RecalculateSpriteBB(fastBmp);
|
||||
game.TerrainAtlas.UpdateState();
|
||||
}
|
||||
|
||||
public static void Init() {
|
||||
|
@ -22,10 +22,16 @@ namespace ClassicalSharp {
|
||||
public void UpdateState(Bitmap bmp) {
|
||||
AtlasBitmap = bmp;
|
||||
TileSize = bmp.Width / TilesPerRow;
|
||||
using (FastBitmap fastBmp = new FastBitmap(bmp, true, true))
|
||||
BlockInfo.RecalculateSpriteBB(fastBmp);
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Updates the underlying atlas bitmap </summary>
|
||||
public void UpdateState()
|
||||
{
|
||||
using (FastBitmap fastBmp = new FastBitmap(AtlasBitmap, true, true))
|
||||
BlockInfo.RecalculateSpriteBB(fastBmp);
|
||||
}
|
||||
|
||||
/// <summary> Creates a new texture that contains the tile at the specified index. </summary>
|
||||
public int LoadTextureElement(int index) {
|
||||
int size = TileSize;
|
||||
@ -38,7 +44,9 @@ namespace ClassicalSharp {
|
||||
return game.Graphics.CreateTexture(dst, false, game.Graphics.Mipmaps);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary> Disposes of the underlying atlas bitmap and texture. </summary>
|
||||
public void Dispose() {
|
||||
if (AtlasBitmap != null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user