Skip to content

Commit

Permalink
update olua to v1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongfq committed Sep 1, 2024
1 parent 5c18b68 commit 6b68a52
Show file tree
Hide file tree
Showing 479 changed files with 33,548 additions and 39,616 deletions.
129 changes: 43 additions & 86 deletions addons/cclua/box2d/library/b2/Body.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,64 +33,49 @@ local Body = {}
function Body:__olua_move() end

---Apply an angular impulse.
---\param impulse the angular impulse in units of kg*m*m/s
---\param wake also wake up the body
---@param impulse number
---@param wake boolean
---@param impulse number # the angular impulse in units of kg*m*m/s
---@param wake boolean # also wake up the body
function Body:applyAngularImpulse(impulse, wake) end

---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.
---\param force the world force vector, usually in Newtons (N).
---\param point the world position of the point of application.
---\param wake also wake up the body
---@param force b2.Vec2
---@param point b2.Vec2
---@param wake boolean
---@param force b2.Vec2 # the world force vector, usually in Newtons (N).
---@param point b2.Vec2 # the world position of the point of application.
---@param wake boolean # also wake up the body
function Body:applyForce(force, point, wake) end

---Apply a force to the center of mass. This wakes up the body.
---\param force the world force vector, usually in Newtons (N).
---\param wake also wake up the body
---@param force b2.Vec2
---@param wake boolean
---@param force b2.Vec2 # the world force vector, usually in Newtons (N).
---@param wake boolean # also wake up the body
function Body:applyForceToCenter(force, wake) end

---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.
---\param impulse the world impulse vector, usually in N-seconds or kg-m/s.
---\param point the world position of the point of application.
---\param wake also wake up the body
---@param impulse b2.Vec2
---@param point b2.Vec2
---@param wake boolean
---@param impulse b2.Vec2 # the world impulse vector, usually in N-seconds or kg-m/s.
---@param point b2.Vec2 # the world position of the point of application.
---@param wake boolean # also wake up the body
function Body:applyLinearImpulse(impulse, point, wake) end

---Apply an impulse to the center of mass. This immediately modifies the velocity.
---\param impulse the world impulse vector, usually in N-seconds or kg-m/s.
---\param wake also wake up the body
---@param impulse b2.Vec2
---@param wake boolean
---@param impulse b2.Vec2 # the world impulse vector, usually in N-seconds or kg-m/s.
---@param wake boolean # also wake up the body
function Body:applyLinearImpulseToCenter(impulse, wake) end

---Apply a torque. This affects the angular velocity
---without affecting the linear velocity of the center of mass.
---\param torque about the z-axis (out of the screen), usually in N-m.
---\param wake also wake up the body
---@param torque number
---@param wake boolean
---@param torque number # about the z-axis (out of the screen), usually in N-m.
---@param wake boolean # also wake up the body
function Body:applyTorque(torque, wake) end

---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.
---\param def the fixture definition.
---@param def b2.FixtureDef # the fixture definition.
---\warning This function is locked during callbacks.
---@param def b2.FixtureDef
---@return b2.Fixture
---
---Creates a fixture from a shape and attach it to this body.
Expand All @@ -108,26 +93,23 @@ function Body:createFixture(def) end
---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.
---\param fixture the fixture to be removed.
---@param fixture b2.Fixture # the fixture to be removed.
---\warning This function is locked during callbacks.
---@param fixture b2.Fixture
function Body:destroyFixture(fixture) end

---Dump this body to a file
function Body:dump() end

---Get the angle in radians.
---\return the current world rotation angle in radians.
---@return number
---@return number # the current world rotation angle in radians.
function Body:getAngle() end

---Get the angular damping of the body.
---@return number
function Body:getAngularDamping() end

---Get the angular velocity.
---\return the angular velocity in radians/second.
---@return number
---@return number # the angular velocity in radians/second.
function Body:getAngularVelocity() end

---Get the list of all contacts attached to this body.
Expand All @@ -145,8 +127,7 @@ function Body:getFixtureList() end
function Body:getGravityScale() end

---Get the rotational inertia of the body about the local origin.
---\return the rotational inertia, usually in kg-m^2.
---@return number
---@return number # the rotational inertia, usually in kg-m^2.
function Body:getInertia() end

---Get the list of all joints attached to this body.
Expand All @@ -158,64 +139,51 @@ function Body:getJointList() end
function Body:getLinearDamping() end

---Get the linear velocity of the center of mass.
---\return the linear velocity of the center of mass.
---@return b2.Vec2
---@return b2.Vec2 # the linear velocity of the center of mass.
function Body:getLinearVelocity() end

---Get the world velocity of a local point.
---\param localPoint a point in local coordinates.
---\return the world velocity of a point.
---@param localPoint b2.Vec2
---@return b2.Vec2
---@param localPoint b2.Vec2 # a point in local coordinates.
---@return b2.Vec2 # the world velocity of a point.
function Body:getLinearVelocityFromLocalPoint(localPoint) end

