Commit Graph

65 Commits

Author SHA1 Message Date
Alex Szpakowski 528c1e2390 love.filesystem's loaders in the package.loaders table error instead of crashing when no argument is given to them (resolves issue #1504). 2019-08-02 21:04:22 -03:00
Alex Szpakowski 459d31db7e Fix the Data-returning variant of love.filesystem.read/File:read to return the size that was read. Now it's consistent with the string-returning variant. 2019-07-31 19:24:17 -03:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Alex Szpakowski 0cefb12c13 Add a variant of love.filesystem.getInfo which filters based on file type. getInfo(filename, "directory") will only return info for non-symlinked directories, for example. 2018-03-24 14:43:56 -03:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Alex Szpakowski 0b7cb4a353 Add variants of File:read and love.filesystem.read which take an enum to determine whether they return a FileData or string. 2017-12-22 16:32:54 -04:00
Alex Szpakowski 640e8f0d2e love.filesystem.mount can accept a Data object containing zipped data.
- Add mount(Data, archivename, mountpoint [, appendtopath]). 'archivename' must be a string that has not been used with mount before.
- Add mount(FileData, mountpoint [, appendtopath]). The file path of the FileData is used as the archive name.
- Add unmount(Data).
- unmount(archivename) also works.
2017-12-16 23:09:15 -04:00
Bart van Strien 19ddc27069 Use a seekless implementation of File:lines/love.filesystem.lines
The previous algorithm would seek every time. This meant that although reading
from a filesystem would be quick (especially with disk caching), but reading
from a zip would be extremely slow.

The new version is rouhgly as fast on a filesystem, but appears not to slow
down on zips at all. Not in my tests, at least.

