Commit Graph

103 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 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 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
Alex Szpakowski 1bc8b7346d Added internal thread name support, for use with debuggers. 2014-05-02 08:56:23 -03:00
Alex Szpakowski e4dc533bb2 Minor code cleanup 2014-05-01 14:12:21 -03:00
Alex Szpakowski 3120a0e650 Goodbye 2013, hello 2014! 2014-01-03 17:28:58 -04:00
Alex Szpakowski 74f26160da Fixed a couple bugs caught by clang's static analyzer 2013-09-18 18:30:12 -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 d3826aba9d Improved thread safety of love.event.wait and love.event.push 2013-08-30 17:34:58 -03:00
Alex Szpakowski 5b28b34a0b Fixed Thread:start(func) crashing instead of erroring 2013-08-29 20:59:25 -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 113ed1cfe7 Merged SDL2 changes from bartbes/love-experiments/SDL2 into default.
- Added love.system module, including clipboard functions.

- Added custom hardware cursors (love.mouse.newCursor, love.mouse.setCursor.)

- Revamped love.joystick:
-- added Joystick objects and moved love.joystick functions which operated on individual joysticks to methods on the Joystick objects.
-- Added love.joystick.getJoystick and love.joystick.getJoystickCount.
-- Added events for when joysticks are connected and disconnected.
-- Added 'Gamepad' methods to Joystick objects: Joystick:isGamepad, Joystick:getGamepadAxis, and Joystick:isGamepadDown. They're a common abstraction for xbox controller-like joystick across operating systems.

- Added monitor choosing support and "fullscreen desktop" mode to love.window.

- Moved unicode text input events to their own callback function (love.textinput), removed the key repeat functions from love.keyboard and made the second argument of love.keypressed a boolean saying whether the keypress was a repeat.

- liblove now works with love.window and love.graphics in OS X
2013-08-25 16:51:42 -03:00
Bart van Strien 1602c6de7a Make mutex locks slightly more safe in some places (and correct in another...) 2013-08-03 22:13:33 +02:00
Alex Szpakowski 3e57cfd174 Slightly reduced internal reliance on specific module backends 2013-08-03 16:30:37 -03:00
Alex Szpakowski 2106ff2403 Added love.threaderror event callback function (re issue #673) 2013-08-03 15:10:08 -03:00
Alex Szpakowski 4dba3e91e2 Thread:start now clears the thread's error string before starting 2013-08-03 05:00:46 -03:00
Alex Szpakowski 8ac288876d Added Thread:isRunning 2013-07-16 00:18:04 -03:00
Alex Szpakowski 35b4f03411 Fixed thread:start crashing with nil arguments 2013-07-10 17:41:54 -03:00
Bart van Strien f5603b0291 Make love compile against lua5.2 2013-07-10 16:02:52 +02:00
Bart van Strien 7e50691b6c Threads can now start with arguments, which will be in ... inside of the thread 2013-07-09 14:52:27 +02:00
Alex Szpakowski 9155b7b0ee Removed dead code for the now-removed Thread:kill 2013-07-08 17:00:47 -03:00
Alex Szpakowski 6e3a7288dd Improved performance of ImageData:mapPixel (now up to 2x as fast as in 0.8.0!); love.graphics.newImage, Image:refresh, love.window.setIcon, and ImageRasterizers now prevent other threads from modifying the ImageData used in those functions until they're done accessing it 2013-06-25 05:28:20 -03:00
Alex Szpakowski 8d7e0b5629 Time-travelling license text 2013-06-22 03:14:15 -03:00
Alex Szpakowski cd1a23c4ad Improved handling of (File)Data in love.graphics.newFont and love.thread.newThread 2013-06-08 16:50:13 -03:00
Alex Szpakowski 4c616e409b Renamed ParticleSystem:count, Channel:count, and all getNum* functions to get*Count (issue #602) 2013-05-03 04:04:44 -03:00
Alex Szpakowski f0860a488d Added argument type checking to Channel:push (nil now errors instead of crashing) 2013-03-30 14:42:09 -03:00
Alex Szpakowski 22c514e53a Fixed a compiler warning 2013-03-03 18:55:57 -04:00
Bart van Strien 3d0c5761ce Merge in default, update changelog
--HG--
branch : minor
2013-03-03 19:51:04 +01:00
Alex Szpakowski 0e4d7f1f4a Replaced deprecated lua_open calls with luaL_newstate 2013-02-16 00:51:57 -04: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 c7c5d0ed6b Fix race conditions and deadlocks in Channels (hopefully) (issue #554)
Also, this is a giant commit because of the official Code Style (tm) was applied.

--HG--
branch : minor
2013-01-30 17:15:12 +01:00
Bart van Strien be2363fc00 Add Channel:supply(), a blocking version of Channel:push()
--HG--
branch : minor
2013-01-27 20:04:16 +01:00
Bart van Strien 3dc4e3cdca Also mutex lock in Channel::retain
--HG--
branch : minor
2012-07-05 17:25:41 +02:00
Bart van Strien 777e97de2e Make Channels more thread-safe (I know, I know..)
--HG--
branch : minor
2012-07-04 20:22:54 +02:00
Bart van Strien 399a6a6614 Merge in channels from love-experiments
Rewritten love.thread and changed communication
method from weird system before, to channels.

--HG--
branch : minor
2012-07-04 17:15:16 +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
Bill Meltsner be55579a22 Happy New Year, have an enormous diff 2012-01-09 02:41:11 -06: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 53e010a832 Remove all uses of LOVE_UNUSED, and simply not name the arguments instead 2011-12-20 20:26:17 +01:00
Bart van Strien 735260d4d8 Thread:kill()? What Thread:kill()? 2011-12-13 19:24:10 +01:00
Bart van Strien 083dd11185 Switch to a custom event system, where SDL pumps into
To do this we needed to take ThreadVariant out of love.thread, and move it to common.
This also changes event names, instead of 1/2-letter abbreviations, full names!
2011-12-13 17:50:38 +01:00
Bart van Strien 0aae9684b3 Automated formatting fix 2011-11-16 11:32:41 +01:00
Bart van Strien 2fafab9a0e Add luax_checkstring/pushstring functions that handle inline \0 characters 2011-11-15 21:37:11 +01:00
Bart van Strien cf2bfcc4a2 Fix more memory leaks (issue #327) 2011-11-12 15:00:26 +01:00
Bill Meltsner 57f9cf439e Add LOVE_UNUSED macro to stamp out all those "unused parameter" warnings 2011-10-12 14:03:38 -05:00
Bart van Strien f9084c4625 Thread:getKeys needs to return a 1-indexed table 2011-08-31 12:28:56 +02:00