Libraries.Game.Graphics.TextureRegion Documentation

The TextureRegion class is made up of two features: a Texture, and a rectangular space on the screen. This class is primarily for internal use in the game engine. For a class with the same functionality, users are recommended to use the Drawable class. Any texture defined by this class will be located on the screen by a coordinate system. A coordinate of (0,0) is the very botom left corner of the screen. Increasing the first value will make the texture move to the right. Increasing the second value will make the texture move up the screen.

Inherits from: Libraries.Language.Object, Libraries.Game.Disposable

Summary

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
CopyTextureRegion(Libraries.Game.Graphics.TextureRegion region)This action copies the information from the given TextureRegion into this TextureRegion.
CopyTextureRegion(Libraries.Game.Graphics.TextureRegion region, integer x, integer y, integer width, integer height)This action copies the information from a given TextureRegion at the given coordinates to the given width and height onto this TextureRegion.
Dispose()This action will dispose of the Texture stored in this TextureRegion.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
FlipX()This action flips the TextureRegion along the x-axis.
FlipY()This action flips the TextureRegion along the y-axis.
GetBottomSide()This action returns where the TextureRegion begins the bottom edge of its region on the stored texture, where 0 is the far bottom of the texture and 1 is the far top side of the texture.
GetHashCode()This action gets the hash code for an object.
GetLeftSide()This action returns where the TextureRegion begins the left edge of its region on the stored texture, where 0 is the far left of the texture and 1 is the far right side of the texture.
GetRegionHeight()This action returns the height of the region.
GetRegionWidth()This action returns the width of the TextureRegion.
GetRegionX()This action returns the x coordinate where the region begins on the Texture.
GetRegionY()This action returns the y coordinate where the region begins on the Texture.
GetRightSide()This action returns where the TextureRegion begins the right edge of its region on the stored texture, where 0 is the far left of the texture and 1 is the far right side of the texture.
GetTextureField()This action returns the texture held by this TextureRegion.
GetTopSide()This action returns where the TextureRegion begins the top edge of its region on the stored texture, where 0 is the far bottom of the texture and 1 is the far top side of the texture.
IsFlippedX()This action returns whether or not the TextureRegion has been flipped along the x-axis.
IsFlippedY()This action returns whether or not the TextureRegion has been flipped along the y-axis.
LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture, number left, number right, number top, number bottom)This action loads part of a texture into this TextureRegion, using the given percentage coordinates from 0 to 1 of the texture to load.
LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture, integer width, integer height)This action loads part of a texture into the TextureRegion, starting from the bottom left corner to the given width and height.
LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture)This action loads an entire texture into the TextureRegion.
LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture, integer x, integer y, integer width, integer height)This action loads part of a texture into this TextureRegion, starting from the given x,y coordinates of the Texture to the given width and height.
SetBottomSide(number bottom)This action sets where the TextureRegion begins the bottom edge of its region on the stored texture, where 0 is the far bottom of the texture and 1 is the far top side of the texture.
SetLeftSide(number left)This action sets where the TextureRegion begins the left edge of its region on the stored texture, where 0 is the far left of the texture and 1 is the far right side of the texture.
SetRegion(Libraries.Game.Graphics.TextureRegion region)Sets the region of this TextureRegion to be the same as the region of a different TextureRegion.
SetRegion(integer x, integer y, integer width, integer height)Sets the region of this TextureRegion to start at the given x,y coordinates and go to the given width and height.
SetRegion(number left, number top, number right, number bottom)This action will set the region of this TextureRegion to begin at the bottom left of the Texture to the top right, where 0 represents the far left or bottom, and 1 represents the far right or top.
SetRegion(Libraries.Game.Graphics.TextureRegion region, integer x, integer y, integer width, integer height)Sets the region of this TextureRegion to begin at the start of the given TextureRegion's plus an offset by the given x,y values, and stretching to the given width and height.
SetRegionHeight(integer height)This action sets the height of the region.
SetRegionWidth(integer width)This action sets the width of the TextureRegion.
SetRegionX(integer x)This action sets the x coordinate where the region begins on the Texture.
SetRegionY(integer y)This action sets the y coordinate where the region begins on the Texture.
SetRightSide(number right)This action sets where the TextureRegion begins the left edge of its region on the stored texture, where 0 is the far left of the texture and 1 is the far right side of the texture.
SetTexture(Libraries.Game.Graphics.Texture newTexture)This action sets the texture used by this TextureRegion to the given texture.
SetTopSide(number top)This action sets where the TextureRegion begins the top edge of its region on the stored texture, where 0 is the far bottom of the texture and 1 is the far top side of the texture.

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

