From 8e59db0075fc5beaac76775cc873ff914e9c0bbf Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 28 Nov 2020 17:05:46 +0100 Subject: [PATCH] added an example for custom clothing --- Content/ExampleMod/CustomClothes.png | Bin 0 -> 876 bytes Content/ExampleMod/CustomClothesIcons.png | Bin 0 -> 468 bytes ExampleMod.cs | 14 ++++++++++++++ 3 files changed, 14 insertions(+) create mode 100644 Content/ExampleMod/CustomClothes.png create mode 100644 Content/ExampleMod/CustomClothesIcons.png diff --git a/Content/ExampleMod/CustomClothes.png b/Content/ExampleMod/CustomClothes.png new file mode 100644 index 0000000000000000000000000000000000000000..fb2524343423dbc8f7f4e13702e7e470a0873c76 GIT binary patch literal 876 zcmV-y1C#uTP)Px&CP_p=RCt{2+(ByVFc5&@iD?Oe&?98yoyh%9BC_kIM+gRE4E0+C1=*Gq$&%xw z@Bg5Sx}K4($O&|m5di=I0RBrm-ybfQ%V7Vml=7bY&hgHJm&;{19*?7AP18hQ#5=`T z(*s)TS#Sx*<59HM!=v*;=d2Mwn*b4!>-G9*oMbsU`@UZ-#yJ5#xv#)03cd;2k3!Bf zm=f!X@B3c5u1gw!zu(K}=jX#~h*|+_F2SvNCqOB+>-#?IMofI_N0=R3V*F5!k5GcH z>lP256Z;DB000000001hzsURl`e}*ld_E`rZ$CGF)AG31dieVK8Xdb{uhBP=8^39J zd^&R_#pDj1vqrqLG*(qfMdK(rIX5YfH%(LQ0_4{)7G{{RpA z2hcwt9{mG^{sD_)Um+d<00000008h8Q66_4oPPhmL}@Cgf51~qW6v&6ZyjI0Q9uD} z?N4wSO~5ls+pktW_dZiUKR@>iE%6Md_9A%J_|8Yb9=w#)oTlqUiT(wl4i?`20j0~+ zsd-F!KG&o2yt6!BqO`nq4$9*I000000001BiVYIJ;CK1{e{MYe16(K4Kfr_j0rU@u zNB;n!f576{SBM7y0000000000Hn61R9vc&^4Q|Qo@%jDzU7SN}Jyg}L{+qN%$W9<4 z(aldv#G4y8`vaP$xlclD9y4xLRiiv2^N9#1G))guI>6W$VLH*oc8@R{8${&3xuNfS zsq1>t3-JB@J=l3fWVX@5yFbA0_+YoxiDk#cc8^d>?b^1z|DJR6A|iENkD4&FZ5v(z z)BZtIv9Dz4hGSNfS;B|IA!`CeZmYmds%zZY1c*k|Ox12sJ761SMEBgoU<<+|OkzO?b0000 "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() {