---Get the world linear velocity of a world point attached to this body.
---\param worldPoint a point in world coordinates.
---\return the world velocity of a point.
---@param worldPoint b2.Vec2
---@return b2.Vec2
---@param worldPoint b2.Vec2 # a point in world coordinates.
---@return b2.Vec2 # the world velocity of a point.
function Body:getLinearVelocityFromWorldPoint(worldPoint) end

---Get the local position of the center of mass.
---@return b2.Vec2
function Body:getLocalCenter() end

---Gets a local point relative to the body's origin given a world point.
---\param worldPoint a point in world coordinates.
---\return the corresponding local point relative to the body's origin.
---@param worldPoint b2.Vec2
---@return b2.Vec2
---@param worldPoint b2.Vec2 # a point in world coordinates.
---@return b2.Vec2 # the corresponding local point relative to the body's origin.
function Body:getLocalPoint(worldPoint) end

---Gets a local vector given a world vector.
---\param worldVector a vector in world coordinates.
---\return the corresponding local vector.
---@param worldVector b2.Vec2
---@return b2.Vec2
---@param worldVector b2.Vec2 # a vector in world coordinates.
---@return b2.Vec2 # the corresponding local vector.
function Body:getLocalVector(worldVector) end

---Get the total mass of the body.
---\return the mass, usually in kilograms (kg).
---@return number
---@return number # the mass, usually in kilograms (kg).
function Body:getMass() end

---Get the mass data of the body.
---\return a struct containing the mass, inertia and center of the body.
---@return b2.MassData
---@return b2.MassData # a struct containing the mass, inertia and center of the body.
function Body:getMassData() end

---Get the next body in the world's body list.
---@return b2.Body
function Body:getNext() end

---Get the world body origin position.
---\return the world position of the body's origin.
---@return b2.Vec2
---@return b2.Vec2 # the world position of the body's origin.
function Body:getPosition() end

---Get the body transform for the body's origin.
---\return the world transform of the body's origin.
---@return b2.Transform
---@return b2.Transform # the world transform of the body's origin.
function Body:getTransform() end

---Get the type of this body.
Expand All @@ -235,22 +203,17 @@ function Body:getWorld() end
function Body:getWorldCenter() end

---Get the world coordinates of a point given the local coordinates.
---\param localPoint a point on the body measured relative the the body's origin.
---\return the same point expressed in world coordinates.
---@param localPoint b2.Vec2
---@return b2.Vec2
---@param localPoint b2.Vec2 # a point on the body measured relative the the body's origin.
---@return b2.Vec2 # the same point expressed in world coordinates.
function Body:getWorldPoint(localPoint) end

---Get the world coordinates of a vector given the local coordinates.
---\param localVector a vector fixed in the body.
---\return the same vector expressed in world coordinates.
---@param localVector b2.Vec2
---@return b2.Vec2
---@param localVector b2.Vec2 # a vector fixed in the body.
---@return b2.Vec2 # the same vector expressed in world coordinates.
function Body:getWorldVector(localVector) end

---Get the sleeping state of this body.
---\return true if the body is awake.
---@return boolean
---@return boolean # true if the body is awake.
function Body:isAwake() end

---Is this body treated like a bullet for continuous collision detection?
Expand Down Expand Up @@ -279,14 +242,12 @@ function Body:resetMassData() end
function Body:setAngularDamping(angularDamping) end

---Set the angular velocity.
---\param omega the new angular velocity in radians/second.
---@param omega number
---@param omega number # the new angular velocity in radians/second.
function Body:setAngularVelocity(omega) end

---Set the sleep state of the body. A sleeping body has very
---low CPU cost.
---\param flag set to true to wake the body, false to put it to sleep.
---@param flag boolean
---@param flag boolean # set to true to wake the body, false to put it to sleep.
function Body:setAwake(flag) end

---Should this body be treated like a bullet for continuous collision detection?
Expand Down Expand Up @@ -322,16 +283,14 @@ function Body:setGravityScale(scale) end
function Body:setLinearDamping(linearDamping) end

---Set the linear velocity of the center of mass.
---\param v the new linear velocity of the center of mass.
---@param v b2.Vec2
---@param v b2.Vec2 # the new linear velocity of the center of mass.
function Body:setLinearVelocity(v) end

---Set the mass properties to override the mass properties of the fixtures.
---Note that this changes the center of mass position.
---Note that creating or destroying fixtures can also alter the mass.
---This function has no effect if the body isn't dynamic.
---\param data the mass properties.
---@param data b2.MassData
---@param data b2.MassData # the mass properties.
function Body:setMassData(data) end

---You can disable sleeping on this body. If you disable sleeping, the
Expand All @@ -342,10 +301,8 @@ function Body:setSleepingAllowed(flag) end
---Set the position of the body's origin and rotation.
---Manipulating a body's transform may cause non-physical behavior.
---Note: contacts are updated on the next call to b2World::Step.
---\param position the world position of the body's local origin.
---\param angle the world rotation in radians.
---@param position b2.Vec2
---@param angle number
---@param position b2.Vec2 # the world position of the body's local origin.
---@param angle number # the world rotation in radians.
function Body:setTransform(position, angle) end

