Commit Graph

306 Commits

Author SHA1 Message Date
Alex Szpakowski 3efcf3901b Removed Canvas:clear. love.graphics.clear now accepts r,g,b,a values (and defaults to 0,0,0,0 with no arguments given.) love.graphics.clear clears the content of the currently active Canvas(es.)
--HG--
branch : minor
2015-02-27 03:47:25 -04:00
Alex Szpakowski ebc68023a7 Fix many warnings about implicit integer conversions when compiling for 64 bits.
--HG--
branch : minor
2015-02-20 01:20:08 -04:00
Alex Szpakowski ac2b03e8a4 Added love.graphics.isActive. love.graphics function calls (and method calls on objects created via love.graphics) are only guaranteed to work when isActive is true, otherwise bad things might happen (the program crashing, for example.)
It's usually only false when the app is inactive on iOS, and when the window hasn't been created yet.

--HG--
branch : minor
2015-02-17 02:24:09 -04:00
Alex Szpakowski 67aede6bc0 Merged default into minor
--HG--
branch : minor
2015-02-02 01:13:21 -04:00
Alex Szpakowski 665cdc4ae7 Moved the default Font logic from the graphics.lua script to the Graphics and Font module C++ code. Moved love.graphics.setNewFont from the graphics.lua script to the Graphics module Lua wrapper code. Moved the Vera.ttf data from the graphics.lua script to its own file inside the Font module. 2015-01-31 01:10:38 -04:00
Alex Szpakowski ad1fbbf3ea Merged default into minor
--HG--
branch : minor
2015-01-29 21:27:05 -04:00
Alex Szpakowski b876255442 Cleaned up some graphics code. 2015-01-24 03:39:05 -04:00
Alex Szpakowski 970704c2b7 Added Text objects via love.graphics.newText(font [, textstring]). Reworked the internal code of Font objects to use fewer individual textures and less VRAM per object, and to be compatible with OpenGL ES. Slightly improved the performance of love.graphics.print and love.graphics.printf.
Text objects are Drawable objects that represent text on the screen. They decouple text drawing from text parsing and vertex uploading, in a similar manner to SpriteBatches. They also optionally allow efficient batching of text from the same Font in different relative coordinate transformations, without having many draw calls.

Text objects currently have the following methods:

Text:set(textstring) -- replaces any existing text in the object with the new string.
Text:setf(textstring, wraplimit, alignmode) -- replaces any existing text with formatted text using the new string.

Text:getFont() -- gets the Font object used for this Text object.
Text:getWidth() -- gets the width in pixels of the most recently added text in the Text object.
Text:getHeight() -- gets the height in pixels of the most recently added text in the Text object.

Text:add(textstring, x, y, angle, sx, sy, ox, oy, kx, ky) -- adds a new string to the text object using the specified relative coordinate transformation, without replacing existing text. This behaves much like SpriteBatch:add.
Text:addf(textstring, wraplimit, alignmode, x, y, angle, sx, sy, ox, oy, kx, ky) -- adds a new formatted string to the text object using the specified relative coordinate transformation.
Text:clear() -- clears all text from the object.

