Returns a TextureRegion representing the frame of animation for the given state time. StateTime: The amount of seconds an object has spent in the state this Animation instance represents, e.g. running, jumping and so on using the mode specified by PlayMode.
Returns a TextureRegion representing the frame of animation for the given state time. StateTime: The amount of seconds an object has spent in the state this Animation instance represents, e.g. running, jumping and so on. Looping: Whether the animation is looping or not.
Constructs an animation. An Animation stores a list of TextureRegions representing an animated sequence, e.g. for running or jumping. Each region of an Animation is called a key frame; multiple key frames make up the animation. FrameDuration: The time between frames in seconds. KeyFrames: The TextureRegions representing the frames.
Constructs an animation. An Animation stores a list of TextureRegions representing an animated sequence, e.g. for running or jumping. Each region of an Animation is called a key frame; multiple key frames make up the animation. FrameDuration: The time between frames in seconds. KeyFrames: The TextureRegions representing the frames. PlayMode: One of the PLAYMODE constants.
Increases the size of the backing array to accommodate the specified number of additional items. Useful before adding many items to avoid multiple backing array resizes. Returns items.
Get (IndexAsInt) AsObject
IndexOf (ValueAsObject, IdentityAsBoolean) AsInt
Returns an index of first occurrence of the given value in the array or -1 if no such value exists. Identity: If True, the comparison uses =. If False, the comparison uses the Equals function.
Initialize
Creates an ordered array with a capacity of 16.
Initialize2 (CapacityAsInt)
Creates an ordered array with the specified capacity.
Initialize3 (OrderedAsBoolean, CapacityAsInt)
Creates an array. Ordered: If False, functions that remove elements may change the order of other elements in the array, which avoids a memory copy. Capacity: Any elements added beyond this will cause the backing array to be grown.
InitializeWithArray (Array() AsObject)
Creates a new ordered array containing the elements in the specified array. The capacity is set to the number of elements, so any subsequent elements added will cause the backing array to be grown.
InitializeWithList (ListAsList)
Creates a new ordered array containing the items in the specified list. The capacity is set to the number of items.
Returns an index of last occurrence of the given value in the array or -1 if no such value exists. Search is started from the end of the array. Identity: If True, the comparison uses =. If False, the comparison uses the Equals function.
PeekAsObject
Returns the last item.
PopAsObject
Removes and returns the last item.
RemoveIndex (IndexAsInt) AsObject
Removes and returns the item at the specified index.
Removes the given value from the array if it exists. Identity: If True, the comparison uses =. If False, the comparison uses the Equals function. Returns True if the value was found and removed, False otherwise.
Reverse
Set (IndexAsInt, ValueAsObject)
Shrink
Reduces the size of the backing array to the size of the actual items. This is useful to release memory when many items have been removed, or if it is known that more items will not be added.
Shuffle
SizeAsInt
Sort
Sorts this array. The array elements must be able to be compared. This function is not thread safe.
Swap (FirstAsInt, SecondAsInt)
toArrayAsObject()
Returns the items as an array of objects.
toListAsList
Returns the items as a list.
toList2 (LAsList)
Returns the items in the given list.
Truncate (NewSizeAsInt)
Reduces the size of the array to the specified size. If the array is already smaller than the specified size, no action is taken.
Returns whether the asset with the given name and type is loaded.
Load (FileNameAsString, TypeAsClass)
Adds the given asset to the loading queue of the AssetManager.
LoadedAssetNamesAsList [read only]
Returns the file names of all loaded assets, or null.
LoadedAssetsAsInt [read only]
Returns the number of loaded assets.
MAPLOADER_AtlasTMXAsInt
MAPLOADER_tIDEAsInt
MAPLOADER_TMXAsInt
ProgressAsFloat [read only]
Returns the progress in percent of completion.
QueuedAssetsAsInt [read only]
Returns the number of currently queued assets.
TiledMapLoaderAsInt [write only]
Sets the appropriate loader for the tiled map's file type. This property must be set before calling Load.
TYPE_BitmapFontAsClass
TYPE_MusicAsClass
TYPE_ParticleEffectAsClass
TYPE_PixmapAsClass
TYPE_SoundAsClass
TYPE_TextureAsClass
TYPE_TextureAtlasAsClass
TYPE_TiledMapAsClass
Unload (FileNameAsString)
Removes the asset and all its dependencies if they are not used by other assets.
UpdateAsBoolean
Updates the AssetManager, keeping it loading any assets in the preload queue. Returns False when the loading is finished. Example: SublGdx_Render IfAssetMgr.UpdateThen 'Loading in progress ... Return EndIf 'Loading is finished ...
Update2 (MillisAsInt) AsBoolean
Updates the AssetManager continuously for the specified number of milliseconds, yielding the CPU to the loading thread between updates. This may block for less time if all loading tasks are complete. This may block for more time if the portion of a single task that happens in the GL thread takes a long time. Returns False when the loading is finished.
Creates a new AudioDevice either in mono or stereo mode. The AudioDevice has to be disposed via its Dispose method when it is no longer used. SamplingRate: The sampling rate in Hz (e.g. 44100).
Creates a new AudioRecorder either in mono or stereo mode. The AudioRecorder has to be disposed after it is no longer used. SamplingRate: The sampling rate in Hz (e.g. 44100).
Creates a new Music instance which is used to play back a music stream from a file. Currently supported formats are WAV, MP3 and OGG. The Music instance has to be disposed if it is no longer used via the Dispose method. Music instances are automatically paused and resumed when an Application is paused or resumed. Internal: Internal file path. evtPrefix: Prefix of the Completed event.
NewSound (InternalAsString) AslgSound
Creates a new Sound which is used to play back audio effects such as gun shots or explosions. The Sound's audio data is retrieved from the file specified. Note that the complete audio data is loaded into RAM. The current upper limit for decoded audio is 1 MB. Currently supported formats are WAV, MP3 and OGG. The Sound has to be disposed if it is no longer used via the Dispose method. Internal: Internal file path.
Implementation of the {@link AudioDevice} interface for Android using the AudioTrack class. You will need to set the permission android.permission.RECORD_AUDIO in your manifest file.
Returns the ascent, which is the distance from the cap height to the top of the tallest glyph.
CapHeightAsFloat [read only]
Returns the cap height, which is the distance from the top of most uppercase characters to the baseline. Since the drawing position is the cap height of the first line, the cap height can be used to get the location of the baseline.
Returns the number of glyphs from the substring that can be rendered in the specified width. Start: The first character of the string. End: The last character of the string (exclusive).
ContainsCharacter (CharacterAsChar) AsBoolean
Returns true if the character is contained in this font.
DescentAsFloat [read only]
Returns the descent, which is the distance from the bottom of the glyph that extends the lowest to the baseline. This number is negative.
dispose
Disposes the texture used by this BitmapFont's region if this BitmapFont created the texture.
Draws a string, which may contain newlines (CRLF), at the specified position with the specified color. The color is changed for the following drawing operations.
Draws a string, which may contain newlines (CRLF), at the specified position. AlignmentWidth: The width to consider for alignment. Alignment: One of the ALIGNMENT constants.
Draws a string, which may contain newlines (CRLF), at the specified position with the specified color. Each line is automatically wrapped within the specified width and the color is changed for the following drawing operations.
Draws a string, which may contain newlines (CRLF), at the specified position. Each line is automatically wrapped within the specified width. Alignment: One of the ALIGNMENT constants.
Makes the specified glyphs fixed width. This can be useful to make the numbers in a font fixed width. Eg, when horizontally centering a score or loading percentage text, it will not jump around as different numbers are shown.
Returns the bounds of the specified text, which may contain newlines and is wrapped within the specified width. Note the returned TextBounds instance is reused.
Initialize
Creates a BitmapFont using the default 15pt Arial font included in the library. This is convenient to easily display text without bothering with generating a bitmap font.
Initialize2 (FontFileAslgFileHandle)
Creates a BitmapFont from a BMFont file. The image file name is read from the BMFont file and the image is loaded from the same directory.
Creates a BitmapFont with the glyphs relative to the specified region. If the region is null, the glyph textures are loaded from the image file given in the font file. The Dispose method will not dispose the region's texture in this case! Region: The texture region containing the glyphs. The glyphs must be relative to the lower left corner (ie, the region should not be flipped). If the region is null the glyph images are loaded from the image path in the font file.
Creates a BitmapFont with the glyphs relative to the specified region. If the region is null, the glyph textures are loaded from the image file given in the font file. The Dispose method will not dispose the region's texture in this case! Region: The texture region containing the glyphs. The glyphs must be relative to the lower left corner (ie, the region should not be flipped). If the region is null the glyph images are loaded from the image path in the font file. Flip: If true, the glyphs will be flipped for use with a perspective where 0,0 is the upper left corner.
Adds glyphs for the specified text, which may contain newlines (CRLF). X: The X position for the left most character. Y: The Y position for the top of most capital letters in the font (the cap height). Alignment: The horizontal alignment. One of the ALIGNMENT constants.
Adds glyphs for the specified text. X: The X position for the left most character. Y: The Y position for the top of most capital letters in the font (the cap height). Start: The first character of the string to draw. End: The last character of the string to draw (exclusive).
Adds glyphs for the specified text, which may contain newlines (CRLF) and is automatically wrapped within the specified width. X: The X position for the left most character. Y: The Y position for the top of most capital letters in the font (the cap height). Alignment: The horizontal alignment for the wrapped line. One of the ALIGNMENT constants.
Returns the size of the cached string. The height is the distance from the top of most capital letters in the font (the cap height) to the baseline of the last line of text.
Initialize (FontAslgBitmapFont)
Creates a new BitmapFontCache. It caches glyph geometry for a BitmapFont, providing a fast way to render static text. This saves needing to compute the location of each glyph each frame.
Clears any cached glyphs and adds glyphs for the specified text, which may contain newlines (CRLF). X: The X position for the left most character. Y: The Y position for the top of most capital letters in the font (the cap height). Alignment: The horizontal alignment. One of the ALIGNMENT constants.
SetPosition (XAsFloat, YAsFloat)
Sets the position of the text, relative to the position when the cached text was created.
Clears any cached glyphs and adds glyphs for the specified text. X: The X position for the left most character. Y: The Y position for the top of most capital letters in the font (the cap height). Start: The first character of the string to draw. End: The last character of the string to draw (exclusive).
Clears any cached glyphs and adds glyphs for the specified text, which may contain newlines (CRLF) and is automatically wrapped within the specified width.
Clears any cached glyphs and adds glyphs for the specified text, which may contain newlines (CRLF) and is automatically wrapped within the specified width. X: The X position for the left most character. Y: The Y position for the top of most capital letters in the font (the cap height). Alignment: The horizontal alignment for the wrapped line. One of the ALIGNMENT constants.
Translate (X_amountAsFloat, Y_amountAsFloat)
Sets the position of the text, relative to its current position.
UseIntegerPositionsAsBoolean
Gets or sets whether this font uses integer positions for drawing. Default is to use them so filtering doesn't kick in as badly.
Vertices() AsFloat [read only]
XAsFloat [read only]
Returns the X position of the cached string, relative to the position when the string was cached.
YAsFloat [read only]
Returns the Y position of the cached string, relative to the position when the string was cached.
Set the active state of the body. An inactive body is not simulated and cannot be collided with or woken up. If you pass a flag of true, all fixtures will be added to the broad-phase. If you pass a flag of false, all fixtures will be removed from the broad-phase and all contacts will be destroyed. Fixtures and joints are otherwise unaffected. You may continue to create/destroy fixtures and joints on inactive bodies. Fixtures on an inactive body are implicitly inactive and will not participate in collisions, ray-casts, or queries. Joints connected to an inactive body are implicitly inactive. An inactive body is still owned by a b2World object and remains in the body list.
Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body. force: the world force vector, usually in Newtons (N). point: the world position of the point of application. wake: up the body
Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body. forceX: the world force vector on x, usually in Newtons (N). forceY: the world force vector on y, usually in Newtons (N). pointX: the world position of the point of application on x. pointY: the world position of the point of application on y. wake: up the body
Apply a force to the center of mass. This wakes up the body. forceX: the world force vector, usually in Newtons (N). forceY: the world force vector, usually in Newtons (N).
Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body. impulse: the world impulse vector, usually in N-seconds or kg-m/s. point: the world position of the point of application. wake: up the body
Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body. impulseX: the world impulse vector on the x-axis, usually in N-seconds or kg-m/s. impulseY: the world impulse vector on the y-axis, usually in N-seconds or kg-m/s. pointX: the world position of the point of application on the x-axis. pointY: the world position of the point of application on the y-axis. wake: up the body
applyTorque (torqueAsFloat, wakeAsBoolean)
Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body. torque: about the z-axis (out of the screen), usually in N-m. wake: up the body
AwakeAsBoolean [write only]
Set the sleep state of the body. A sleeping body has very low CPU cost.
BulletAsBoolean [write only]
Should this body be treated like a bullet for continuous collision detection?
Creates a fixture and attach it to this body. Use this function if you need to set some fixture parameters, like friction. Otherwise you can create the fixture directly from a shape. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step. def: the fixture definition.
Creates a fixture from a shape and attach it to this body. This is a convenience function. Use b2FixtureDef if you need to set parameters like friction, restitution, user data, or filtering. If the density is non-zero, this function automatically updates the mass of the body. shape: the shape to be cloned. density: the shape density (set to zero for static bodies).
destroyFixture (fixtureAslgBox2DFixture)
Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly destroyed when the body is destroyed. fixture: the fixture to be removed.
FixedRotationAsBoolean [write only]
Set this body to have fixed rotation. This causes the mass to be reset.
GetFixtureList (FixturesAslgArray)
Fills the given array with all fixtures attached to this body. Do not modify this list!
GetJointList (JointsAslgArray)
Fills the given array with all joints attached to this body. Do not modify this list!
Get the world linear velocity of a world point attached to this body. worldPoint: a point in world coordinates. Return type: @return:the world velocity of a point.
Gets a local point relative to the body's origin given a world point. worldPoint: a point in world coordinates. Return type: @return:the corresponding local point relative to the body's origin.
Get the world coordinates of a point given the local coordinates. localPoint: a point on the body measured relative the the body's origin. Return type: @return:the same point expressed in world coordinates.
Get the world coordinates of a vector given the local coordinates. localVector: a vector fixed in the body. Return type: @return:the same vector expressed in world coordinates.
GravityScaleAsFloat
Sets the gravity scale of the body
InertiaAsFloat [read only]
Get the rotational inertia of the body about the local origin.
isActiveAsBoolean
Get the active state of the body.
isAwakeAsBoolean
Get the sleeping state of this body. Return type: @return:true if the body is sleeping.
isBulletAsBoolean
Is this body treated like a bullet for continuous collision detection?
isFixedRotationAsBoolean
Does this body have fixed rotation?
isSleepingAllowedAsBoolean
Is this body allowed to sleep
LinearDampingAsFloat
Gets or sets the linear damping of the body.
LinearVelocityAslgMathVector2
Gets or sets the linear velocity of the center of mass.
linVelLocAslgMathVector2
linVelWorldAslgMathVector2
LocalCenterAslgMathVector2 [read only]
Get the local position of the center of mass.
localPoint2AslgMathVector2
localVectorAslgMathVector2
MassAsFloat [read only]
Get the total mass of the body.
MassDataAslgBox2DMassData
Get the mass data of the body.
PositionAslgMathVector2 [read only]
Get the world body origin position.
resetMassData
This resets the mass properties to the sum of the mass properties of the fixtures. This normally does not need to be called unless you called SetMassData to override the mass and you later want to reset the mass.
Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior. position: the world position of the body's local origin. angle: the world rotation in radians.
setTransform2 (xAsFloat, yAsFloat, angleAsFloat)
Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior. x: the world position on the x-axis y: the world position on the y-axis angle: the world rotation in radians.
SleepingAllowedAsBoolean [write only]
You can disable sleeping on this body. If you disable sleeping, the
A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions. Shapes are added to a body after construction.
Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.
angleAsFloat
The world angle of the body in radians.
angularDampingAsFloat
Angular damping is use to reduce the angular velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large.
angularVelocityAsFloat
The angular velocity of the body.
awakeAsBoolean
Is this body initially awake or sleeping?
bulletAsBoolean
Is this a fast moving body that should be prevented from tunneling through other moving bodies? Note that all bodies are prevented from tunneling through kinematic and static bodies. This setting is only considered on dynamic bodies.
fixedRotationAsBoolean
Should this body be prevented from rotating? Useful for characters.
gravityScaleAsFloat
Scale the gravity applied to this body.
linearDampingAsFloat
Linear damping is use to reduce the linear velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large.
linearVelocityAslgMathVector2
The linear velocity of the body's origin in world co-ordinates.
positionAslgMathVector2
The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.
Loads the collision fixtures defined with the Physics Body Editor application. You only need to give it a body and the corresponding fixture name, and it will attach these fixtures to your body.
Creates and applies the fixtures defined in the editor. The name parameter is used to retrieve the right fixture from the loaded file.
The body reference point (the red cross in the tool) is by default located at the bottom left corner of the image. This reference point will be put right over the BodyDef position point. Therefore, you should place this reference point carefully to let you place your body in your world easily with its BodyDef.position point. Note that to draw an image at the position of your body, you will need to know this reference point (see getOrigin).
Also, saved shapes are normalized. As shown in the tool, the width of the image is considered to be always 1 meter. Thus, you need to provide a scale factor so the polygons get resized according to your needs (not every body is 1 meter large in your game, I guess). body: The Box2d body you want to attach the fixture to. name: The name of the fixture you want to load. fd: The fixture parameters to apply to the created body fixture. scale: The desired scale of the body. The default width is 1.
Gets the origin point attached to the given name. Since the point is normalized in [0,1] coordinates, it needs to be scaled to your body size. Warning: this method returns the same Vector2 object each time, so copy it if you need it for later use.
The class manages contact between two shapes. A contact exists for each overlapping AABB in the broad-phase (except if filtered). Therefore a contact object may exist that has no contact points.
Enable/disable this contact. This can be used inside the pre-solve contact listener. The contact is only disabled for the current time step (or sub-step in continuous collisions).
Contact impulses for reporting. Impulses are used instead of forces because sub-step forces may approach infinity for rigid body collisions. These match up one-to-one with the contact points in b2Manifold.
Distance joint definition. This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game.
A line segment (edge) shape. These can be connected in chains or loops to other edge shapes. The connectivity information is used to ensure correct contact normals.
The collision category bits. Normally you would just set one bit.
groupIndexAsShort
Collision groups allow a certain group of objects to never collide (negative) or always collide (positive). Zero means no collision group. Non-zero group filtering always wins against the mask bits.
maskBitsAsShort
The collision mask bits. This states the categories that this shape would accept for collision.
Get the parent body of this fixture. This is NULL if the fixture is not attached.
DensityAsFloat
Get the density of this fixture.
FilterDataAslgBox2DFilter
Set the contact filtering data. This will not update contacts until the next time step when either parent body is active and awake. This automatically calls Refilter.
FrictionAsFloat
Get the coefficient of friction.
isSensorAsBoolean
Is this fixture a sensor (non-solid)? Return type: @return:the true if the shape is a sensor.
refilter
Call this if you want to establish collision that was previously disabled by b2ContactFilter::ShouldCollide.
RestitutionAsFloat
Get the coefficient of restitution.
SensorAsBoolean [write only]
Set if this fixture is a sensor.
ShapeAslgBox2DShape [read only]
Returns the shape of this fixture
testPoint (pAslgMathVector2) AsBoolean
Test a point for containment in this fixture. p: a point in world coordinates.
A gear joint is used to connect two joints together. Either joint can be a revolute or prismatic joint. You specify a gear ratio to bind the motions together: coordinate1 + ratio * coordinate2 = constant The ratio can be negative or positive. If one joint is a revolute joint and the other joint is a prismatic joint, then the ratio will have units of length or units of 1/length.
Gear joint definition. This definition requires two existing revolute or prismatic joints (any combination will work). The provided joints must attach a dynamic body to a static body.
A joint edge is used to connect bodies and joints together in a joint graph where each body is a node and each joint is an edge. A joint edge belongs to a doubly linked list maintained in each attached body. Each joint has two joint nodes, one for each attached body.
A mouse joint is used to make a point on a body track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces. NOTE: this joint is not documented in the manual because it was developed to be used in the testbed. If you want to learn how to use the mouse joint, look at the testbed.
Set this flag to true if the attached bodies should collide.
dampingRatioAsFloat
The damping ratio. 0 = no damping, 1 = critical damping.
frequencyHzAsFloat
The response speed.
maxForceAsFloat
The maximum constraint force that can be exerted to move the candidate body. Usually you will express as some multiple of the weight (multiplier * mass * gravity).
targetAslgMathVector2
The initial world target point. This is assumed to coincide with the body anchor initially.
Constructs a ParticleEmitter for Box2D using the given file. Box2d World is used for raycasting. Assumes that particles use same unit system that Box2d world does.
Constructs a ParticleEmitter for Box2D fully copying the given emitter attributes. Box2d World is used for raycasting. Assumes that particles use same unit system that Box2d world does.
Needs to be called when the shape is no longer used, e.g. after a fixture was created based on the shape.
getVertex (indexAsInt, vertexAslgMathVector2)
Returns the vertex at the given position. index: the index of the vertex 0 <= index < getVertexCount( ) vertex: vertex
RadiusAsFloat
Returns the radius of this shape
Set (vertices() AslgMathVector2)
Copy vertices. This assumes the vertices define a convex polygon. It is assumed that the exterior is the the right of each edge.
Set2 (vertices() AsFloat)
Copy vertices from the given float array. It is assumed the vertices are in x,y order and define a convex polygon. It is assumed that the exterior is the the right of each edge.
Set3 (vertices() AsFloat, offsetAsInt, lenAsInt)
Copy vertices from the given float array, taking into account the offset and length. It is assumed the vertices are in x,y order and define a convex polygon. It is assumed that the exterior is the the right of each edge.
SetAsBox (hxAsFloat, hyAsFloat)
Build vertices to represent an axis-aligned box. hx: the half-width. hy: the half-height.
Build vertices to represent an oriented box. hx: the half-width. hy: the half-height. center: the center of the box in local coordinates. angle: the rotation in radians of the box in local coordinates.
A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in body1. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction.
Prismatic joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.
The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 + ratio * length2 <= constant Yes, the force transmitted is scaled by the ratio. The pulley also enforces a maximum length limit on both sides. This is useful to prevent one side of the pulley hitting the top.
Registers a query callback function. This callback function will be called for each fixture found by lgBox2DWorld.QueryAABB. The function may terminate the query by returning false.
Registers a ray cast callback function. This callback function will be called by lgBox2DWorld.RayCast. The function controls how the ray cast proceeds by returning a float: -1: ignore this fixture and continue; 0: terminate the ray cast; fraction: clip the ray to this point; 1: don't clip the ray and continue. Parameters passed to the callback function: Fixture: The fixture hit by the ray; Point: The point of initial intersection; Normal: The normal vector at the point of intersection. The lgMathVector2 instances passed to the callback will be reused for future calls so make a copy of them!
A revolute joint constrains two bodies to share a common point while they are free to rotate about the point. The relative rotation about the shared point is the joint angle. You can limit the relative rotation with a joint limit that specifies a lower and upper angle. You can use a motor to drive the relative rotation about the shared point. A maximum motor torque is provided so that infinite forces are not generated.
Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body's origin rather than the center of mass because: 1. you might not know where the center of mass will be. 2. if you add/remove shapes from a body and recompute the mass, the joints will be broken.
A rope joint enforces a maximum distance between two points on two bodies. It has no other effect. Warning: if you attempt to change the maximum length during the simulation you will get some non-physical behavior. A model that would allow you to dynamically modify the length would have some sponginess, so I chose not to implement it that way. See b2DistanceJoint if you want to dynamically control length.
Rope joint definition. This requires two body anchor points and a maximum lengths. Note: by default the connected objects will not collide. see collideConnected in b2JointDef.
A shape is used for collision detection. You can create a shape however you like. Shapes used for simulation in b2World are created automatically when a b2Fixture is created. Shapes may encapsulate a one or more child shapes.
NOTE: YOU NEED TO DISPOSE SHAPES YOU CREATED YOURSELF AFTER YOU NO LONGER USE THEM! E.g. after calling body.createFixture();
Encodes a Box2D transform. We are lazy so we only store a 4 float wide array. First two floats are the position of the b2Transform struct. Next two floats are the cosine and sine of the rotation angle.
A wheel joint. This joint provides two degrees of freedom: translation along an axis fixed in body1 and rotation in the plane. You can use a joint limit to restrict the range of motion and a joint motor to drive the rotation or to model rotational friction. This joint is designed for vehicle suspensions.
Wheel joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.
BeginContact(Contact As lgBox2DContact) EndContact(Contact As lgBox2DContact) PreSolve(Contact As lgBox2DContact, OldManifold As lgBox2DManifold) PostSolve(Contact As lgBox2DContact, Impulse As lgBox2DContactImpulse) ShouldCollide(FixtureA As lgBox2DFixture, FixtureB As lgBox2DFixture) As Boolean
Manually clear the force buffer on all bodies. By default, forces are cleared automatically after each call to Step. The default behavior is modified by AutoClearForces. The purpose of this function is to support sub-stepping. Sub-stepping is often used to maintain a fixed sized time step under a variable frame-rate. When you perform sub-stepping you will disable auto clearing of forces and instead call ClearForces after all sub-steps are complete in one pass of your game loop.
ContactCountAsInt [read only]
Gets the number of contacts (each may have 0 or more contact points).
CreateBody (DefAslgBox2DBodyDef) AslgBox2DBody
Creates a rigid body given a definition. No reference to the definition is retained.
CreateJoint (DefAslgBox2DJointDef) AslgBox2DJoint
Creates a joint to constrain bodies together. No reference to the definition is retained.
DestroyBody (BodyAslgBox2DBody)
Destroys the specified rigid body and all associated fixtures and joints. This function is locked during callbacks.
DestroyJoint (JointAslgBox2DJoint)
Destroys the specified joint. This may cause the connected bodies to begin colliding.
dispose
Releases all resources of this object.
GetAllBodies (BodiesAslgArray)
Fills the given array with all bodies currently in the simulation.
GetAllContactsAslgArray
Returns an array of Contact instances produced by the last call to Step. Contacts are created and destroyed in the middle of a time step. Use the Contact events to avoid missing contacts.
GetAllJoints (JointsAslgArray)
Fills the given array with all joints currently in the simulation.
Constructs a world object and registers the contact listeners. The Contact instance passed to the contact events will be reused for future calls so make a copy of its data! Gravity: The world gravity vector. DoSleep: Improve performance by not simulating inactive bodies. EvtPrefix: Prefix of the contact events.
Queries the world for all fixtures that potentially overlap the provided AABB. Callback: An instance of lgBox2DQueryCallback. lowerX: The X coordinate of the lower left corner lowerY: The Y coordinate of the lower left corner upperX: The X coordinate of the upper right corner upperY: The Y coordinate of the upper right corner
Ray-casts the world for all fixtures in the path of the ray. The ray-cast ignores shapes that contain the starting point. Callback: An instance of lgBox2DRayCastCallback. Point1: The ray starting point. Point2: The ray ending point.
SetContactFilter
Raises the ShouldCollide event for each contact to provide collision filtering. Otherwise the default filter is used.
Takes a time step. This performs collision detection, integration, and constraint solution. TimeStep: The amount of time to simulate, this should not vary. VelocityIterations: For the velocity constraint solver. PositionIterations: For the position constraint solver.
VelocityThresholdAsFloat
Gets or sets the global box2d velocity threshold (default 1.0).
A color class, holding the r, g, b and alpha component as floats in the range [0,1]. All methods perform clamping on the internal values after execution.
Linearly interpolates between this color and the target color by t which is in the range [0,1]. The result is stored in this color. target: The target color t: The interpolation coefficient Return type: @return:This color for chaining.
Sets the Color components using the specified integer value in the format RGB565. This is inverse to the rgb565(r, g, b) method. color: The Color to be modified. value: An integer color value in RGB565 format.
rgb888 (rAsFloat, gAsFloat, bAsFloat) AsInt
rgb888ToColor (colorAslgColor, valueAsInt)
Sets the Color components using the specified integer value in the format RGB888. This is inverse to the rgb888(r, g, b) method. color: The Color to be modified. value: An integer color value in RGB888 format.
Sets the Color components using the specified integer value in the format RGBA4444. This is inverse to the rgba4444(r, g, b, a) method. color: The Color to be modified. value: An integer color value in RGBA4444 format.
Sets the Color components using the specified integer value in the format RGBA8888. This is inverse to the rgba8888(r, g, b, a) method. color: The Color to be modified. value: An integer color value in RGBA8888 format.
set (colorAslgColor) AslgColor
Sets this color to the given color. color: the Color
Packs the color components into a 32-bit integer with the format ABGR and then converts it to a float. Return type: @return:the packed color as a 32-bit float
toIntBitsAsInt
Packs the color components into a 32-bit integer with the format ABGR. Return type: @return:the packed color as a 32-bit int.
toStringAsString
Returns the color encoded as hex string with the format RRGGBBAA.
valueOf (hexAsString) AslgColor
Returns a new color from a hex string with the format RRGGBBAA.
hide status bar buttons on Android 4.x and higher (API 14+). Doesn't work if "android:targetSdkVersion" less 11 or if API less 14. default: false
maxSimultaneousSoundsAsInt
the maximum number of Sound instances that can be played simultaneously, sets the corresponding SoundPool constructor argument.
numSamplesAsInt
number of samples for CSAA/MSAA, 2 is a good value
rAsInt
number of bits per color channel
stencilAsInt
number of bits for depth and stencil buffer
touchSleepTimeAsInt
the time in milliseconds to sleep after each event in the touch handler, set this to 16ms to get rid of touch flooding on pre Android 2.0 devices. default: 0
useAccelerometerAsBoolean
whether to use the accelerometer. default: true
useCompassAsBoolean
whether to use the compass. default: true
useGL20AsBoolean
whether to use OpenGL ES 2.0 or not. default: false
useWakelockAsBoolean
whether to use a WakeLock or not. In case this is true you have to add the permission "android.permission.WAKE_LOCK" to your manifest file. default: false
Uploads the pixel data to the OpenGL ES texture. The caller must bind an OpenGL ES texture. A call to Prepare must preceed a call to this method.
consumePixmapAslgPixmap
Returns the Pixmap for upload by Texture. A call to Prepare must preceed a call to this method. Any internal datastructures created in Prepare should be disposed of here.
Returns whether this implementation can cope with a EGL context loss.
isPreparedAsBoolean
Returns whether the TextureData is prepared or not.
prepare
Prepares the TextureData for a call to ConsumePixmap or ConsumeCompressedData. This method can be called from a non OpenGL thread and should thus not interact with OpenGL.
Represents a file or directory on the filesystem, classpath, Android SD card, or Android assets directory. FileHandles are created via a {@link Files} instance.
Because some of the file types are backed by composite files and may be compressed (for example, if they are in an Android .apk or are found via the classpath), the methods for extracting a {@link #path()} or {@link #file()} may not be appropriate for all types. Use the Reader or Stream methods here to hide these dependencies from your platform independent code.
Returns a handle to the child with the specified name.
copyTo (destAslgFileHandle)
Copies this file or directory to the specified file or directory. If this handle is a file, then 1) if the destination is a file, it is overwritten, or 2) if the destination is a directory, this file is copied into it, or 3) if the destination doesn't exist, Mkdirs is called on the destination's parent and this file is copied into it with a new name. If this handle is a directory, then 1) if the destination is a file, GdxRuntimeException is thrown, or 2) if the destination is a directory, this directory is copied into it recursively, overwriting existing files, or 3) if the destination doesn't exist, Mkdirs is called on the destination and this directory is copied into it recursively.
deleteAsBoolean
Deletes this file or empty directory and returns success. Will not delete a directory that has children.
deleteDirectoryAsBoolean
Deletes this file or directory and all children, recursively.
emptyDirectory
Deletes all children of this directory, recursively.
existsAsBoolean
Returns true if the file exists. An internal handle to a directory will always return false.
extensionAsString
isDirectoryAsBoolean
Returns true if this file is a directory. An internal handle to an empty directory will return false.
lastModifiedAsLong
Returns the last modified time in milliseconds for this file. Zero is returned if the file doesn't exist. Zero is returned for internal files.
lengthAsLong
Returns the length in bytes of this file, or 0 if this file is a directory, does not exist, or the size cannot otherwise be determined.
mkdirs
moveTo (destAslgFileHandle)
Moves this file to the specified file, overwriting the file if it already exists.
nameAsString
Returns the name of the file, without any parent paths.
nameWithoutExtensionAsString
Returns the name of the file, without parent paths or the extension.
parentAslgFileHandle
pathAsString
Returns the path of the file as specified on construction, e.g. Files.internal("dir/file.png") -> dir/file.png.
pathWithoutExtensionAsString
Returns the path and filename without the extension, e.g. dir/dir2/file.png -> dir/dir2/file.
readBytesAsByte()
Reads the entire file into a byte array.
readStringAsString
Reads the entire file into a string using the platform's default charset.
readString2 (charsetAsString) AsString
Reads the entire file into a string using the specified charset.
sibling (nameAsString) AslgFileHandle
Returns a handle to the sibling with the specified name.
tempDirectory (prefixAsString) AslgFileHandle
tempFile (prefixAsString) AslgFileHandle
toStringAsString
typeAscom.badlogic.gdx.Files.FileType
writeBytes (bytes() AsByte, appendAsBoolean)
Writes the specified bytes to the file. Parent directories will be created if necessary. append: If false, this file will be overwritten if it exists, otherwise it will be appended.
writeString (stringAsString, appendAsBoolean)
Writes the specified string to the file using the default charset. Parent directories will be created if necessary. append: If false, this file will be overwritten if it exists, otherwise it will be appended.
Writes the specified string to the file as UTF-8. Parent directories will be created if necessary. append: If false, this file will be overwritten if it exists, otherwise it will be appended. charset: May be null to use the default charset.
Uploads the pixel data to the OpenGL ES texture. The caller must bind an OpenGL ES texture. A call to Prepare must preceed a call to this method.
consumePixmapAslgPixmap
Returns the Pixmap for upload by Texture. A call to Prepare must preceed a call to this method. Any internal datastructures created in Prepare should be disposed of here.
Returns whether this implementation can cope with a EGL context loss.
isPreparedAsBoolean
Returns whether the TextureData is prepared or not.
prepare
Prepares the TextureData for a call to ConsumePixmap or ConsumeCompressedData. This method can be called from a non OpenGL thread and should thus not interact with OpenGL.
Generates a new BitmapFont from a TrueType font file, containing glyphs for the given characters. Throws a GdxRuntimeException in case the font could not be generated. Using big sizes might cause such an exception. All characters need to fit onto a single texture. Internal: The internal path of the font file. Size: The size in pixels. Characters: The characters the font should contain.
Generates a new BitmapFont from a TrueType font file, containing glyphs for the given characters. Throws a GdxRuntimeException in case the font could not be generated. Using big sizes might cause such an exception. All characters need to fit onto a single texture. File: The file handle. Size: The size in pixels. Characters: The characters the font should contain.
Generates a new BitmapFont from a TrueType font file. Throws a GdxRuntimeException in case the font could not be generated. Using big sizes might cause such an exception. All characters need to fit onto a single texture. Internal: The internal path of the font file. Size: The size in pixels.
Generates a new BitmapFont from a TrueType font file. Throws a GdxRuntimeException in case the font could not be generated. Using big sizes might cause such an exception. All characters need to fit onto a single texture. File: The file handle. Size: The size in pixels.
Generates BitmapFonts of various sizes from a TrueType font file, containing glyphs for the given characters. Returns a Map where the size is the key and the BitmapFont the value. Internal: The internal path of the font file. Sizes: An array containing the desired sizes in pixels. Characters: The characters the font should contain.
Generates BitmapFonts of various sizes from a TrueType font file, containing glyphs for the given characters. Returns a Map where the size is the key and the BitmapFont the value. File: The file handle. Sizes: An array containing the desired sizes in pixels. Characters: The characters the font should contain.
Creates BitmapFonts of various sizes from a TrueType font file. Returns a Map where the size is the key and the BitmapFont the value. Internal: The internal path of the font file. Sizes: An array containing the desired sizes in pixels.
Creates BitmapFonts of various sizes from a TrueType font file. Returns a Map where the size is the key and the BitmapFont the value. File: The file handle. Sizes: An array containing the desired sizes in pixels.
TouchDown(X As Float, Y As Float, Pointer As Int) As Boolean Tap(X As Float, Y As Float, Count As Int) As Boolean LongPress(X As Float, Y As Float) As Boolean Fling(VelocityX As Float, VelocityY As Float) As Boolean Pan(X As Float, Y As Float, DeltaX As Float, DeltaY As Float) As Boolean PanStop(X As Float, Y As Float, Pointer As Int) As Boolean Pinch(InitialPointer1 As lgMathVector2, InitialPointer2 As lgMathVector2, Pointer1 As lgMathVector2, Pointer2 As lgMathVector2) As Boolean Zoom(InitialDistance As Float, Distance As Float) As Boolean
Registers a GestureDetector that detects gestures (tap, long press, fling, pan, zoom, pinch). It will be called each frame before the call to Render. If another GestureDetector was already registered, it is replaced.