Libraries.Interface.Views.DefaultTreeMenuView Documentation

Inherits from: Libraries.Game.Graphics.Drawable, Libraries.Interface.Views.ControlView, Libraries.Interface.Item, Libraries.Interface.Item2D, Libraries.Language.Object, Libraries.Interface.Views.View2D, Libraries.Interface.Views.ToggleView, Libraries.Game.Graphics.TextureRegion, Libraries.Game.Disposable

Summary

Actions Summary Table

ActionsDescription
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.
Add(Libraries.Interface.Item2D newItem)This action adds a different Item2D into this one.
AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)This action adds a new Behavior to this Item.
AddFocusListener(Libraries.Interface.Events.FocusListener listener)This action adds a FocusListener to the Item.
AddMouseListener(Libraries.Interface.Events.MouseListener listener)This action adds a MouseListener to the Item.
AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)This action adds a MouseMovementListener to the Item.
AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)This action adds a MouseWheelListener to the Item.
AddTouchListener(Libraries.Interface.Events.TouchListener listener)This action adds a TouchListener to the Item.
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.
ApplyAngularImpulse(number impulse)This action applies an angular impulse to this item.
ApplyForce(Libraries.Compute.Vector2 force, Libraries.Compute.Vector2 point)This action applies a force to this item at the passed point.
ApplyForceToCenter(Libraries.Compute.Vector2 force)This action applies a force to this item at the center of the item.
ApplyLinearImpulse(Libraries.Compute.Vector2 impulse, Libraries.Compute.Vector2 point)This action applies a linear impulse to this item at the passed point.
ApplyTorque(number torque)This action applies a torque to this item.
BeginCollision(Libraries.Interface.Item item)This action is used to indicate that two items have just begun colliding.
BeginMouseOver()
CanRotate(boolean flag)
CancelBehaviors()This action stops all behaviors this Item is following without finishing them.
ClickedMouse()
CollideWithChildren()
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
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.
Contains(number containsX, number containsY)This action tests if a point in global x,y coordinates is contained inside this Item2D.
Copy()
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.
CopyTextureRegion(Libraries.Game.Graphics.TextureRegion region)This action copies the information from the given TextureRegion into this TextureRegion.
CreateNodes(Libraries.Game.Collision.BroadphaseCollision2D broadphase, Libraries.Game.Collision.PhysicsPosition2D transform)This action creates the nodes for this item for the broadphase collision.
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.
Dispose()The Dispose action will dispose the currently loaded texture.
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.
Draw(Libraries.Game.Graphics.Painter2D painter)The Draw action is used to perform custom drawing on this Item and its children.
Empty()This action will remove all items from this item's children hierarchy.
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.
EnablePhysics(boolean flag)This action enables physics for this item.
EndMouseOver()
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
FastMoving(boolean flag)
FinishCollision(Libraries.Interface.Item item)This action is used to indicate that two items that were previously colliding no longer are.
FlipX()This action flips the Drawable along the x-axis, or in other words, flips it horizontally in 2D space.
FlipY()This action flips the Drawable along the y-axis, or in other words, flips it vertically in 2D space.
Focus()This action sets focus on this Item.
GainedFocus(Libraries.Interface.Events.FocusEvent event)This action is fired if the item received the focus.
GainedSelection()
GetAccessibilityCode()This action returns the current accessiblity code for this Item
GetAccessibilityType()This action returns the name of the accessiblity code for this Item as Text
GetAccessibleParent()
GetAngularDamping()childIterator:HasNext
GetAngularVelocity()This action gets this item's angular velocity in radians per second.
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.
GetBoundingBox(integer childIndex)This action is used to get the bounding box of the 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.
GetCenterX()This action returns the x coordinate of the center of this Item2D.
GetCenterY()This action returns the y coordinate of the center of this Item2D.
GetChildren()This action gets the children of this item in an array.
GetClipCoordinates(Libraries.Compute.Vector2 xCoords, Libraries.Compute.Vector2 yCoords)This action gets the clipping coordinates of this Item2D.
GetCollisionGroupFlag()
GetCollisionGroupIndex()
GetCollisionList()This is an action used internally to retrieve the head of the linked list of collisions with this item.
GetColor()This action returns the color filter stored in the Drawable.
GetColorGroup()This action returns the color filter stored in the Drawable.
GetDensity()
GetDescription()This action returns the current internal description of the Item.
GetFocusListeners()This action returns an Iterator containing all of the FocusListeners that have been added to this Item using the AddFocusListener action.
GetForce()This action gets the total force on this item.
GetFriction()
GetGlobalX()This action returns the Item's global x coordinate.
GetGlobalY()This action returns the Item's global y coordinate.
GetGlobalZ()This action returns the Item's global z value.
GetGradient()This action returns the gradient stored in the Drawable.
GetHashCode()This action gets the hash code for an object.
GetHeight()This action will return the currently set height of the Item2D.
GetInertia()This action gets the rotational inertia of this item.
GetInputGroup()This action returns the input group for this Item.
GetInputTable()
GetInverseInertia()This action gets the inverse inertia of this item (i.
GetInverseMass()This action gets the inverse mass of the item (i.
GetItem(integer index)This action returns an Item2D that was previously added to this Item2D by finding it at the given index in the internal array of children Items.
GetItem()
GetItemAt(number x, number y)This action searches through all Items stored in this Item2D and finds the deepest Item which contains the given point in global coordinates.
GetItemCount()This action returns the number of items contained in this Item2D.
GetItems()This action returns an iterator containing all the items contained in this Item2D.
GetJointList()This is an action used internally to retrieve the head of the liked list of joints connected to this item.
GetLayer()This action returns the current Layer2Dthat this Item2D is a part of in the Game libraries.
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.
GetLinearDamping()childIterator:HasNext
GetLinearVelocity()This action gets the linear velocity of this item in units per second.
GetLinearVelocityFromLocalPoint(Libraries.Compute.Vector2 localPoint)Code used to scale Items about their cente
GetLinearVelocityFromWorldPoint(Libraries.Compute.Vector2 worldPoint)Code used to scale Items about their cente
GetLocalCenter()This action gets the position of the center of this item in local coordinates (i.
GetLocalPoint(Libraries.Compute.Vector2 worldPoint)Given a global point (i.
GetLocalVector(Libraries.Compute.Vector2 worldVector)Given the screen coordinates of a vector, this action computes the local coordinates of the vector (i.
GetMass()This action returns the mass of the item in kilograms.
GetMass(Libraries.Game.Physics.Mass2D mass)
GetMouseListeners()This action returns an Iterator containing all of the MouseListeners that have been added to this Item using the AddMouseListener action.
GetMouseMovementListeners()This action returns an Iterator containing all of the MouseMovementListeners that have been added to this Item using the AddMouseMovementListener action.
GetMouseWheelListeners()This action returns an Iterator containing all of the MouseWheelListeners that have been added to this Item using the AddMouseWheelListener action.
GetName()This action returns the current internal name of the Item.
GetNextFocus()This action returns the next focus item.
GetNodeCount()This action gets the number of broadphase nodes this item has.
GetNodes()This action returns all of the broadphase nodes attached to this item in an array.
GetOffsetX()This action returns the X offset of the Item.
GetOffsetY()This action returns the Y offset of the item.
GetOffsetZ()This action returns the Z offset of the item.
GetOriginX()This action will return the current X origin of this Item2D.
GetOriginY()This action will return the current Y origin of this Item2D.
GetParent()This action returns the parent of this Item2D.
GetPhysicsProperties()
GetPreviousFocus()This action returns the previous focus item.
GetRawInertia()
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.
GetResponsiveness()Vertices are set to negative Z to reverse draw orde
GetRestitution()
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.
GetRotation()Gets the current degree of rotation of this Item.
GetRotationInRadians()Gets the current rotation of this Item in radians.
GetScaleX()This action will return the current x-scaling value of this Item2D.
GetScaleY()This action will return the current y-scaling value of this Item2D.
GetScreenX()This action returns the x coordinate of the Item on the screen.
GetScreenY()This action returns the y coordinate of the Item on the screen.
GetShape()This item returns the collision shape of this item.
GetShapeType()This action returns an integer representing the type of collision shape currently attached to this item.
GetSleepTime()
GetSweep()This action returns the swept movement of this item used for time of impact solving for the physics system.
GetText()
GetTexture()This action returns the texture that is currently loaded into the Drawable.
GetTextureField()This action returns the texture held by this TextureRegion.
GetToggleState()
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.
GetTorque()This action gets the total torque on this item.
GetTouchListeners()This action returns an Iterator containing all of the TouchListeners that have been added to this Item using the AddTouchListener action.
GetTransform()This action returns the position of the item in physical space.
GetTransform0()This action gets the position of the item in physics space from the previous frame.
GetVertex(integer index)This action returns a value from one of the internal vertices of this Item2D.
GetVertices()This action returns the internal vertices array of this Item2D.
GetView2D()
GetVisibleItemAt(number x, number y)This action searches through all Items stored in this Item2D and finds the deepest Item which contains the given point in global coordinates.
GetWidth()This action will return the currently set width of the Item2D.
GetWorldCenter()This action gets the position of the center of this item in global (world) coordinates.
GetWorldPoint(Libraries.Compute.Vector2 localPoint)Given a point relative to the center of this item, this action computes and returns that point in screen coordinates.
GetWorldVector(Libraries.Compute.Vector2 localVector)Given the local coordinates of a vector, this action computes the screen coordinates of the corresponding vector.
GetX()This action returns the currently set X coordinate of the Item.
GetY()This action returns the currently set Y coordinate of the Item.
GetZ()This action returns the currently set Z value of this Item2D.
HasMoved()
Hide()This action is used to indicate that an Item and all Items that were added to it should not be visible on the screen.
Initialize(integer width, integer height)
IsAccessibleParent()
IsClipping()The IsClipping action returns true if pixel clipping is enabled, or false if it is disabled.
IsCollidable()This action determines whether this item is collidable.
IsCustomDrawing()The IsCustomDrawing action returns whether or not this Item is directly managing how itself and its children are drawn.
IsEmpty()This action returns whether or not any items are contained in this Item.
IsFastMoving()
IsFlippedX()This action will return true if the Drawable has been flipped across the x-axis, or false if it has not.
IsFlippedY()This action will return true if the Drawable has been flipped across the y-axis, or false if it has not.
IsFocusable()This action returns whether or not the Item can currently receive focus.
IsFocused()The IsFocused action determines if this Item is currently focused, returning true if it is, or false if it is not.
IsLoaded()This action returns true if there is a texture currently loaded into the Drawable, otherwise it returns false.
IsNonResponsive()
IsPhysicsEnabled()This action determines whether physics is currently enabled for this item.
IsResponsive()
IsRotationAllowed()
IsShowing()This action returns whether the Item is currently set to be visible on the screen.
IsSimulated()
IsSimulationRequired()
IsUnmovable()
Load(Libraries.Game.Graphics.TextureRegion region, integer sourceX, integer sourceY, integer sourceWidth, integer sourceHeight)This action will load the given TextureRegion into this Drawable, loading from the given x,y coordinates of the texture to the given width and height.
Load(Libraries.Game.Graphics.TextureRegion region)This action will load the given TextureRegion into this Drawable, which will set its appearance when drawn on screen.
Load(text filePath)This action will create a new texture from the image file located at the given file path.
Load(Libraries.Compute.Matrix matrix)This action will load a matrix into a Texture to create a monochrome (black and white) image, then load the Texture into this Drawable.
Load(Libraries.Game.Graphics.Texture texture, integer sourceWidth, integer sourceHeight)This action will load the given texture into this Drawable, loading from the lower left corner of the texture to the given width and height.
Load(Libraries.Game.Graphics.Texture newTexture, integer sourceX, integer sourceY, integer sourceWidth, integer sourceHeight)This action will load the given texture into this Drawable, loading from the given x,y coordinates of the texture to the given width and height.
Load(Libraries.System.File file)This action will create a new texture from provided image file.
Load(Libraries.Game.Graphics.Texture texture)This action will load the given texture into this Drawable.
LoadCircle(integer radius, Libraries.Game.Graphics.ColorGroup 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 black circle with the given radius.
LoadFilledCircle(integer radius)This action will create a new Texture with a solid black circle with the given radius.
LoadFilledCircle(integer radius, Libraries.Game.Graphics.ColorGroup color)This action will create a new Texture with a solid circle of the given color with the given radius.
LoadFilledRectangle(integer width, integer height)This action will create a new Texture with a solid black rectangle with the given width and height.
LoadFilledRectangle(integer width, integer height, Libraries.Game.Graphics.ColorGroup 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 black 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.ColorGroup 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.
LoadLine(integer x, integer y)This action will create a new Texture with a black line that connects an imaginary point at 0,0 to the provided x,y coordinates.
LoadLine(integer x, integer y, Libraries.Game.Graphics.ColorGroup 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.
LoadRectangle(integer width, integer height)This action will create a new Texture with a hollow black rectangle with the given width and height.
LoadRectangle(integer width, integer height, Libraries.Game.Graphics.ColorGroup color)This action will create a new Texture with a hollow rectangle of the given color with 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.
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, 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.
LostFocus(Libraries.Interface.Events.FocusEvent event)This action is fired if the item lost the focus.
LostSelection()
Move(number xAmount, number yAmount)This action will increase the x and y coordinates of this Item by the given amounts.
MoveX(number xAmount)This action will increase the x-coordinate of this Item by the given amount.
MoveY(number yAmount)This action will increase the y-coordinate of this Item by the given amount.
MoveZ(number zAmount)This action will increase the z-coordinate of this Item by the given amount.
PrepareVertices()Checks to see if the Item2D's internal vertices are up to date, and updates them if they are not.
ProcessMouseEvent(Libraries.Interface.Events.MouseEvent event)This action takes a mouse event and handles it.
ProcessTouchEvent(Libraries.Interface.Events.TouchEvent event)FIX ME: Needs comments
QueueForDrawing(Libraries.Game.Graphics.Painter2D painter)
ReleasedMouse()
Remove(integer index)This action removes an Item that was previously added to this Item by finding it at the given index in the internal array of children Items.
Remove(Libraries.Interface.Item2D removed)This action removes an Item2D that was previously added to this Item2D.
RemoveFocusListener(Libraries.Interface.Events.FocusListener listener)This action removes a FocusListener from the Item.
RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)This action removes a MouseListener from the Item.
RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)This action removes a MouseMovementListener from the Item.
RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)This action removes a MouseWheelListener from the Item.
RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)This action removes a TouchListener from the Item.
RequireSimulation(boolean flag)
ResetMass()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.
Resize()The Resize action is used to recalculate the size and position of Controls that are being controlled by a Layout.
Rotate(number degrees)Rotates this Item2D by the given number of degrees.
Scale(number amount)This action will multiply the current scaling value by the given number.
Scale(number xAmount, number yAmount)This action will multiply the x scaling and y scaling values, respectively, by the given numbers.
ScaleFromCenter(number amount)This action will multiply the current scaling value by the given number.
ScaleFromCenter(number xAmount, number yAmount)This action will multiply the current scaling values of the x and y planes by the given number.
SetAccessibilityCode(integer newAccessibilityCode)This action changes the accessibility code for this Item.
SetAlpha(number alpha)Sets the alpha of the Drawable.
SetAngularDamping(number angularDamping)Code used to scale Items about their cente
SetAngularVelocity(number angularVelocity)This action sets this item's angular velocity in radians per second.
SetBottomSide(number bottom)This action selects a point on the loaded texture that this Drawable will consider to be the bottom edge of the image to be drawn.
SetBoundingBox(number newX, number newY, number newWidth, number newHeight)This action will set the x coordinate, y coordinate, width, and height of the Item2D, respectively.
SetCenter(number setX, number setY)This action will set the X and Y coordinates of the Item so that the center of the Item is located at the given X, Y coordinates.
SetCenterX(number setX)This action will set the X coordinate of the Item so that the center of the Item is aligned with the given X coordinate value.
SetCenterY(number setY)This action will set the Y coordinate of the Item so that the center of the Item is aligned with the given Y coordinate value.
SetClipCoordinates(Libraries.Game.Graphics.Painter2D painter)This action sets the clipping coordinates of the given painter to respect the coordinates of this Item (if it's clipping) as well as any clipping being performed by parent Items.
SetClipping(boolean clip)The SetClipping action is used to enable or disable clipping.
SetCollidable(boolean flag)This action sets this item to be collidable.
SetCollideWithChildren(boolean flag)
SetCollisionGroupFlag(boolean flag)
SetCollisionGroupIndex(integer index)
SetCollisionList(Libraries.Game.Collision.CollisionEdge2D edge)This is an action used internally by the physics system to keep track of the collisions with this item in a linked list structure.
SetColor(Libraries.Game.Graphics.ColorGroup tint)Sets the color filter on this Drawable.
SetColor(number red, number green, number blue, number alpha)Sets the color filter of the Drawable from the given components of red, green, blue, and alpha.
SetCustomDrawing(boolean isCustom)The SetCustomDrawing action is used to indicate that this Item wants to directly manage how itself and its children are drawn.
SetDensity(number density)
SetDescription(text newDescription)This action sets the internal description of the Item.
SetFlipX(boolean flip)This action will set the Item2D to be flipped across the X-axis according to the boolean.
SetFlipY(boolean flip)This action will set the Item2D to be flipped across the Y-axis according to the boolean.
SetFocusable(boolean focus)The SetFocusable action sets whether or not this Item should be focusable.
SetForce(Libraries.Compute.Vector2 force)This action sets the total force on this item.
SetFriction(number friction)
SetHasMoved(boolean flag)
SetHeight(number newHeight)This action will set the height of the Item2D.
SetInputGroup(text group)This action sets the input group for this Item.
SetItem(integer index, Libraries.Interface.Item2D newItem)This action sets a value inside the internal item array of this Item2D.
SetItem(Libraries.Interface.Item2D item)
SetJointList(Libraries.Game.Physics.Joints.JointEdge2D edge)This is an action used internally by the physics system to keep track of the joints connected to this item in a linked list structure.
SetLayer(Libraries.Game.Layer2D parentLayer)This action is used by the Game libraries to create a reference to the layer that this Item2D exists on.
SetLeftSide(number left)This action selects a point on the loaded texture that this Drawable will consider to be the left edge of the image to be drawn.
SetLinearDamping(number linearDamping)Code used to scale Items about their cente
SetLinearVelocity(Libraries.Compute.Vector2 linearVelocity)This action sets the linear velocity of this item in units per second.
SetLinearVelocityX(number linearVelocityX)This action sets the x-component of this item's linear velocity in units per second.
SetLinearVelocityY(number linearVelocityY)This action sets the y-component of this item's linear velocity in units per second.
SetMass(number mass)
SetMass(Libraries.Game.Physics.Mass2D mass)
SetName(text newName)This action sets the internal name of the Item.
SetNextFocus(Libraries.Interface.Item next)This action sets the next focus item.
SetNonResponsive()
SetOffset(number xAmount, number yAmount)This action will set both the X and Y offsets of the item, respectively.
SetOffset(number xAmount, number yAmount, number zAmount)This action will set X, Y, and Z offsets of the item, respectively.
SetOffsetX(number xAmount)This action sets the X offset of the Item.
SetOffsetY(number yAmount)This action sets the Y offset of the item.
SetOffsetZ(number zAmount)This action sets the Z offset of the item.
SetOrigin(number setX, number setY)This action will set the origin of the Item to be at the given location in the Item.
SetOriginCenter()This action will set the origin of the Item to be at the current center of the Item's width and height bounds.
SetParent(Libraries.Interface.Item2D newItem)This action sets a reference to the parent item.
SetPhysicsProperties(Libraries.Game.Physics.PhysicsProperties2D properties)
SetPosition(number setX, number setY)This action will set both the X coordinate and the Y coordinate of the Item, in that order.
SetPosition(number setX, number setY, number setZ)This action will set both the X and Y coordinates of this Item2D, and will additionally set the Z value of this Item2D.
SetPreviousFocus(Libraries.Interface.Item previous)This action sets the previous focus item.
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(Libraries.Game.Graphics.TextureRegion region)Sets the region of this TextureRegion to be the same as the region of a different TextureRegion.
SetRegion(number left, number top, number right, number bottom)This action selects the portion of the loaded texture to use when drawing.
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.
SetResponsive()
SetResponsiveness(integer type)Code used to scale about the cente
SetRestitution(number restitution)
SetRightSide(number right)This action selects a point on the loaded texture that this Drawable will consider to be the right edge of the image to be drawn.
SetRotation(number degrees)Sets this Item2D to be rotated to an angle of the given number of degrees.
SetScale(number newX, number newY)This action sets separate scaling values for the x and y planes on this Item2D.
SetScale(number scale)This action sets the scale of this Item2D, causing the vertices of the item to be calculated based on a scaled percentage of the width and height.
SetScaleFromCenter(number scale)This action sets the scale of this Item2D, causing the vertices of the item to be calculated based on a scaled percentage of the width and height.
SetScaleFromCenter(number newX, number newY)This action sets separate scaling values for the x and y planes on this Item2D.
SetScaleX(number scaleX)This action sets the scaling value of the x plane on this Item2D.
SetScaleY(number scaleY)This action sets the scaling value of the y plane on this Item2D.
SetScreenPositionFromPhysicsPosition()
SetShape(Libraries.Game.Collision.Shapes.CollisionShape2D shape)This action sets the collision shape of this item.
SetSize(number newWidth, number newHeight)This action will set the width and height of the Item2D, respectively.
SetSleepTime(number time)
SetText(text value)
SetTexture(Libraries.Game.Graphics.Texture newTexture)This action sets the texture used by this TextureRegion to the given texture.
SetToggleState(boolean openState)
SetTopSide(number top)This action selects a point on the loaded texture that this Drawable will consider to be the top edge of the image to be drawn.
SetTorque(number torque)This action sets the total torque on this item.
SetTransform(Libraries.Compute.Vector2 position, number angle)This action is used internally by the physics system to set the position of this item in the physics world.
SetTransform(Libraries.Game.Collision.PhysicsPosition2D transform)This action sets the position of the item in physical space.
SetTransform0(Libraries.Game.Collision.PhysicsPosition2D transform)This action sets the position of the item in physics space from the previous frame.
SetUnmovable()
SetUpdateTransform(boolean flag)
SetVertex(integer index, number value)This action sets a value of one of the internal vertices of this Item2D.
SetView2D(Libraries.Interface.Views.View2D content)
SetWidth(number newWidth)This action will set the width of the Item2D.
SetX(number setX)This action sets the X coordinate of the Item.
SetY(number setY)This action sets the Y coordinate of the Item.
SetZ(number setZ)This action sets the Z value of the Item2D.
ShouldCollide(Libraries.Interface.Item2D otherItem)get the old target global center of the obje
Show()This action is used to indicate that an Item and all Items that were added to it should be visible on the screen.
Simulate(boolean flag)
SynchronizeNodes()This action is used to syncronize the item's position in physics space with its position in the tree used for broadphase collision.
SynchronizeTransform()This action is used to update this items position in physics space after physics solving is finished for this item.
TestPoint(Libraries.Compute.Vector2 point)This item is used to test whether a passed point is on the collision shape of this item.
Update(number secondsSinceUpdate)This action updates the item.
UpdateAll(number secondsSinceUpdate)This action calls the Update action on this Item and all Items that have been added to this item with the Add action.
UpdateFlipping(boolean flipX, boolean flipY)
UpdatePosition(number x, number y, number z)
UpdateRotation(number angle)
UpdateSize(number width, number height)
UpdateTransformAngle()
UpdateTransformX()
UpdateTransformY()
UseDefaultColor()This action removes the color filter from a Drawable.
UsingCustomColor()This action returns whether or not the Drawable has a custom Color filter.
UsingCustomGradient()This action returns whether or not the Drawable is using a gradient.
UsingCustomTint()This action returns whether or not the Drawable is being tinted by a ColorGroup, such as a Color or Gradient.

Actions Documentation

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.

Example Code

use Libraries.Interface.Item2D

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

Parameters

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.

Example Code

use Libraries.Interface.Item2D

        Item2D parentItem
        Item2D child
        parentItem:Add(child)

Parameters

AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)

This action adds a new Behavior to this Item.

Parameters

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.

Example Code

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

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.

Example Code

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

Parameters

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.

Example Code

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

Parameters

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.

Example Code

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

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.

Example Code

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

Parameters

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

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.

Example Code

use Libraries.Interface.Item2D

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

Parameters

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.

Example Code

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)

Parameters

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.

Example Code

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)

Parameters

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.

Example Code

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)

Parameters

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.

Example Code

use Libraries.Interface.Item2D

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

Parameters

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.

Example Code

use Libraries.Interface.Item

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

Parameters

BeginMouseOver()

CanRotate(boolean flag)

Parameters

CancelBehaviors()

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

ClickedMouse()

CollideWithChildren()

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.

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.

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

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.

Example Code

use Libraries.Interface.Item2D

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

Parameters

Return

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

Copy()

Return

Libraries.Interface.Views.ControlView

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

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 Code

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.

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 Code

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.

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.

Example Code

use Libraries.Game.Graphics.Drawable

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

Parameters

EndMouseOver()

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.

FastMoving(boolean flag)

Parameters

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.

Example Code

use Libraries.Interface.Item

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

Parameters

FlipX()

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

Example Code

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 Code

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

GetAccessibilityCode()

This action returns the current accessiblity code for this Item

Return

integer:

GetAccessibilityType()

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

Return

text:

GetAccessibleParent()

Return

Libraries.Interface.Item

GetAngularDamping()

childIterator:HasNext

Return

number:

GetAngularVelocity()

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

Example Code

use Libraries.Interface.Item2D

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

Return

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

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

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.

Example Code

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

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

Return

Libraries.Game.Shapes.Rectangle:

GetCenterX()

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

Example Code

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

Return

number:

GetCenterY()

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

Example Code

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

Return

number:

GetChildren()

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

Example Code

use Libraries.Interface.Item2D

    Item2D parent
    Item2D child1
    Item2D child2

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

    Array<Item2D> children = parent:GetChildren()

Return

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

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

Return

boolean

GetCollisionGroupIndex()

Return

integer

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.

Example Code

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

Return

Libraries.Game.Graphics.Color:

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.

Example Code

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

Return

Libraries.Game.Graphics.ColorGroup:

GetDensity()

Return

number

GetDescription()

This action returns the current internal description of the Item.

Example Code

use Libraries.Interface.Item

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

Return

text:

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.

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.

Example Code

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

Return

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

GetFriction()

Return

number

GetGlobalX()

This action returns the Item's global x coordinate. This is the actual world coordinate that the item exists at after it has been offset by its parent's position. If this Item doesn't have a parent, and the offset hasn't been set manually, this is the same as GetX().

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffsetX(100)
        myItem:SetX(30)
        number globalX = myItem:GetGlobalX()

Return

number:

GetGlobalY()

This action returns the Item's global y coordinate. This is the actual world coordinate that the item exists at after it has been offset by its parent's position. If this Item doesn't have a parent, and the offset hasn't been set manually, this is the same as GetY().

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffsetY(60)
        myItem:SetX(90)
        number globalY = myItem:GetGlobalY()

Return

number:

GetGlobalZ()

This action returns the Item's global z value. For an Item2D, this simply returns the Item2D's current z value.

Return

number:

GetGradient()

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

Example Code

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

        class Main is Game

            Gradient gradient
            Color color

            action Main
                StartGame()
            end

            action CreateGame
                Drawable drawable
                Gradient gradient
                gradient:Set(color:Red(), color:Green(), color:Blue(), color:White())
                drawable:SetGradient(gradient)

                drawGradient = drawable:GetGradient()
            end

        end

Return

Libraries.Game.Graphics.Gradient:

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 will return the currently set height of the Item2D.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        number height = myItem:GetHeight()

Return

number:

GetInertia()

This action gets the rotational inertia of this item. The inertia is in kilogram units squared.

Example Code

use Libraries.Interface.Item2D

    Item2D item
    item:SetWidth(100)
    item:SetHeight(100)
    item:EnablePhysics(true)
    item:SetMass(20)
    number inertia = item:GetInertia()

Return

number: The inertia of this item in kilogram units squared

GetInputGroup()

This action returns the input group for this Item. When used with the Game libraries, this tag describes what InputTable (if any) can interact with this Item due to input.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetInputGroup("arrowKeys")
        output "My item's input group is : " + item:GetInputGroup()

Return

text: The input group tag being used by this Item.

GetInputTable()

Return

Libraries.Game.InputTable:

GetInverseInertia()

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.

Example Code

use Libraries.Interface.Item2D

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

Return

number: The inverse inertia of this item

GetInverseMass()

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

Example Code

use Libraries.Interface.Item2D

    Item2D item
    item:SetWidth(100)
    item:SetHeight(100)
    item:EnablePhysics(true)
    item:SetMass(20)
    number inverseMass = item:GetInverseMass()

Return

number: The inverse mass of this item

GetItem(integer index)

This action returns an Item2D that was previously added to this Item2D by finding it at the given index in the internal array of children Items.

Example Code

use Libraries.Interface.Item2D

        Item2D parentItem
        Item2D child1
        Item2D child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        Item temp = parentItem:GetItem(0)

Parameters

Return

Libraries.Interface.Item2D:

GetItem()

Return

Libraries.Interface.Item2D

GetItemAt(number x, number y)

This action searches through all Items stored in this Item2D and finds the deepest Item which contains the given point in global coordinates.

Example Code

use Libraries.Interface.Item2D

        Item2D parentItem
        Item2D child
        Item2D grandchild
        parentItem:Add(child)
        child:Add(grandchild)
        grandchild:SetHeight(100)
        grandchild:SetWidth(100)
        Item2D temp = parentItem:GetItemAt(75, 75)

Parameters

Return

Libraries.Interface.Item2D: The deepest item in the children hierarchy at the given point.

GetItemCount()

This action returns the number of items contained in this Item2D.

Example Code

use Libraries.Interface.Item2D

        Item2D parentItem
        Item2D child1
        Item2D child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        integer size = parentItem:GetItemCount()

Return

integer:

GetItems()

This action returns an iterator containing all the items contained in this Item2D.

Example Code

use Libraries.Interface.Item2D
        use Libraries.Containers.Iterator

        Item2D parentItem
        Item2D child1
        Item2D child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        Iterator<Item2D> iterator = parentItem:GetItems()

Return

Libraries.Containers.Iterator:

GetJointList()

This is an action used internally to retrieve the head of the liked list of joints connected to this item. This action is used internally and users should not need to use this action.

Return

Libraries.Game.Physics.Joints.JointEdge2D: The head of the linked list of connected joints

GetLayer()

This action returns the current Layer2Dthat this Item2D is a part of in the Game libraries.

Return

Libraries.Game.Layer2D:

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:

GetLinearDamping()

childIterator:HasNext

Return

number:

GetLinearVelocity()

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

Example Code

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

Return

Libraries.Compute.Vector2: The vector representing the linear velocity of this item in units per second

GetLinearVelocityFromLocalPoint(Libraries.Compute.Vector2 localPoint)

Code used to scale Items about their cente

Parameters

Return

Libraries.Compute.Vector2:

GetLinearVelocityFromWorldPoint(Libraries.Compute.Vector2 worldPoint)

Code used to scale Items about their cente

Parameters

Return

Libraries.Compute.Vector2:

GetLocalCenter()

This action gets the position of the center of this item in local coordinates (i.e., with respect to itself).

Return

Libraries.Compute.Vector2: The vector representing the center of this item in local coordinates

GetLocalPoint(Libraries.Compute.Vector2 worldPoint)

Given a global point (i.e., the screen coordinates of the point), this action computes the corresponding point relative to the center of this item.

Example Code

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

    Item2D item
    Vector2 worldPoint

    item:SetWidth(100)
    item:SetHeight(100)
    item:SetPosition(400, 350)
    
    worldPoint:Set(400, 350)    // the lower left corner of the item

    Vector2 localPoint = item:GetLocalPoint(worldPoint)

Parameters

Return

Libraries.Compute.Vector2: The coordinates of the point relative to the center of this item

GetLocalVector(Libraries.Compute.Vector2 worldVector)

Given the screen coordinates of a vector, this action computes the local coordinates of the vector (i.e., the coordinates of the vector relative to the center of this item)

Example Code

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

    Item2D item
    Vector2 worldVector

    item:SetWidth(100)
    item:SetHeight(100)
    item:SetPosition(400, 350)
    
    worldVector:Set(400, 350)    // the lower left corner of the item

    Vector2 localVector = item:GetLocalVector(worldVector)

Parameters

Return

Libraries.Compute.Vector2: The local coordinates of the corresponding vector

GetMass()

This action returns the mass of the item in kilograms. Physics must be enabled on this item before using this action. If the item is non-responsive or unmovable, the mass is zero.

Example Code

use Libraries.Interface.Item2D

    Item2D item
    item:SetWidth(100)
    item:SetHeight(100)
    item:EnablePhysics(true)
    item:SetMass(20)
    number mass = item:GetMass()

Return

number: The mass in kilograms

GetMass(Libraries.Game.Physics.Mass2D mass)

Parameters

GetMouseListeners()

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

Return

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

GetMouseMovementListeners()

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

Return

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

GetMouseWheelListeners()

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

Return

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

GetName()

This action returns the current internal name of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetName("My Item")
        output "My item's name is " + item:GetName()

Return

text:

GetNextFocus()

This action returns the next focus item. When this Item has the focus and the user requests the focus to advance (e.g. by pressing the tab key), the returned value is the next item to receive that focus, if it is defined. If it isn't defined, the focus can not advance from this Item.

Return

Libraries.Interface.Item: The next Item to receive focus after this one.

GetNodeCount()

This action gets the number of broadphase nodes this item has. This action is used internally and users should not need to use this action.

Return

integer: The number of broadphase nodes attached to this item

GetNodes()

This action returns all of the broadphase nodes attached to this item in an array. This action is used internally and users should not need to use this action.

Return

Libraries.Containers.Array: The broadphase nodes attached to this item in an array

GetOffsetX()

This action returns the X offset of the Item. The offset tells the Item where to relate its X position to. In other words, the X offset is where an X coordinate of 0 is for this Item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffsetX(100)
        number offset = myItem:GetOffsetX()

Return

number:

GetOffsetY()

This action returns the Y offset of the item. The offset tells the Item where to relate its Y position to. In other words, the Y offset is where a Y coordinate of 0 is for this item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffsetY(75)
        number offset = myItem:GetOffsetY()

Return

number:

GetOffsetZ()

This action returns the Z offset of the item. The offset tells the Item where to relate its Z position to. In other words, the Z offset is where a Z coordinate of 0 is for this item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffsetZ(75)
        number offset = myItem:GetOffsetZ()

Return

number:

GetOriginX()

This action will return the current X origin of this Item2D. By default, the origin is at the coordinates 0, 0.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetOriginCenter()
        number xOrigin = myItem:GetOriginX()

Return

number:

GetOriginY()

This action will return the current Y origin of this Item2D. By default, the origin is at the coordinates 0, 0.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetOriginCenter()
        number yOrigin = myItem:GetOriginY()

Return

number:

GetParent()

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

Example Code

use Libraries.Interface.Item2D

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

Return

Libraries.Interface.Item2D:

GetPhysicsProperties()

Return

Libraries.Game.Physics.PhysicsProperties2D

GetPreviousFocus()

This action returns the previous focus item. When this Item has the focus and the user requests the focus to move backwards (e.g. by pressing shift & tab), the returned value is the previous item to receive that focus, if it is defined. If it isn't defined, the focus can not move backwards from this Item.

Return

Libraries.Interface.Item: The previous Item to receive focus before this one.

GetRawInertia()

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:

GetResponsiveness()

Vertices are set to negative Z to reverse draw orde

Return

integer:

GetRestitution()

Return

number

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:

GetRotation()

Gets the current degree of rotation of this Item.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetRotation(90)
        number rotation = myItem:GetRotation()

Return

number:

GetRotationInRadians()

Gets the current rotation of this Item in radians.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetRotation(90)
        number rotation = myItem:GetRotationInRadians()

Return

number:

GetScaleX()

This action will return the current x-scaling value of this Item2D. By default, the x-scaling value of an Item is 1.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:Scale(1.25)
        number scaleX = myItem:GetScaleX()

Return

number:

GetScaleY()

This action will return the current y-scaling value of this Item2D. By default, the y-scaling value of an Item is 1.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:Scale(1.25)
        number scaleY = myItem:GetScaleY()

Return

number:

GetScreenX()

This action returns the x coordinate of the Item on the screen. If the Item hasn't been attached to a Layer, this will return a "Not a Number" value instead.

Return

number:

GetScreenY()

This action returns the y coordinate of the Item on the screen. If the Item hasn't been attached to a Layer, this will return a "Not a Number" value instead.

Return

number:

GetShape()

This item returns the collision shape of this item. The collision shape is the shape the collision system will use to test for collisions with this item. Note that this may be different from the shape drawn on the screen.

Example Code

use Libraries.Game.Drawable
    use Libraries.Game.Collision.Shapes.Circle

    Drawable ball
    ball:Load("ball.png")
    Circle circle
    circle:SetRadius(30)
    ball:SetShape(circle)
    CollisionShape2D shape = ball:GetShape()

Return

Libraries.Game.Collision.Shapes.CollisionShape2D: The collision shape for this item

GetShapeType()

This action returns an integer representing the type of collision shape currently attached to this item.

Return

integer: The integer representing the type of collision shape for this item

GetSleepTime()

Return

number

GetSweep()

This action returns the swept movement of this item used for time of impact solving for the physics system. This action is used internally and users should not need to call this action.

Return

Libraries.Game.Collision.Sweep2D: The swept motion of this item

GetText()

Return

text

GetTexture()

This action returns the texture that is currently loaded into the Drawable.

Example Code

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

        class Main is Game

            action Main
                StartGame()
            end

            action CreateGame
                Drawable drawable
                drawable:LoadFilledCircle(75)
                Texture circle = drawable:GetTexture()
            end

        end

Return

Libraries.Game.Graphics.Texture:

GetTextureField()

This action returns the texture held by this TextureRegion.

Return

Libraries.Game.Graphics.Texture:

GetToggleState()

Return

boolean

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:

GetTorque()

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

Example Code

use Libraries.Interface.Item2D

    Item2D item

    item:SetWidth(100)
    item:SetHeight(100)
    item:EnablePhysics(true)
    item:SetTorque(200)
    number totalTorque = item:GetTorque()

Return

number: The total torque in kilogram units squared per second per second

GetTouchListeners()

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

Return

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

GetTransform()

This action returns the position of the item in physical space. This acction is used internally and should not be used by users to get the position of this item on the screen.

Return

Libraries.Game.Collision.PhysicsPosition2D: The position and angle of this item in physics space

GetTransform0()

This action gets the position of the item in physics space from the previous frame. This action is used internally and users should not need to use this action

Return

Libraries.Game.Collision.PhysicsPosition2D: The position and angle of the item in physics space in the previous frame

GetVertex(integer index)

This action returns a value from one of the internal vertices of this Item2D. This action is primarily for internal use, and most users will never need to use this action directly.

Parameters

Return

number:

GetVertices()

This action returns the internal vertices array of this Item2D. This action is primarily for internal use, and most users will never need to use this action directly.

Return

Libraries.Containers.Number32BitArray:

GetView2D()

Return

Libraries.Interface.Views.View2D

GetVisibleItemAt(number x, number y)

This action searches through all Items stored in this Item2D and finds the deepest Item which contains the given point in global coordinates. This action will only return items which are visible (that is, IsShowing() returns true).

Example Code

use Libraries.Interface.Item2D

        Item2D parentItem
        Item2D child
        Item2D grandchild
        parentItem:Add(child)
        child:Add(grandchild)
        grandchild:SetHeight(100)
        grandchild:SetWidth(100)
        Item2D temp = parentItem:GetVisibleItemAt(75, 75)

Parameters

Return

Libraries.Interface.Item2D: The deepest visible item in the children hierarchy at the given point.

GetWidth()

This action will return the currently set width of the Item2D.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        number width = myItem:GetWidth()

Return

number:

GetWorldCenter()

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

Return

Libraries.Compute.Vector2: The vector representing the center of this item in global coordinates

GetWorldPoint(Libraries.Compute.Vector2 localPoint)

Given a point relative to the center of this item, this action computes and returns that point in screen coordinates.

Example Code

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

    Item2D item
    Vector2 localPoint

    item:SetWidth(100)
    item:SetHeight(100)
    item:SetPosition(400, 250)
    
    localPoint:Set(0, 0)    // Get the coordinates of the center of the item

    Vector2 worldPoint = item:GetWorldPoint(localPoint)

Parameters

Return

Libraries.Compute.Vector2: The screen coordinates of the passed local point

GetWorldVector(Libraries.Compute.Vector2 localVector)

Given the local coordinates of a vector, this action computes the screen coordinates of the corresponding vector.

Parameters

Return

Libraries.Compute.Vector2: The coordinates of the corresponding global vector Attribute Example use Libraries.Interface.Item2D use Libraries.Compute.Vector2 Item2D item Vector2 localVector item:SetWidth(100) item:SetHeight(100) item:SetPosition(400, 250) localVector:Set(0, 0) // Get the coordinates of the center of the item Vector2 worldVector = item:GetWorldVector(localVector)

GetX()

This action returns the currently set X coordinate of the Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        number value = myItem:GetX()

Return

number:

GetY()

This action returns the currently set Y coordinate of the Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        number value = myItem:GetY()

Return

number:

GetZ()

This action returns the currently set Z value of this Item2D.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        number value = myItem:GetZ()

Return

number:

HasMoved()

Return

boolean

Hide()

This action is used to indicate that an Item and all Items that were added to it should not be visible on the screen. Note that the Item class on its own cannot be drawn on the screen, but classes that inherit from it such as Libraries.Game.Graphics.Drawable can be. By default, Items are considered visible.

Example Code

use Libraries.Interface.Item

        Item item
        item:Hide()

Initialize(integer width, integer height)

Parameters

IsAccessibleParent()

Return

boolean

IsClipping()

The IsClipping action returns true if pixel clipping is enabled, or false if it is disabled. If it is enabled, when the Item and its children are drawn as part of the QueueForDrawing action, any pixels that would be drawn outside of the unrotated dimensions of the Item are not rendered. In other words, the Item will only draw inside the exact rectangle formed by its x, y position and its width and height.

Return

boolean: Whether or not pixel clipping is enabled for this Item.

IsCollidable()

This action determines whether this item is collidable.

Example Code

use Libraries.Game.Graphics.Drawable
    
    Drawable circle
    circle:LoadFilledCircle(30)
    circle:SetCollidable(true)
    boolean result = circle:IsCollidable

Return

boolean: True if this item is collidable, false otherwise

IsCustomDrawing()

The IsCustomDrawing action returns whether or not this Item is directly managing how itself and its children are drawn. When this value is true, the Item is responsible for determining its rendering via the Draw(Painter2D) action -- if this action isn't overridden, the Item and its children won't be drawn. This is an advanced feature only necessary for complex custom components, and most users will not need to use this functionality.

Return

boolean: Whether or not this Item is currently using custom drawing rules.

IsEmpty()

This action returns whether or not any items are contained in this Item.

Example Code

use Libraries.Interface.Item2D

        Item2D parentItem
        Item2D child1
        parentItem:Add(child1)
        boolean wasEmpty = parentItem:IsEmpty()

Return

boolean:

IsFastMoving()

Return

boolean

IsFlippedX()

This action will return true if the Drawable has been flipped across the x-axis, or false if it has not.

Example Code

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:FlipX()
                    boolean flipX = line:IsFlippedX()
                end
            end

Return

boolean:

IsFlippedY()

This action will return true if the Drawable has been flipped across the y-axis, or false if it has not.

Example Code

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:FlipY()
                    boolean flipY = line:IsFlippedY()
                end
            end

Return

boolean:

IsFocusable()

This action returns whether or not the Item can currently receive focus. This property can be set with SetFocusable().

Return

boolean:

IsFocused()

The IsFocused action determines if this Item is currently focused, returning true if it is, or false if it is not.

Return

boolean:

IsLoaded()

This action returns true if there is a texture currently loaded into the Drawable, otherwise it returns false.

Example Code

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

        class Main is Game

            action Main
                StartGame()
            end

            action CreateGame
                Drawable drawable
                output "Drawable is loaded = " + drawable:IsLoaded()
                drawable:LoadFilledCircle(75)
                output "Drawable is now loaded = " + drawable:isLoaded()
            end

        end

Return

boolean:

IsNonResponsive()

Return

boolean

IsPhysicsEnabled()

This action determines whether physics is currently enabled for this item.

Example Code

use Libraries.Game.Graphics.Drawable

    Drawable circle
    circle:LoadFilledCircle(30)
    circle:EnablePhysics(true)
    boolean result = circle:IsPhysicsEnabled()

Return

boolean: True if physics is enabled for this item, false otherwise

IsResponsive()

Return

boolean

IsRotationAllowed()

Return

boolean

IsShowing()

This action returns whether the Item is currently set to be visible on the screen.

Example Code

use Libraries.Interface.Item

        Item item
        item:Hide()
        boolean visible = item:IsShowing()

Return

boolean: A boolean representing whether or not the Item is currently visible.

IsSimulated()

Return

boolean

IsSimulationRequired()

Return

boolean

IsUnmovable()

Return

boolean

Load(Libraries.Game.Graphics.TextureRegion region, integer sourceX, integer sourceY, integer sourceWidth, integer sourceHeight)

This action will load the given TextureRegion into this Drawable, loading from the given x,y coordinates of the texture to the given width and height.

Example Code

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

            class Main is Game

                Drawable circlePiece
                Texture circleTexture
                TextureRegion circleRegion

                action Main
                    StartGame()
                end

                action CreateGame
                    circleTexture:LoadFilledCircle(50)
                    circleRegion:LoadTextureRegion(circleTexture)
                    circlePiece:Load(circleRegion, circleTexture:GetWidth()/4, 0, circleTexture:GetWidth()/2, circleTexture:GetHeight())
                    circlePiece:SetPosition(250, 100)
                    Add(circlePiece)
                end
            end

Parameters

Load(Libraries.Game.Graphics.TextureRegion region)

This action will load the given TextureRegion into this Drawable, which will set its appearance when drawn on screen.

Example Code

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

            class Main is Game

                Drawable circle
                Texture circleTexture
                TextureRegion circleRegion

                action Main
                    StartGame()
                end

                action CreateGame
                    circleTexture:LoadFilledCircle(50)
                    circleRegion:LoadTextureRegion(circleTexture)
                    circle:Load(circleRegion)
                    circle:SetPosition(250, 100)
                    Add(circle)
                end
            end

Parameters

Load(text filePath)

This action will create a new texture from the image file located at the given file path. This texture will then be loaded into this Drawable. This sets the Drawable's appearance when it is drawn on the screen.

Example Code

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

            class Main is Game

                Drawable bunny

                action Main
                    StartGame()
                end

                action CreateGame
                    // Assuming that we have a file in our project named "Rabbit.png"
                    bunny:Load("Rabbit.png")
                    Add(bunny)
                end
            end

Parameters

Load(Libraries.Compute.Matrix matrix)

This action will load a matrix into a Texture to create a monochrome (black and white) image, then load the Texture into this Drawable. 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 Drawable and making it larger so that it's easier to see.
            drawable:Load(matrix)
            Add(drawable)

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

Parameters

Load(Libraries.Game.Graphics.Texture texture, integer sourceWidth, integer sourceHeight)

This action will load the given texture into this Drawable, loading from the lower left corner of the texture to the given width and height.

Example Code

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

            class Main is Game

                Drawable semicircle1
                Drawable semicircle2
                Texture circleTexture

                action Main
                    StartGame()
                end

                action CreateGame
                    circleTexture:LoadFilledCircle(50)
                    semicircle1:Load(circleTexture, circleTexture:GetWidth()/2, circleTexture:GetHeight())
                    semicircle2:Load(circleTexture, circleTexture:GetWidth(), circleTexture:GetHeight()/2)
                    semicircle1:SetPosition(50, 100)
                    semicircle2:SetPosition(250, 100)
                    Add(semicircle1)
                    Add(semicircle2)
                end
            end

Parameters

Load(Libraries.Game.Graphics.Texture newTexture, integer sourceX, integer sourceY, integer sourceWidth, integer sourceHeight)

This action will load the given texture into this Drawable, loading from the given x,y coordinates of the texture to the given width and height.

Example Code

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

            class Main is Game

                Drawable circlePiece
                Texture circleTexture

                action Main
                    StartGame()
                end

                action CreateGame
                    circleTexture:LoadFilledCircle(50)
                    circlePiece:Load(circleTexture, circleTexture:GetWidth()/4, 0, circleTexture:GetWidth()/2, circleTexture:GetHeight())
                    circlePiece:SetPosition(250, 100)
                    Add(circlePiece)
                end
            end

Parameters

Load(Libraries.System.File file)

This action will create a new texture from provided image file. This texture will then be loaded into this Drawable. This sets the Drawable's appearance when it is drawn on the screen.

Example Code

use Libraries.Game.Graphics.Drawable
            use Libraries.System.File
            use Libraries.Game.Game

            class Main is Game

                Drawable bunny
                File imageFile

                action Main
                    StartGame()
                end

                action CreateGame
                    // Assuming that we have a folder in our project called
                    // "Assets" containing a file named "hare.jpg"
                    imageFile:SetWorkingDirectory("Assets")
                    imageFile:SetPath("hare.jpg")
                    bunny:Load(imageFile)
                    Add(bunny)
                end
            end

Parameters

Load(Libraries.Game.Graphics.Texture texture)

This action will load the given texture into this Drawable. This sets the Drawable's appearance when it is drawn on the screen.

Example Code

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

            class Main is Game

                Drawable circle1
                Drawable circle2
                Texture circleTexture

                action Main
                    StartGame()
                end

                action CreateGame
                    circleTexture:LoadFilledCircle(50)
                    circle1:Load(circleTexture)
                    circle2:Load(circleTexture)
                    circle1:SetPosition(50, 100)
                    circle2:SetPosition(250, 100)
                    Add(circle1)
                    Add(circle2)
                end
            end

Parameters

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

This action will create a new Texture with a hollow circle of the given color with the given radius. This texture is then loaded into the Drawable.

Example Code

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 red
                    red:SetColor(1, 0, 0, 1)
                    Drawable circle
                    circle:LoadCircle(75, red)
                    circle:SetPosition(50, 50)
                    Add(circle)
                end
            end

Parameters

LoadCircle(integer radius)

This action will create a new Texture with a hollow black circle with the given radius. This texture is then loaded into the Drawable.

Example Code

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

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Drawable circle
                    circle:LoadCircle(75)
                    circle:SetPosition(50, 50)
                    Add(circle)
                end
            end

Parameters

LoadFilledCircle(integer radius)

This action will create a new Texture with a solid black circle with the given radius. This texture is then loaded into the Drawable.

Example Code

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

            class Main is Game
                
                action Main
                    StartGame()
                end

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

Parameters

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

This action will create a new Texture with a solid circle of the given color with the given radius. This texture is then loaded into the Drawable.

Example Code

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 blue
                    blue:SetColor(0, 0, 1, 1)
                    Drawable circle
                    circle:LoadFilledCircle(75, blue)
                    circle:SetPosition(50, 50)
                    Add(circle)
                end
            end

Parameters

LoadFilledRectangle(integer width, integer height)

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

Example Code

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

            class Main is Game
                
                action Main
                    StartGame()
                end

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

Parameters

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

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.

Example Code

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

Parameters

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

This action will create a new Texture with a solid black triangle that is made of the points identified by the three given points. The three points are relative to the origin of the Drawable. This texture is then loaded into the Drawable.

Example Code

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

            class Main is Game
                
                action Main
                    StartGame()
                end

                action CreateGame
                    Drawable triangle
                    triangle:LoadFilledTriangle(0, 0, 200, 200, 400, 0)
                    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.ColorGroup 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. The three points are relative to the origin of the Drawable. This texture is then loaded into the Drawable.

Example Code

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)
                    Drawable triangle
                    triangle:LoadFilledTriangle(0, 0, 200, 200, 400, 0, purple)
                    triangle:SetPosition(50, 50)
                    Add(triangle)
                end
            end

