Commit Graph

1021 Commits

Author SHA1 Message Date
Alex Szpakowski 2ad1712eaf Font:getWrap can now accept a colored text table in the same format as what's accepted by love.graphics.print. Resolves issue #1108.
The returned table of strings still has no color information.
2015-12-20 19:25:09 -05:00
Alex Szpakowski 48345bd58c Changed the optional 'multiply alpha' boolean argument in love.graphics.setBlendMode to be an enum with constants 'alphamultiply' and 'premultiplied'.
The default value for the second argument of setBlendMode is 'alphamultiply'.
2015-12-16 14:53:16 -04:00
Alex Szpakowski dad93959f9 Fixed a memory leak. 2015-12-15 21:51:47 -04:00
Alex Szpakowski 5460a5b872 Hopefully work around an nvidia graphics driver bug in OS X.
Some nvidia GPUs in OS X fail to render geometry that uses an OpenGL index buffer and client-side vertex arrays. This affected ParticleSystems and love.graphics.print. The code for those has been changed to use a client-side index array instead of an OpenGL index buffer.
2015-12-15 21:50:38 -04:00
Alex Szpakowski 0a059814e7 Revamped love.graphics.stencil and love.graphics.setStencilTest:
- Each canvas (and the screen) has an invisible stencil value associated with each pixel. Stencil values are between [0, 255].

- love.graphics.stencil takes a function argument which draws things, and makes the geometry of what's drawn set the stencil values of pixels instead of coloring the pixels.

- Its second argument is a 'stencil action' which determines what happens to the stencil values of pixels. The possible stencil actions are 'replace' (the default), 'invert', 'increment', 'decrement', 'incrementwrap', and 'decrementwrap'. If the stencil action is 'replace', the third argument of love.graphics.stencil is a number between [0, 255] which determines what the stencil value of each pixel that touches drawn objects is replaced with.

The fourth argument is a boolean which determines whether the previous stencil values of all pixels on-screen should be kept (true), or cleared to 0 (false, the default.) love.graphics.clear also clears the stencil values.

- love.graphics.setStencilTest allows for anything drawn to be affected by a comparison between the arguments to setStencilTest and the existing stencil value of the pixels that are touched by what's drawn. Its first argument is a compare mode which can be 'equal', 'notequal', 'less', 'lequal', 'gequal', or 'greater', and the second argument is an integer value (between 0 and 255) used in the comparison with the value in the stencil buffer.

For example, love.graphics.setStencilTest("greater", 0) will cause any geometry drawn afterwards to only appear on pixels whose stencil value is greater than 0.
2015-12-14 20:43:39 -04:00
Alex Szpakowski c73fb2ef98 Fixed stenciling inside a Canvas in OpenGL ES 2. 2015-12-13 23:50:23 -04:00
Alex Szpakowski 493d5d6911 Removed more dead video remote code. 2015-12-13 21:54:55 -04:00
Alex Szpakowski 9573b415a3 Whoops... 2015-12-13 21:45:59 -04:00
Alex Szpakowski 834bd149d5 Fixed Video:setSource(nil). 2015-12-13 21:45:25 -04:00
Alex Szpakowski 2d7a99a3ae Set the internal wrap mode for videos to clamp. Fixes video playback on some OpenGL ES devices. 2015-12-13 21:22:36 -04:00
Alex Szpakowski 77b832057d Fixed the Windows build... 2015-12-11 00:21:33 -04:00
Alex Szpakowski 7769090c1f Mesh:setVertices can now accept a Data object. 2015-12-11 00:07:42 -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 5bdd858487 Fixed compiler warnings when new versions of FreeType are used. 2015-11-30 23:36:17 -04:00
Alex Szpakowski 6036454a20 Fixed up some code. 2015-11-30 02:26:59 -04:00
Alex Szpakowski 4c82c96369 Added a new texture wrap mode "clampzero", which outputs transparent black (or opaque black for textures without an alpha channel) rather than the texture's edge colors, when it's drawn or sampled from outside of its regular texture coordinate range. 2015-11-30 02:22:20 -04:00
Alex Szpakowski 2c4e713114 Imported some of the dynamiccore branch from love-experiments:
- Type names for love's Lua objects are specified as an argument to luax_register_type, rather than being statically defined in an array.

- luax_register_type takes a variable number of method array arguments, for registering superclass methods without copying them into the subclass' method array.

