Libraries.Interface.Controls.Charts.Graphics.Wedge Documentation

The Wedge class is used to render wedges in a pie chart. Wedges have an outer radius that measures the number of pixels from the origin (the center of a pie chart) to the outer edge of the wedge. They also have an inner radius that measures how many pixels are between the origin and the start of the wedge, allowing for "donut" style charts. A wedge should always be the same size as its parent container. If it doesn't have a parent, the wedge should be large enough to render the whole circle, even if it's only a portion of it.

Example Code

use Libraries.Game.Game
use Libraries.Game.Graphics.Drawable
use Libraries.Game.Graphics.Color
use Libraries.Interface.Controls.Charts.Graphics.Wedge

class Main is Game
action Main
    StartGame()
end

action CreateGame
    Color color

    Drawable pieChart
    pieChart:LoadFilledRectangle(400, 400, color:White())

    // Put it wedges until we've filled a whole pie chart shape.
    number total = 0
    repeat until total >= 1
        Wedge wedge
        Color newColor
        newColor:SetColor(1 - total, 0.5, total, 1)
        wedge:Load(newColor)

        // The size of the wedge should match the size of its parent container.
        // If it isn't a child of another item, it should be large enough to contain the entire circle, even if it's only a portion of it.
        wedge:SetSize(pieChart:GetWidth(), pieChart:GetHeight())
        wedge:SetOuterRadius(180)
        wedge:SetInnerRadius(25)
        
        number newTotal = total + 0.125

        // Each wedge is positioned according to what percent of a pie chart it begins and ends at.
        // The percentages are stored as values between 0 and 1.
        wedge:SetStartPercentage(total)
        wedge:SetEndPercentage(newTotal)

        total = newTotal
        pieChart:Add(wedge)
    end

    Add(pieChart)
end
end

Inherits from: Libraries.Interface.Controls.Control, Libraries.Game.Graphics.Drawable, Libraries.Interface.Events.TouchListener, Libraries.Interface.Item, Libraries.Interface.Controls.Charts.ChartItem, Libraries.Interface.Item2D, Libraries.Language.Object, Libraries.Interface.Controls.Charts.Graphics.ChartDrawable, Libraries.Interface.Events.TextureLoadListener, Libraries.Game.Graphics.TextureRegion, Libraries.Game.Disposable

Variables Table

VariablesDescription
text WEDGE_SHADER_PROGRAM_NAME

Actions Documentation

Activate(Libraries.Interface.Events.BehaviorEvent event)

Returns true if rendering the focus event.

Parameters

Activate()

This action returns a default behavior for this paricular control. Some controls do nothing by default, like a TextBox that responds to different kinds of input. Others, however, have default behaviors, like a Button or a MenuItem. If there is no default behavior, this action returns undefined.

Add(integer index, Libraries.Interface.Item2D newItem)

This action adds a different Item2D into this one, storing the added Item2D at a specific index in the internal array.

Parameters

Example

use Libraries.Interface.Item2D

Item2D parentItem
Item2D child
parentItem:Add(0, child)

Add(Libraries.Interface.Item2D newItem)

This action adds a different Item2D into this one. This makes a few things happen. 1. The added item will get this item as its parent. 2. The added item's x and y coordinates will become relative to this Item. 3. Most actions on this Item will also affect the added Item.

Parameters

Example

use Libraries.Interface.Item2D

Item2D parentItem
Item2D child
parentItem:Add(child)

AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)

This action adds a new Behavior to this Item.

Parameters

AddControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)

This action removes an Item2D at a specifed index from the internal array.

Parameters

Example

use Libraries.Interface.Item2D

Item2D parentItem
Item2D child
parentItem:Add(0, child)
parentItem:Remove(0)

AddFocusListener(Libraries.Interface.Events.FocusListener listener)

This action adds a FocusListener to the Item. When the Item receives a FocusEvent due to either gaining or losing the focus, the listener will be notified.

Parameters

Example

use Libraries.Interface.Item
use Libraries.Interface.Events.FocusListener
Item myItem
FocusListener listener
myItem:AddFocusListener(listener)

AddGestureListener(Libraries.Interface.Events.GestureListener listener)