Parameters

LoadLine(integer x, integer y)

This action will create a new Texture with a black line that connects an imaginary point at 0,0 to the provided x,y coordinates. This texture is then loaded into the Drawable.

Example Code

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)
                    Add(line)
                end
            end

Parameters

LoadLine(integer x, integer y, Libraries.Game.Graphics.ColorGroup 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. This texture is then loaded into the Drawable.

Example Code

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)
                    Drawable line
                    line:LoadLine(20, 100, cyan)
                    line:SetPosition(50, 50)
                    Add(line)
                end
            end

Parameters

LoadRectangle(integer width, integer height)

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

Example Code

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

            class Main is Game
                
                action Main
                    StartGame()
                end

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

Parameters

LoadRectangle(integer width, integer height, Libraries.Game.Graphics.ColorGroup 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.Drawable
            use Libraries.Game.Graphics.Color
            use Libraries.Game.Game

            class Main is Game
                
                action Main
                    StartGame()
                end

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

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

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, 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

LostFocus(Libraries.Interface.Events.FocusEvent event)

This action is fired if the item lost the focus.

Parameters

LostSelection()

Move(number xAmount, number yAmount)

This action will increase the x and y coordinates of this Item by the given amounts.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetX(50)
        myItem:SetY(80)
        myItem:Move(25, -20)

Parameters

MoveX(number xAmount)

This action will increase the x-coordinate of this Item by the given amount.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetX(50)
        myItem:MoveX(25)

Parameters

MoveY(number yAmount)

This action will increase the y-coordinate of this Item by the given amount.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetY(50)
        myItem:MoveY(25)

Parameters

MoveZ(number zAmount)

This action will increase the z-coordinate of this Item by the given amount.

Example Code

use Libraries.Interface.Item@D

        Item2D myItem
        myItem:SetZ(5)
        myItem:MoveZ(2)

Parameters

PrepareVertices()

Checks to see if the Item2D's internal vertices are up to date, and updates them if they are not. This is used primarily internally to ensure that the item's vertices are properly aligned before use, e.g. to project an image on the screen at the coordinates of the vertices. Most users will never need to use this action directly.

ProcessMouseEvent(Libraries.Interface.Events.MouseEvent event)

This action takes a mouse event and handles it. It will first test to see if the mouse event took place within the bounds of this Item. If so, it will notify any MouseListeners of the event. If the event was not contained within this Item, or if there are no MouseListeners on this Item, the Item will ask its parent Item to process the mouse event, if there is a parent.

Example Code

use Libraries.Interface.Item2D
        use Libraries.Interface.Events.MouseEvent
        use Libraries.Interface.Events.MouseListener
        Item2D myItem
        MouseListener listener
        myItem:AddMouseListener(listener)
        MouseEvent event
        event:eventType = event:CLICKED_MOUSE
        myItem:ProcessMouseEvent(event)

Parameters

ProcessTouchEvent(Libraries.Interface.Events.TouchEvent event)

FIX ME: Needs comments

Parameters

QueueForDrawing(Libraries.Game.Graphics.Painter2D painter)

Parameters

ReleasedMouse()

Remove(integer index)

This action removes an Item that was previously added to this Item by finding it at the given index in the internal array of children Items.

Example Code

use Libraries.Interface.Item

        Item parentItem
        Item child1
        Item child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        parentItem:Remove(0)

Parameters

Return

Libraries.Interface.Item2D: The Item that was removed.

Remove(Libraries.Interface.Item2D removed)

This action removes an Item2D that was previously added to this Item2D.

Example Code

use Libraries.Interface.Item2D

        Item2D parentItem
        Item2D child1
        Item2D child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        parentItem:Remove(child1)

Parameters

Return

boolean: Whether or not the Item was found and removed.

RemoveFocusListener(Libraries.Interface.Events.FocusListener listener)

This action removes a FocusListener from the Item. The listener will no longer receive notification if the Item gets a FocusEvent.

Example Code

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

Parameters

RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)

