diff --git a/Content/ExampleMod/Localization/En.json b/Content/ExampleMod/Localization/En.json index 69f3d79..7d22f11 100644 --- a/Content/ExampleMod/Localization/En.json +++ b/Content/ExampleMod/Localization/En.json @@ -1,6 +1,7 @@ { "BuildMode": { - "ExampleMod.CustomTable": "Custom Table" + "ExampleMod.CustomTable": "Custom Table", + "ExampleMod.CrossedWallpaper": "Crossed Wallpaper" }, "Clothes": { "ExampleMod.DarkShirt": "Dark Shirt", diff --git a/Content/ExampleMod/Wallpapers.png b/Content/ExampleMod/Wallpapers.png new file mode 100644 index 0000000..b8974bf Binary files /dev/null and b/Content/ExampleMod/Wallpapers.png differ diff --git a/ExampleMod.cs b/ExampleMod.cs index b628879..c2ea4c3 100644 --- a/ExampleMod.cs +++ b/ExampleMod.cs @@ -12,6 +12,7 @@ using TinyLife.Emotions; using TinyLife.Mods; using TinyLife.Objects; using TinyLife.Utilities; +using TinyLife.World; namespace ExampleMod; @@ -31,6 +32,7 @@ public class ExampleMod : Mod { private UniformTextureAtlas customHairs; private UniformTextureAtlas customBottoms; private UniformTextureAtlas uiTextures; + private UniformTextureAtlas wallpaperTextures; public override void AddGameContent(GameImpl game, ModInfo info) { // adding a custom furniture item @@ -92,6 +94,9 @@ public class ExampleMod : Mod { // we use this emotion modifier in SitDownOnGrassAction GrassSittingModifier = EmotionModifier.Register( new EmotionModifier("ExampleMod.GrassSitting", this.uiTextures[1, 0], EmotionType.Happy)); + + // adding a custom wallpaper (we're using the top left texture region, which is why we pass 0, 0 as the texture coordinate) + Wallpaper.Register("ExampleMod.CrossedWallpaper", 15, this.wallpaperTextures, new Point(0, 0), ColorScheme.Modern, this.Icon); } public override void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker, ModInfo info) { @@ -103,6 +108,8 @@ public class ExampleMod : Mod { texturePacker.Add(content.Load("CustomHairs"), r => this.customHairs = new UniformTextureAtlas(r, 4, 6)); texturePacker.Add(content.Load("CustomBottomsShoes"), r => this.customBottoms = new UniformTextureAtlas(r, 8, 6)); texturePacker.Add(content.Load("UiTextures"), r => this.uiTextures = new UniformTextureAtlas(r, 8, 8)); + // wallpaper textures require special treatment to work with openings, the x and y values are passed to the UniformTextureAtlas constructor + TextureHandler.ApplyWallpaperMasks(content.Load("Wallpapers"), 4, 5, r => this.wallpaperTextures = r); } public override IEnumerable GetCustomFurnitureTextures(ModInfo info) {