This action adds a GestureListener to the Item. If the Item ever receives a GestureEvent, the listener will be notified.

Parameters

Example

use Libraries.Interface.Item
use Libraries.Interface.Events.GestureListener
Item myItem
GestureListener listener
myItem:AddGestureListener(listener)

AddLayoutProperties(Libraries.Interface.Layouts.LayoutProperties properties)

Returns true if rendering the mouse down event.

Parameters

AddMouseListener(Libraries.Interface.Events.MouseListener listener)

This action adds a MouseListener to the Item. If the Item ever receives a MouseEvent due to a mouse click, the mouse listener will be notified.

Parameters

Example

use Libraries.Interface.Item
use Libraries.Interface.Events.MouseListener
Item myItem
MouseListener listener
myItem:AddMouseListener(listener)

AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)

This action adds a MouseMovementListener to the Item. If the Item ever receives a MouseEvent due to mouse movement, the listener will be notified.

Parameters

Example

use Libraries.Interface.Item
use Libraries.Interface.Events.MouseMovementListener
Item myItem
MouseMovementListener listener
myItem:AddMouseMovementListener(listener)

AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)

This action adds a MouseWheelListener to the Item. If the Item ever receives a MouseEvent due to the mouse wheel being scrolled, the listener will be notified.

Parameters

Example

use Libraries.Interface.Item
use Libraries.Interface.Events.MouseWheelListener
Item myItem
MouseWheelListener listener
myItem:AddMouseWheelListener(listener)

AddSelectionListener(Libraries.Interface.Events.SelectionListener listener)

This action adds the given SelectionListeners to the Control.

Parameters

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

AddTouchListener(Libraries.Interface.Events.TouchListener listener)

This action adds a TouchListener to the Item. If the Item ever receives a TouchEvent, the listener will be notified.

Parameters

Example

use Libraries.Interface.Item
use Libraries.Interface.Events.TouchListener
Item myItem
TouchListener listener
myItem:AddTouchListener(listener)

Advance(number time)

This action is used to advance the item forward in time in physics space to synchronize it for time of impact solving. This action is used internally and users should not need to use this action. Attribute Parameter time The amount of seconds to advance the item forward in time

Parameters

  • number time

ApplyAngularImpulse(number impulse)

This action applies an angular impulse to this item. The units are in kilogram units squared per second. This modifies the angular velocity of this item. Physics must be enabled on this item before using this action.

Parameters

  • number impulse: The angular impulse in kilogram units squared per second

Example

use Libraries.Interface.Item2D

Item2D item
item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)
item:ApplyAngularImpulse(80)

ApplyForce(Libraries.Compute.Vector2 force, Libraries.Compute.Vector2 point)

This action applies a force to this item at the passed point. The force is in kilogram units per second per second. The point is the screen coordinates where the point will be applied. If the point is not on the center of the item, then a torque will be introduced causing the item to rotate. Physics must be enabled on this item before using this action.

Parameters

Example

use Libraries.Compute.Vector2
use Libraries.Interface.Item2D

Item2D item
Vector2 force
Vector2 point

item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)

force:Set(300, 350)
point:Set(100, 100)    // apply the force to the top right corner of the item

item:ApplyForce(force, point)

ApplyForceToCenter(Libraries.Compute.Vector2 force)

This action applies a force to this item at the center of the item. The force is in kilogram units per second per second. No torque is introduced to the item when using this action. Physics must be enabled on this item before using this action.

Parameters

Example

use Libraries.Compute.Vector2
use Libraries.Interface.Item2D

Item2D item
Vector2 force

item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)

force:Set(300, 350)

item:ApplyForce(force)

ApplyLinearImpulse(Libraries.Compute.Vector2 impulse, Libraries.Compute.Vector2 point)

This action applies a linear impulse to this item at the passed point. The impulse is in kilogram units per second. This immeadietly modifies the linear velocity of this item. The point is the screen coordinates where the impulse will be applied. If the point is not the center of the item, then the angular velocity of this item will also be modified. Physics must be enabled on this item before using this action.

Parameters

Example

use Libraries.Interface.Item2D
use Libraries.Compute.Vector2