This action removes a MouseListener from the Item. The listener will no longer receive notification if the Item gets a mouse click event.

Example Code

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

Parameters

RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)

This action removes a MouseMovementListener from the Item. The listener will no longer receive notification if the Item gets a mouse movement event.

Example Code

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

Parameters

RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)

This action removes a MouseWheelListener from the Item. The listener will no longer receive notification if the Item gets a mouse wheel event.

Example Code

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

Parameters

RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)

This action removes a TouchListener from the Item. The listener will no longer receive notification if the Item gets a TouchEvent.

Example Code

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

Parameters

RequireSimulation(boolean flag)

Parameters

ResetMass()

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.

Resize()

The Resize action is used to recalculate the size and position of Controls that are being controlled by a Layout. Calling Resize on an Item2D won't have a direct effect on it, but if the Item's children hierarchy contains any Controls, those Controls will be resized.

Rotate(number degrees)

Rotates this Item2D by the given number of degrees. This will also rotate all Items in the children hierarchy of this Item.

Example Code

use Libraries.Interface.Item

        Item myItem
        myItem:Rotate(65)

Parameters

Scale(number amount)

This action will multiply the current scaling value by the given number. A parameter of 0 or less will be ignored.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetScale(1.5)
        myItem:Scale(1.1)

Parameters

