Commit Graph

255 Commits

Author SHA1 Message Date
Alex Szpakowski 9cf1868b81 Fixed the point style and color mask getting reset in love.window.setMode (thanks Shell32) 2015-01-31 01:22:54 -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 cf60cf89fc De-namespaced a class, to make it less verbose. 2015-01-24 04:09:56 -04:00
Alex Szpakowski 222d4cfdc8 Maybe fixed Windows build? 2015-01-24 03:43:52 -04:00
Alex Szpakowski b876255442 Cleaned up some graphics code. 2015-01-24 03:39:05 -04:00
Alex Szpakowski 18569979e9 Better cleanup when the graphics and window subsystems are destroyed and restarted. 2015-01-21 18:23:16 -04:00
Alex Szpakowski c7b45b3505 Updated copyright for the new year 2014-12-31 19:32:43 -04:00
Alex Szpakowski 808e533b02 Tweaked streaming Sources to use fewer OpenAL buffers (and increased the amount of decoded data per buffer to compensate), and removed some unnecessary #include statements. 2014-09-28 14:58:59 -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 f972c9923f Fixed love.graphics.reset reverting the current font to nil and breaking love.graphics.print. 2014-09-11 02:42:56 -03:00
Alex Szpakowski 68b2c9e851 The default filter mode is now included in the state affected by love.graphics.push("all"). 2014-08-29 01:31:16 -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 191b910f23 Fixed love.graphics.newScreenshot potentially deleting any active Canvases. 2014-08-08 18:49:11 -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 a0fff798aa Fixed compiling with Visual Studio. 2014-08-07 01:12:48 -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 809ea8691f Fixed wireframe mode not being saved and restored properly on love.window.setMode. 2014-08-04 22:02:47 -03:00
Alex Szpakowski e87fbdcaaf Fixed the default line join mode to be 'miter' instead of an undefined value. 2014-07-15 15:49:01 -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 4c67a94ba3 Hopefully fixed issue #898, and cleaned up code for love.graphics.getRendererInfo. 2014-06-19 03:02:37 -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 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
Alex Szpakowski be8c19911f Fixed love.graphics.isCreated to properly return false if love.window.setMode failed 2014-03-31 04:56:29 -03:00
Alex Szpakowski 146b3cff19 Added blend mode "screen". 2014-03-27 23:28:36 -03:00
Alex Szpakowski 6259e38d84 Meshes will now use the smallest integer data type possible for index buffer (vertex map) values, instead of always using 32-bit integer numbers. 2014-02-12 02:22:57 -04:00
Alex Szpakowski b625bb6624 moved Mesh:setWireframe to love.graphics.setWireframe (affects all draws until it's disabled.)
Wireframe mode should only be used for debugging: the wireframe lines behave differently than regular lines, their widths aren't affected by the graphics scale, and the mode isn't available on OpenGL ES.
2014-02-03 04:59:58 -04:00
Alex Szpakowski ce4fdf4ac9 Added sRGB (gamma-correct) support for Images, Canvases, and the main screen.
love.graphics.newImage(path, “srgb”) creates a new Image whose texels are treated as being in the sRGB color space, so they are linearized when drawing/sampling from the image.

love.graphics.newCanvas(w, h, “srgb”) creates a new Canvas whose texels are treated as being in the sRGB color space, so drawing to the Canvas does a linear->sRGB conversion (but blends linearly), and sampling from it (drawing it or using it in a shader) converts from sRGB to linear space.

The "srgb" window flag does the same as Canvases for the main screen.
2014-02-02 18:31:41 -04:00
Alex Szpakowski 9e746c56fa love.graphics.getBlendMode no longer does several glGetInteger function calls 2014-01-30 21:51:17 -04:00
Alex Szpakowski 2a4d47e614 Added a missing newline to a print statement 2014-01-29 23:10:57 -04:00
Alex Szpakowski d70023e350 Enable OpenGL’s debug output when the LOVE_GRAPHICS_DEBUG environment variable is ‘1’. Resolves issue #607. 2014-01-27 23:30:16 -04:00
Alex Szpakowski 988404e4ca Added love.graphics.getSystemLimit (resolves issue #840). Deprecated love.graphics.getMaxPointSize.
love.graphics.getSystemLimit currently accepts these enum strings: “pointsize”, “texturesize”, “multicanvas”, and “canvasfsaa”.
2014-01-27 02:19:30 -04:00
Alex Szpakowski 7556fde5e6 Added antialiasing (MSAA) support to Canvases via a new optional parameter. Added Canvas:getFSAA. 2014-01-27 01:31:41 -04:00
Alex Szpakowski ba7e69d776 Added Mesh:setDrawRange(min, max) and Mesh:getDrawRange().
If no vertex map is set, this restricts the drawn vertices to those whose indices in the vertex array are between [min, max] inclusive.
If a vertex map is set, this restricts the values used in the vertex map to those whose indices in the vertex map array are between [min, max] inclusive.

Added Mesh constructor variant: love.graphics.newMesh(vertexcount, texture, drawmode). Creates a Mesh with a certain number of vertices with x,y,u,v,r,g,b,a values of (0,0,0,0,255,255,255,255).
2014-01-21 06:16:47 -04:00
Alex Szpakowski fda005c5ff love.graphics.getScissor now has a proper C++ module method 2014-01-09 22:49:00 -04:00
Alex Szpakowski c64b3d2527 Renamed love.graphics.getMaxImageSize to love.graphics.getMaxTextureSize (old function is still there, but deprecated.) 2014-01-09 22:18:37 -04:00
Alex Szpakowski 1d3c4e125e Make love.graphics.reset call love.graphics.origin instead of clearing the internal pixel size stack 2014-01-05 15:52:12 -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 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 a00c006c44 The graphics viewport is now properly restored when switching from an active Canvas to no Canvas (resolves issue #817) 2013-12-30 23:52:46 -04:00
Alex Szpakowski d0d629a314 Fixed line width after love.graphics.scale with negative numbers (resolves issue #808) 2013-12-18 03:15:44 -04:00
Alex Szpakowski d9da19d665 Error for misspelled / invalid window attributes in love.window.setMode (resolves issue #736) 2013-10-20 13:17:57 -03:00
Alex Szpakowski c63e2ec624 Merged default into Mesh
--HG--
branch : Mesh
2013-09-29 04:58:26 -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 1be8ac5be4 Removed some unused functions and fixed up some wrap_ headers 2013-09-26 00:48:48 -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 113ed1cfe7 Merged SDL2 changes from bartbes/love-experiments/SDL2 into default.
- Added love.system module, including clipboard functions.

- Added custom hardware cursors (love.mouse.newCursor, love.mouse.setCursor.)

- Revamped love.joystick:
-- added Joystick objects and moved love.joystick functions which operated on individual joysticks to methods on the Joystick objects.
-- Added love.joystick.getJoystick and love.joystick.getJoystickCount.
-- Added events for when joysticks are connected and disconnected.
-- Added 'Gamepad' methods to Joystick objects: Joystick:isGamepad, Joystick:getGamepadAxis, and Joystick:isGamepadDown. They're a common abstraction for xbox controller-like joystick across operating systems.

- Added monitor choosing support and "fullscreen desktop" mode to love.window.

- Moved unicode text input events to their own callback function (love.textinput), removed the key repeat functions from love.keyboard and made the second argument of love.keypressed a boolean saying whether the keypress was a repeat.

- liblove now works with love.window and love.graphics in OS X
2013-08-25 16:51:42 -03:00