Also removed most of the header declarations for wrapper functions.
2015-11-29 20:38:12 -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 890e8f1086 Simplified the code for love.graphics.arc. 2015-11-27 17:49:17 -04:00
Alex Szpakowski ebf6ca822c Added an optional 'startvertex' argument to Mesh:setVertices, which specifies a (1-based) offset within the Mesh's vertices to replace. 2015-11-26 23:04:04 -04:00
Alex Szpakowski 3c1c13793e Added SpriteBatch:attachAttribute(attributename, mesh), which lets SpriteBatches use per-vertex information from a vertex attribute in a Mesh when drawing.
Each sprite in a SpriteBatch has 4 vertices in the following order: top-left, bottom-left, top-right, bottom-right. The index returned by SpriteBatch:add (and used by SpriteBatch:set) can be multiplied by 4 to determine the first vertex in a specific sprite.
2015-11-26 21:24:29 -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 7ebef76b24 Added love.window.setScreenSaverEnabled and love.window.isScreenSaverEnabled (resolves issue #1088.) 2015-11-24 22:16:40 -04:00
Alex Szpakowski ec17811aa9 The 'dimension' field is no longer needed when passing matrices-as-flat-tables to Shader:sendMatrix. 2015-11-24 15:14:57 -04:00
Alex Szpakowski 75faf77d66 Improved the performance of Shader:send when matrices are used. 2015-11-24 14:25:52 -04:00
Alex Szpakowski a81621df82 Removed the 'multicanvas' GraphicsFeature constant since it's redundant (the love.graphics.getSystemLimits().multicanvas number can be used instead.) 2015-11-14 19:33:56 -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 7043b5314d Added high-dpi / retina support to the no-game screen; additional minor tweaks and cleanup. 2015-11-11 19:35:45 -04:00
Alex Szpakowski 0558fcdbd4 Added Source:getDuration (thanks Boolsheet!)
For streaming sources, the duration may not always be sample-accurate and may return -1 if it cannot be determined at all.
2015-11-07 01:49:37 -04:00
Alex Szpakowski bb24c1b7a6 Mesh:getVertexMap now returns nil rather than an empty table, if no vertex map is set (resolves issue #1096.) 2015-11-02 19:37:18 -04:00
Alex Szpakowski 46daf9dd15 Simplified some code by removing an unnecessary/useless optimization. 2015-11-02 03:28:31 -04:00
Alex Szpakowski 389b91cf6f Added per-character color support to love.graphics.print/printf and Text objects. Resolves issue #865.
The aforementioned functions now optionally accept an array instead of a plain string. The array is in the format of: {{r, g, b [, a]}, "first colored text, ", {r, g, b [, a]}, "second colored text", ...}, where the color values specify the color to use in the next section of the text.
2015-11-01 23:17:46 -04:00
Alex Szpakowski 799e303673 More fixes for love.graphics.printf's text positioning. 2015-10-29 03:57:29 -03:00
Alex Szpakowski 396b0f0956 Mostly fixed the center and right wrap alignments for love.graphics.printf. 2015-10-29 00:44:00 -03:00
Alex Szpakowski 34b8e47831 Removed the internal rounding applied to the x and y parameters of love.graphics.print/printf. Resolves issue #1062. 2015-10-28 01:59:53 -03:00
Alex Szpakowski c03ce3a9ab love.math.random now uses a slight variant of Xorshift (Xorshift*). 2015-10-26 20:47:56 -03:00
Alex Szpakowski f92e6552d4 Rewrote Font:getWrap (and thus love.graphics.printf's logic) to behave better. Resolves issue #799.
It now wraps text at the specified wrap limit even when there are no spaces in a line, and has improved performance.
2015-10-24 02:28:22 -03:00
Alex Szpakowski 890802c0a3 Use a more descriptive error message if love.graphics.newImage fails because the OpenGL texture can't be created. 2015-10-15 14:42:57 -03:00
Alex Szpakowski 0bf80bb9fc Fixed a minor memory leak in love.graphics.setMode. 2015-09-16 22:28:22 -03: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 05ed70ed18 Updated stb_image to 2.07. 2015-09-13 11:26:11 -03:00
Alex Szpakowski 369dedaf38 Fixed SpriteBatch:set and Mesh:setVertex preventing some vertex data from being sent to the GPU. 2015-09-09 20:47:03 -03:00
Alex Szpakowski dc7cffe111 Fixed the color set by love.graphics.setColor not being restored properly when love.graphics.pop is called after love.graphics.push("all"). 2015-09-05 11:20:47 -03:00
Alex Szpakowski e979455772 love.event.quit now accepts a single (optional) argument, which is used as the program's exit status number. Resolves issue #1070. 2015-08-25 17:12:59 -03:00
Alex Szpakowski 1261427304 Replaced love.graphics.point with love.graphics.points, which draws a number of points at a time.
It currently has 3 variants, with the last one using optional per-point colors:

- love.graphics.points(x1, y1, x2, y2, ...)

- love.graphics.points({x1, y1, x2, y2, ...})

- love.graphics.points({{x1, y1 [, r, g, b, a]}, {x2, y2 [, r, g, b, a]}, ...}).
2015-08-19 17:48:27 -03:00
Alex Szpakowski 780c970b99 Removed an unnecessary error message in love.graphics.newMesh. 2015-08-18 22:32:27 -03:00
Alex Szpakowski 71116807e3 Fixed the default error handler to disable relative mouse mode. 2015-08-18 22:13:06 -03:00
Alex Szpakowski 153bd6f4cb Cleaned up the Font:getWrap code a bit. 2015-08-16 01:04:51 -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
Alex Szpakowski db91a73d57 Trigger a Lua error if love.graphics.draw(canvas) is called while that canvas is the active one.
This only catches a subset of the possible accidental read-while-writing situations that can happen when using Canvases, unfortunately.
2015-08-14 22:46:29 -03:00