Commit Graph

176 Commits

Author SHA1 Message Date
Alex Szpakowski ec9dec6b80 Replaced luax_newtype with luax_pushtype (and added luax_rawnewtype for the old functionality of luax_newtype.)
luax_pushtype keeps the object in a weak table and checks the table before creating a new userdata, so it re-uses the object's existing wrapper userdata if it can, whenever the object is pushed to Lua.

This fixes some subtle issues with love objects, where using them as keys in tables would not always work as expected (https://love2d.org/forums/viewtopic.php?f=4&t=39398&p=112388#p112415). It also decreases the amount of new Lua objects created, saving the garbage collector some work.
2013-08-29 00:40:06 -03:00
Alex Szpakowski 4f6e956f85 Fixed ChainShape:getChildEdge crashing 2013-08-11 17:50:57 -03:00
Alex Szpakowski 2561ace2d6 Fixed Fixture:getType crashing 2013-08-11 17:32:12 -03:00
Alex Szpakowski a4ff39e0d4 Improved error checking for some enum strings (resolves issue #690).
Also moved love.audio.newSource from Lua code into C++ code
2013-08-03 21:24:43 -03:00
Bart van Strien 259f15da6f Apply box2d heap tickler patch: make sure ChainShape:getPoints has enough stack size 2013-07-17 00:06:53 +02:00
Alex Szpakowski 3880646a6a Fixed some uncaught exceptions in love.physics 2013-07-02 02:27:08 -03:00
Bart van Strien 0a422daa75 Add Contact:getChildren (pull request #15) 2013-05-10 17:40:04 +02:00
Alex Szpakowski 668a1bfa6d Silenced some compiler warnings 2013-02-09 21:24:41 -04:00
Alex Szpakowski 96161c66f6 Updated copyright text for the new year 2013-02-05 05:32:49 -04:00
Bart van Strien 4de936ed75 Fix love.physics.getDistance 2012-11-19 21:10:28 +01:00
Bart van Strien 8234e71c74 Add an ASSERT_GUARD for World:update, catching any errors occuring there 2012-08-28 17:47:23 +02:00
Boolsheet cde5aa3307 Import box2d-contacts branch from love-experiments
Fix issues with Contact lifetime, based on the work of
Matteo "teomat" Goggi
2012-07-24 23:59:42 +02:00
Bart van Strien 7793e7f02f CRLF to LF 2012-07-04 14:40:24 +02:00
rude 81c38e22d0 Applied the new style guidelines.
Well, sort of. Lot's more to be done, but this is a start.
2012-06-28 23:52:33 +02:00
Bart van Strien 2986890746 Fix Shape:testPoint's stack indices (issue #430) 2012-05-18 18:00:04 +02:00
Aidan Gauland 8a6c36231c Corrected scaling of values in RopeJoint constructor. 2012-04-17 20:55:47 +12:00
Aidan Gauland 27b62b5c9c Removed scaling of unit vectors. 2012-04-17 20:54:12 +12:00
Bart van Strien 66aef58075 Use a clearer error message when the raycast callback doesn't return a number (issue #356) 2012-03-03 12:11:06 +01:00
Bart van Strien 0c9d8f3c41 Handle masks and categories in our contact filter
Turns out, setting our own contact filter bypasses the inbuilt mask and category handling,
this means, however, that masks and categories are processed before your contact filter is
called, so if you really want to do all the filtering manually, you should just make sure
you never change the default masks and category, or restore it.
2012-02-09 20:26:18 +01:00
Bill Meltsner 57dabc9f89 Change WheelJoint:get/setSpringFrequencyHz to get/setSpringFrequency 2012-02-06 10:32:33 -05:00
Bill Meltsner 20f4e567b3 Fix Fixture:getShape(), for real this time.
All the Memoizer stuff was pointless: when you create a Fixture, it clones the b2Shape, so there was never going to be a memoized Shape to find. And cloning the Shape is incorrect as well, since you should able to modify the Shape retrieved through getShape and have it affect the Fixture. Everything's much simpler now.
2012-02-05 19:22:33 -05:00
Bill Meltsner 31a85e81a2 Properly convert the anchor points for RopeJoints to local coordinates 2012-02-04 19:53:29 -05:00
Bill Meltsner f67d454aa3 Fix off-by-one error in Fixture:getBits 2012-02-04 19:45:38 -05:00
Bill Meltsner ddb1492c1f bounds check ChainShape:getPoint, and make functions that take indices 1-indexed on the Lua end of things 2012-02-04 19:38:11 -05:00
Bill Meltsner 83f7002f67 Remove the unnecessary transform arguments to Fixture:rayCast that some idiot blindly copy/pasted from Shape:rayCast 2012-02-04 19:16:27 -05:00
Bill Meltsner fae16c712d make Body::applyForce(fx, fy) semantically clearer 2012-02-04 19:09:20 -05:00
Bill Meltsner 4aa3939311 Actually register Box2D worlds as contact filters 2012-02-04 19:07:24 -05:00
Bill Meltsner 2a88ed1fa5 Fix issues with Shape retention in Fixture:getShape() 2012-02-04 18:55:48 -05:00
Bill Meltsner e5cabe3b3f Remove Shape:destroy().
With the changes to Shapes rendering them mere blocks of information with no role in the World save being attached to Bodies and discarded, Shape:destroy no longer has any justification for its continued existence. Truly, on several levels, it has been hoist with its own petard.
2012-02-04 18:35:30 -05:00
Bill Meltsner dac757b688 remove scaling for density.
while technically density is (according to the Box2D docs) in kg/m^2, it seems like a number that can be safely left un-scaled, for simplicity's sake; the concept of a shape/fixture's density seems sufficiently divorced from the MKS system as to render this a non-issue. if this proves to be a problem in use, scaling can be re-added.
2012-02-04 18:26:43 -05:00
Bill Meltsner f3d770e5e7 Scale Body inertia 2012-02-04 17:54:16 -05:00
Bill Meltsner 223f9eebef Provide a default density of 1.0 for Fixtures 2012-02-04 17:21:42 -05:00
Bill Meltsner e482f32da3 Allow vertices in either clockwise or counter-clockwise order for newPolygonShape (fixes issue #326) 2012-02-04 17:18:57 -05:00
Bill Meltsner f00b5f03f2 catch a possible Box2D exception in setMassData (fixes issue #342) 2012-02-04 16:55:09 -05:00
Bart van Strien a67b5b501f Fix a leak on destruction of a physics world 2012-01-24 23:00:18 +01:00
Bart van Strien f6e9f4cac7 Stop Body:getWorldPoints from overflowing the lua stack 2012-01-15 11:09:38 +01:00
Bart van Strien 9dc4138366 Fix a comment 2012-01-12 11:26:22 +01:00
Linus Sjögren 7f13fc47c7 Damn you, copy paste! 2012-01-10 04:24:13 +01:00
Linus Sjögren afd0ef1d9e Add a custom Body:setMass function. 2012-01-10 04:14:17 +01:00
Bill Meltsner be55579a22 Happy New Year, have an enormous diff 2012-01-09 02:41:11 -06:00
Bart van Strien 7c1e1fd0db Return nil if the raycasts don't hit anything (issue #335) 2012-01-08 13:27:10 +01:00
Bart van Strien c1f68e058d Use Box2D's callbacks for destruction of physics objects and wait until the end of the timestep before destroying them.
Merge of box2d-id2 from love-experiments
2012-01-08 13:16:50 +01:00
Bart van Strien ae833449d4 Move some includes over to the right file, fixing an include loop in the process 2011-12-29 13:47:39 +01:00
Bart van Strien 5ad9821290 ASSERT_GUARD raycasts 2011-12-29 13:37:42 +01:00
Bart van Strien c707a4ca45 Properly export all lua-facing functions and use those for initialization (love.cpp no longer explicitly mentions implementations) 2011-12-24 01:10:40 +01:00
Bart van Strien 0aae9684b3 Automated formatting fix 2011-11-16 11:32:41 +01:00
Bart van Strien cf2bfcc4a2 Fix more memory leaks (issue #327) 2011-11-12 15:00:26 +01:00
Bart van Strien bc2dd6f75b Enola Gay delivers again 2011-10-12 21:49:04 +02:00
Bill Meltsner cb6bde5ad7 Always use protection 2011-10-12 14:42:51 -05:00
Bart van Strien b32464f0d3 Forward box2d asserts to exception, then catch those in the new* functions 2011-10-12 21:36:46 +02:00