Commit Graph

104 Commits

Author SHA1 Message Date
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
Alex Szpakowski b8ec6633ab Fixed love.graphics.printf wrapping when the wrap limit is the same as the text width (issue #558) 2013-03-13 00:08:09 -03:00
Alex Szpakowski d9736ab3ab Removed mipmap support from Font graphics objects 2013-02-19 14:21:01 -04:00
Alex Szpakowski 23968d3b4a Fixed image mipmap creation on some systems with buggy video drivers 2013-02-17 11:36:17 -04:00
Alex Szpakowski 1945b7975d Cleaned up exception handling code when creating new fonts, spritebatches, and shaders 2013-02-14 21:49:11 -04:00
Alex Szpakowski 96161c66f6 Updated copyright text for the new year 2013-02-05 05:32:49 -04:00
Alex Szpakowski 022f549554 Use unsigned ints instead of unsigned shorts to represent UTF8 font glyphs 2013-01-22 23:43:35 -04:00
rude de8b4d91a5 Use GLint when getting GL_GENERATE_MIPMAP.
Using GLboolean caused a stack corruption according to VS2012.
2013-01-12 12:53:07 +01:00
Bart van Strien 32684b674e Add Font:getAscent/getDescent/getBaseline (issue #445) 2013-01-18 13:20:40 +01:00
Alexander Szpakowski 36c5259e12 Font objects now have mipmap filter and mipmap sharpness support 2013-01-07 16:31:48 -04:00
Alexander Szpakowski a6f4a3ab0f Removed names of unused parameters to quiet noisy compilers 2013-01-07 07:29:04 -04:00
Alexander Szpakowski e5388ff73b Removed more unnecessary tabs in blank lines 2013-01-07 07:11:40 -04:00
Alexander Szpakowski 1678252b7a Applied patch from issue #542 (texture filtering inconsistencies) in main LÖVE repository 2013-01-01 21:29:38 -04:00
Alexander Szpakowski a8dc813258 Text drawing performance improvements (issue #532) 2012-12-15 22:18:40 +01:00
vrld 6d02057864 Close issue #408: printf-justify alignment.
Add letter_spacing argument to Font::print(). Might be worth to expose to Lua
at some point. Justify alignment may result in mushy/blurred glyphs.
2012-07-08 13:37:09 +02:00