Item2D item
Vector2 impulse
Vector2 point

item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)

impulse:Set(100)
point:Set(100, 100)     // apply the impulse to the top right corner

item:ApplyLinearImpulse(impulse, point)

ApplyTorque(number torque)

This action applies a torque to this item. The units are kilogram units squared per second per second. Physics must be enabled on this item before using this action.

Parameters

  • number torque: The torque to apply to this item in kilogram units squared per second per second

Example

use Libraries.Interface.Item2D

Item2D item
item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)
item:ApplyTorque(350)

AreChildrenProcessingMouseEvents()

This action returns whether or not this Item is allowing its children to receive mouse events if the Item is custom drawing. If the Item isn't using custom drawing, this value is irrelevant -- children objects always receive mouse events before the parent if the parent isn't performing custom drawing.

Return

boolean:

BeganTouch(Libraries.Interface.Events.TouchEvent event)

BeginCollision(Libraries.Interface.Item item)

This action is used to indicate that two items have just begun colliding. When two Items collide, the BeginCollision action should be called on both of them, with the other item passed as a parameter to the action. Note that this action does nothing by default, but classes that inherit from Item may override it.

Parameters

Example

use Libraries.Interface.Item

Item collider1
Item collider2
collider1:BeginCollision(collider2)
collider2:BeginCollision(collider1)

BeginMouseOver()

This action is used when a control is moused over by the mouse.

CanRotate(boolean flag)

This action gets the position of the center of this item in global (world) coordinates.

Parameters

  • boolean flag

CancelBehaviors()

This action stops all behaviors this Item is following without finishing them.

ClickedMouse()

This action is used when a control is clicked by the mouse.

CollideWithChildren()

This action sets the mass, mass moment of inertia, and how the 2D item should move (via linear velocity) to be at the desired location.

Return

boolean:

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)

ComputeDistance(Libraries.Compute.Vector2 point, integer childIndex, Libraries.Compute.Vector2 normalOut)

This action computes the distance of the passed point from the collision shape attached to this item. This action is used internally and users should not need to use this action.

Parameters

  • Libraries.Compute.Vector2: The vector representing the point to compute the distance from
  • integer childIndex: The index of the collision shape attached to this item we want the bounding box of
  • Libraries.Compute.Vector2: The direction of the point from the shape

Return

number: The distance of the point from the collision shape of this item

Contains(number containsX, number containsY)

This action tests if a point in global x,y coordinates is contained inside this Item2D. The global coordinates are considered to be the x and y coordinates of this Item plus its offsetX and offsetY values.

Parameters

  • number containsX
  • number containsY

Return

boolean: Whether or not the point is contained in this Item.

Example

use Libraries.Interface.Item2D

Item2D item
item:SetPosition(50, 50)
item:SetWidth(100)
item:SetHeight(50)
boolean value = item:Contains(125, 70)

ContinuedTouch(Libraries.Interface.Events.TouchEvent event)

CopyAndActivateInputTable(text name)

This action obtains the Input Table from this control, copies it, assigns it a group name, sets the control to use the new input table, and then adds it to the global input table hash table.

Parameters

  • text name: the name of the group for the new input table.

Return

Libraries.Game.InputTable: the input table copy

Example

use Libraries.Game.Game
use Libraries.Interface.Controls.TextBox
use Libraries.Game.InputTable

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        TextBox box
        InputTable copy = box:CopyAndActivateInputTable("New Group")
    end

    action Update(number seconds)
    end
end

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

CopyTextureRegion(Libraries.Game.Graphics.TextureRegion region)

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

Parameters

CreateGame()

CreateNodes(Libraries.Game.Collision.BroadphaseCollision2D broadphase, Libraries.Game.Collision.PhysicsPosition2D transform)

This action creates the nodes for this item for the broadphase collision. This action is needed in order to add the item to the collision detection system. This action is used internally and users should not need to use this action.

Parameters

DestroyNodes(Libraries.Game.Collision.BroadphaseCollision2D broadphase)

This action destroys the nodes for this item for the broadphase collision, essentially removing it from the collision detection system. This action is used internally and users should not need to use this action.

