Commit Graph

81 Commits

Author SHA1 Message Date
Alex Szpakowski f12596dd19 More code restructuring.
Move all love.graphics functionality that doesn’t call OpenGL out of the OpenGL backend Graphics class.

--HG--
branch : minor
2016-12-30 18:36:54 -04:00
Alex Szpakowski c7419e0e37 Move most graphics Font code out of the opengl subfolder.
--HG--
branch : minor
2016-12-30 14:19:07 -04:00
Alex Szpakowski a78fa39113 Added “none” blend mode. This is equivalent to setBlendMode(“replace”, “premultiplied”) (which also effectively disables blending) but doesn’t require explicitly setting the alpha multiplication mode.
--HG--
branch : minor
2016-12-28 12:32:37 -04:00
Alex Szpakowski 19aee7e75c Minor optimizations to love.graphics.draw(texture).
--HG--
branch : minor
2016-12-28 01:24:21 -04:00
Alex Szpakowski 603c3e43d5 Moved line and shape drawing code out of the opengl folder, since it no longer directly calls any OpenGL functions.
--HG--
branch : minor
2016-12-27 23:21:25 -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
Alex Szpakowski d7feb20df9 Remove love.timer SDL implementation files, since they don’t do anything.
--HG--
branch : minor
2016-12-10 16:21:48 -04:00
Alex Szpakowski 7d68a72d5f Add audio Filter files to the Xcode project
--HG--
branch : minor
2016-12-03 16:35:12 -04:00
Alex Szpakowski 0126f7986a Add missing files to the Xcode project
--HG--
branch : minor
2016-11-30 18:04:10 -04:00
Alex Szpakowski 0a3adc0839 Unify pixel format enums for ImageData, CompressedImageData, and Canvas into a single PixelFormat enum.
Replace love.graphics.getRawImageFormats and love.graphics.getCompressedImageFormats with love.graphics.getImageFormats.

