Commit Graph

415 Commits

Author SHA1 Message Date
Alex Szpakowski 37472d6f5e Add 'usedpiscale' boolean (true by default) to love.window.setMode's settings table and love.conf's t.window table. Add love.window.getNativeDPIScale.
When usedpiscale=false, love will no longer automatically scale coordinates by the screen's DPI scale factor (so all coordinates will be in pixels), even when highdpi=true. love.window.getDPIScale will return 1, love.graphics.newCanvas will default to a dpi scale of 1 instead of the screen's dpi scale, etc.

love.window.getNativeDPIScale() will return the screen's DPI scale as reported by the OS no matter what usedpiscale is set to.
2019-06-24 21:54:09 -03:00
Alex Szpakowski db1c982f76 boot.lua and nogame.lua line numbers match the source code once they're embedded into love (thanks, pgimeno!) 2019-04-06 13:08:25 -03:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Alex Szpakowski 324a290040 The code related to t.audio.mixwithsystem=true is run before the audio module is loaded. Fixes issue #1430. 2018-12-26 11:36:23 -04:00
Alex Szpakowski d4762b4612 Add love.window.getDisplayOrientation and a love.displayrotated callback. Resolves issue #1441.
Note that this tracks screen orientation, rather than device orientation.
2018-12-17 16:19:56 -04:00
Alex Szpakowski 388c93b049 nogame screen: escape key quits love. 2018-04-01 15:05:39 -03:00
Alex Szpakowski 3fe9e51a46 nogame screen: bring back double-tap-to-exit on touch screens. 2018-04-01 13:01:02 -03:00
Bart van Strien 2f17cab3b4 Prevent out-of-bounds access in Text:add when an empty string is added (fixes #1372) 2018-01-30 17:31:44 +01:00
Bart van Strien fd514d8176 Update some more copyright notices
I am so good at using search/replace I definitely didn't need a second commit
for this.
2018-01-03 19:55:02 +01:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Alex Szpakowski 1abc7b20f7 Show an error instead of the nogame screen if a nonexistant folder is passed in as a source game directory. 2017-12-26 20:17:43 -04:00
Alex Szpakowski 9fa73f8b87 Several love.data functions now take an enum ("data" or "string") to determine whether they return a Data object or a string.
Changed functions are love.data.compress, decompress, encode, decode, and pack.
2017-12-22 16:13:20 -04:00
rude 5950688770 Added new nogame screen (Duckloon). 2017-12-13 22:15:23 +01:00
Bart van Strien d19129de5b Regenerate boot.lua.h
Because of course that went wrong. I'm not sure whether it's the merge's fault,
or the merged in boot.lua.h was outdated. Either way, here we are.

--HG--
branch : minor
2017-11-03 13:38:04 +01:00
Bart van Strien 59fb287bd1 Merged in SoniEx2/love/minor (pull request #96)
Improve argument handling

--HG--
branch : minor
2017-11-03 12:27:10 +00:00
Bart van Strien 790625f0c4 Make love.run and love.errhand return a function for their main loop instead (resolves #1268)
This way lua code can stop every iteration (usually frame), and return to the
c++ code, so love can work in environments with co-operative multithreading
like emscripten.

It may be interesting to see if we can make this optional, so this only happens
on platforms that require it, but I doubt it's significant in the grand scheme
of things.

--HG--
branch : minor
2017-10-30 13:30:19 +01:00
Alex Szpakowski d882c6811b Make love.run's code style more consistent.
--HG--
branch : minor
2017-10-21 03:12:37 -03:00
Alex Szpakowski ac84589c57 Backed out changeset 1b487edea8a8
--HG--
branch : minor
2017-09-30 17:02:16 -03:00
Alex Szpakowski 8fa511aea8 Move boot.lua into src/modules/love/
--HG--
branch : minor
2017-09-30 16:41:45 -03: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 844900db39 Rename all cases of 'pixel density' to 'DPI scale' in love's APIs.
--HG--
branch : minor
2017-09-24 16:09:05 -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
Bart van Strien 03b863d788 Simplify love.audio's Pool class
Move most logic back to Source. Pool now simply contains a list of playing
sources and a mutex. Also gets rid of the pause/pauseAtomic duplication in
Source, since it can now request a lock from Pool itself.

--HG--
branch : minor
2017-02-11 21:41:22 +01:00
Alex Szpakowski a6669a8bb2 Merge default into minor
--HG--
branch : minor
2017-01-21 12:06:35 -04:00
Bart van Strien a9a294beb3 Rebuild boot.lua.h 2017-01-15 20:26:21 +01: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
Alex Szpakowski 0d2e08baff Implement automatic batching for points, lines, shapes, and images/quads.
The above are batched together into a single draw call when called without other drawing calls in between, as long as the following criteria are met:

- The texture is the same.
- The primitive type is the same (points cannot be batched with non-points).
- The love.graphics state is the same (aside from the current color - i.e. setColor - and the transform state).
- The active shader’s uniform values are the same.

You can examine the ‘drawcalls’ field of love.graphics.getStats() to help determine if your code is allowing for optimum batching.

--HG--
branch : minor
2016-12-27 21:02:58 -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