Parameters

Dispose()

The Dispose action will dispose the currently loaded texture. This frees up computer resources, but the texture will no longer be usable. Note that multiple Drawables can use the same texture, and disposing of it will get rid of the texture information not just for this Drawable, but any Drawable that is using the texture. Dispose should be used when a texture will not be used again. Here are some guide lines for when you should or should not dispose a Drawable: 1. If the Drawable was loaded using Load(text) or Load(File), then the Drawable created new texture data when it was loaded. This can be safely disposed, unless you copied the Drawable, e.g. with Load(Drawable). 2. If the Drawable was loaded as a shape, e.g. with the LoadRectangle action, the Drawable created new texture data when it loaded. It can be safely disposed, unless you copied the Drawable, e.g. with Load(Drawable). 3. If the Drawable was loaded using a Texture or a TextureRegion, such as with the Load(Texture) action, then it is NOT safe to dispose this if there are any other Drawables that are still in use which were also loaded with the same Texture. If there are no other Drawables that were loaded with the Texture, it is safe to dispose. If a texture was used to load multiple Drawables, it is good practice to use the Dispose action directly from the Texture once all of the Drawables are no longer in use. 4. If the Drawable was loaded with an ImageSheet, you should NEVER dispose the Drawable's texture. All Drawables loaded from an ImageSheet use the same Texture data, so disposing of any Drawable from an ImageSheet will delete the ImageSheet's texture data. If you ever wish to dispose an ImageSheet's texture data, it is good practice to use the ImageSheet's Dispose action.

Example

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

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Drawable drawable
        drawable:LoadFilledCircle(75)
        Add(drawable)

        // When we no longer need the Drawable, we can remove it from
        // the Game, and then Dispose it to clean up the memory it used.
        Remove(drawable)
        drawable:Dispose()
    end

end

DisposeAll()

This action is used to call Dispose on this Item and on the entire children hierarchy of this Item.

DisposeChildren()

This action is used to call Dispose on the entire children hierarchy of this Item. This will not call Dispose on this Item.

DoSpecialNavigation(integer navigationType)

This action triggers special navigation behavior in the specified navigation direction. This behavior overrides the typical navigation provided by the chart. This will only be called by the Chart if the HasSpecialNavigation action returns true for the provided parameter. By default this does nothing, but some classes may override this with custom behavior.

Parameters

  • integer navigationType

Draw(Libraries.Game.Graphics.Painter2D painter)

The Draw action is used to perform custom drawing on this Item and its children. This is only called during the Game engine's draw phase if this Item has enabled custom drawing via the SetCustomDrawing action. This is an advanced feature, and shouldn't be used by most users. If custom drawing is enabled, this action should be overriden -- if it isn't, the Item will attempt to provide default rendering for itself, its view, and its children, without regard to depth buffering. This action is responsible for instructing the provided Painter on how to draw this item, the view, and its children, and in what order to do so.

Parameters

Empty()

This action will remove all items from this item's children hierarchy. Note that this will not empty the hierarchies of the contained Items.

Example

use Libraries.Interface.Item2D

Item2D parentItem
Item2D child1
Item2D child2
Item2D grandchild
parentItem:Add(child1)
parentItem:Add(child2)
child1:Add(grandChild)
parentItem:Empty()

EmptyAll()

This action will call Empty on the entire children hierarchy of this item, and then empty this item as well.

EmptyChildren()

This action is used to call Empty on all children contained in this item's children hierarchy. This will not empty the children of this item.

EmptySelectionListeners()

This action empties or removes all SelectionListeners which have been added to the Control of the given SelectionEvent.

EmptyTextureLoadListeners()

This action removes all TextureLoadListeners that have been added to the texture.

EnablePhysics(boolean flag)

This action enables physics for this item. Passing true turns on physics for this item while passing false turns off physics for this item.

Parameters

  • boolean flag: Whether or not to enable physics for this item

Example

use Libraries.Game.Graphics.Drawable

Drawable circle
circle:LoadFilledCircle(30)
circle:EnablePhysics(true)

EndMouseOver()

This action is used when a control is moused over and it ends.