--HG--
branch : minor
2016-11-27 22:53:23 -04:00
Alex Szpakowski 5bf25007da Fix building for iOS
--HG--
branch : minor
2016-11-25 23:21:08 -04:00
Alex Szpakowski 9930b81f94 The Xcode project now recognizes frameworks placed in love/platform/Xcode/macosx/Frameworks/ when building for macOS (closes issue #1230).
--HG--
branch : minor
2016-11-25 23:10:29 -04:00
Alex Szpakowski 14aa6965b3 Added Transform objects to love.math (resolves issue #1228).
- Added love.math.newTransform.
- Added love.graphics.applyTransform and love.graphics.replaceTransform.
- love.graphics.draw/print/printf, Text:add/addf, and SpriteBatch:add can accept a Transform argument.
- love.graphics.push can accept an optional Transform as a second argument, which will apply the Transform after pushing the matrix stack,
- Shader:send can accept Transform objects when sending to a mat4 uniform variable.

--HG--
branch : minor
2016-11-24 21:30:45 -04:00
Alex Szpakowski a245819ae1 Fix compilation on macOS and iOS. Minor cleanup.
--HG--
branch : minor
2016-11-20 10:04:08 -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
James Watkins-Harvey 8885fc621d Updated luasocket to 3.0rc1 (git commit 316a945)
--HG--
branch : minor
2016-10-01 16:30:53 -04:00
Alex Szpakowski ddc4b06eba Moved the base Decoder implementation out of the lullaby subfolder.
--HG--
branch : minor
2016-10-23 21:32:20 -03:00
Alex Szpakowski be1a59fb18 Disable 64 -> 32 bit integer conversion warnings in Xcode. lodepng and luasocket both generate a lot of them...
--HG--
branch : minor
2016-10-18 23:35:37 -03:00
Alex Szpakowski 2e016810c9 Update Xcode project
--HG--
branch : minor
2016-10-18 22:08:25 -03:00
Alex Szpakowski bfb00239fd Fix compiling for iOS
--HG--
branch : minor
2016-09-29 21:21:53 -03:00
Alex Szpakowski e9ac008f43 Merge default into minor
--HG--
branch : minor
2016-08-13 12:41:14 -03:00
Alex Szpakowski d2c2c717e4 Mac: treat folders with the .love extension as packages that can be double-clicked to open with LÖVE (resolves issue #1186). 2016-07-20 19:36:43 -03:00
Alex Szpakowski e71f95595c ImageData (and Images loaded from them) now support different data formats. Resolves issue #1048.
Currently exposed formats are rgba8 and rgba16 (normalized), and rgba16f and rgba32f (floating-point). Some systems, especially mobile ones, won't support every format when creating a love.graphics Image. Use love.graphics.getRawImageFormats to check for support.

love.image.newImageData now takes an optional format parameter as its third argument when creating an empty sized ImageData. It defaults to rgba8.

16-bit PNGs, .hdr images, and floating-point OpenEXR images can now be loaded via love.image.newImageData and love.graphics.newImage.

--HG--
branch : minor
2016-05-22 15:28:20 -03:00
Alex Szpakowski 31b44797bc Merge default into minor
--HG--
branch : minor
2016-05-12 18:20:01 -03:00
Alex Szpakowski 9bebe9e4e8 Updated the version. 2016-05-02 18:03:57 -03:00
Alex Szpakowski 9701e2a262 Fixed love on iOS 6 crashing on launch due to GameController.framework being missing (see issue #1155). Some further issues remain, for now. 2016-04-10 21:52:16 -03:00
Bart van Strien 3a2e859acd Add love.math.hash, which supports MD5/SHA-1/SHA-2.
--HG--
branch : minor
2016-04-02 18:39:53 +02:00
Alex Szpakowski 9ee1d3cf2f Increased the version on Windows / OS X / iOS
--HG--
branch : minor
2016-03-03 21:30:46 -04:00
Alex Szpakowski 57697b372b New Mac and iOS icons 2016-02-12 17:07:24 -04:00
Alex Szpakowski 46a2e7b85c Happy new year! 🎉 2016-01-01 00:05:06 -04:00
Alex Szpakowski 2cadb30ecf Updated the version to 0.10.1. 2015-12-29 22:52:16 -04:00
Alex Szpakowski aad3c0d4d9 Fixed building for OS X. 2015-12-15 15:02:23 -04:00
Alex Szpakowski cdc019b96b libmodplug is now used on iOS. 2015-12-15 14:03:44 -04:00
Alex Szpakowski 03032034e9 Fixed the Theora framework having its headers removed when love is built for Mac OS X. 2015-12-14 15:42:03 -04: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 3eb363059b Added love.event.addListener and removeListener.
addListener takes a function, and names of events that will trigger the function when they're processed inside love.event.poll or love.event.wait. When the given listener function is called, the name of the event as well as all of the event's arguments are passed to the function.

If addListener is called multiple times with the same function and events, it will not add the function more than once.

removeListener takes a function and removes it from all events it was previously added to.
2015-12-11 20:14:52 -04:00
Alex Szpakowski 52b1bd78f2 Implemented LuaJIT FFI versions of love.math.random and RandomGenerator:random. 2015-12-10 12:45:53 -04:00
Alex Szpakowski 27ec680f50 Updated the Xcode project files for video support. Theora.framework is now required for building for OS X, and the iOS dependencies have been updated to include the theora library. 2015-12-08 22:44:19 -04:00
Alex Szpakowski 374d1ae0e1 Implemented LuaJIT FFI versions of love.math.noise, love.math.gammaToLinear, and love.math.linearToGamma.
The new versions of the functions are only used if LuaJIT's JIT compiler is enabled.

Those functions are often combined with ImageData:mapPixel or ImageData:setPixel, which also have LuaJIT FFI versions in 0.10.0 - so without JIT-able implementations of the math functions, the FFI code in the ImageData methods would not be JIT-compiled and would end up taking up to 10 times as long to execute compared to the non-FFI versions in 0.9.2.
2015-12-08 21:24:16 -04:00
Alex Szpakowski fcb76693c8 Added the script used to compile LuaJIT for iOS. 2015-12-04 21:13:09 -04:00
Alex Szpakowski 77998c707d Added the ability to use ASTC compressed textures, when the system supports them. 2015-11-28 14:55:26 -04:00
Alex Szpakowski f1d0187a58 Fixed the iOS build. 2015-11-25 15:49:24 -04:00
Alex Szpakowski ac99a47386 Moved most of the ParticleSystem code from modules/graphics/opengl/ to modules/graphics/ 2015-11-25 04:29:00 -04:00
Alex Szpakowski e9c75c342e Text:add and Text:addf now return index numbers which can be used as arguments to Text:getWidth and text:getHeight to determine the (pre-transformed) width and height of specific text within the Text object. 2015-11-14 18:51:43 -04:00
Alex Szpakowski 00845c0ad0 Added love.graphics.intersectScissor(x, y, w, h). Resolves issue #1071.
It sets the active scissor rectangle to the intersection of the existing scissor (if any) and the specified rectangle.
2015-09-16 19:04:57 -03:00
Alex Szpakowski 9c1214c77a Updated the Xcode project to use Xcode 7's recommended settings. 2015-09-16 16:36:44 -03: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
Alex Szpakowski d30e60f8d7 Disable bitcode (for now) when building the iOS app, since the dependencies don't have it. 2015-09-09 23:28:48 -03:00
Alex Szpakowski d3d970b925 Renamed iOS.mm and iOS.h to ios.mm and ios.h, to match the naming conventions of other files. 2015-08-27 18:46:04 -03:00
Alex Szpakowski e44f20fdc6 Renamed OSX.mm/OSX.h to macosx.mm/macosx.h to match love's file naming conventions. 2015-08-15 00:41:45 -03:00