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.Interface.Events.TextureLoadListener, Libraries.Game.Disposable
Actions Documentation
AddTextureLoadListener(Libraries.Interface.Events.TextureLoadListener listener)
This action adds a TextureLoadListener to the texture. If the texture finishes asynchronously loading an image, the listener will be alerted.
Parameters
- Libraries.Interface.Events.TextureLoadListener: A TextureLoadListener to be alerted when this texture finishes asynchronous loading.
Compare(Libraries.Language.Object object)
This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Example
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
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
- Libraries.Game.Graphics.TextureRegion
- integer x
- integer y
- integer width
- integer height
Dispose()
This action will dispose of the Texture stored in this TextureRegion.
EmptyTextureLoadListeners()
This action removes all TextureLoadListeners that have been added to the texture.
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
Example
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
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.
Return
integer: The integer hash code of the object.
Example
Object o
integer hash = o:GetHashCode()
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()
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
- Libraries.Game.Graphics.Texture
- number left
- number right
- number top
- number bottom
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
- Libraries.Game.Graphics.Texture
- integer width
- integer height
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
- Libraries.Game.Graphics.Texture
- integer x
- integer y
- integer width
- integer height
OnTextureLoad(Libraries.Interface.Events.TextureLoadEvent event)
This action removes all TextureLoadListeners that have been added to the texture.
Parameters
RemoveTextureLoadListener(Libraries.Interface.Events.TextureLoadListener listener)
This action removes a TextureLoadListener from the texture. If the listener was not previously added to this texture, this does nothing.
Parameters
- Libraries.Interface.Events.TextureLoadListener: A TextureLoadListener to be removed from the Texture.
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
- number bottom
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
- number left
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
- integer x
- integer y
- integer width
- integer 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.
Parameters
- number left
- number top
- number right
- number bottom
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
- Libraries.Game.Graphics.TextureRegion
- integer x
- integer y
- integer width
- integer height
SetRegionHeight(integer height)
This action sets the height of the region.
Parameters
- integer height
SetRegionWidth(integer width)
This action sets the width of the TextureRegion.
Parameters
- integer width
SetRegionX(integer x)
This action sets the x coordinate where the region begins on the Texture.
Parameters
- integer x
SetRegionY(integer y)
This action sets the y coordinate where the region begins on the Texture.
Parameters
- integer y
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
- number right
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
- number top
On this page
Variables TableAction Documentation- AddTextureLoadListener(Libraries.Interface.Events.TextureLoadListener listener)
- Compare(Libraries.Language.Object object)
- CopyTextureRegion(Libraries.Game.Graphics.TextureRegion region)
- CopyTextureRegion(Libraries.Game.Graphics.TextureRegion region, integer x, integer y, integer width, integer height)
- Dispose()
- EmptyTextureLoadListeners()
- Equals(Libraries.Language.Object object)
- FlipX()
- FlipY()
- GetBottomSide()
- GetHashCode()
- GetLeftSide()
- GetRegionHeight()
- GetRegionWidth()
- GetRegionX()
- GetRegionY()
- GetRightSide()
- GetTextureField()
- GetTopSide()
- IsFlippedX()
- IsFlippedY()
- LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture, number left, number right, number top, number bottom)
- LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture, integer width, integer height)
- LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture)
- LoadTextureRegion(Libraries.Game.Graphics.Texture newTexture, integer x, integer y, integer width, integer height)
- OnTextureLoad(Libraries.Interface.Events.TextureLoadEvent event)
- RemoveTextureLoadListener(Libraries.Interface.Events.TextureLoadListener listener)
- SetBottomSide(number bottom)
- SetLeftSide(number left)
- SetRegion(Libraries.Game.Graphics.TextureRegion region)
- SetRegion(integer x, integer y, integer width, integer height)
- SetRegion(number left, number top, number right, number bottom)
- SetRegion(Libraries.Game.Graphics.TextureRegion region, integer x, integer y, integer width, integer height)
- SetRegionHeight(integer height)
- SetRegionWidth(integer width)
- SetRegionX(integer x)
- SetRegionY(integer y)
- SetRightSide(number right)
- SetTexture(Libraries.Game.Graphics.Texture newTexture)
- SetTopSide(number top)