Scale(number xAmount, number yAmount)

This action will multiply the x scaling and y scaling values, respectively, by the given numbers. A parameter of 0 or less will be ignored.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetScale(1.5)
        myItem:Scale(1.1, 0.9)

Parameters

ScaleFromCenter(number amount)

This action will multiply the current scaling value by the given number. A parameter of 0 or less will be ignored. This action will increase or decrease the scale of the object from the center, and update the Item's x,y coordinates to reflect the new bottom-left corner of the Item.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetScale(1.5)
        myItem:ScaleFromCenter(1.1)

Parameters

ScaleFromCenter(number xAmount, number yAmount)

This action will multiply the current scaling values of the x and y planes by the given number. A parameter of 0 or less will be ignored. This action will increase or decrease the scale of the object from the center, and update the Item's x,y coordinates to reflect the new bottom-left corner of the Item.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetScale(1.5)
        myItem:ScaleFromCenter(1.1, 0.9)

Parameters

SetAccessibilityCode(integer newAccessibilityCode)

This action changes the accessibility code for this Item. This should be done with care because setting the accessiblity code to the incorrect type can cause accessibility to stop functioning or, in some cases, cause the program to crash.

Parameters

SetAlpha(number alpha)

Sets the alpha of the Drawable. The alpha represents how transparent the Drawable is. The given value should be between 0 and 1, where a value of 0 is totally transparent, and a value of 1 is totally opaque.

