public GameTexture2D this[string name, int frame] { get { var texture = textureList.FirstOrDefault(item => item.Type.Equals(name) && item.ID == frame); if (texture == null) { BOXFile.Entry entry; if ((entry = BOX.Entries.FirstOrDefault(item => item.Filename == name + ".mfb")) == null) { throw new Exception($"Texture (name: {name}.mfb) doesn't exists."); } var mfb = new MFBFile(entry.Data); for (var i = 0; i < mfb.Entries.Count; i++) { var item = new GameTexture2D( GetTexture2DFromBitmap(new Bitmap(mfb.Entries[i])), mfb.Offset, name.Replace(".mfb", null), i ); textureList.Add(item); if (i == frame) { texture = item; } } } if (texture == null) { throw new Exception($"{name}.mfb: frame {frame} doesn't exists."); } return(texture); } }
private void DrawTexture(Point isoCoords, GameTexture2D texture) { spriteBatch.Draw(texture.getTexture2D(), new Vector2( isoCoords.X - texture.Offset.X + tileWidth / 2, isoCoords.Y - texture.Offset.Y), Color.White); }