CTexture
Represents a (z)doom format composite texture. A composite texture is made up of one or more patches (
For more information, see:
- TEXTURE1 and TEXTURE2 for Doom format
TEXTUREx - TEXTURES for ZDoom format
TEXTURES
Properties
| Property | Type | Description |
|---|---|---|
| The patches that make up the texture | ||
| The texture name | ||
| Width of the texture | ||
| Height of the texture | ||
If true, use world units instead of pixels for offsets (in map) |
||
If true, this is a ZDoom TEXTURES format texture, and contains |
||
The type of the texture: texture, sprite, graphic, walltexture or flat |
||
Horizontal scale of the texture (multiplier, eg. 0.5 is half size) |
||
Vertical scale of the texture (multiplier, eg. 0.5 is half size) |
||
| X offset of the texture | ||
| Y offset of the texture | ||
If true, texture is optional |
||
If true, no decals will show on this texture |
||
If true, this texture is never drawn ingame (like AASHITTY) |
Constructors
No Constructors
This type can not be created directly in scripts.
See:
Functions
Overview
General
Patch Modification
AsText
Gets the text definition of the texture in ZDoom TEXTURES format.
Returns
string : A text representation of the texture
Clear
Clears all texture data.
ConvertExtended
Converts the texture to an 'extended' (ZDoom TEXTURES) texture, and all patches to
Does nothing if the texture is already extended format (true).
ConvertRegular
Converts the texture to an 'regular' (Doom TEXTUREx) texture, and all patches to
Does nothing if the texture is already regular format (false).
CopyTexture
Copies another texture.
Parameters
other (CTexture ): The texture to copy[keepFormat] (boolean ): Iftrue, the current texture format (extended property) will be kept, otherwise it will be converted to the format ofother . Default isfalse
AddPatch
Adds a new patch to the texture.
Parameters
patch (string ): The name of the patch to add[x] (integer , default0): The x position of the patch within the texture[y] (integer , default0): The y position of the patch within the texture[index] (integer , default-1): Where to add the patch in thepatches array. Patches later in the array are drawn over the top of previous ones. If-1, the patch is added to the end of the array
Notes
The type of patch created depends on this texture's
DuplicatePatch
Duplicates the patch at
Parameters
index (integer ): The index of the patch to duplicate[offsetX] (integer ): The amount to add to the X offset of the duplicated patch. Default is8[offsetY] (integer ): The amount to add to the Y offset of the duplicated patch. Default is8
Example
-- Add Patch
texture:AddPatch('patch1', 10, 10)
-- Duplicate Patch
texture:DuplicatePatch(1, 5, 5)
local dupPatch = texture.patches[2]
App.LogMessage('@' .. dupPatch.offsetX .. ',' .. dupPatch.offsetY) -- @15,15
RemovePatch
Removes the patch at
Parameters
index (integer ): The index of the patch to remove
Returns
boolean :falseif the givenindex was invalid (no patch removed)
ReplacePatch
Replaces the patch at
Parameters
index (integer ): The index of the patch to replacenewPatch (string ): The new patch name
Returns
boolean :falseif the givenindex was invalid (no patch replaced)
SwapPatches
Swaps the patch at
Parameters
index1 (integer ): The index of the first patch to swapindex2 (integer ): The index of the second patch to swap
Returns
boolean :falseif either of the given indices were invalid (no patches swapped)