Example Code

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

            class Main is Game

                Drawable circle

                action Main
                    StartGame()
                end

                action CreateGame
                    circle:LoadFilledCircle(50)
                    circle:SetAlpha(0.5)
                    circle:SetPosition(50, 100)
                    Add(circle)
                end
            end

Parameters

SetAngularDamping(number angularDamping)

Code used to scale Items about their cente

Parameters

SetAngularVelocity(number angularVelocity)

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

Example Code

use Libraries.Interface.Item2D

    Item2D item
    item:SetWidth(100)
    item:SetHeight(100)
    item:EnablePhysics(true)
    item:SetAngularVelocity(0.1)

Parameters

SetBottomSide(number bottom)

This action selects a point on the loaded texture that this Drawable will consider to be the bottom edge of the image to be drawn. 0 represents the bottom edge of the base texture, and 1 represents the top edge of the base texture.

Parameters

SetBoundingBox(number newX, number newY, number newWidth, number newHeight)

This action will set the x coordinate, y coordinate, width, and height of the Item2D, respectively.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetBoundingBox(50, 200, 100, 75)

Parameters

SetCenter(number setX, number setY)

This action will set the X and Y coordinates of the Item so that the center of the Item is located at the given X, Y coordinates.

Example Code

use Libraries.Interface.Item
        Item myItem
        myItem:SetCenter(70, 40)