--HG--
branch : minor
2017-11-11 21:42:52 +01:00
Bart van Strien 9e4374935d Show (short) list of possible enum values when an invalid value is encountered (resolves #1318)
All enum errors have (hopefully) been changed to a luax_enumerror, which has a
fixed error message. If additionally a list of valid options is passed, it
lists that in the error message. For every enum error with few options I've
implemented this using a getConstants call.

This solution has been designed specifically to reduce the number of template
instantiations (as I've been told that was a concern). All new template code
happens in places where there already was an instantiation of the relevant
StringMap. Of course there is still std::vector<std::string>...

--HG--
branch : minor
2017-10-02 17:11:53 +02:00
Alex Szpakowski bdc6eb3b29 Fix copy/paste error in the love.filesystem.isDirectory deprecation message.
--HG--
branch : minor
2017-09-25 15:52:49 +00:00
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 4ee85e1793 love get* APIs which return tables with fields can optionally accept a table argument to fill in, instead of creating a new table.
--HG--
branch : minor
2017-09-22 19:47:55 -03:00
Alex Szpakowski 23c9edcc52 Hopefully fix the build
--HG--
branch : minor
2017-08-27 18:17:30 -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 fee157b6b9 Functions that take a boolean argument now properly type-check for it.
--HG--
branch : minor
2017-08-14 22:56:20 -03:00
Alex Szpakowski 2dd6408d00 Images/[Compressed]ImageData can be created using any Data, instead of just files or FileData.
--HG--
branch : minor
2017-08-05 23:55:20 -03:00
Alex Szpakowski 17cf7bba83 Cleaned up love.graphics.newShader's wrapper code a bit.
--HG--
branch : minor
2017-07-29 23:09:45 -03:00
Alex Szpakowski 5ef6730497 Added a variant of love.graphics.captureScreenshot which takes a single filename parameter. Resolves issue #1293.
--HG--
branch : minor
2017-07-29 12:54:53 -03:00
Alex Szpakowski 94ce558126 require now looks for both .dylib and .so extensions for C dynamic libraries in macOS, instead of just .so.
It also now replaces all occurrences of '??' and '?' in the path with the module filename and module name respectively, rather than just the first occurrence.

--HG--
branch : minor
2017-07-27 19:54:56 -03:00
Alex Szpakowski 28ed5e5a4b Actually merge the latest default into minor…
--HG--
branch : minor
2017-01-12 22:55:19 -04:00
evan yeung 8d269226c0 Let the love.filesystem loader support the template path for multiple interrogation mark. 2017-01-04 02:26:22 +00:00
evan yeung 9b77dbe262 Let the love.filesystem loader support the template path for multiple interrogation mark. 2017-01-04 01:56:27 +00:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Bart van Strien 5d43c9601a Automatically deduce the type in luax_pushtype, if possible
--HG--
branch : dynamiccore2
2016-11-13 17:38:42 +01:00
Bart van Strien 7dd960619d Automatically deduce the type in luax_checktype, luax_getmodule, luax_optmodule and luax_totype
--HG--
branch : dynamiccore2
2016-11-13 17:13:40 +01:00
Bart van Strien c761202486 Build type information on first use (load-time), instead of using a hardcoded list
--HG--
branch : dynamiccore2
2016-11-13 16:38:57 +01:00
Alex Szpakowski ef61573cd3 Merge default into minor
--HG--
branch : minor
2016-08-29 22:41:24 -03:00
Alex Szpakowski acde58d311 Improved the error message when nil is passed as the first argument to love.image.newImageData (resolves issue #1205). 2016-08-21 11:22:21 -03:00
Bart van Strien db8e7a7670 Merge default into minor
--HG--
branch : minor
2016-04-02 17:19:20 +02:00
Alex Szpakowski 1b1572ad85 love.filesystem.mount accepts DroppedFiles in the first parameter. You could previously pass in DroppedFile:getFilename() and it would work too, this just makes it a bit nicer. 2016-03-31 17:58:27 -03:00
Alex Szpakowski 734789eb93 Added love.math.encode(format, data | string [, linelength]) and love.math.decode(format, data | string). Current formats are "base64" and "hex". The optional line length only applies to base64 and specifies the maximum number of characters per line in the encoded string.
Removed the variant of love.filesystem.newFileData which decoded a base64-encoded string since it's redundant.

--HG--
branch : minor
2016-03-28 19:28:40 -03:00
Alex Szpakowski 2e5f385be3 Merge default into minor
--HG--
branch : minor
2016-03-03 21:28:30 -04:00
Alex Szpakowski f51bbb8462 Cleaned up some StrongRef-related code. 2016-03-01 18:57:17 -04:00
Bart van Strien 33341de7bc Rewrite the c module loader, adding a search path (fixes #1050)
Note: also removes the restriction that only fused games can load libraries from
their save folders.

--HG--
branch : minor
2016-02-26 15:24:01 +01: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 2c550fbf6d now I removed it from the wrap :)
--HG--
branch : new-conf-flag-for-android-2
2016-01-09 19:47:45 -05:00
BobbyJones e855f2ae01 removed the isAndroidSaveExternal from the wrap
--HG--
branch : new-conf-flag-for-android-2
2016-01-09 19:45:47 -05: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
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 de0b63a48d Re-added love.filesystem.exists.
If PhysFS 2.1-alpha is used and a directory is symlinked, isDirectory will return false (whereas it will return true when PhysFS 2.0 is used.) exists will return true in all cases.
2015-12-11 23:17:49 -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 0f986b10aa Cleaned up some code, the 'ry' parameter of love.graphics.rectangle now defaults to the value of 'rx' rather than defaulting to 0. 2015-05-27 17:36:27 -03:00
Alex Szpakowski 811b2db466 The full executable path, rather than argv[0], is now used when determining whether the executable is fused (resolves issue #1043.) 2015-05-04 10:38:28 -03:00
Alex Szpakowski e7f56241ec Removed the callback argument from love.filesystem.getDirectoryItems (resolves issue #877.)
Cleaned up the getDirectoryItems ccde to no longer call Lua API functions from Filesystem.cpp (now it's all in wrap_Filesystem.cpp.)
2015-04-25 00:16:10 -03:00
Alex Szpakowski 2844499ef7 Added the ability to have custom vertex attributes in Meshes (resolves issue #768.)
Added new love.graphics.newMesh variants: newMesh(vertexformat, vertices [, drawmode, meshusage]) and newMesh(vertexformat, numvertices [, drawmode, meshusage]).

Replaced the regular love.graphics.newMesh variants with newMesh(vertices [, drawmode, meshusage]) and newMesh(numvertices [, drawmode, meshusage]). To use an image or canvas with a mesh, use Mesh:setTexture.

vertexformat is a table with the following prototype:
{
  {attributename, datatype, components},
  {attributename, datatype, components},
  ...
}

Where attributename is the name of the vertex attribute (can be the built-in names 'VertexPosition', 'VertexTexCoord', or 'VertexColor', or a custom name for use in a vertex shader), datatype is the type of values used for the attribute ('float' or 'byte'), and components is the number of components in the vertex attribute (between 1 and 4.)

The vertex format is used to determine the layout of the vertices in the mesh, for example the 'regular' newMesh variants use this vertex format:
format = {
  {"VertexPosition", "float", 2},
  {"VertexTexCoord", "float", 2},
  {"VertexColor", "byte", 4},
}

The mesh usage parameter accepts the same constants as the spritebatch usage hint in love.graphics.newSpriteBatch - "dynamic", "static", and "stream".

Mesh:setVertex now sets *all* vertex attributes for a specific vertex in the Mesh.

Added Mesh:setVertexAttribute(vertexindex, attributeindex, attributevalue1, ...), which sets the values for a specific vertex attribute in a specific vertex in the Mesh (resolves issue #784.)

Added Mesh:getVertexFormat and Mesh:flush.

Added Mesh:setAttributeEnabled(attributename, enable) and Mesh:isAttributeEnabled(attributename), to enable or disable the use of a specific attribute when drawing the Mesh.

Added Mesh:attachAttribute(attributename, mesh), which makes the Mesh use a vertex attribute from another mesh when drawing the Mesh. This can be used to separate out vertex attributes which are updated at different rates into different meshes, and to share vertex data between multiple meshes.

Removed Mesh:setVertices, Mesh:getVertices, and Mesh:setVertexColors.
2015-04-08 22:24:17 -03:00
Alex Szpakowski 2f419c1c83 Replaced most cases of type bits and type name strings in love's Lua wrapper code with type id's.
--HG--
branch : minor
2015-03-01 18:32:41 -04:00
Alex Szpakowski d229fb1129 Merged default into minor
--HG--
branch : minor
2015-02-09 21:43:31 -04:00
Alex Szpakowski 320ec8b472 Added love.filesystem.getRealDirectory(filepath).
It returns the platform-specific full path of the directory containing the filepath (rather than the file.) For example, if 'saves/save1.txt' exists in the save directory, love.filesystem.getRealDirectory("saves/save1.txt") will equal love.filesystem.getSaveDirectory().
2015-02-09 17:43:59 -04:00