public static TextureRegion2D GetItemTextureRegionById(int id) { ItemDefinition itemDef = itemMap[id]; TextureAtlas atlas = itemTextureMaps[itemDef.SpriteMapLocation]; return(atlas.GetTextureRegion(itemDef.SpriteIndex)); }
public void DrawGround(SpriteBatch spriteBatch, TextureAtlas tileAtlas, int xPos, int yPos) { // Draw base Ground Texture int textureRegionIndex = (persistentTile.GroundTileId * tileAtlas.Width); TextureRegion2D textureRegion = tileAtlas.GetTextureRegion(textureRegionIndex); spriteBatch.Draw(textureRegion.Texture, new Vector2(xPos, yPos), textureRegion.SourceRectangle, Color.White); // Draw transition textures foreach (KeyValuePair <ushort, byte> kvp in transitionData) { textureRegionIndex = (kvp.Key * tileAtlas.Width) + kvp.Value; textureRegion = tileAtlas.GetTextureRegion(textureRegionIndex); spriteBatch.Draw(textureRegion.Texture, new Vector2(xPos, yPos), textureRegion.SourceRectangle, Color.White); } }
public static TextureRegion2D GetObjectTextureRegionById(int id) { ObjectDefinition objDef = objectMap[id]; TextureAtlas atlas = objectTextureMaps[objDef.SpriteMapLocation]; return(atlas.GetTextureRegion(objDef.SpriteIndex)); }