Parameters

SetCenterX(number setX)

This action will set the X coordinate of the Item so that the center of the Item is aligned with the given X coordinate value.

Example Code

use Libraries.Interface.Item
        Item myItem
        myItem:SetCenterX(70)

Parameters

SetCenterY(number setY)

This action will set the Y coordinate of the Item so that the center of the Item is aligned with the given Y coordinate value.

Example Code

use Libraries.Interface.Item
        Item myItem
        myItem:SetCenterY(65)

Parameters

SetClipCoordinates(Libraries.Game.Graphics.Painter2D painter)

This action sets the clipping coordinates of the given painter to respect the coordinates of this Item (if it's clipping) as well as any clipping being performed by parent Items. This action is called automatically by the Game engine as necessary, and most users will never need to use this action directly.

Parameters

SetClipping(boolean clip)

The SetClipping action is used to enable or disable clipping. If it is enabled, when the Item and its children are drawn as part of the QueueForDrawing action, any pixels that would be drawn outside of the unrotated dimensions of the Item are not rendered. In other words, the Item will only draw inside the exact rectangle formed by its x, y position and its width and height.

Parameters

SetCollidable(boolean flag)

This action sets this item to be collidable. Passing true turns on collision for this item while passing false turns off collision for this item.

Example Code

use Libraries.Game.Graphics.Drawable
    
    Drawable circle
    circle:LoadFilledCircle(30)
    circle:SetCollidable(true)

Parameters

SetCollideWithChildren(boolean flag)

Parameters

SetCollisionGroupFlag(boolean flag)

Parameters

SetCollisionGroupIndex(integer index)

Parameters

SetCollisionList(Libraries.Game.Collision.CollisionEdge2D edge)

This is an action used internally by the physics system to keep track of the collisions with this item in a linked list structure. This action sets the head of the linked list of collisions to the passed CollisionEdge2D object. This action is used internally and users should not need to use this action.

Parameters

SetColor(Libraries.Game.Graphics.ColorGroup tint)

Sets the color filter on this Drawable. This will reduce the intensity of colors in the Drawable that are not part of the filter, while leaving the other colors that are part of the filter as the same.

Example Code

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

            class Main is Game

                Drawable circle
                Color red
                Color yellow

                action Main
                    StartGame()
                end

                action CreateGame
                    red:SetColor(1, 0, 0, 1)
                    yellow:SetColor(1, 1, 0, 1)
                    circle:LoadFilledCircle(50, yellow)
                    circle:SetColor(red)
                    circle:SetPosition(50, 100)
                    Add(circle)
                end
            end

Parameters

SetColor(number red, number green, number blue, number alpha)

Sets the color filter of the Drawable from the given components of red, green, blue, and alpha. The values for the components should be between 0 and 1, representing 0% to 100% of that color or alpha.

Example Code

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

            class Main is Game

                Drawable circle
                Color white

                action Main
                    StartGame()
                end

                action CreateGame
                    white:SetColor(1, 1, 1, 1)
                    circle:LoadFilledCircle(50, white)
                    circle:SetColor(0.5, 1, 0.25, 1)
                    circle:SetPosition(50, 100)
                    Add(circle)
                end
            end

Parameters

SetCustomDrawing(boolean isCustom)

The SetCustomDrawing action is used to indicate that this Item wants to directly manage how itself and its children are drawn. When this is set to true, the Item must be responsible for determining this rendering via the Draw(Painter2D) action -- if this action isn't overridden, the Item and its children won't be drawn. This is an advanced feature only necessary for complex custom components, and most users will not need to use this functionality.

Parameters

SetDensity(number density)

Parameters

SetDescription(text newDescription)

This action sets the internal description of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetDescription("Used for demo purposes.")

Parameters

SetFlipX(boolean flip)

This action will set the Item2D to be flipped across the X-axis according to the boolean. If the boolean value is false, the Item2D will be set to its unflipped state. If it is true, the Item will be set to its flipped state.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetFlipX(true)

Parameters

SetFlipY(boolean flip)

This action will set the Item2D to be flipped across the Y-axis according to the boolean. If the boolean value is false, the Item2D will be set to its unflipped state. If it is true, the Item will be set to its flipped state.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetFlipY(true)

Parameters

SetFocusable(boolean focus)

The SetFocusable action sets whether or not this Item should be focusable. If the Item is currently focused and made unfocusable, then it will lose focus, and there will be no focused element.

Parameters

SetForce(Libraries.Compute.Vector2 force)

This action sets the total force on this item. The units are kilogram units per second per second. This action should be used to set the total force on this item. If we want to apply a force to this item, we should use the ApplyForce actions instead. Physics must be enabled on this item before using this action.

Example Code

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)