EndedTouch(Libraries.Interface.Events.TouchEvent event)

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)

FastMoving(boolean flag)

This action gets the linear velocity of this item in units per second. Physics must be enabled on this item before using this action.

Parameters

  • boolean flag

Example

use Libraries.Interface.Item2D
use Libraries.Compute.Vector2

Item2D item
Vector2 velocity

item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)
velocity:Set(100, 0)
item:SetLinearVelocity(velocity)

Vector2 currentVelocity = item:GetLinearVelocity()

FinishCollision(Libraries.Interface.Item item)

This action is used to indicate that two items that were previously colliding no longer are. The FinishCollision action should be called on both Items involved, with the other item passed as a parameter to the action. Note that this action does nothing by default, but classes that inherit from Item may override it.

Parameters

Example

use Libraries.Interface.Item

Item collider1
Item collider2
collider1:FinishCollision(collider2)
collider2:FinishCollision(collider1)

FlipX()

This action flips the Drawable along the x-axis, or in other words, flips it horizontally in 2D space.

Example

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

class Main is Game
    
    action Main
        StartGame()
    end

    action CreateGame
        Drawable line
        line:LoadLine(20, 100)
        line:SetPosition(50, 50)
        line:FlipX()
        Add(line)
    end
end

FlipY()

This action flips the Drawable along the y-axis, or in other words, flips it vertically in 2D space.

Example

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

class Main is Game
    
    action Main
        StartGame()
    end

    action CreateGame
        Drawable line
        line:LoadLine(20, 100)
        line:SetPosition(50, 50)
        line:FlipY()
        Add(line)
    end
end

Focus()

This action sets focus on this Item. If the Item is not focusable, it will instead look through the parent hierarchy and set focus on the first focusable ancestor. If no focusable Item can be found, this action will have no effect.

GainedFocus(Libraries.Interface.Events.FocusEvent event)

This action is fired if the item received the focus.

Parameters

GainedSelection()

This action is used when a Chart Drawable gains the selection. Selection elements are then shown.

GetAccentColor()

This action gets the accent color from the control.

Return

Libraries.Game.Graphics.ColorGroup: the accent control.

GetAccessibilityCode()

This action returns the current accessiblity code for this Item

Return

integer:

GetAccessibilityRoleDescription()

This action returns the custom accessibility role description for this item, if any.

Return

text:

GetAccessibilityType()

This action returns the name of the accessiblity code for this Item as Text

Return

text:

GetAccessibleParent()

This action returns the parent of this Item2D. An Item2D gets a parent when it is added to another Item using the Add action.

Return

Libraries.Interface.Item:

Example

use Libraries.Interface.Item2D

Item2D parentItem
Item2D child
parentItem:Add(child)
Item2D item = child:GetParent()

GetActivationBehavior()

This action returns a default behavior for this paricular control. Some controls do nothing by default, like a TextBox that responds to different kinds of input. Others, however, have default behaviors, like a Button or a MenuItem. If there is no default behavior, this action returns undefined.

Return

Libraries.Interface.Behaviors.Behavior:

GetAngularDamping()

This action gets the inverse inertia of this item (i.e., one divided by the inertia of this item). Physics must be enabled on this item before using this action.

Return

number: The inverse inertia of this item

Example

use Libraries.Interface.Item2D

Item2D item
item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)
item:SetMass(20)
number inverseInertia = item:GetInverseInertia()

GetAngularVelocity()

This action gets this item's angular velocity in radians per second. Physics must be enabled in this item before using this action.

Return

number: The angular velocity of this item in radians per second

Example

use Libraries.Interface.Item2D

Item2D item
item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)
item:SetAngularVelocity(0.1)
number angularVelocity = item:GetAngularVelocity()

GetAnnotation()

This action gets the chart drawables annotation (ChartLabel). Annotation is a control label that can be shown appended to this drawable. It can show things like a name, value, equation or custom text.

Return

Libraries.Interface.Controls.Charts.ChartLabel: the ChartLabel of ChartDrawable object.

GetBackgroundColor()

This action gets the color of the Control background color.

Return

Libraries.Game.Graphics.ColorGroup: the background the color.

