Class Texture
java.lang.Object
zombie.asset.Asset
zombie.core.textures.Texture
- All Implemented Interfaces:
Serializable, IDestroyable, IMaskerable, ITexture
- Direct Known Subclasses:
AngelCodeFont.CharDefTexture, SmartTexture, VideoTexture
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class Asset
Asset.ObserverCallback, Asset.State -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AssetTypebooleanstatic intstatic booleanbooleanstatic floatstatic intstatic intstatic floatstatic floatstatic floatfloatfloatstatic intstatic booleanfloatinternal texture coordinates it's used to get the max border of texture...floatinternal texture coordinates it's used to get the max border of texture...floatinternal texture coordinates it's used to get the max border of texture...floatinternal texture coordinates it's used to get the max border of texture... -
Constructor Summary
ConstructorsConstructorDescriptionTexture()creates an emptiy texture and adds it to the game engine's texture listTexture(int width, int height, int flags) create a new empty texture.Texture(int width, int height, int flags, boolean deferCreation) Texture(int width, int height, int flags, int format, int internalFormat) create a new empty texture.LOADS and crete a texture from a fileLOADS and crete a texture from a fileloads and create a texture from a file and cretes as trasparent the section that have the color equal to the RGB valued spefiedTexture(String name, BufferedInputStream b, boolean bDoMask) Texture(AssetPath path, AssetManager manager, Texture.TextureAssetParams params) creates a copy of an existent texture -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()Blinds the imagevoidbind(int unit) Description copied from interface: ITexturestatic voidbindNone()static voidstatic voidvoidcopyMaskRegion(Texture from, int x, int y, int width, int height) voidcreates the mask of collisionsvoidcreateMask(boolean[] mask) voidcreateMask(BooleanGrid mask) voidcreateMask(WrappedBuffer buf) voiddestroy()destroys the image and release all resourcesbooleanstatic int[]flipPixels(int[] imgPixels, int imgw, int imgh) static voidforgetTexture(String name) getData()returns the texture's pixel in a ByteBuffer EXAMPLE: ByteBuffer bb = getData(); byte r, g, b; bb.rewind(); //invalid input: '<'-- IMPORTANT!! try { while (true) { bb.mark(); r = bb.get(); g = bb.get(); b = bb.get(); bb.reset(); bb.put((byte)(r+red)); bb.put((byte)(g+green)); bb.put((byte)(b+blue)); bb.get(); // alpha catch (Exception e) { setData(bb);static Texturestatic TextureintDescription copied from interface: ITextureintDescription copied from interface: ITextureintintgetID()Description copied from interface: ITexturegetMask()returns the mask of collisionsgetName()floatfloatintintstatic TexturegetSharedTexture(String name) static TexturegetSharedTexture(String name, int flags) static TexturegetSteamAvatar(long steamID) static TexturegetTexture(String name) gets a texture from it's name; If the texture isn't already loaded this method will load it.getType()booleanindicates if the image will use the alpha channel or notegetUVScale(Vector2 uvScale) static TexturegetWhite()intgetWidth()Description copied from interface: ITextureintDescription copied from interface: ITextureintintgetX()floatgetXEnd()Description copied from interface: ITexturefloatDescription copied from interface: ITextureintgetY()floatgetYEnd()Description copied from interface: ITexturefloatDescription copied from interface: ITexturebooleanindicates if the texture has a mask of collisions or notbooleanreturns if the texture is destroyed or notbooleanisMaskSet(int x, int y) booleanisSolid()Description copied from interface: ITexturebooleanisValid()voidloadMaskRegion(ByteBuffer cache) voidmakeTransp(int red, int green, int blue) Description copied from interface: ITexturevoidstatic voidstatic StringprocessFilePath(String filePath) static voidvoidreloadFromFile(String name) voidrender(float x, float y) voidrender(float x, float y, float width, float height) voidrender(float x, float y, float width, float height, float r, float g, float b, float a, Consumer<TextureDraw> texdModifier) voidrender(ObjectRenderEffects dr, float x, float y, float width, float height, float r, float g, float b, float a, Consumer<TextureDraw> texdModifier) voidrenderdiamond(float x, float y, float width, float height, int l, int u, int r, int d) voidrendershader2(float x, float y, float width, float height, int texx, int texy, int texWidth, int texHeight, float r, float g, float b, float a) voidrenderstrip(int x, int y, int width, int height, float r, float g, float b, float a, Consumer<TextureDraw> texdModifier) voidrenderwalln(float x, float y, float width, float height, int u, int d, int u2, int d2) voidrenderwallnw(float x, float y, float width, float height, int u, int d, int u2, int d2, int r, int r2) voidrenderwallw(float x, float y, float width, float height, int u, int d, int u2, int d2) voidvoidsaveMaskRegion(ByteBuffer cache) voidsaveOnRenderThread(String filename) voidsaveToCurrentSavefileDirectory(String filename) voidsaveToZomboidDirectory(String filename) voidsetAlphaForeach(int red, int green, int blue, int alpha) Description copied from interface: ITexturevoidvoidsetData(ByteBuffer data) sets the texture's pixel from a ByteBuffer EXAMPLE: ByteBuffer bb = getData(); byte r, g, b; bb.rewind(); //invalid input: '<'-- IMPORTANT!! try { while (true) { bb.mark(); r = bb.get(); g = bb.get(); b = bb.get(); bb.reset(); bb.put((byte)(r+red)); bb.put((byte)(g+green)); bb.put((byte)(b+blue)); bb.get(); // alpha catch (Exception e) { setData(bb);voidsetHeight(int height) voidsets the mask of collisionsvoidvoidsetNameOnly(String name) voidsetOffsetX(int offset) voidsetOffsetY(int offset) voidsetRealHeight(int realHeight) voidsetRealWidth(int realWidth) voidsetRegion(int x, int y, int width, int height) Description copied from interface: ITexturevoidsetUseAlphaChannel(boolean value) indicates if the texture contains the alpha channel or notvoidsetWidth(int width) split(int xOffset, int yOffset, int width, int height) Texture[]split(int xOffset, int yOffset, int row, int coloumn, int width, int height, int spaceX, int spaceY) Texture[][]split2D(int[] xstep, int[] ystep) static voidsteamAvatarChanged(long steamID) voidTexDeferedCreation(int w, int h, int flags) voidTexDeferedCreation(int w, int h, int flags, int format, int internalFormat) toString()static TexturetrygetTexture(String name) Methods inherited from class Asset
addDependency, getAssetManager, getObserverCb, getPath, getRefCount, getState, isEmpty, isFailure, isReady, onCreated, removeDependency, setAssetParams
-
Field Details
-
nullTextures
-
ASSET_TYPE
-
bindCount
public static int bindCount -
doingQuad
public static boolean doingQuad -
lr
public static float lr -
lg
public static float lg -
lb
public static float lb -
la
public static float la -
lastlastTextureID
public static int lastlastTextureID -
totalTextureID
public static int totalTextureID -
lastTextureID
public static int lastTextureID -
warnFailFindTexture
public static boolean warnFailFindTexture -
flip
public boolean flip -
offsetX
public float offsetX -
offsetY
public float offsetY -
bindAlways
public boolean bindAlways -
xEnd
public float xEndinternal texture coordinates it's used to get the max border of texture... -
yEnd
public float yEndinternal texture coordinates it's used to get the max border of texture... -
xStart
public float xStartinternal texture coordinates it's used to get the max border of texture... -
yStart
public float yStartinternal texture coordinates it's used to get the max border of texture... -
assetParams
-
-
Constructor Details
-
Texture
-
Texture
-
Texture
-
Texture
-
Texture
- Throws:
Exception
-
Texture
-
Texture
-
Texture
create a new empty texture.- Parameters:
width- size of textureheight-name-this- size of texture
-
Texture
public Texture(int width, int height, int flags) create a new empty texture.- Parameters:
width- size of textureheight-this- size of texture
-
Texture
public Texture(int width, int height, int flags, int format, int internalFormat) -
Texture
public Texture(int width, int height, int flags, boolean deferCreation) -
Texture
loads and create a texture from a file and cretes as trasparent the section that have the color equal to the RGB valued spefied- Parameters:
file- red value to comparered- green value to comparegreen- blue value to comparethis- relative path- Throws:
Exception
-
Texture
-
Texture
public Texture()creates an emptiy texture and adds it to the game engine's texture list
-
-
Method Details
-
TexDeferedCreation
public void TexDeferedCreation(int w, int h, int flags, int format, int internalFormat) -
TexDeferedCreation
public void TexDeferedCreation(int w, int h, int flags) -
processFilePath
-
bindNone
public static void bindNone() -
getWhite
-
getErrorTexture
-
getEngineMipmapTexture
-
clearTextures
public static void clearTextures() -
trygetTexture
-
onTexturePacksChanged
public static void onTexturePacksChanged() -
getTexture
-
getSteamAvatar
-
steamAvatarChanged
public static void steamAvatarChanged(long steamID) -
forgetTexture
-
reload
-
flipPixels
public static int[] flipPixels(int[] imgPixels, int imgw, int imgh) -
reloadFromFile
-
bind
-
bind
-
copyMaskRegion
-
createMask
public void createMask()creates the mask of collisions -
createMask
public void createMask(boolean[] mask) -
createMask
-
createMask
-
destroy
public void destroy()destroys the image and release all resources- Specified by:
destroyin interfaceIDestroyable
-
equals
-
getData
returns the texture's pixel in a ByteBuffer EXAMPLE: ByteBuffer bb = getData(); byte r, g, b; bb.rewind(); //invalid input: '<'-- IMPORTANT!! try { while (true) { bb.mark(); r = bb.get(); g = bb.get(); b = bb.get(); bb.reset(); bb.put((byte)(r+red)); bb.put((byte)(g+green)); bb.put((byte)(b+blue)); bb.get(); // alpha catch (Exception e) { setData(bb); -
setData
sets the texture's pixel from a ByteBuffer EXAMPLE: ByteBuffer bb = getData(); byte r, g, b; bb.rewind(); //invalid input: '<'-- IMPORTANT!! try { while (true) { bb.mark(); r = bb.get(); g = bb.get(); b = bb.get(); bb.reset(); bb.put((byte)(r+red)); bb.put((byte)(g+green)); bb.put((byte)(b+blue)); bb.get(); // alpha catch (Exception e) { setData(bb); -
getHeight
-
setHeight
public void setHeight(int height) -
getHeightHW
public int getHeightHW()Description copied from interface: ITexture- Specified by:
getHeightHWin interfaceITexture
-
getHeightOrig
public int getHeightOrig() -
getID
-
getMask
returns the mask of collisions- Specified by:
getMaskin interfaceIMaskerable- Returns:
- mask of collisions
-
setMask
-
isMaskSet
public boolean isMaskSet(int x, int y) -
getName
-
setName
-
getTextureId
-
getUseAlphaChannel
public boolean getUseAlphaChannel()indicates if the image will use the alpha channel or note- Returns:
- if the image will use the alpha channel or note
-
setUseAlphaChannel
public void setUseAlphaChannel(boolean value) indicates if the texture contains the alpha channel or not- Parameters:
value- if true, the image will use the alpha channel
-
getX
public int getX() -
getY
public int getY() -
getWidth
-
setWidth
public void setWidth(int width) -
getWidthHW
public int getWidthHW()Description copied from interface: ITexture- Specified by:
getWidthHWin interfaceITexture
-
getWidthOrig
public int getWidthOrig() -
getXEnd
-
getXStart
-
getYEnd
-
getYStart
-
getOffsetX
public float getOffsetX() -
setOffsetX
public void setOffsetX(int offset) -
getOffsetY
public float getOffsetY() -
setOffsetY
public void setOffsetY(int offset) -
isCollisionable
public boolean isCollisionable()indicates if the texture has a mask of collisions or not -
isDestroyed
public boolean isDestroyed()returns if the texture is destroyed or not- Specified by:
isDestroyedin interfaceIDestroyable
-
isSolid
-
isValid
public boolean isValid() -
makeTransp
public void makeTransp(int red, int green, int blue) Description copied from interface: ITexture- Specified by:
makeTranspin interfaceITexture- Parameters:
red- color used in the testgreen- color used in the testblue- color used in the test
-
render
public void render(float x, float y, float width, float height) -
render
public void render(float x, float y) -
render
public void render(float x, float y, float width, float height, float r, float g, float b, float a, Consumer<TextureDraw> texdModifier) -
render
public void render(ObjectRenderEffects dr, float x, float y, float width, float height, float r, float g, float b, float a, Consumer<TextureDraw> texdModifier) -
rendershader2
public void rendershader2(float x, float y, float width, float height, int texx, int texy, int texWidth, int texHeight, float r, float g, float b, float a) -
renderdiamond
public void renderdiamond(float x, float y, float width, float height, int l, int u, int r, int d) -
renderwallnw
public void renderwallnw(float x, float y, float width, float height, int u, int d, int u2, int d2, int r, int r2) -
renderwallw
public void renderwallw(float x, float y, float width, float height, int u, int d, int u2, int d2) -
renderwalln
public void renderwalln(float x, float y, float width, float height, int u, int d, int u2, int d2) -
renderstrip
public void renderstrip(int x, int y, int width, int height, float r, float g, float b, float a, Consumer<TextureDraw> texdModifier) -
setAlphaForeach
public void setAlphaForeach(int red, int green, int blue, int alpha) Description copied from interface: ITexture- Specified by:
setAlphaForeachin interfaceITexture- Parameters:
red- color used in the testgreen- color used in the testblue- color used in the testalpha- the alpha color that will be setted to the pixel that pass the test
-
setCustomizedTexture
public void setCustomizedTexture() -
setNameOnly
-
setRegion
-
splitIcon
-
split
-
split
-
split
public Texture[] split(int xOffset, int yOffset, int row, int coloumn, int width, int height, int spaceX, int spaceY) -
split2D
-
toString
-
saveMask
-
saveToZomboidDirectory
-
saveToCurrentSavefileDirectory
-
saveOnRenderThread
-
loadMaskRegion
-
saveMaskRegion
-
getRealWidth
public int getRealWidth() -
setRealWidth
public void setRealWidth(int realWidth) -
getRealHeight
public int getRealHeight() -
setRealHeight
public void setRealHeight(int realHeight) -
getUVScale
-
getType
-
onBeforeReady
public void onBeforeReady() -
collectAllIcons
-