Parameters

SetFriction(number friction)

Parameters

SetHasMoved(boolean flag)

Parameters

SetHeight(number newHeight)

This action will set the height of the Item2D.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetHeight(70)

Parameters

SetInputGroup(text group)

This action sets the input group for this Item. When used with the Game libraries, this tag describes what InputTable (if any) can interact with this Item due to input.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetInputGroup("arrowKeys")
        output "My item's input group is : " + item:GetInputGroup()

Parameters

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

This action sets a value inside the internal item array of this Item2D.

Example Code

use Libraries.Interface.Item2D

        Item2D parentItem
        Item2D child1
        Item2D child2
        parentItem:Add(child1)
        parentItem:SetItem(0, child2)

Parameters

SetItem(Libraries.Interface.Item2D item)

Parameters

SetJointList(Libraries.Game.Physics.Joints.JointEdge2D edge)

This is an action used internally by the physics system to keep track of the joints connected to this item in a linked list structure. This action sets the head of the linked list of collisions to the passed CollisionEdge2D object. This action is used internally and users should not need to use this action.

Parameters

SetLayer(Libraries.Game.Layer2D parentLayer)

This action is used by the Game libraries to create a reference to the layer that this Item2D exists on. It is automatically called as needed by the Layer2Dclass. Most users will never need to use this action directly.

Parameters

SetLeftSide(number left)

This action selects a point on the loaded texture that this Drawable will consider to be the left edge of the image to be drawn. 0 represents the left edge of the base texture, and 1 represents the right edge of the base texture.

Parameters

SetLinearDamping(number linearDamping)

Code used to scale Items about their cente

Parameters

SetLinearVelocity(Libraries.Compute.Vector2 linearVelocity)

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

Example Code

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)

Parameters

SetLinearVelocityX(number linearVelocityX)

This action sets the x-component of this item's linear velocity in units per second. Physics must be enabled on this item before using this action.

Example Code

use Libraries.Interface.Item2D

    Item2D item

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

Parameters

SetLinearVelocityY(number linearVelocityY)

This action sets the y-component of this item's linear velocity in units per second. Physics must be enabled on this item before using this action.

Example Code

use Libraries.Interface.Item2D

    Item2D item

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

Parameters

SetMass(number mass)

Parameters

SetMass(Libraries.Game.Physics.Mass2D mass)

Parameters

SetName(text newName)

This action sets the internal name of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetName("My Item")

Parameters

SetNextFocus(Libraries.Interface.Item next)

This action sets the next focus item. When this Item has the focus and the user requests the focus to advance (e.g. by pressing the tab key), the focus will move to the next focus item, if it is defined.

Parameters

SetNonResponsive()

SetOffset(number xAmount, number yAmount)

This action will set both the X and Y offsets of the item, respectively.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffset(100, 75)

Parameters

SetOffset(number xAmount, number yAmount, number zAmount)

This action will set X, Y, and Z offsets of the item, respectively.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffset(100, 75, 2)

Parameters

SetOffsetX(number xAmount)

This action sets the X offset of the Item. The offset tells the Item where to relate its X position to. In other words, the X offset is where an X coordinate of 0 is for this Item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffsetX(100)

Parameters

SetOffsetY(number yAmount)

This action sets the Y offset of the item. The offset tells the Item where to relate its Y position to. In other words, the Y offset is where a Y coordinate of 0 is for this item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffsetY(75)

Parameters

SetOffsetZ(number zAmount)

This action sets the Z offset of the item. The offset tells the Item where to relate its Z position to. In other words, the Z offset is where a Z coordinate of 0 is for this item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetOffsetZ(75)

Parameters

SetOrigin(number setX, number setY)

This action will set the origin of the Item to be at the given location in the Item. This is used when projecting the Item's vertices onto the screen, i.e. when determining where to draw a picture on the screen.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetOrigin(20, 20)

Parameters

SetOriginCenter()

This action will set the origin of the Item to be at the current center of the Item's width and height bounds.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetSize(50, 80)
        myItem:SetOriginCenter()

SetParent(Libraries.Interface.Item2D newItem)

This action sets a reference to the parent item. It is called automatically when an Item2D is added as a child to another Item2D. Most users will not need to use this action directly.

Parameters

SetPhysicsProperties(Libraries.Game.Physics.PhysicsProperties2D properties)

Parameters

SetPosition(number setX, number setY)

This action will set both the X coordinate and the Y coordinate of the Item, in that order.

Example Code

use Libraries.Interface.Item
        Item myItem
        myItem:SetPosition(30, 70)

Parameters

SetPosition(number setX, number setY, number setZ)

This action will set both the X and Y coordinates of this Item2D, and will additionally set the Z value of this Item2D.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetPosition(30, 70, 3)

Parameters

SetPreviousFocus(Libraries.Interface.Item previous)

This action sets the previous focus item. When this Item has the focus and the user requests the focus to move backwards (e.g. by pressing shift & tab), the focus will move to the previous focus item, if it is defined.

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(Libraries.Game.Graphics.TextureRegion region)

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

Parameters

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

This action selects the portion of the loaded texture to use when drawing. The four parameters represent the left, top, right, and bottom sides of the texture, respectively. For the left and right parameters, 0 represents the left of the base texture, and 1 represents the right of the base texture. For the top and bottom parameters, 0 represents the bottom, and 1 represents the 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

SetResponsive()

SetResponsiveness(integer type)

Code used to scale about the cente

Parameters

SetRestitution(number restitution)

Parameters

SetRightSide(number right)

This action selects a point on the loaded texture that this Drawable will consider to be the right edge of the image to be drawn. 0 represents the left edge of the base texture, and 1 represents the right edge of the base texture.

Parameters

SetRotation(number degrees)

Sets this Item2D to be rotated to an angle of the given number of degrees. This will also rotate all Items in the children hierarchy of this Item.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetRotation(90)

