Libraries.Game.Graphics.Fonts.CoordinateVector Documentation

The CoordinateVector class is used to store information about x/y coordinate pairs, including their position, whether or not they are on the curve, and if they are endpoints.

Example Code

use Libraries.Game.Graphics.Fonts.all   
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame()
        CoordinateVector vector
        vector:SetX(0)
        vector:SetY(1)
        output "x: " + vector:GetX() + ", y: " + vector:GetY()
    end
end

Inherits from: Libraries.Language.Object

Actions Documentation

AddNewPointRelativeToLast(integer changeInX, integer changeInY, boolean onCurve, boolean endpoint)

This action changes the vector's coordinates based on the change in x and y for a given line.

Parameters

  • integer changeInX: The rate of change along the x-axis.
  • integer changeInY: The rate of change along the y-axis.
  • boolean onCurve: Whether or not this point is on the curve.
  • boolean endpoint

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame()
        CoordinateVector vector
        vector:AddNewPointRelativeToLast(1, 2, true, false)
    end
end

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

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)

Copy(Libraries.Game.Graphics.Fonts.CoordinateVector vector)

This action makes a copy of a given vector.

Parameters

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        CoordinateVector vector1
        CoordinateVector vector2
        vector1:SetX(1)
        vector1:SetY(1)
        vector2:Copy(vector1)
        output vector2:GetX()
    end
end

Equals(Libraries.Language.Object object)

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

Parameters

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)

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()

GetX()

This action returns the x position of the vector.

Return

integer: Returns the x position of the vector.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        CoordinateVector vector
        output vector:GetX()
    end
end

GetY()

This action returns the y position of the vector.

Return

integer: Returns the y position of the vector.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        CoordinateVector vector
        output vector:GetY()
    end
end

IsComputed()

This action checks whether or not this vector has had its coordinates computed.

Return

boolean: Returns true if the vector has been computed, and false if it has not been.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        CoordinateVector vector
        output vector:IsComputed()
    end
end

IsEndpoint()

This action checks whether or not this vector is an endpoint of the curve.

Return

boolean: Returns true if the vector is an endpoint of the curve, and false if it is not.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        CoordinateVector vector
        output vector:IsEndpoint()
    end
end

IsOnCurve()

This action returns whether or not the vector is on the outline curve.

Return

boolean: Returns true if the vector is on the curve, and false if it is not.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end
    
    action CreateGame()
        CoordinateVector vector 
        output vector:IsOnCurve()
    end 
end

SetComputed(boolean computed)

This action sets whether or not this vector has had its coordinates computed.

Parameters

  • boolean computed: True if the vector has been computed, and false if it has not been.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end
    
    action CreateGame
        CoordinateVector vector
        vector:SetComputed(false)
    end
end

SetEndpoint(boolean endpoint)

This action sets whether or not this vector is an endpoint of the curve.

Parameters

  • boolean endpoint: True if the vector is an endpoint, and false if it is not.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        CoordinateVector vector
        vector:SetEndpoint(true)
    end
end

SetOnCurve(boolean onCurve)

This action sets whether or not this vector is on the outline curve.

Parameters

  • boolean onCurve: True is the vector is on the curve, false if it is not.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        CoordinateVector vector
        vector:SetOnCurve(true)
        output vector:IsOnCurve()
    end
end

SetX(integer x)

This action sets the x position of the vector.

Parameters

  • integer x: The x position of the vector.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        CoordinateVector vector
        vector:SetX(1)
        output vector:GetX()
    end
end

SetY(integer y)

This action sets the y position of the vector.

Parameters

  • integer y: The y position of the vector.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        CoordinateVector vector
        vector:SetY(1)
        output vector:GetY()
    end
end