---Set the type of this body. This may alter the mass and velocity.
Expand Down
3 changes: 1 addition & 2 deletions addons/cclua/box2d/library/b2/BroadPhase.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ function BroadPhase.new() end

---Shift the world origin. Useful for large worlds.
---The shift formula is: position -= newOrigin
---\param newOrigin the new origin with respect to the old origin
---@param newOrigin b2.Vec2
---@param newOrigin b2.Vec2 # the new origin with respect to the old origin
function BroadPhase:shiftOrigin(newOrigin) end

---Test overlap of fat AABBs.
Expand Down
18 changes: 6 additions & 12 deletions addons/cclua/box2d/library/b2/ChainShape.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,15 @@ local ChainShape = {}
function ChainShape:clear() end

---Create a chain with ghost vertices to connect multiple chains together.
---\param vertices an array of vertices, these are copied
---\param count the vertex count
---\param prevVertex previous vertex from chain that connects to the start
---\param nextVertex next vertex from chain that connects to the end
---@param vertices b2.Vec2
---@param count any
---@param prevVertex b2.Vec2
---@param nextVertex b2.Vec2
---@param vertices b2.Vec2 # an array of vertices, these are copied
---@param count any # the vertex count
---@param prevVertex b2.Vec2 # previous vertex from chain that connects to the start
---@param nextVertex b2.Vec2 # next vertex from chain that connects to the end
function ChainShape:createChain(vertices, count, prevVertex, nextVertex) end

---Create a loop. This automatically adjusts connectivity.
---\param vertices an array of vertices, these are copied
---\param count the vertex count
---@param vertices b2.Vec2
---@param count any
---@param vertices b2.Vec2 # an array of vertices, these are copied
---@param count any # the vertex count
function ChainShape:createLoop(vertices, count) end

---Get a child edge.
Expand Down
9 changes: 3 additions & 6 deletions addons/cclua/box2d/library/b2/DistanceJoint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,18 @@ function DistanceJoint:getStiffness() end
function DistanceJoint:setDamping(damping) end

---Set the rest length
---\returns clamped rest length
---@return number # s clamped rest length
---@param length number
---@return number
function DistanceJoint:setLength(length) end

---Set the maximum length
---\returns the clamped maximum length
---@return number # s the clamped maximum length
---@param maxLength number
---@return number
function DistanceJoint:setMaxLength(maxLength) end

---Set the minimum length
---\returns the clamped minimum length
---@return number # s the clamped minimum length
---@param minLength number
---@return number
function DistanceJoint:setMinLength(minLength) end

---Set/get the linear stiffness in N/m
Expand Down
24 changes: 8 additions & 16 deletions addons/cclua/box2d/library/b2/Fixture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ function Fixture:dump(bodyIndex) end
function Fixture:getAABB(childIndex) end

---Get the parent body of this fixture. This is nullptr if the fixture is not attached.
---\return the parent body.
---@return b2.Body
---@return b2.Body # the parent body.
function Fixture:getBody() end

---Get the density of this fixture.
Expand All @@ -61,8 +60,7 @@ function Fixture:getFriction() end
function Fixture:getMassData(massData) end

---Get the next fixture in the parent body's fixture list.
---\return the next shape.
---@return b2.Fixture
---@return b2.Fixture # the next shape.
function Fixture:getNext() end

---Get the coefficient of restitution.
Expand All @@ -80,8 +78,7 @@ function Fixture:getRestitutionThreshold() end
function Fixture:getShape() end

---Get the type of the child shape. You can use this to down cast to the concrete shape.
---\return the shape type.
---@return b2.Shape.Type
---@return b2.Shape.Type # the shape type.
function Fixture:getType() end

---Get the user data that was assigned in the fixture definition. Use this to
Expand All @@ -90,17 +87,13 @@ function Fixture:getType() end
function Fixture:getUserData() end

---Is this fixture a sensor (non-solid)?
---\return the true if the shape is a sensor.
---@return boolean
---@return boolean # the true if the shape is a sensor.
function Fixture:isSensor() end

---Cast a ray against this shape.
---\param output the ray-cast results.
---\param input the ray-cast input parameters.
---\param childIndex the child shape index (e.g. edge index)
---@param output b2.RayCastOutput
---@param input b2.RayCastInput
---@param childIndex any
---@param output b2.RayCastOutput # the ray-cast results.
---@param input b2.RayCastInput # the ray-cast input parameters.
---@param childIndex any # the child shape index (e.g. edge index)
---@return boolean
function Fixture:rayCast(output, input, childIndex) end

Expand Down Expand Up @@ -138,8 +131,7 @@ function Fixture:setRestitutionThreshold(threshold) end
function Fixture:setSensor(sensor) end

---Test a point for containment in this fixture.
---\param p a point in world coordinates.
---@param p b2.Vec2
---@param p b2.Vec2 # a point in world coordinates.
---@return boolean
function Fixture:testPoint(p) end

Expand Down
Loading

0 comments on commit 6b68a52

Please sign in to comment.