CopyTextureRegion(Libraries.Game.Graphics.TextureRegion region)

This action copies the information from the given TextureRegion into this TextureRegion.

Parameters

CopyTextureRegion(Libraries.Game.Graphics.TextureRegion region, integer x, integer y, integer width, integer height)

This action copies the information from a given TextureRegion at the given coordinates to the given width and height onto this TextureRegion.

Parameters

Dispose()

This action will dispose of the Texture stored in this TextureRegion.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

FlipX()

This action flips the TextureRegion along the x-axis.

FlipY()

This action flips the TextureRegion along the y-axis.

GetBottomSide()

This action returns where the TextureRegion begins the bottom edge of its region on the stored texture, where 0 is the far bottom of the texture and 1 is the far top side of the texture.

Return

number:

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetLeftSide()

This action returns where the TextureRegion begins the left edge of its region on the stored texture, where 0 is the far left of the texture and 1 is the far right side of the texture.

Return

number:

GetRegionHeight()

This action returns the height of the region.

Return

integer:

GetRegionWidth()

This action returns the width of the TextureRegion.

Return

integer:

GetRegionX()

This action returns the x coordinate where the region begins on the Texture.

Return

integer:

GetRegionY()

This action returns the y coordinate where the region begins on the Texture.

Return

integer:

GetRightSide()

This action returns where the TextureRegion begins the right edge of its region on the stored texture, where 0 is the far left of the texture and 1 is the far right side of the texture.

Return

number:

GetTextureField()

This action returns the texture held by this TextureRegion.

Return

Libraries.Game.Graphics.Texture:

GetTopSide()

This action returns where the TextureRegion begins the top edge of its region on the stored texture, where 0 is the far bottom of the texture and 1 is the far top side of the texture.

Return

number:

IsFlippedX()

This action returns whether or not the TextureRegion has been flipped along the x-axis.

Return

boolean:

IsFlippedY()

This action returns whether or not the TextureRegion has been flipped along the y-axis.

Return

boolean:

LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture, number left, number right, number top, number bottom)

This action loads part of a texture into this TextureRegion, using the given percentage coordinates from 0 to 1 of the texture to load.

Parameters

LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture, integer width, integer height)

This action loads part of a texture into the TextureRegion, starting from the bottom left corner to the given width and height.

Parameters

LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture)

This action loads an entire texture into the TextureRegion.

Parameters

LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture, integer x, integer y, integer width, integer height)

This action loads part of a texture into this TextureRegion, starting from the given x,y coordinates of the Texture to the given width and height.

Parameters

SetBottomSide(number bottom)

This action sets where the TextureRegion begins the bottom edge of its region on the stored texture, where 0 is the far bottom of the texture and 1 is the far top side of the texture.

Parameters

SetLeftSide(number left)

This action sets where the TextureRegion begins the left edge of its region on the stored texture, where 0 is the far left of the texture and 1 is the far right side of the texture.

Parameters

SetRegion(Libraries.Game.Graphics.TextureRegion region)

Sets the region of this TextureRegion to be the same as the region of a different TextureRegion.

Parameters

SetRegion(integer x, integer y, integer width, integer height)

Sets the region of this TextureRegion to start at the given x,y coordinates and go to the given width and height.

Parameters

SetRegion(number left, number top, number right, number bottom)

This action will set the region of this TextureRegion to begin at the bottom left of the Texture to the top right, where 0 represents the far left or bottom, and 1 represents the far right or top.

Parameters

SetRegion(Libraries.Game.Graphics.TextureRegion region, integer x, integer y, integer width, integer height)

Sets the region of this TextureRegion to begin at the start of the given TextureRegion's plus an offset by the given x,y values, and stretching to the given width and height.

Parameters

SetRegionHeight(integer height)

This action sets the height of the region.

Parameters

SetRegionWidth(integer width)

This action sets the width of the TextureRegion.

Parameters

SetRegionX(integer x)

This action sets the x coordinate where the region begins on the Texture.

Parameters

SetRegionY(integer y)

This action sets the y coordinate where the region begins on the Texture.

Parameters

SetRightSide(number right)

This action sets where the TextureRegion begins the left edge of its region on the stored texture, where 0 is the far left of the texture and 1 is the far right side of the texture.

Parameters

SetTexture(Libraries.Game.Graphics.Texture newTexture)

This action sets the texture used by this TextureRegion to the given texture.

Parameters

SetTopSide(number top)

This action sets where the TextureRegion begins the top edge of its region on the stored texture, where 0 is the far bottom of the texture and 1 is the far top side of the texture.

Parameters