Commit Graph

118 Commits

Author SHA1 Message Date
Alex Szpakowski 2dc8a8ea45 Cleaned up some index buffer code. 2015-06-16 21:27:19 -03:00
Alex Szpakowski a35ccb4426 Added Font:setFallbacks(otherfont, ...). Resolves issue #1041.
Note that general font metrics are largely still based on the original (non-fallback) font, whereas glyph sizes are based on the fallback fonts when those are used to get the glyph.
2015-05-02 18:07:35 -03:00
Alex Szpakowski 06ef263537 Added OpenGL debug groups for most graphics operations when love is built in debug mode for iOS. The Xcode frame capture tool uses them to create nice visual groups for OpenGL function calls. 2015-03-16 22:55:58 -03:00
Alex Szpakowski e2652fddc1 Updated the readme. 2015-03-04 03:21:26 -04:00
Alex Szpakowski 8277eb9abd Renamed the internal OpenGL buffer class from VertexBuffer to GLBuffer. 2015-03-03 02:21:28 -04:00
Alex Szpakowski faa4a33fe9 Use triangle strips rather than triangle fans when possible.
--HG--
branch : minor
2015-02-28 02:32:34 -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 54516a5652 Fixed a case of undefined behavior in love.graphics.printf and Text:set.
--HG--
branch : minor
2015-01-29 21:36:28 -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 1124612c1f Some work towards OpenGL ES 2+ support for love 0.10.
--HG--
branch : minor
2015-01-19 23:32:16 -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 af0371361f Merged default into minor
--HG--
branch : minor
2014-10-18 01:45:02 -03:00
Alex Szpakowski 1108dea696 Updated the error message when invalid UTF-8 strings are used in love.graphics.print and friends to mention UTF-8. 2014-10-06 19:34:11 -03:00
Alex Szpakowski 760304e023 Fixed love.graphics.print.
--HG--
branch : minor
2014-08-26 08:08:09 -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 53e63d48c9 Merged default into minor
--HG--
branch : minor
2014-08-07 18:10:19 -03:00
Alex Szpakowski d59c76a55f Reduced the number of explicit retain/release method calls on love objects. Less chance of bugs! 2014-08-07 14:53:17 -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 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 dc35db1c7b Fixed tab characters (‘\t’) in text to be drawn properly with love.graphics.print. 2014-01-15 23:38:39 -04:00
Alex Szpakowski 9b9671f5ee Fixed a potential memory leak when a Font object errors 2014-01-15 23:03:39 -04:00
Alex Szpakowski 3120a0e650 Goodbye 2013, hello 2014! 2014-01-03 17:28:58 -04:00
Alex Szpakowski aa69a695d3 Canvases can now be used in SpriteBatches, ParticleSystems, and Meshes (resolves issue #782).
Canvases and Images are now subclasses of the new Texture class.
Added setTexture and getTexture methods for Meshes, ParticleSystems, and SpriteBatches (the old set/getImage methods are deprecated but not removed.)
Canvas texture coordinates are no longer flipped.
2014-01-03 17:07:12 -04:00
Alex Szpakowski 98b258b75f Fixed font textures in OpenGL returning black RGB values when a shader is active (reverts changeset 69b0b4e) 2013-12-31 22:09:04 -04:00
Alex Szpakowski f3bd944cf5 Reduced the RAM and VRAM space taken up by TrueType font glyphs by 1/2. 2013-12-31 20:15:55 -04:00
Alex Szpakowski 2ee869b0e8 Fixed some compiler warnings 2013-12-07 05:07:54 -04:00
Alex Szpakowski c8f5494900 Images, Canvases, Quads, and Fonts now have the same vertex winding order 2013-11-10 19:57:13 -04:00
Alex Szpakowski 4e321697d3 Renamed Font:hasGlyph to Font:hasGlyphs, and expanded it to accept multiple arguments and full strings. Resolves issue #762. 2013-10-25 21:56:32 -03:00
Alex Szpakowski 857296f107 Merged default into Mesh
--HG--
branch : Mesh
2013-09-30 04:00:28 -03:00
Alex Szpakowski 95eedcd1be Using auto for some iterators for less dense-looking code 2013-09-30 02:35:10 -03:00
Alex Szpakowski c63e2ec624 Merged default into Mesh
--HG--
branch : Mesh
2013-09-29 04:58:26 -03:00
Alex Szpakowski 5f609c2e2b OS X: switched to -std=c++11, fixed compilation, cleaned up obsolete files in src/platform/macosx/ 2013-09-29 02:50:37 -03:00
Alex Szpakowski 1e696c4505 Added Mesh objects and love.graphics.newMesh. Mesh objects are similar to Geometry but they're drawables (the relationship between meshes and images is the opposite of geometry and images.)
Removed Geometry objects and re-added Quads.

example:
local vertices = {{0, 0, 0, 0}, {100, 0, 1, 0}, {100, 100, 1, 1}, {0, 100, 0, 1}}
mesh = love.graphics.newMesh(vertices, image, "fan")
..
love.graphics.draw(mesh, 0, 0)

--HG--
branch : Mesh
2013-09-28 18:26:47 -03:00
Alex Szpakowski bcee9a222b Made some float/int/unsigned char conversions explicit, fixed ParticleSystem:getColors, fixed love.mouse.isDown with x1 and x2 buttons 2013-09-26 00:36:50 -03:00
Alex Szpakowski 5de43a7207 The Vertex struct is now recognized as POD by C++, also fixed the name to be consistent with other love structs 2013-09-24 11:09:18 -03:00
Alex Szpakowski 91e4feeca0 Fixed justify AlignMode 2013-07-10 20:36:20 -03:00
Alex Szpakowski 8b261abfdc Slightly improved performance and cleaned up code a bit for love.graphics.print 2013-06-26 20:21:08 -03:00
Alex Szpakowski 76618f0328 Cleaned up font code to always use uint32 instead of the slightly more ambiguous "unsigned int" for codepoints 2013-06-16 19:48:53 -03:00
Alex Szpakowski d48d1fd441 Exposed the internal Rasterizer and GlyphData object methods to Lua. Also added Font:hasGlyph. 2013-06-16 07:36:18 -03:00
Alex Szpakowski 8b50dd499b Removed now-unnecessary optional filter parameters from love.graphics.newImageFont 2013-04-28 18:15:03 -07:00
Alex Szpakowski a5eaffe625 Disabled opengl debug output until it can be improved & made optional 2013-04-23 16:47:22 -07:00
vrld 71317c4359 Add Geometries (replaces Quads).
A Geometry is a collection of vertices describing a non self-intersecting
(simple) polygon. In addition to screen coordinates, the vertices have
attributes for texture coordinates (s,t) and color (r,g,b,a).

It can be used as a quad, to display distorted images, or anything in between.

Added:
^^^^^^

-- geometry from table, where table has the format:
-- info = {
-- {x,y, s,t, [r = 255, g = 255, b = 255, a = 255]}
-- {x,y, s,t, [r = 255, g = 255, b = 255, a = 255]}
-- ...
-- }
geom = love.graphics.newGeometry(info)

-- convenience wrapper for quads (same as before)
geom = love.graphics.newQuad(x,y, w,h, sw,sh)

-- retrieve vertex i (1-indexed)
x,y,s,t,r,g,b,a = geom:getVertex(i)

-- set vertex i (1-indexed)
geom:setVertex(i, x,y, s,t, [r,g,b,a])

-- flip geometry
geom:flip(x, y)


Renamed:
^^^^^^^^

love.graphics.drawq() -> love.graphics.drawg()


Removed:
^^^^^^^^

quad:setViewport()
quad:getViewport()
2013-04-21 18:53:13 +02:00
Alex Szpakowski 6fd3038405 Improved clarity/readability of internal OpenGL state shadowing functions 2013-04-17 01:06:33 -03:00
Alex Szpakowski d5aa807747 More internal code cleanup 2013-03-31 19:02:27 -03:00
Alex Szpakowski 3fcb2201bc Fixed love.graphics.newFont using the wrong texture format when creating its glyph texture 2013-03-24 23:43:36 -03:00
Alex Szpakowski 2009124cf9 Reworked internal anisotropic filtering code to be more concise and intuitive 2013-03-21 12:21:13 -03:00
Alex Szpakowski 25d6700361 Moved anisotropic filtering to Image:setFilter(min, mag, anisotropy), added anisotropic filtering support to canvases and fonts 2013-03-20 23:23:26 -03:00