Parameters

SetScale(number newX, number newY)

This action sets separate scaling values for the x and y planes on this Item2D. This will cause the vertices of this Item to be calculated based on a scaled percentage of the width and height. The default scaling values are 1.0, or 100% of the Item's width and height.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetScale(1.5, 0.75)

Parameters

SetScale(number scale)

This action sets the scale of this Item2D, causing the vertices of the item to be calculated based on a scaled percentage of the width and height. The default scaling values are 1.0, or 100% of the Item's width and height.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetScale(1.25)

Parameters

SetScaleFromCenter(number scale)

This action sets the scale of this Item2D, causing the vertices of the item to be calculated based on a scaled percentage of the width and height. The default scaling values are 1.0, or 100% of the Item's width and height. This action will increase or decrease the scale of the object from the center, and update the Item's x,y coordinates to reflect the new bottom-left corner of the Item.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetScaleFromCenter(1.25)

Parameters

SetScaleFromCenter(number newX, number newY)

This action sets separate scaling values for the x and y planes on this Item2D. This will cause the vertices of this Item to be calculated based on a scaled percentage of the width and height. The default scaling values are 1.0, or 100% of the Item's width and height. This action will increase or decrease the scale of the object from the center, and update the Item's x,y coordinates to reflect the new bottom-left corner of the Item.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetScaleFromCenter(1.5, 0.75)

Parameters

SetScaleX(number scaleX)

This action sets the scaling value of the x plane on this Item2D. This will cause the vertices of this Item to be calculated based on a scaled percentage of the width. The default scaling values are 1.0, or 100% of the Item's width and height.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetScaleX(1.5)

Parameters

SetScaleY(number scaleY)

This action sets the scaling value of the y plane on this Item2D. This will cause the vertices of this Item to be calculated based on a scaled percentage of the height. The default scaling values are 1.0, or 100% of the Item's width and height.

Example Code

use Libraries.Interface.Item2D
        
        Item2D myItem
        myItem:SetSize(100, 200)
        myItem:SetScaleY(0.75)

Parameters

SetScreenPositionFromPhysicsPosition()

SetShape(Libraries.Game.Collision.Shapes.CollisionShape2D shape)

This action sets the collision shape of this item. The collision shape is the shape the collision system will use to test for collisions with this item. Note that this may be different from the shape drawn on the screen. A copy of the passed shape is used for the collison shape for this item.

Example Code

use Libraries.Game.Drawable
    use Libraries.Game.Collision.Shapes.Circle

    Drawable ball
    ball:Load("ball.png")
    Circle circle
    circle:SetRadius(30)
    ball:SetShape(circle)

Parameters

SetSize(number newWidth, number newHeight)

This action will set the width and height of the Item2D, respectively.

Example Code

use Libraries.Interface.Item2D

        Item2D myItem
        myItem:SetSize(100, 50)

Parameters

SetSleepTime(number time)

Parameters

SetText(text value)

Parameters

SetTexture(Libraries.Game.Graphics.Texture newTexture)

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

Parameters

SetToggleState(boolean openState)

Parameters

SetTopSide(number top)

This action selects a point on the loaded texture that this Drawable will consider to be the top edge of the image to be drawn. 0 represents the bottom edge of the base texture, and 1 represents the top edge of the base texture.

Parameters

SetTorque(number torque)

This action sets the total torque on this item. The units are kilogram units squared per second per second. This action should be used to set the total torque on this item. If we want to apply a torque to this item, we should use the ApplyTorque actions instead. Physics must be enabled on this action before using this action.

Example Code

use Libraries.Interface.Item2D

    Item2D item

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

Parameters

SetTransform(Libraries.Compute.Vector2 position, number angle)

This action is used internally by the physics system to set the position of this item in the physics world. This action is used internally and users users should not need to use this action.

Parameters

SetTransform(Libraries.Game.Collision.PhysicsPosition2D transform)

This action sets the position of the item in physical space. This action is used internally and should not be used by users to set the position of this item on the screen.

Parameters

SetTransform0(Libraries.Game.Collision.PhysicsPosition2D transform)

This action sets the position of the item in physics space from the previous frame. This action is used internally and users should not need to use this action.

Parameters

SetUnmovable()

SetUpdateTransform(boolean flag)

Parameters

SetVertex(integer index, number value)

This action sets a value of one of the internal vertices of this Item2D. This action is primarily for internal use, and most users will never need to use this action directly.

Parameters

SetView2D(Libraries.Interface.Views.View2D content)

Parameters

SetWidth(number newWidth)

This action will set the width of the Item2D.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetWidth(50)

Parameters

SetX(number setX)

This action sets the X coordinate of the Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetX(35.0)

Parameters

SetY(number setY)

This action sets the Y coordinate of the Item.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetY(210.0)

Parameters

SetZ(number setZ)

This action sets the Z value of the Item2D. For Item2D, the z value is used during layer sorting to determine ordering, where lower z values will be placed first.

Example Code

use Libraries.Interface.Item2D
        Item2D myItem
        myItem:SetZ(3)

Parameters

ShouldCollide(Libraries.Interface.Item2D otherItem)

get the old target global center of the obje

Parameters

Return

boolean:

Show()

This action is used to indicate that an Item and all Items that were added to it should be visible on the screen. Note that the Item class on its own cannot be drawn on the screen, but classes that inherit from it such as Libraries.Game.Graphics.Drawable can be. By default, Items are considered visible.

Example Code

use Libraries.Interface.Item

        Item item
        item:Show()

Simulate(boolean flag)

Parameters

SynchronizeNodes()

This action is used to syncronize the item's position in physics space with its position in the tree used for broadphase collision. This action is used internally and users should not need to use this action.

SynchronizeTransform()

This action is used to update this items position in physics space after physics solving is finished for this item. This action is used internally and users should not need to use this action.

TestPoint(Libraries.Compute.Vector2 point)

This item is used to test whether a passed point is on the collision shape of this item.

Example Code

use Libraries.Interface.Drawable
    use Libraries.Compute.Vector2

    Drawable circle
    circle:LoadFilledCircle(30)
    circle:SetPosition(350, 400)
    Vector2 point
    point:Set(365, 410)
    boolean result = circle:TestPoint(point)

Parameters

Return

boolean: True if the passed point is on the collisoin shape, false otherwise

Update(number secondsSinceUpdate)

This action updates the item. It takes a number parameter that should indicate how many seconds have passed since the last time this action was called. This action does nothing in the Item class, but any class that inherits from Item may override it.

Example Code

use Libraries.Interface.Item
        use Libraries.System.DateTime
        
        class Main is Item

            action Main
                // We'll use a DateTime object to count seconds.
                DateTime time
                number currentTime = time:GetEpochTime()
                number newTime = 0

                repeat while GetX() < 300
                    // Check what the time is now.
                    newTime = time:GetEpochTime()

                    // Calculate how many seconds have passed, then call Update.
                    Update( (newTime - currentTime)/1000 )

                    // Store the old time.
                    currentTime = newTime
                end
            end

            // Our update action will move our Item to the right at 200 units a second.
            action Update(number secondsSinceUpdate)
                SetX(GetX() + 200 * secondsSinceUpdate)
            end
        end

Parameters

UpdateAll(number secondsSinceUpdate)

This action calls the Update action on this Item and all Items that have been added to this item with the Add action.

Example Code

use Libraries.Interface.Item
        
        Item parentItem
        Item child1
        Item child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        parentItem:UpdateAll(0)

Parameters

UpdateFlipping(boolean flipX, boolean flipY)

Parameters

UpdatePosition(number x, number y, number z)

Parameters

UpdateRotation(number angle)

Parameters

UpdateSize(number width, number height)

Parameters

UpdateTransformAngle()

UpdateTransformX()

UpdateTransformY()

UseDefaultColor()

This action removes the color filter from a Drawable.

Example Code

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)

                Drawable drawable
                drawable:LoadFilledCircle(100, cyan)
                drawable:SetColor(0, 1, 0, 1)
                output "Drawable has custom color filter = " + drawable:UsingCustomColor()
                
                drawable:UseDefaultColor()
                output "Drawable now has custom color filter = " + drawable:UsingCustomColor()
            end

        end

UsingCustomColor()

This action returns whether or not the Drawable has a custom Color filter. This will return false if a different type of filter, such as a Gradient, is in use. To check for a filter regardless of type, use the UsingCustomTint action.

Example Code

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)

                Drawable drawable
                drawable:LoadFilledCircle(100, cyan)
                output "Drawable has custom color filter = " + drawable:UsingCustomColor()
                
                drawable:SetColor(0, 1, 0, 1)
                output "Drawable now has custom color filter = " + drawable:UsingCustomColor()
            end

        end

Return

boolean:

UsingCustomGradient()

This action returns whether or not the Drawable is using a gradient. This will return false if a different type of filter, such as a Gradient, is in use. To check for a filter regardless of type, use the UsingCustomTint action.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Gradient
        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)

                Drawable drawable
                drawable:LoadFilledCircle(100, cyan)
                output "Drawable has custom color gradient? " + drawable:UsingCustomGradient()
                
                Gradient gradient
                Color color
                gradient:Set(color:Red(), color:Green(), color:Blue(), color:White())
                drawable:SetGradient(gradient)
                output "Drawable now has custom color gradient? " + drawable:UsingCustomGradient()
            end
        end

Return

boolean:

UsingCustomTint()

This action returns whether or not the Drawable is being tinted by a ColorGroup, such as a Color or Gradient.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Gradient
        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)

                Drawable drawable
                drawable:LoadFilledCircle(100, cyan)
                // This will return true - the circle is using a cyan tint.
                output "Is the Drawable tinted with a color? " + drawable:UsingCustomTint()
                
                Gradient gradient
                Color color
                gradient:Set(color:Red(), color:Green(), color:Blue(), color:White())
                drawable:SetGradient(gradient)
                // This will return true because the circle is tinted with a gradient.
                output "After using a gradient, is the Drawable tinted? " + drawable:UsingCustomTint()

                drawable:UseDefaultColor()
                // This should return false. The Drawable is no longer using a tint.
                output "After resetting the color, is the Drawable still tinted? " + drawable:UsingCustomTint()
            end
        end

Return

boolean: