diff --git a/Content/ExampleMod/CustomClothes.png b/Content/ExampleMod/CustomClothes.png new file mode 100644 index 0000000..fb25243 Binary files /dev/null and b/Content/ExampleMod/CustomClothes.png differ diff --git a/Content/ExampleMod/CustomClothesIcons.png b/Content/ExampleMod/CustomClothesIcons.png new file mode 100644 index 0000000..0cc2152 Binary files /dev/null and b/Content/ExampleMod/CustomClothesIcons.png differ diff --git a/ExampleMod.cs b/ExampleMod.cs index 533cbbd..a24ff4e 100644 --- a/ExampleMod.cs +++ b/ExampleMod.cs @@ -2,9 +2,11 @@ using System; using System.Collections.Generic; using ExtremelySimpleLogger; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using MLEM.Data; using MLEM.Data.Content; using MLEM.Misc; +using MLEM.Textures; using TinyLife; using TinyLife.Mods; using TinyLife.Objects; @@ -21,12 +23,20 @@ namespace ExampleMod { public override string Description => "This is the example mod for Tiny Life!"; private DataTextureAtlas customFurniture; + private UniformTextureAtlas customClothes; + private UniformTextureAtlas customClothesIcons; public override void AddGameContent(GameImpl game) { // adding a custom furniture item FurnitureType.Register(new FurnitureType.TypeSettings("ExampleMod.CustomTable", new Point(1, 1), ObjectCategory.Table, 150, ColorScheme.SimpleWood) { Construct = (i, t, c, m, p) => new CustomTable(i, t, c, m, p) }); + + // adding custom clothing + Clothes.Register(new Clothes("ExampleMod.DarkShirt", ClothesLayer.Shirt, + this.customClothes[0, 0], // the top left in-world region (the rest will be auto-gathered from the atlas) + this.customClothesIcons[0, 0], // the region to use for the icon in the character editor + ColorScheme.WarmDark)); } public override void Initialize(Logger logger, RawContentManager content) { @@ -36,6 +46,10 @@ namespace ExampleMod { // the texture atlas combines the png texture and the .atlas information // see https://mlem.ellpeck.de/api/MLEM.Data.DataTextureAtlas.html for more info this.customFurniture = content.LoadTextureAtlas("CustomFurniture"); + + // loads a texture atlas with the given amount of separate texture regions in the x and y axes + this.customClothes = new UniformTextureAtlas(content.Load("CustomClothes"), 4, 6); + this.customClothesIcons = new UniformTextureAtlas(content.Load("CustomClothesIcons"), 16, 16); } public override IEnumerable GetCustomFurnitureTextures() {