Commit Graph

207 Commits

Author SHA1 Message Date
Alex Szpakowski da7cd267ea Changed luax_pushtype to retain the pushed object itself, but only if the object isn't in the Lua state already.
Previously, calling e.g. love.graphics.getFont() 10,000 times would retain the object 10,000 times (and release it 10,000 times when the Font object was garbage-collected in the Lua state.) Now it will only retain it once and release it once.
2014-08-09 16:04:59 -03:00
Alex Szpakowski d59c76a55f Reduced the number of explicit retain/release method calls on love objects. Less chance of bugs! 2014-08-07 14:53:17 -03:00
Alex Szpakowski c6c32dee17 Removed a piece of code I forgot to delete 2014-07-28 16:58:51 -03:00
Alex Szpakowski d52bab4221 Updated the new module changes to use more compile/link-time checking rather than runtime checking. 2014-07-21 15:12:01 -03:00
Alex Szpakowski 014b9a46e5 Updated the Lua wrapper code for modules to account for cases where the module's instance is removed from memory completely and recreated during the program's lifetime. 2014-07-21 14:52:01 -03:00
Alex Szpakowski 9ab9a393d5 Added Contact:getFixtures and Body:getContactList (see issue #905).
The list of Contacts associated with bodies changes during World:update (potentially multiple times), so you might miss collisions if you don't use the World callbacks at all.
2014-07-07 15:24:24 -03:00
Alex Szpakowski 2ae4e9cd5a Fixed a potential memory leak in the love.physics World callbacks. 2014-06-18 16:24:38 -03:00
Alex Szpakowski 431b6a56ce Added Body:getWorld (resolves issue #895) 2014-06-09 19:00:05 -03:00
Alex Szpakowski 5dd23dffd1 Added Joint:setUserData and Joint:getUserData (resolves issue #894.) 2014-06-05 20:56:43 -03:00
Alex Szpakowski dfa319e01a Replaced the EXCEPT_GUARD macro for converting love exceptions into Lua errors with the new luax_catchexcept function, which takes lambda function arguments. 2014-06-03 19:27:00 -03:00
Bart van Strien e667485f68 Check argument count of newChainShape 2014-04-26 14:35:39 +02:00
Alex Szpakowski 4faddcd9aa Fixed some trivial compiler warnings 2014-03-12 17:55:19 -03:00
Alex Szpakowski 55514720a6 Fixed some minor compiler warnings 2014-03-01 21:16:01 -04:00
Alex Szpakowski fe5e7c17e7 Added Body:setUserData and Body:getUserData (resolves issue #853_ 2014-02-26 20:47:05 -04:00
Alex Szpakowski 2a19a4444e Allow Fixture:setUserData and Fixture:getUserData to be called in coroutines (resolves issue #850.)
Bad things will still happen if you call them from a love Thread which didn't create the World and the Fixture object. Don't do it!
2014-02-15 20:59:57 -04:00
Alex Szpakowski c17cada9e0 Fixed World:getBodyList, World:getJointList, and World:getContactList causing hard crashes instead of Lua errors 2014-02-10 14:01:59 -04:00
Alex Szpakowski 0e13975c11 Improved some error message text 2014-01-17 22:28:06 -04:00
Alex Szpakowski 3120a0e650 Goodbye 2013, hello 2014! 2014-01-03 17:28:58 -04:00
Alex Szpakowski 1d3f6e967d Added CircleShape:get/setPoint. 2014-01-03 14:06:23 -04:00
Alex Szpakowski 760f8220fa Fixed a small memory leak if love.physics.newChainShape errors 2013-12-10 03:54:56 -04:00
Alex Szpakowski a1a116e7a2 Fixed an uncaught exception in World:translateOrigin
--HG--
branch : box2d-2.3
2013-11-09 16:37:19 -04:00
Alex Szpakowski 5e3a0fbc6e Updated box2d from 2.2.1 to 2.3.0
--HG--
branch : box2d-2.3
2013-11-09 04:30:36 -04:00
Alex Szpakowski f03efd2dca Fixed Contact:getChildren to be 1-based 2013-10-30 18:07:41 -03:00
Alex Szpakowski 74ac2820cd Joint:enableMotor -> Joint:setMotorEnabled, Joint:enableLimit -> Joint:setLimitsEnabled, Joint:isLimitEnabled -> Joint:hasLimitsEnabled. Resolves issue #691. 2013-10-24 17:30:41 -03:00
Alex Szpakowski 951f5740bb Renamed ChainShape:setPrevVertex to ChainShape:setPreviousVertex (see issue #691) 2013-10-07 23:49:49 -03:00
Alex Szpakowski 95eedcd1be Using auto for some iterators for less dense-looking code 2013-09-30 02:35:10 -03:00
Alex Szpakowski bcee9a222b Made some float/int/unsigned char conversions explicit, fixed ParticleSystem:getColors, fixed love.mouse.isDown with x1 and x2 buttons 2013-09-26 00:36:50 -03:00
Alex Szpakowski 8d5ddb9e34 Fixed some internal documentation (thanks to clang's -Wdocumentation) 2013-09-23 21:52:28 -03:00
Alex Szpakowski ffe0485173 Removed love.window.checkMode (resolves issue #653, invalidates issue #592).
Also fixed love.window.setMode to fail instead of bug out when trying to set a fullscreen mode which is too large for the monitor.
2013-09-19 18:13:52 -03:00
Alex Szpakowski 06f80d5c08 Fixed undefined behaviour when love exceptions are converted into Lua errors (resolves issue #729) 2013-09-05 23:17:29 -03:00
Alex Szpakowski 93a782d445 Renamed World:setAllowSleeping and World:getAllowSleeping to World:setSleepingAllowed and World:isSleepingAllowed (see issue #691, also consistent with the Body methods) 2013-08-31 21:15:09 -03:00
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