--HG--
branch : minor
2015-01-23 00:47:28 -04:00
Alex Szpakowski 5df56d041a Added GLSL ES 1.00 (OpenGL ES 2) shader support.
--HG--
branch : minor
2015-01-20 22:31:54 -04:00
Alex Szpakowski 8067d42df2 Canvases now have OpenGL ES support, updated Texture:setWrap to return false for repeat wrap modes in non-power-of-two textures if OpenGL ES 2 is used and the implementation doesn't have support for repeat on NPOT textures.
--HG--
branch : minor
2015-01-20 15:13:59 -04:00
Alex Szpakowski 18ab3973e8 Added support for ETC2/EAC compressed textures. Changed the CompressedFormat enum names to capitalize the format names (e.g. "PVR1rgba4" instead of "pvr1rgba4".) Improved sRGB support for compressed textures.
--HG--
branch : minor
2015-01-20 07:53:44 -04:00
Alex Szpakowski a7e4148869 Merged default into minor
--HG--
branch : minor
2015-01-16 15:47:26 -04:00
Alex Szpakowski c7b45b3505 Updated copyright for the new year 2014-12-31 19:32:43 -04:00
Alex Szpakowski 8edb90a719 Added support for loading BMFont bitmap font files with love.graphics.newFont (see issue #190.) Some esoteric BMFont features are not supported.
Moved the Font module Lua wrapper code out of the freetype implementation folder.

--HG--
branch : minor
2014-09-28 16:00:40 -03:00
Alex Szpakowski 34688e929e Merged default into minor
--HG--
branch : minor
2014-09-28 15:56:04 -03:00
Alex Szpakowski b70f72acb3 Fixed a couple potential memory leaks if love.graphics.newShader causes an error, and cleaned up some shader-related code. 2014-09-27 02:26:58 -03:00
Alex Szpakowski aba33bf2e7 Merged default into minor
--HG--
branch : minor
2014-09-20 00:34:34 -03:00
Alex Szpakowski 3d7a3c2c3c Improved the error message when a misspelled filename is given to love.graphics.newShader (resolves issue #928.) 2014-09-18 22:36:22 -03:00
Alex Szpakowski 3a51f0ad08 Changed the love.graphics internal code to always use a default shader when none is set externally, and replaced the deprecated OpenGL vertex attribute code with the equivalent generic vertex attribute functions.
This will simplify the code and make it more maintainable when OpenGL ES 2+ support is added, compared to using the deprecated VA functions on desktop GL and the generic VA functions on GLES.

--HG--
branch : minor
2014-08-26 03:24:42 -03:00
Alex Szpakowski 71c71985d3 Merged default into minor
--HG--
branch : minor
2014-08-21 16:53:43 -03:00
Alex Szpakowski 8ffe610659 Added love.graphics.getStats. It returns a table with performance-related graphics statistics. Currently it contains these fields:
drawcalls: The number of internal draw calls made so far in the current frame.

canvasswitches: The number of times the active Canvas has been changed so far in the current frame.

texturememory: The approximate amount of video memory (in bytes) used by OpenGL textures created by Images, Canvases, and Fonts.

images: The number of active Image objects.

canvases: The number of active Canvas objects.

fonts: The number of active Font objects.
2014-08-21 15:01:29 -03:00
Alex Szpakowski 19bbf6d3ff Merged bartbes/love-experiments/stencil-functions into minor
--HG--
branch : minor
2014-08-09 20:18:09 -03:00
Alex Szpakowski 9b1f7d7a6e Merged default into minor
--HG--
branch : minor
2014-08-09 19:55:29 -03:00
Alex Szpakowski d5ccdc040a Cleaned up some Proxy-related code. 2014-08-09 16:18:22 -03:00
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 0749272632 Renamed love.graphics.drawStencil to love.graphics.stencil.
--HG--
branch : stencil-functions
2014-08-08 00:56:52 -03:00
Alex Szpakowski 2b70d84611 Replaced the old stencil API with love.graphics.drawStencil(stencilfunc), love.graphics.setStencilTest(enable, invert), and love.graphics.getStencilTest.
Draw to the stencil buffer (rather than the color buffer) using love.graphics.drawStencil with a function which draws geometry. Once the stencil buffer has been drawn to, use love.graphics.setStencilTest before drawing to let drawn geometry be affected by it.

love.graphics.clear (and Canvas:clear) will clear both the color and stencil buffers by default. love.graphics.clear("stencil") will clear only the stencil buffer.

--HG--
branch : stencil-functions
2014-08-08 00:25:44 -03:00
Alex Szpakowski 53e63d48c9 Merged default into minor
--HG--
branch : minor
2014-08-07 18:10:19 -03:00
Alex Szpakowski afc505e183 Added stack type enums to love.graphics.push (resolves issue #906.) Current enums are "transform" and "all". "transform" is the default (for compatibility.) When love.graphics.push("all") is used, love.graphics.pop() will restore all love.graphics module state to what it was when push was called.
Updated the graphics code to use a custom matrix stack rather than OpenGL1's APIs.
2014-08-06 22:25:29 -03:00
Alex Szpakowski aa05664d4c Merged default into minor
--HG--
branch : minor
2014-07-30 01:32:10 -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 75cf164507 Error when the second argument to love.graphics.newImage isn't a table.
--HG--
branch : minor
2014-07-10 16:13:42 -03:00
Alex Szpakowski a1d67f0788 Replaced love.graphics.isSupported and love.graphics.getSystemLimit with love.graphics.getSupported and love.graphics.getSystemLimits, which return tables with graphics feature / system limit enum names as keys, and support status / limit numbers as values.
Removed the 'hdrcanvas', 'dxt', and 'bc5' graphics feature enums now that they're deprecated in 0.9.x in favour of getCanvasFormats and getCompressedImageFormats.

--HG--
branch : minor
2014-07-08 14:09:00 -03:00
Alex Szpakowski e3f9c0dca4 Merged default into minor
--HG--
branch : minor
2014-07-08 14:01:55 -03:00
Alex Szpakowski d11ccd0e69 Added love.graphics.getCanvasFormats and love.graphics.getCompressedImageFormats, and removed love.graphics.hasCanvasFormat.
The two new functions return tables containing the names of all relevant formats as keys, and boolean values indicating whether the formats are supported.
2014-07-05 16:22:52 -03:00
Alex Szpakowski 56653fa946 Merged default into minor
--HG--
branch : minor
2014-06-19 15:06:59 -03:00
Alex Szpakowski 4c67a94ba3 Hopefully fixed issue #898, and cleaned up code for love.graphics.getRendererInfo. 2014-06-19 03:02:37 -03:00
Alex Szpakowski 2bfa8dbfb5 Merged default into minor
--HG--
branch : minor
2014-06-16 03:09:04 -03:00
Alex Szpakowski 23d3cbc2e2 Renamed all cases of FSAA to the more accurately-named MSAA. The FSAA names (canvas:getFSAA, t.window.fsaa, etc.) still exist for now, for backwards-compatibility. 2014-06-13 23:28:00 -03:00
Alex Szpakowski 8483ea31a1 Changed love.graphics.newImage's optional second argument to be a table of flags. Current flags are 'mipmaps' and 'srgb'.
If mipmaps are enabled on image creation, the image will use the default mipmap filter (now 'nearest' by default.) Image:setMipmapFilter will error if the image was not created with mipmaps enabled.

--HG--
branch : minor
2014-06-05 17:19:31 -03:00
Alex Szpakowski 3792dee4b4 Backout changeset 57172a7f03452a6b07f346e850f3e1020e230f46 2014-06-05 14:59:29 -03:00
Alex Szpakowski e9e303c1e8 Changed embedded Lua scripts to be included in the love source via C++11's raw string literals instead of a generated header file. Removed auto.lua.
As a result, love can be compiled immediately after editing an embedded Lua script.

Visual Studio 2013 or newer is required for C++11 raw string literals in Windows.
2014-06-05 13:42:03 -03:00
Alex Szpakowski bfa3ec9369 Merged default into minor
--HG--
branch : minor
2014-06-05 03:02:50 -03:00
Alex Szpakowski 79b453653a Added love.joystick.loadGamepadMappings (resolves issue #842), and Joystick:saveGamepadMapping.
The latter returns a mapping string, and the former loads a newline-separated list of mapping strings.
2014-06-04 15:50:06 -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 724bdbd296 love.graphics.newImage, love.image.newImageData, etc. no longer leave Lua-owned FileData objects floating around waiting to be GC'd when called with filename arguments, resulting in less memory use on startup (resolves issue #890.)
Moved love.filesystem Lua wrapper code from src/modules/filesystem/physfs/ to src/modules/filesystem/.
2014-06-02 00:22:41 -03:00
Alex Szpakowski 53b20b63a5 Merged default into minor
--HG--
branch : minor
2014-05-21 21:16:37 -03:00
Alex Szpakowski 408a593113 Added support for several specific Canvas formats. Also added love.graphics.hasCanvasFormat.
The list includes RGBA with 4-bit components, RGBA with 10-bit R, G, and B components and a 2-bit alpha component, RGB with 9-bit RGB components and a 5-bit exponent component (for HDR rendering), and several more.

--HG--
branch : Canvas-formats
2014-05-13 20:54:58 -03:00
Alex Szpakowski 5428a5d75f Backout changeset b3928e24add23da69dcd90c34985cd6a05454be0 2014-05-03 22:07:32 -03:00
Alex Szpakowski 4bc96f1bf6 Internally compose and pass an array of shader source codes to OpenGL, instead of relying on #line to make sure the line number is correct for shader error messages (resolves issue #882) 2014-05-03 21:43:20 -03:00