GetBorderColor()

This action gets the border color of the control.

Return

Libraries.Game.Graphics.ColorGroup: the controls border color.

GetBorderStyle()

This action gets the border style either, LayoutProperties.TOP, LayoutProperties.BOTTOM, LayoutProperties.LEFT, LayoutProperties.RIGHT, and LayoutProperties.ALL.

Return

integer:

GetBorderThickness()

This action gets the border thickness on the control.

Return

number: the border thickness.

GetBottomLeftPixelRounding()

This action returns the bottom left pixel rounding value.

Return

number: the bottom left pixel rounding value.

GetBottomLeftRounding()

This action returns the bottom left rounding value.

Return

number: the bottom left rounding value.

GetBottomMargin()

This action gets the bottom margin size. The bottom margin is the space outside of the bottom border.

Return

number: the number amount of bottom margin.

GetBottomPadding()

This action gets the bottom padding size. The bottom padding is the space inside of the bottom border.

Return

number: the number amount of bottom padding.

GetBottomRightPixelRounding()

This action returns the bottom right pixel rounding value.

Return

number: the bottom right pixel rounding value.

GetBottomRightRounding()

This action returns the bottom right rounding value.

Return

number: the bottom right rounding value.

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:

GetBoundingBox(integer childIndex)

This action is used to get the bounding box of the item. A bounding box is an axis-alligned rectangle containing the shape used for broadphase collision. This action is used internally and users should not need to use this action.

Parameters

  • integer childIndex: The index of the collision shape attached to this item we want the bounding box of

Return

Libraries.Game.Collision.BoundingBox2D: The bounding box of the collision shape attached to this item

GetBoundingRectangle()

This action returns a rectangle that fully encloses the four corners of the Item as it is represented by its internal vertices array. Note that the rectangle produced by this action will be larger than the actual box formed by this Item's vertices if the Item is rotated.

Return

Libraries.Game.Shapes.Rectangle:

Example

use Libraries.Interface.Item2D
use Libraries.Game.Shapes.Rectangle

Item2D myItem
myItem:SetBoundingBox(20, 80, 100, 100)
Rectangle box = myItem:GetBoundingRectangle()

GetCenterX()

This action returns the x coordinate of the center of this Item2D.

Return

number:

Example

use Libraries.Interface.Item2D
Item2D myItem
myItem:SetWidth(20)
myItem:SetX(100)
number x = myItem:GetCenterX()

GetCenterY()

This action returns the y coordinate of the center of this Item2D.

Return

number:

Example

use Libraries.Interface.Item2D
Item2D myItem
myItem:SetHeight(20)
myItem:SetY(100)
number y = myItem:GetCenterY()

GetChartArea()

A link to the parent chart area of this drawable.

Return

Libraries.Interface.Controls.Charts.ChartAreaPanel:

GetChildren()

This action gets the children of this item in an array.

Return

Libraries.Containers.Array: The children of this item in an array

Example

use Libraries.Interface.Item2D

Item2D parent
Item2D child1
Item2D child2

parent:Add(child1)
parent:Add(child2)

Array<Item2D> children = parent:GetChildren()

GetClipCoordinates(Libraries.Compute.Vector2 xCoords, Libraries.Compute.Vector2 yCoords)

This action gets the clipping coordinates of this Item2D. The coordinates are returned via the two provided Vector2 parameters, the first vector storing the x values of the left and right sides of the clipping coordinates and the second vector storing the y values of the bottom and top sides. The returned boolean value indicates if this Item uses these clipping coordinates (i.e. if this Item or one of its parent Items has clipping enabled). If the clipping is valid, the action returns true. Otherwise, it returns false.

Parameters

Return

boolean:

GetCollisionGroupFlag()

This action gets the total force on this item. The units are kilogram units per second per second. Physics must be enabled on this item before using this action.

Return

boolean: The total force in kilogram units per second per second

Example

use Libraries.Interface.Item2D
use Libraries.Compute.Vector2

Item2D item
Vector2 force

item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)
force:Set(300, 350)
item:SetForce(force)
Vector2 totalForce = item:GetForce()

GetCollisionGroupIndex()

