Commit Graph

285 Commits

Author SHA1 Message Date
Alex Szpakowski 90e86c329d Add love.data module.
- Moved love.math.compress / decompress / decode / encode / hash to love.data.
- Changed love.data.compress/decompress to take the format argument first instead of second.
- Added love.data.newDataView. Returns a read-only subsection of an existing Data object.
- Added love.data.newByteData. Mostly useful in combination with LuaJIT's FFI as it has no extra methods currently.
- Added implementations of Lua 5.3's data packing APIs: love.data.packString / packData / unpack / getPackedSize.

Resolves issue #1336.
Resolves issue #1331.

--HG--
branch : minor
2017-09-24 19:25:27 -03:00
Alex Szpakowski 9d0e984c3d Add love.filesystem.getInfo. Deprecate love.filesystem.exists/isDirectory/isFile/isSymlink/getLastModified/getSize. Resolves issue #641.
--HG--
branch : minor
2017-08-27 18:14:54 -03:00
Alex Szpakowski de28c6e6a8 Add the ability to have formally deprecated functions.
Functions which are deprecated will print out a message and show up in a small dialog on-screen, when they're first called. Deprecation output is disabled in fused mode by default, and can be modified with love.setDeprecationOutput(enable).

--HG--
branch : minor
2017-08-27 13:46:31 -03:00
Alex Szpakowski a42f27db47 The default error handler sanitizes error messages to remove non UTF-8 bytes before displaying it. Resolves issue #1330.
--HG--
branch : minor
2017-08-17 22:02:49 -03:00
Alex Szpakowski 98eef9e88a Add a default love.threaderror callback which just calls error().
--HG--
branch : minor
2017-08-06 21:42:05 -03:00
Alex Szpakowski 9654376bdd Rename love.errhand to love.errorhandler (see issue #573).
love.errhand will still be called if love.errorhandler doesn't exist, and love defines love.errhand by default rather than love.errorhandler, to prevent hard-to-diagnose problems with existing code that defines love.errhand.

--HG--
branch : minor
2017-08-05 16:56:39 -03:00
Alex Szpakowski 254e50dbfe Rename love.mouse.hasCursor to isCursorSupported (resolves issue #1309).
--HG--
branch : minor
2017-08-05 16:53:27 -03:00
Alex Szpakowski f0c682d50d boot.lua cleanup and fixes
--HG--
branch : minor
2017-08-02 21:49:34 -03:00
Kyle McLamb c2ea3a846c Cleanup
* love.load now takes two arguments. signature:
    love.load(args, raw_args)
* Rename love.arg functions
* Use love.arg.getLow instead of reimplementing it like a goof

--HG--
branch : minor
2017-08-02 19:58:29 -04:00
Kyle McLamb f6600953ec merge
--HG--
branch : minor
2017-08-02 19:33:42 -04:00
Alex Szpakowski 02aa7937a1 Rename love.audio.setMixMode to setMixWithSystem. Fix some copyright notice typos.
--HG--
branch : minor
2017-07-29 23:22:54 -03:00
Alex Szpakowski 19b4079ecc Merge default into minor
--HG--
branch : minor
2017-07-28 19:14:54 -03:00
Alex Szpakowski 2eb9b3bdcd love.timer.step now returns the calculated dt directly.
--HG--
branch : minor
2017-07-23 19:56:48 -03:00
Alex Szpakowski ef5897b22c Seed love.math.random when the math module is loaded, instead of in love.run.
--HG--
branch : minor
2017-07-23 19:45:49 -03:00
Tiago Koji Castro Shibata 3dfe3808c6 Remove playmuted audio configuration 2017-07-18 15:15:04 -03:00
Kyle McLamb 4ed370b098 Update comment
--HG--
branch : minor
2017-07-10 00:34:57 -04:00
Kyle McLamb 9a03cf10a4 Remove parsed options from the love.load arglist
--HG--
branch : minor
2017-07-10 00:22:41 -04:00
Tiago Koji Castro Shibata 74c35358bb Move setMixMode to love.audio 2017-06-10 00:07:39 -03:00
Tiago Koji Castro Shibata 4c145e8c13 Support audio mix modes 2017-06-02 19:35:58 -03:00
Alex Szpakowski 28ed5e5a4b Actually merge the latest default into minor…
--HG--
branch : minor
2017-01-12 22:55:19 -04:00
Alex Szpakowski c5b7a07064 Merge default into minor.
--HG--
branch : minor
2017-01-12 22:52:24 -04:00
Bart van Strien 9316d84028 Add (optional) copy-to-clipboard functionality to the error handler
Based on pull request #74 by raidho
2017-01-11 11:44:50 +01:00
Alex Szpakowski 5243fb5a85 Allow disabling stencil capabilities for the main screen in love.window.setMode.
--HG--
branch : minor
2017-01-05 19:40:18 -04:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Alex Szpakowski d26002f5cc Revamped and streamlined retina / high-DPI support (resolves issue #1122).
With the highdpi window flag enabled on a retina-capable display and OS, content should now appear to the user at the same size and in the same positions as with the flag disabled.

As a result, mouse and touch coordinates, Texture and graphics dimensions, and the graphics coordinate system now use pixel density-scaled units instead of pixels. Raw pixel units should generally only be used for things such as shader algorithms which execute per-pixel and rely on accurate pixel dimensions. love.window.fromPixels and friends typically don’t need to be used anymore.

Images, Canvases, and Fonts can have an optional explicit ‘pixel density’ set when creating them. This allows for easily loading high pixel density content which displays at the same size as regular or low pixel density content.

API changes:

- Added Texture:getPixelWidth/getPixelHeight/getPixelDimensions and Texture:getPixelDensity. Texture:getWidth/getHeight return the pixel density-scaled width and height (as it will appear on the screen when drawn) rather than the number of pixels on each texture dimension.

- Added love.graphics.getPixelWidth/getPixelHeight/getPixelDimensions.

- Added optional ‘pixeldensity’ field to the settings table parameter of love.graphics.newImage. It defaults to 1, or if the file the Image was loaded from has “@2x”, “@3x”, etc. at the end of its name, it uses that number as the pixel density scale by default.

- love.graphics.newCanvas now takes a table as its third parameter, with fields “format”, “msaa”, and “pixeldensity”. pixeldensity defaults to the main screen’s pixel density. The width and height parameters specify the visual size that the Canvas will be drawn at / can be drawn to (pixel density-scaled units).

- love.graphics.newVideo accepts a table as its second parameter, with optional fields “audio” and “pixeldensity”. pixeldensity defaults to 1.

- love.graphics.newFont variants have an optional pixeldensity parameter at the end of the argument list. For TrueType fonts this defaults to the current pixel density scale of the screen, and for BMFonts and ImageFonts this defaults to 1.

- Added Font:getPixelDensity.

- Renamed love.window.getPixelScale to love.window.getPixelDensity.

--HG--
branch : minor
2016-12-29 23:55:51 -04:00
Bart van Strien 77949030e2 Fix various spelling mistakes (mostly in luasocket)
Thanks to Alexandre Detiste for reporting them
2016-12-21 09:54:37 +01:00
Alex Szpakowski 2a47a8c9e2 Revert most render pass API changes. The APIs need more work and iteration before they’re better to use than the old setCanvas APIs.
love.graphics.captureScreenshot has not been reverted.

--HG--
branch : minor
2016-12-11 16:33:05 -04:00
Alex Szpakowski 247e1b6af0 Merge default into minor
--HG--
branch : minor
2016-11-19 19:19:14 -04:00
Alex Szpakowski 3e80ec2257 Render pass API. Replaces love.graphics.setCanvas and friends.
- Removed love.graphics.set/getCanvas, Canvas:renderTo, Canvas:newImageData, love.graphics.clear, love.graphics.discard, and love.graphics.newScreenshot.

- Added love.graphics.beginPass and love.graphics.endPass. All rendering must happen within a pass. love.draw is now called while a render pass to the main screen is active.
- Added love.graphics.renderPass, which is a wrapper for begin/endPass which calls the supplied function argument in between a begin/end. This is similar to the old Canvas:renderTo.
- Added love.graphics.isPassActive, getPassCanvases, getPassWidth, getPassHeight, and getPassDimensions.
- Added love.graphics.captureScreenshot.

- Added a new love.run callback love.drawpasses, which is called after love.update and before love.draw. It is the place to render to Canvases using beginPass or renderPass, since love.draw now always draws to the main screen.

- Renamed the ‘canvasswitches’ field in the table returned by love.graphics.getStats to ‘renderpasses’.

love.graphics.beginPass has the following variants (and renderPass mirrors them with an additional function argument at the end):

- love.graphics.beginPass(), begins rendering to the main screen without clearing it.
- love.graphics.beginPass(r, g, b [, a]), begins rendering to the main screen and clears the screen to the specified color.

- love.graphics.beginPass(canvas [, willstencil]), begins rendering to the specified Canvas without clearing it. love.graphics.stencil can only be used within the Canvas if ‘willstencil’ is true.
- love.graphics.beginPass(canvas, r, g, b [, a] [, willstencil]), beings rendering to the specified Canvas and clears it to the specified color. love.graphics.stencil can only be used within the Canvas if ‘willstencil’ is true.

- love.graphics.beginPass(info), where ‘info’ is a table in the following form:
{
    {canvas [, r, g, b, a]}, — A canvas and an optional color to clear the Canvas to when the pass begins.
    {canvas2, [r, g, b, a]}, — Additional Canvases and optional clear colors for multi-canvas rendering.
    …,
    stencil = false, — Optional boolean field to specify whether love.graphics.stencil is allowed within this pass. False by default.
}

The pass info table can be created once up-front and used for multiple beginPass/renderPass calls.

love.graphics.endPass can take an optional callback function argument, which causes endPass to capture the contents of the Canvas drawn to in the render pass to a new ImageData and passes it to the supplied function (this replaces Canvas:newImageData). This does not work on the main screen.

love.graphics.captureScreenshot replaces love.graphics.newScreenshot. It takes a callback function argument which causes love.graphics.present to capture the contents of the screen to a new ImageData and passes it to the supplied function. captureScreenshot can only be called before drawing to the main screen begins in the current frame (e.g. in love.keypressed, love.update, etc.)

--HG--
branch : minor
2016-11-19 19:13:26 -04:00
Xpol Wan c28a6c51c4 love.arg.parse_option just return how many extra arg the current option consumes.
--HG--
branch : better-parse-options
2016-11-04 22:27:49 +08:00
xpol de855f30d5 Better love.arg.parse_options():
1. use string.match for we are mean to match
2. better match pattern which now do not allow somthing like `not-a-valid--console`
3. use while loop which allows change loop var.

--HG--
branch : better-parse-options
2016-11-04 11:37:38 +08:00
Alex Szpakowski b38e567e74 Added a click count argument to love.mousepressed/released. Tracks double/triple/etc. clicks.
--HG--
branch : minor
2016-09-27 22:46:55 -03:00
Alex Szpakowski 54efa825c3 Merge default into minor
--HG--
branch : minor
2016-09-11 13:09:01 -03:00
Alex Szpakowski e803878445 love.event.quit("restart") now causes LÖVE to restart the Lua state after shutting it down.
Note that this isn't perfect – it won't kill running threads which aren't cleaned up by the Lua code when the main Lua state is shut down.
2016-09-08 18:42:56 -03:00
Alex Szpakowski 8fca2aa607 Call collectgarbage after love.lowmemory(), instead of before. 2016-09-08 18:11:50 -03:00
Alex Szpakowski baebb45c2e Updated the love.conf default for vsync.
--HG--
branch : minor
2016-08-29 22:53:14 -03:00
Alex Szpakowski ed933847f8 Color values in love's APIs are now in the range of [0, 1] rather than [0, 255].
--HG--
branch : minor
2016-01-31 10:49:29 -04:00
Alex Szpakowski 8566729229 Merged in Bobbyjones/love/new-conf-flag-for-android-2 (pull request #53)
New conf flag for android 2
2016-01-10 20:11:34 -04:00
BobbyJones 57467448ad Made the android set save functions private.
--HG--
branch : new-conf-flag-for-android-2
2016-01-09 10:35:20 -05:00
Alex Szpakowski a590cf17aa The default error handler resets the mouse cursor now. 2016-01-05 18:45:20 -04:00
BobbyJones 9dc50fe423 switched c.useexternalstorage to c.externalstorage
--HG--
branch : new-conf-flag-for-android-2
2016-01-02 19:16:20 -05:00
BobbyJones e3da734ace clean up 2016-01-02 18:56:23 -05:00
BobbyJones 3aa51763e2 made a method for setting external save location on android 2016-01-02 18:52:25 -05:00
Alex Szpakowski 46a2e7b85c Happy new year! 🎉 2016-01-01 00:05:06 -04:00
BobbyJones 3c83fb8626 Added a flag that changes android storage from internal to external. 2015-12-31 01:28:00 -05:00
Alex Szpakowski 925eebdaf0 Removed love.event.addListener/removeListener/clearListeners.
They take away too much control from the main game code, which makes it harder to implement things like gamestates without modifying library code.
2015-12-12 17:54:54 -04:00
Alex Szpakowski e5c0c49751 Added love.event.clearListeners. 2015-12-12 14:19:37 -04:00
Alex Szpakowski 44d4ce2c99 Show the error screen instead of just exiting after printing the error, if there's a syntax error in conf.lua (thanks Shoozza!) 2015-12-12 14:13:04 -04:00
Bart van Strien 22f2175bec Add initial video playback support for Ogg Theora videos (resolves issue #66.)
The basic APIs are:

video = love.graphics.newVideo("myvideo.ogv")

love.graphics.draw(video, ...) -- Video objects are Drawables.

video:play(), video:pause()

video:getDuration(), video:tell(), video:rewind(), video:seek(seconds)

video:getSource()

video:getWidth(), video:getHeight(), video:setFilter(min, mag)

More advanced APIs include video:setSource(source), video:getStream(), and videostream:setSync.

To use a custom pixel shader when drawing a Video, call the new TexelVideo(texcoords) function instead of Texel(texture, texcoords) in order to get the pixel colors of a video frame.
2015-12-08 22:41:19 -04:00
Alex Szpakowski 99debab3a4 Updated the readme: Xcode 7 lets you build iOS apps for your device without a registered developer account. 2015-09-14 18:50:48 -03:00