Libraries.Game.Graphics.Texture Documentation

The Texture class represents an image that can be drawn on the screen. Once an image is loaded into a texture, it can be drawn on the screen by loading it into a Drawable.

Example Code

use Libraries.Game.Graphics.Texture
    use Libraries.Game.Graphics.Drawable
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Game

    class Main is Game

        Drawable drawable
        Texture texture
        Color red

        action Main
            StartGame()
        end

        action CreateGame
            red:SetColor(1, 0, 0, 1)
            texture:LoadFilledRectangle(80, 100, red)
            drawable:Load(texture)

            drawable:SetPosition(200, 200)
            Add(drawable)
        end
    end

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

Summary

Actions Summary Table

ActionsDescription
AddTextureLoadListener(Libraries.Interface.Events.TextureLoadListener listener)This action adds a TextureLoadListener to the texture.
Bind()This action activates this texture and binds the texture image to the internal texture ID.
Bind(integer textureUnit)This action binds the texture image to an internal index in the rendering system.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Dispose()This action will release the memory used to store pixel information for this Texture.
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.
FinishLoadingAsynchronously(Libraries.System.File file, Libraries.Game.Graphics.PixelMap pixelMap, Libraries.Game.Graphics.Format format, boolean useMipMaps, Libraries.Game.Graphics.Drawable drawable)This action is used internally by the game engine to finish loading the data loaded by a LoadAsynchronously action.
GetHashCode()This action gets the hash code for an object.
GetHeight()This action returns the height of a loaded Texture.
GetHorizontalWrap()This action returns the horizontal texture wrapping mode.
GetMagnifyFilter()This action returns the magnification filter of this Texture.
GetMinimizeFilter()This action returns the minimization filter of this Texture.
GetSource()This action returns the relative file path to the file that was used to load this texture, if there is one.
GetVerticalWrap()This action returns the vertical texture wrapping mode.
GetWidth()This action returns the width of a loaded Texture.
IsLoadingAsynchronously()This action returns true if the texture is asynchronously loading.
LoadAsynchronously(Libraries.System.File file, Libraries.Game.Graphics.Format format, boolean useMipMaps, Libraries.Game.Graphics.Drawable drawable)This action will load a texture asynchronously (that is, the texture is loaded separately from the rest of the program's execution) and then load that texture into the provided Drawable.
LoadAsynchronously(text filePath, Libraries.Game.Graphics.Drawable drawable)This action will load a texture asynchronously (that is, the texture is loaded separately from the rest of the program's execution) and then load that texture into the provided Drawable.
LoadAsynchronously(Libraries.System.File file, Libraries.Game.Graphics.Drawable drawable)This action will load a texture asynchronously (that is, the texture is loaded separately from the rest of the program's execution) and then load that texture into the provided Drawable.
LoadCircle(integer radius, Libraries.Game.Graphics.Color color)This action will create a new Texture with a hollow circle of the given color with the given radius.
LoadCircle(integer radius)This action will create a new Texture with a hollow white circle with the given radius.
LoadFilledCircle(integer radius, Libraries.Game.Graphics.Color color)This action will create a new Texture with a solid circle of the given color with the given radius.
LoadFilledCircle(integer radius)This action will create a new Texture with a solid white circle with the given radius.
LoadFilledRectangle(integer width, integer height)This action will create a new Texture with a solid white rectangle with the given width and height.
LoadFilledRectangle(integer width, integer height, Libraries.Game.Graphics.Color color)This action will create a new Texture with a solid rectangle of the given color with the given width and height.
LoadFilledTriangle(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3)This action will create a new Texture with a solid white triangle that is made of the points identified by the three given points.
LoadFilledTriangle(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, Libraries.Game.Graphics.Color color)This action will create a new Texture with a solid triangle of the given color that is made of the points identified by the three given points.
LoadFromFile(Libraries.System.File file)This action loads a Texture from a Quorum File.
LoadFromFile(text filePath)This action loads a Texture from a file path given as text.
LoadFromMatrix(Libraries.Compute.Matrix matrix)This action will load a matrix into the Texture to create a monochrome (black and white) image.
LoadFromPixelMap(Libraries.Game.Graphics.PixelMap pixelMap, Libraries.Game.Graphics.Format format, boolean useMipMaps)The LoadFromPixelMap action loads a PixelMap into this texture, using the given Format.
LoadFromPixelMap(Libraries.Game.Graphics.PixelMap pixelMap)The LoadFromPixelMap action loads a PixelMap into this texture.
LoadLine(integer x, integer y)This action will create a new Texture with a white line that connects an imaginary point at 0,0 to the provided x,y coordinates.
LoadLine(integer x, integer y, Libraries.Game.Graphics.Color color)This action will create a new Texture with a line of the given color that connects between an imaginary point at 0,0 to the provided x,y coordinates.
LoadModelTexture(Libraries.System.File file)This action loads a Texture from a Quorum File.
LoadModelTexture(text fileName)This action loads a Texture from a file path given as text.
LoadRectangle(integer width, integer height)This action will create a new Texture with a hollow white rectangle with the given width and height.
LoadRectangle(integer width, integer height, Libraries.Game.Graphics.Color color)This action will create a new Texture with a hollow rectangle of the given color with the given width and height.
Reload()Used to reload a Texture that's already been loaded.
RemoveTextureLoadListener(Libraries.Interface.Events.TextureLoadListener listener)This action removes a TextureLoadListener from the texture.
SetFilter(Libraries.Game.Graphics.TextureFilter minFilter, Libraries.Game.Graphics.TextureFilter magFilter)Sets the minimization filter and magnification filter, respectively, used for this Texture.
SetWrap(Libraries.Game.Graphics.TextureWrap hWrap, Libraries.Game.Graphics.TextureWrap vWrap)Sets the horizontal and vertical texture wrapping modes, respectively, used for this Texture.
UnsafeSetFilter(Libraries.Game.Graphics.TextureFilter min, Libraries.Game.Graphics.TextureFilter mag)This action will set the texture filter of this Texture, assuming it is already bound and active.
UnsafeSetWrap(Libraries.Game.Graphics.TextureWrap u, Libraries.Game.Graphics.TextureWrap v)This action will set the texture wrapping of this Texture, assuming it is already bound and active.

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

Bind()

This action activates this texture and binds the texture image to the internal texture ID. This is for internal use.

Bind(integer textureUnit)

This action binds the texture image to an internal index in the rendering system. This is used internally by the engine as needed, and most users won't need to use it directly.

Parameters

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.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Dispose()

This action will release the memory used to store pixel information for this Texture. This frees up resources, but will make the Texture no longer usable, including in classes that may have loaded the Texture, such as in Drawable. Use this when you are completely finished with a Texture and no longer intend to use it.

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.

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.

FinishLoadingAsynchronously(Libraries.System.File file, Libraries.Game.Graphics.PixelMap pixelMap, Libraries.Game.Graphics.Format format, boolean useMipMaps, Libraries.Game.Graphics.Drawable drawable)

This action is used internally by the game engine to finish loading the data loaded by a LoadAsynchronously action. After this Texture has finished loading, the provided Drawable will be loaded with this Texture (if it is not undefined). This action is used by the engine automatically as needed, and most users will never need to use this action directly.

Parameters

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.

GetHeight()

This action returns the height of a loaded Texture.

Example Code

use Libraries.Game.Texture
        use Libraries.Game.Game

        class Main is Game

            Texture myTexture

            action Main
                StartGame()
            end
        
            action CreateGame
                // This call will load an image "Sample.png" from a directory called "Images".
                myTexture:LoadFromFile("Images/Sample.png")
                number width = myTexture:GetHeight()
            end
        end

Return

integer:

GetHorizontalWrap()

This action returns the horizontal texture wrapping mode. For more on how the TextureWrap works, see Libraries.Game.Graphics.TextureWrap.

Return

Libraries.Game.Graphics.TextureWrap:

GetMagnifyFilter()

This action returns the magnification filter of this Texture. For more on how the TextureFilters work, see Libraries.Game.Graphics.TextureFilter.

Return

Libraries.Game.Graphics.TextureFilter:

GetMinimizeFilter()

This action returns the minimization filter of this Texture. For more on how the TextureFilters work, see Libraries.Game.Graphics.TextureFilter.

Return

Libraries.Game.Graphics.TextureFilter:

GetSource()

This action returns the relative file path to the file that was used to load this texture, if there is one. If no file has been loaded, this will return an empty string instead.

Return

text: The relative file path to the loaded file, or the empty string if no file is loaded.

GetVerticalWrap()

This action returns the vertical texture wrapping mode. For more on how the TextureWrap works, see Libraries.Game.Graphics.TextureWrap.

Return

Libraries.Game.Graphics.TextureWrap:

GetWidth()

This action returns the width of a loaded Texture.

Example Code

use Libraries.Game.Texture
        use Libraries.Game.Game

        class Main is Game

            Texture myTexture

            action Main
                StartGame()
            end
        
            action CreateGame
                // This call will load an image "Sample.png" from a directory called "Images".
                myTexture:LoadFromFile("Images/Sample.png")
                number width = myTexture:GetWidth()
            end
        end

Return

integer:

IsLoadingAsynchronously()

This action returns true if the texture is asynchronously loading. While loading, the texture won't be ready for use yet. Once the texture has loaded, any registered TextureLoadListeners will be triggered.

Return

boolean: True if this texture is currently loading a file, or false otherwise.

LoadAsynchronously(Libraries.System.File file, Libraries.Game.Graphics.Format format, boolean useMipMaps, Libraries.Game.Graphics.Drawable drawable)

This action will load a texture asynchronously (that is, the texture is loaded separately from the rest of the program's execution) and then load that texture into the provided Drawable. This action is called internally and automatically by the game engine when run on the web. Most users will never need to use this action directly.

Parameters

LoadAsynchronously(text filePath, Libraries.Game.Graphics.Drawable drawable)

This action will load a texture asynchronously (that is, the texture is loaded separately from the rest of the program's execution) and then load that texture into the provided Drawable. This action is called internally and automatically by the game engine when run on the web. Most users will never need to use this action directly.

Parameters

LoadAsynchronously(Libraries.System.File file, Libraries.Game.Graphics.Drawable drawable)

This action will load a texture asynchronously (that is, the texture is loaded separately from the rest of the program's execution) and then load that texture into the provided Drawable. This action is called internally and automatically by the game engine when run on the web. Most users will never need to use this action directly.

Parameters

LoadCircle(integer radius, Libraries.Game.Graphics.Color color)

This action will create a new Texture with a hollow circle of the given color with the given radius.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Color
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Color red
                    red:SetColor(1, 0, 0, 1)
                    Texture texture
                    texture:LoadCircle(75, red)
                    Drawable circle
                    circle:Load(texture)
                    circle:SetPosition(50, 50)
                    Add(circle)
                end
            end

Parameters

LoadCircle(integer radius)

This action will create a new Texture with a hollow white circle with the given radius.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Texture texture
                    texture:LoadCircle(75)
                    circle:Load(texture)
                    circle:SetPosition(50, 50)
                    Add(circle)
                end
            end

Parameters

LoadFilledCircle(integer radius, Libraries.Game.Graphics.Color color)

This action will create a new Texture with a solid circle of the given color with the given radius.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Color
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Color blue
                    blue:SetColor(0, 0, 1, 1)
                    Texture texture
                    texture:LoadCircle(75, blue)
                    Drawable circle
                    circle:Load(texture)
                    circle:SetPosition(50, 50)
                    Add(circle)
                end
            end

Parameters

LoadFilledCircle(integer radius)

This action will create a new Texture with a solid white circle with the given radius.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Texture texture
                    texture:LoadFilledCircle(75)
                    Drawable circle
                    circle:Load(texture)
                    circle:SetPosition(50, 50)
                    Add(circle)
                end
            end

Parameters

LoadFilledRectangle(integer width, integer height)

This action will create a new Texture with a solid white rectangle with the given width and height.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Texture texture
                    texture:LoadFilledRectangle(20, 100)
                    Drawable rectangle
                    rectangle:Load(texture)
                    rectangle:SetPosition(50, 50)
                    Add(rectangle)
                end
            end

Parameters

LoadFilledRectangle(integer width, integer height, Libraries.Game.Graphics.Color color)

This action will create a new Texture with a solid rectangle of the given color with the given width and height.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Graphics.Color
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Color green
                    green:SetColor(0, 1, 0, 1)
                    Texture texture
                    texture:LoadFilledRectangle(20, 100, green)
                    Drawable rectangle
                    rectangle:Load(texture)
                    rectangle:SetPosition(50, 50)
                    Add(rectangle)
                end
            end

Parameters

LoadFilledTriangle(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3)

This action will create a new Texture with a solid white triangle that is made of the points identified by the three given points.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Texture texture
                    texture:LoadFilledTriangle(0, 0, 200, 200, 400, 0)
                    Drawable triangle
                    triangle:Load(texture)
                    triangle:SetPosition(50, 50)
                    Add(triangle)
                end
            end

Parameters

LoadFilledTriangle(integer x1, integer y1, integer x2, integer y2, integer x3, integer y3, Libraries.Game.Graphics.Color color)

This action will create a new Texture with a solid triangle of the given color that is made of the points identified by the three given points.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Graphics.Color
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Color purple
                    purple:SetColor(0.5, 0, 0.5, 1)
                    Texture texture
                    texture:LoadFilledTriangle(0, 0, 200, 200, 400, 0, purple)
                    Drawable triangle
                    triangle:Load(texture)
                    triangle:SetPosition(50, 50)
                    Add(triangle)
                end
            end

Parameters

LoadFromFile(Libraries.System.File file)

This action loads a Texture from a Quorum File. The File must already have its path set for this function.

Example Code

use Libraries.Game.Texture
        use Libraries.Game.Game
        use Libraries.System.File

        class Main is Game

            File myFile
            Texture myTexture

            action Main
                StartGame()
            end

            action CreateGame
                myFile:SetPath("Images/Sample.png")

                // This call will load the image that the "myFile" variable points to.
                // The file points to an image called "Sample.png" in a folder called "Images".
                myTexture:LoadFromFile(myFile)
            end
        end

Parameters

LoadFromFile(text filePath)

This action loads a Texture from a file path given as text. The file path should be given relative to the directory where the program is executed from.

Example Code

use Libraries.Game.Texture
        use Libraries.Game.Game

        class Main is Game

            Texture myTexture

            action Main
                StartGame()
            end
        
            action CreateGame
                // This call will load an image "Sample.png" from a directory called "Images".
                myTexture:LoadFromFile("Images/Sample.png")
            end
        end

Parameters

LoadFromMatrix(Libraries.Compute.Matrix matrix)

This action will load a matrix into the Texture to create a monochrome (black and white) image. Each value is assumed to be between 0 and 1, where 0 represents a black pixel and 1 represents a white pixel.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Drawable
    use Libraries.Game.Graphics.Texture
    use Libraries.Compute.Matrix

    class Main is Game

        Texture texture
        Drawable drawable

        action Main
            StartGame()
        end

        action CreateGame
            Matrix matrix

            // 7x7 square that is black at edges and lightens as it goes towards the center.
            matrix:Fill(7, 7, 0)
            matrix:Set(1, 1, 0.33)
            matrix:Set(2, 1, 0.33)
            matrix:Set(3, 1, 0.33)
            matrix:Set(4, 1, 0.33)
            matrix:Set(5, 1, 0.33)
            matrix:Set(5, 2, 0.33)
            matrix:Set(5, 3, 0.33)
            matrix:Set(5, 4, 0.33)
            matrix:Set(5, 5, 0.33)
            matrix:Set(4, 5, 0.33)
            matrix:Set(3, 5, 0.33)
            matrix:Set(2, 5, 0.33)
            matrix:Set(1, 5, 0.33)
            matrix:Set(1, 4, 0.33)
            matrix:Set(1, 3, 0.33)
            matrix:Set(1, 2, 0.33)

            matrix:Set(2, 2, 0.66)
            matrix:Set(3, 2, 0.66)
            matrix:Set(4, 2, 0.66)
            matrix:Set(4, 3, 0.66)
            matrix:Set(4, 4, 0.66)
            matrix:Set(3, 4, 0.66)
            matrix:Set(2, 4, 0.66)
            matrix:Set(2, 3, 0.66)

            matrix:Set(3, 3, 1)

            // Loading the Texture and blowing up the size of the Drawable to make it easier to see.
            texture:LoadFromMatrix(matrix)
            drawable:Load(texture)
            Add(drawable)

            drawable:SetPosition(200, 200)
            drawable:SetSize(100, 100)
        end
    end

Parameters

LoadFromPixelMap(Libraries.Game.Graphics.PixelMap pixelMap, Libraries.Game.Graphics.Format format, boolean useMipMaps)

The LoadFromPixelMap action loads a PixelMap into this texture, using the given Format. If mip-mapping is supported on the given platform, mip-maps will be used if the boolean parameter is true.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.PixelMap
    use Libraries.Game.Graphics.Format
    use Libraries.Game.Graphics.Texture
    use Libraries.Game.Graphics.Drawable
    use Libraries.Game.Graphics.Color

    class Main is Game

        Color color

        action Main
            StartGame()
        end

        action CreateGame
            PixelMap map
            Format format
            format:SetValue(format:RGBA8888)
            map:CreatePixelMap(200, 200, format)

            // We will create a pink box with a red stripe across it.
            map:Fill(color:Pink())

            integer x = 0
            integer y = 85
            repeat while y < 125
                x = 0
                repeat while x < 200
                    map:SetPixel(x, y, color:Red())
                    x = x + 1
                end
                y = y + 1
            end

            Texture texture
            texture:LoadFromPixelMap(map, format, false)

            Drawable drawable
            drawable:Load(texture)
            Add(drawable)
        end
    end

Parameters

LoadFromPixelMap(Libraries.Game.Graphics.PixelMap pixelMap)

The LoadFromPixelMap action loads a PixelMap into this texture. The PixelMap will use its already given Format.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.PixelMap
    use Libraries.Game.Graphics.Format
    use Libraries.Game.Graphics.Texture
    use Libraries.Game.Graphics.Drawable
    use Libraries.Game.Graphics.Color

    class Main is Game

        Color color

        action Main
            StartGame()
        end

        action CreateGame
            PixelMap map
            Format format
            format:SetValue(format:RGBA8888)
            map:CreatePixelMap(200, 200, format)

            // We will create a pink box with a red stripe across it.
            map:Fill(color:Pink())

            integer x = 0
            integer y = 85
            repeat while y < 125
                x = 0
                repeat while x < 200
                    map:SetPixel(x, y, color:Red())
                    x = x + 1
                end
                y = y + 1
            end

            Texture texture
            texture:LoadFromPixelMap(map)

            Drawable drawable
            drawable:Load(texture)
            Add(drawable)
        end
    end

Parameters

LoadLine(integer x, integer y)

This action will create a new Texture with a white line that connects an imaginary point at 0,0 to the provided x,y coordinates.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Texture texture
                    texture:LoadLine(20, 100)
                    Drawable line
                    line:Load(texture)
                    line:SetPosition(50, 50)
                    Add(line)
                end
            end

Parameters

LoadLine(integer x, integer y, Libraries.Game.Graphics.Color color)

This action will create a new Texture with a line of the given color that connects between an imaginary point at 0,0 to the provided x,y coordinates.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Graphics.Color
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Color cyan
                    cyan:SetColor(0, 1, 1, 1)
                    Texture texture
                    texture:LoadLine(20, 100, cyan)
                    Drawable line
                    line:Load(texture)
                    line:SetPosition(50, 50)
                    Add(line)
                end
            end

Parameters

LoadModelTexture(Libraries.System.File file)

This action loads a Texture from a Quorum File. The File must already have its path set for this function. When loaded via this command, the Texture will be set to use linear filtering and repeated texture wrapping, which is typically preferred for 3D models.

Example Code

use Libraries.Game.Texture
        use Libraries.Game.Game
        use Libraries.System.File

        class Main is Game

            File myFile
            Texture myTexture

            action Main
                StartGame()
            end

            action CreateGame
                myFile:SetPath("Images/Sample.png")

                // This call will load the image that the "myFile" variable points to.
                // The file points to an image called "Sample.png" in a folder called "Images".
                myTexture:LoadModelTexture(myFile)
            end
        end

Parameters

LoadModelTexture(text fileName)

This action loads a Texture from a file path given as text. The file path should be given relative to the directory where the program is executed from. When loaded via this command, the Texture will be set to use linear filtering and repeated texture wrapping, which is typically preferred for 3D models.

Example Code

use Libraries.Game.Texture
        use Libraries.Game.Game

        class Main is Game

            Texture myTexture

            action Main
                StartGame()
            end
        
            action CreateGame
                // This call will load an image "Sample.png" from a directory called "Images".
                myTexture:LoadModelTexture("Images/Sample.png")
            end
        end

Parameters

LoadRectangle(integer width, integer height)

This action will create a new Texture with a hollow white rectangle with the given width and height.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Texture texture
                    texture:LoadRectangle(20, 100)
                    Drawable rectangle
                    rectangle:SetPosition(50, 50)
                    Add(rectangle)
                end
            end

Parameters

LoadRectangle(integer width, integer height, Libraries.Game.Graphics.Color color)

This action will create a new Texture with a hollow rectangle of the given color with the given width and height. This texture is then loaded into the Drawable.

Example Code

use Libraries.Game.Graphics.Texture
            use Libraries.Game.Graphics.Color
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Color yellow
                    yellow:SetColor(1, 1, 0, 1)
                    Texture texture
                    texture:LoadRectangle(20, 100, yellow)
                    Drawable rectangle
                    rectangle:Load(texture)
                    rectangle:SetPosition(50, 50)
                    Add(rectangle)
                end
            end

Parameters

Reload()

Used to reload a Texture that's already been loaded. This is used internally to ensure a Texture is automatically regained if the information is lost due to a context loss (e.g., minimizing the application on an Android device). Users will most likely never need to call this action directly.

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

SetFilter(Libraries.Game.Graphics.TextureFilter minFilter, Libraries.Game.Graphics.TextureFilter magFilter)

Sets the minimization filter and magnification filter, respectively, used for this Texture. See Libraries.Game.Graphics.TextureFilter for details on what the different filters do.

Parameters

SetWrap(Libraries.Game.Graphics.TextureWrap hWrap, Libraries.Game.Graphics.TextureWrap vWrap)

Sets the horizontal and vertical texture wrapping modes, respectively, used for this Texture. See Libraries.Game.Graphics.TextureWrap for details on what the different texture wrapping modes do.

Parameters

UnsafeSetFilter(Libraries.Game.Graphics.TextureFilter min, Libraries.Game.Graphics.TextureFilter mag)

This action will set the texture filter of this Texture, assuming it is already bound and active. This method sacrifices safety for speed, and should never be used directly by users.

Parameters

UnsafeSetWrap(Libraries.Game.Graphics.TextureWrap u, Libraries.Game.Graphics.TextureWrap v)

This action will set the texture wrapping of this Texture, assuming it is already bound and active. This method sacrifices safety for speed, and should never be used directly by users.

Parameters