This action gets this item's angular velocity in radians per second. Physics must be enabled in this item before using this action.

Return

integer: The angular velocity of this item in radians per second

Example

use Libraries.Interface.Item2D

Item2D item
item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)
item:SetAngularVelocity(0.1)
number angularVelocity = item:GetAngularVelocity()

GetCollisionList()

This is an action used internally to retrieve the head of the linked list of collisions with this item. This action is used internally and users should not need to use this action.

Return

Libraries.Game.Collision.CollisionEdge2D: The head of the doubly linked list of collisions

GetColor()

This action returns the color filter stored in the Drawable. To see if it's currently in use, use the UsingCustomColor action. If the Drawable is using a different type of filter (such as a Gradient) this will return undefined. To get whatever filter the Drawable is using regardless of type, use the GetColorGroup action.

Return

Libraries.Game.Graphics.Color:

Example

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

class Main is Game

    Color color

    action Main
        StartGame()
    end

    action CreateGame
        Drawable drawable
        drawable:SetColor(0, 1, 1, 1)
        color = drawable:GetColor()
    end

end

GetColorGroup()

This action returns the color filter stored in the Drawable. The returned value is a ColorGroup object, which describes how the color is mapped to the four corners of the Drawable. If no filter is in use, this action will return undefined.

Return

Libraries.Game.Graphics.ColorGroup:

Example

use Libraries.Game.Graphics.Drawable
use Libraries.Game.Graphics.Color
use Libraries.Game.Graphics.ColorGroup
use Libraries.Game.Game

class Main is Game

    Color color

    action Main
        StartGame()
    end

    action CreateGame
        Drawable drawable
        drawable:SetColor(0, 1, 1, 1)
        ColorGroup group = drawable:GetColorGroup()
    end

end

GetColorProperty(text property)

This action gets the color of a given property in the Control.

Parameters

  • text property

Return

Libraries.Game.Graphics.ColorGroup:

GetContainerGridHeight()

This action returns how many rows this Control should be divided into when using a GridLayout. This will have no effect if this Control is not a container or if it is using a different layout.

Return

integer:

GetContainerGridWidth()

This action returns how many columns this Control should be divided into when using a GridLayout. This will have no effect if this Control is not a container or if it is using a different layout.

Return

integer:

GetCurrentLayoutProperties()

This action returns the LayoutProperties that were last used to define the Control, and thus describe its current state. Note that if the Control hasn't been laid out yet, this will return undefined.

Return

Libraries.Interface.Layouts.LayoutProperties: The last LayoutProperties used to layout this Control, or undefined if it hasn't been laid out yet.

GetDefaultFont()

This action obtains the default font for this control. This allows individual controls to customize their default font properties on a per control basis. By default, the system asks for the default system font name on a per control basis, then loads that font and returns it. Font loading is shared, so loading many fonts of the same type and size is not particularly expensive and can be done without much concern for memory requirements.

Return

Libraries.Game.Graphics.Font:

Example

use Libraries.Interface.Controls.TextBox
use Libraries.Game.Graphics.Font

TextBox box
text name = box:GetDefaultFont()
output name

GetDefaultFontName()

This action defines what the default font is for this control. This allows individual controls to customize their default font properties on a per control basis.

Return

text:

Example

use Libraries.Interface.Controls.TextBox

TextBox box
text name = box:GetDefaultFontName()
output name

GetDefaultFontSize()

This action defines what the default font size for this control. This allows individual controls to customize their default font properties on a per control basis.

Return

integer:

Example

use Libraries.Interface.Controls.TextBox

TextBox box
integer size = box:GetDefaultFontSize()
output size

GetDefaultLayoutProperties()

This action returns the default LayoutProperties used for this Control.

Return

Libraries.Interface.Layouts.LayoutProperties: The default LayoutProperties of this Control.

GetDensity()

This action applies a linear impulse to this item at the passed point. The impulse is in kilogram units per second. This immeadietly modifies the linear velocity of this item. The point is the screen coordinates where the impulse will be applied. If the point is not the center of the item, then the angular velocity of this item will also be modified. Physics must be enabled on this item before using this action.

Return

number:

Example

