Table of Contents

Class WallMode

Namespace
TinyLife.World
Assembly
Tiny Life.dll

A wall mode is a way that a Wall's wallpaper can be displayed. Each wall mode represents a cutout that hides certain parts of a wall for an Opening or Roof to be displayed there.

public class WallMode
Inheritance
WallMode
Inherited Members
Extension Methods

Constructors

WallMode(string, UniformTextureAtlas, Point, UniformTextureAtlas, Point?)

Creates a new wall mode with the given mask settings. Each pixel on the mask that is non-transparent will be removed from the Wallpaper.

public WallMode(string name, UniformTextureAtlas maskTexture, Point maskPosition, UniformTextureAtlas downMaskTexture = null, Point? downMaskPosition = null)

Parameters

name string

The name of this wall mode.

maskTexture UniformTextureAtlas

The texture that is used as a mask when masking Wallpaper using TinyLife.World.WallMode.MaskWallpaper(MLEM.Textures.TextureExtensions.TextureData, MLEM.Textures.TextureExtensions.TextureData, MLEM.Textures.TextureExtensions.TextureData, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point).

maskPosition Point

The position on the MaskTexture that the mask is at, in texture region coordinates similar to MLEM.Textures.UniformTextureAtlas.

downMaskTexture UniformTextureAtlas

The texture that is used as a mask for the "down" version of this wall mode when using TinyLife.World.WallMode.MaskWallpaper(MLEM.Textures.TextureExtensions.TextureData, MLEM.Textures.TextureExtensions.TextureData, MLEM.Textures.TextureExtensions.TextureData, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point). If null, this defaults to the default mask texture.

downMaskPosition Point?

The position on the DownMaskTexture that the mask for the "down" version of this wall mode is at, in texture region coordinates similar to MLEM.Textures.UniformTextureAtlas. If null, this defaults to the default "down" mask position.

Fields

Door

A wall mode that represents a wall with a door-shaped hole in it

public static readonly WallMode Door

Field Value

WallMode

DownMaskPosition

The position on the DownMaskTexture that the mask for the "down" version of this wall mode is at, in texture region coordinates similar to MLEM.Textures.UniformTextureAtlas. Each pixel on the mask that is non-transparent will be removed from the "down" version of the Wallpaper.

public readonly Point DownMaskPosition

Field Value

Point

DownMaskTexture

The texture that is used as a mask for the "down" version of this wall mode when using TinyLife.World.WallMode.MaskWallpaper(MLEM.Textures.TextureExtensions.TextureData, MLEM.Textures.TextureExtensions.TextureData, MLEM.Textures.TextureExtensions.TextureData, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point). Each pixel on the mask that is non-transparent will be removed from the "down" version of the Wallpaper.

public readonly UniformTextureAtlas DownMaskTexture

Field Value

UniformTextureAtlas

Full

A wall mode that represents a wall that is rendered in full, without any holes in it

public static readonly WallMode Full

Field Value

WallMode

FullSizeWindow

A full-size window that leaves almost none of the wall, except for a small sliver at the top.

public static readonly WallMode FullSizeWindow

Field Value

WallMode

LongWindow

A long window with a similar width to SmallWindow

public static readonly WallMode LongWindow

Field Value

WallMode

MaskPosition

The position on the MaskTexture that the mask is at, in texture region coordinates similar to MLEM.Textures.UniformTextureAtlas. Each pixel on the mask that is non-transparent will be removed from the Wallpaper.

public readonly Point MaskPosition

Field Value

Point

MaskTexture

The texture that is used as a mask when masking Wallpaper using TinyLife.World.WallMode.MaskWallpaper(MLEM.Textures.TextureExtensions.TextureData, MLEM.Textures.TextureExtensions.TextureData, MLEM.Textures.TextureExtensions.TextureData, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point, Microsoft.Xna.Framework.Point). Each pixel on the mask that is non-transparent will be removed from the Wallpaper.

public readonly UniformTextureAtlas MaskTexture

Field Value

UniformTextureAtlas

Modes

The registered wall modes, both by mods and the game itself.

public static readonly ReadOnlyDictionary<string, WallMode> Modes

Field Value

ReadOnlyDictionary<string, WallMode>

Name

The name of this wall mode.

public readonly string Name

Field Value

string

NarrowLong

A long window with a very low width and the same length as LongWindow.

public static readonly WallMode NarrowLong

Field Value

WallMode

NarrowWideTop

A bathroom-style window that is high up on the wall and wide but not very tall.

public static readonly WallMode NarrowWideTop

Field Value

WallMode

OutlineOnly

A full-size window that leaves almost none of the wall, just a one-pixel outline around the whole wall.

public static readonly WallMode OutlineOnly

Field Value

WallMode

Roof

A wall mode that represents a wall used on the faces of a Roof that are straight

public static readonly WallMode Roof

Field Value

WallMode

RoofGable

A wall mode that represents a wall used on the faces of a Roof that are gabled

public static readonly WallMode RoofGable

Field Value

WallMode

RoofGableInverse

A wall mode that represents a wall used on the faces of a Roof that are gabled in the opposite direction as RoofGable

public static readonly WallMode RoofGableInverse

Field Value

WallMode

SmallWindow

A wall mode that represents a wall with a small, rectanglular window in it

public static readonly WallMode SmallWindow

Field Value

WallMode

StairsBottom

A wall mode that represents the triangle-like areas at the bottom half of Stairs.

public static readonly WallMode[] StairsBottom

Field Value

WallMode[]

StairsTop

A wall mode that represents the triangle-like areas at the bottom half of Stairs.

public static readonly WallMode[] StairsTop

Field Value

WallMode[]

Methods

ApplyMasks(Texture2D, int, int, RuntimeTexturePacker, Action<Dictionary<Point, TextureRegion>>)

Applies the game's predefined wallpaper maskings (based on WallMode) to the given wallpaper texture. When adding custom Wallpaper types, this method should be used.

public static UniformTextureAtlas ApplyMasks(Texture2D wallpapers, int regionAmountX, int regionAmountY, RuntimeTexturePacker packer = null, Action<Dictionary<Point, TextureRegion>> result = null)

Parameters

wallpapers Texture2D

The texture to mask

regionAmountX int

The amount of texture regions on the x axis

regionAmountY int

The amount of texture regions on the y axis

packer RuntimeTexturePacker

The texture packer to pack the resulting texture with, or null to skip packing the texture

result Action<Dictionary<Point, TextureRegion>>

A function that is called when the packer packed the masked texture, which yields the resulting texture atlas

Returns

UniformTextureAtlas

OffsetTextureRegion(Point, bool, bool)

Offsets the given texture region based on this wall mode, causing the returned texture region to contain the same Wallpaper, but with this wall mode's cutout.

public Point OffsetTextureRegion(Point region, bool vertical, bool isDown)

Parameters

region Point

The texture region location to offset.

vertical bool

Whether the texture region location returned should be a vertical wall.

isDown bool

Whether the texture region location returned should be in the Down display mode.

Returns

Point

The offset texture region position.

Register(WallMode)

Registers the given WallMode to the Modes registry.

public static WallMode Register(WallMode mode)

Parameters

mode WallMode

The mode to register.

Returns

WallMode

The mode passed, for chaining.