use Libraries.Interface.Item2D
use Libraries.Compute.Vector2

Item2D item
Vector2 impulse
Vector2 point

item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)

impulse:Set(100)
point:Set(100, 100)     // apply the impulse to the top right corner

item:ApplyLinearImpulse(impulse, point)

GetDescription()

This action returns the current internal description of the Item.

Return

text:

Example

use Libraries.Interface.Item

Item item
item:SetDescription("Used for demo purposes.")
output "My item's description is : " + item:GetDescription()

GetDisplayName()

This action obtains the displayable name for this region of the chart.

Return

text: the display name

GetDownItem()

Returns the Item accessed "below" (via the DOWN arrow) this Item in the chart selection.

Return

Libraries.Interface.Controls.Charts.ChartItem:

GetDrawableShape()

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

Return

Libraries.Game.Graphics.DrawableShape:

Example

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)
        Drawable rectangle
        rectangle:LoadFilledRectangle(20, 100, green)
        rectangle:SetPosition(50, 50)
        Add(rectangle)
    end
end

GetDrawableType()

This action returns an integer code representing the type of graphics that's been loaded into this Drawable. The type values can be found in the SceneProperties class. The default value is NONE.

Return

integer: An integer code from the SceneProperties class that describes the type of image this Drawable uses.

GetEndPercentage()

This action determines where the wedge ends along a circle, as a percentage represented between 0 and 1. A value of 0 is placed at the top of the circle, moving clockwise as the value increases. For example, a wedge with a start percentage of 0.25 and an end percentage of 0.5 will start on the right side and end at the bottom, filling the bottom-right quadrant of a circle.

Return

number: A value between 0 and 1 indicating where the wedge ends on the circle.

GetEnterItem()

Returns the Item accessed within (default: ENTER key) this Item in the chart selection.

Return

Libraries.Interface.Controls.Charts.ChartItem:

GetEscapeItem()

Returns the escape Item accessed from this Item in the chart selection (by default using the ESCAPE key).

Return

Libraries.Interface.Controls.Charts.ChartItem:

GetFocusBorderColor()

This action gets the focus border color.

Return

Libraries.Game.Graphics.ColorGroup: the focus border color.

GetFocusColor()

This action sets the focus color.

Return

Libraries.Game.Graphics.ColorGroup: the focus color.

GetFocusFontColor()

This action gets focus font color.

Return

Libraries.Game.Graphics.ColorGroup: the focus font color.

GetFocusListeners()

This action returns an Iterator containing all of the FocusListeners that have been added to this Item using the AddFocusListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered FocusListeners.

GetFont()

This action returns the Font being used by this Control. How this Font is used varies between Controls, and in some cases the Control will ignore it entirely (for example, ScrollPanes), but typically this sets the font that's used for the default label on many Controls, such as Buttons. If the Font is undefined, many Controls will omit their default label.

Return

Libraries.Game.Graphics.Font: The Font being used for this Control.

GetFontColor()

This action gets the current the font color of the font contained in the Control.

Return

Libraries.Game.Graphics.ColorGroup:

GetFontOutlineColor()

This action gets the font outline color value.

Return

Libraries.Game.Graphics.ColorGroup: the font outline color value.

GetFontOutlineThickness()

This action returns the font outline thickness value.

Return

number: the font outline thickness value.

GetFontSize()

This action returns the base Font size to be used by this Control, if the Control uses a Font.

Return

integer:

GetForce()

This action gets the total force on this item. The units are kilogram units per second per second. Physics must be enabled on this item before using this action.

Return

Libraries.Compute.Vector2: The total force in kilogram units per second per second

Example

use Libraries.Interface.Item2D
use Libraries.Compute.Vector2

Item2D item
Vector2 force

item:SetWidth(100)
item:SetHeight(100)
item:EnablePhysics(true)
force:Set(300, 350)
item:SetForce(force)
Vector2 totalForce = item:GetForce()

GetForegroundColor()

This action gets the color of the Control foreground color.

Return

Libraries.Game.Graphics.ColorGroup: the foreground color.

GetForegroundSelectionColor()

This action gets the color of the Control foreground selection color.

Return