Commit Graph

99 Commits

Author SHA1 Message Date
vrld 19eade843c Add support for Bezier curves of arbitrary degree.
New functions:

bezier = love.math.newBezierCurve(control-points)
degree = bezier:getDegree() -- degree = #control-points - 1
x,y = bezier:getControlPoint(pos) -- pos < 0 => string.sub semantics
bezier:setControlPoint(pos, x, y) -- pos < 0 => string.sub semantics
bezier:insertControlPoint(x,y, [pos = -1])
x,y = bezier:eval(t) -- 0 <= t <= 1
polyline = bezier:render([accuracy = 5]) -- returns a table of points

Example:

function love.load()
	b = love.math.newBezierCurve(10,10, 80,400, 380,400, 470,10)
end

function love.draw()
	if not curve then -- curve rendering is expensive-ish
		curve = b:render()
	end
	love.graphics.line(curve)
end
2013-05-12 21:57:06 +02:00
Alex Szpakowski aa59761177 Fixed smooth lines with love.graphics.origin() after love.graphics.scale 2013-05-12 16:13:32 -03:00
Alex Szpakowski ff77eb4b29 Added love.window (issue #6.) All window-related functions have been moved from love.graphics to love.window.
love.graphics.setCaption has been renamed to love.window.setTitle.
2013-05-10 22:32:15 -03:00
Alex Szpakowski 7ab3809165 Fixed Object:typeOf for love.physics objects new to 0.8.0, removed vestigial ColorMode code 2013-05-07 15:23:26 -03:00
Alex Szpakowski 1edfbb766f Misc. fixes 2013-05-01 16:17:42 -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 5301026f3c Added support for DXT1/3/5 and BC5/7 compressed textures via love.image.CompressedData. Some internals are still iffy.
- added a new CompressedData type to love.image
- added love.image.isCompressed(file or data)
- love.graphics.newImage automatically tests for compression when loading a file
- added love.graphics.isSupported strings for DXT, BC5, and BC7

Compressed textures meant to be used on the GPU offer huge performance gains when
- loading the texture from a file
- loading the texture from RAM to VRAM
- loading mipmaps
- rendering

--HG--
branch : image-CompressedData
2013-04-04 19:09:18 -03:00
Bart van Strien 3d0c5761ce Merge in default, update changelog
--HG--
branch : minor
2013-03-03 19:51:04 +01:00
Alex Szpakowski 96161c66f6 Updated copyright text for the new year 2013-02-05 05:32:49 -04:00
rude c03e35b6cc Merge default branch.
--HG--
branch : minor
2013-01-12 11:52:04 +01:00
Bart van Strien 68a895e7c6 Catch errors in love.font.newRasterizer, add luax_pconvobj which pcalls, allowing love.graphics.newFont to clean up before re-erroring 2012-12-15 14:26:46 +01:00
Bart van Strien 8867f6c329 Merge in default
--HG--
branch : minor
2012-10-14 17:23:35 +02:00
vrld 1fd12e4596 Add Module::registerInstance() and Module::getInstance().
Module::registerInstance() registers a module instance which can later
be retrieved using Module::getInstance().

registerInstance() is called in luax_register_module().

getInstance() expects the full name (as returned by Module::getName())
of the requested module.
2012-08-05 16:03:37 +02:00
Bart van Strien 399a6a6614 Merge in channels from love-experiments
Rewritten love.thread and changed communication
method from weird system before, to channels.

--HG--
branch : minor
2012-07-04 17:15:16 +02:00
Bart van Strien 7793e7f02f CRLF to LF 2012-07-04 14:40:24 +02:00
rude 81c38e22d0 Applied the new style guidelines.
Well, sort of. Lot's more to be done, but this is a start.
2012-06-28 23:52:33 +02:00
Bart van Strien fbfd20a142 Move the references from _G to the registry 2012-01-12 11:24:05 +01:00
Bill Meltsner be55579a22 Happy New Year, have an enormous diff 2012-01-09 02:41:11 -06:00
Bart van Strien e0b420c988 Properly export love modules to lua, package.loaded is correct now 2012-01-07 14:08:41 +01:00
Bart van Strien 0aae9684b3 Automated formatting fix 2011-11-16 11:32:41 +01:00
Bart van Strien 2fafab9a0e Add luax_checkstring/pushstring functions that handle inline \0 characters 2011-11-15 21:37:11 +01:00
Bill Meltsner d40b25c1e6 Hindenmerge 2011-10-12 13:40:56 -05:00
Bill Meltsner d35dbaa28b Add __eq metamethod to all objects (checks to see if the Proxy data they represent are equal)
--HG--
branch : box2d-update
2011-09-24 11:58:24 -04:00
Bart van Strien 09367dc3bd Make love loaders the first 2, preventing lua loaders from loading the wrong files (issue #283) 2011-08-22 18:04:19 +02:00
vrld 28b4008797 Rename Framebuffer to Canvas (issue #263). Move error reporting code.
Error reporting now resides in Graphics::newCanvas() instead of the
previous location wrap_newFramebuffer(). Changed error text for
"Error in implementation" to point to a possible fix.
2011-08-12 14:41:18 +02:00
Przemysław Grzywacz 1d5fca6f46 Multiple thread backends. 2011-06-08 16:54:35 +02:00
Bill Meltsner 2e675a40c0 do a bit of type cleanup 2011-05-08 18:41:42 -04:00
Bill Meltsner cee7a4ccdb Removed EncodedImageData, added three new encoded image formats, and changed the way screenshots work - saving screenshots will be broken until we have some way of flipping ImageData, though
--HG--
branch : minor
2011-03-19 23:41:07 -05:00
Bill Meltsner fde708160e bringing in the new year by changing every 2010 to 2011 2011-01-15 14:40:27 -06:00
rude 31c9995082 Fixed some type conversion warnings in VC. Mostly float <-> int and bool <-> int. 2011-01-09 16:28:30 +01:00
bart@bartbes.ath.cx 200d4bc653 It looks like a dirty hack, it probably is, but this fixes the GC 2010-05-20 21:53:50 +02:00
bart@bartbes.ath.cx 3d726b0dd9 Added mutexes to the GC and made tip buildable again on linux 2010-05-20 17:31:07 +02:00
Bill Meltsner 17d7770eec added varargs version of luax_convobj (for making Rasterizers) 2010-04-15 10:18:09 -04:00
Bill Meltsner b1dac7f381 EncodedImageData was implemented really stupidly. Now it's less stupid. 2010-04-11 23:09:29 -04:00
bart@bartbes.ath.cx 736f7ab1a2 love.thread can now share full userdata 2010-02-14 17:41:11 +01:00
bart@bartbes.ath.cx 7935050435 Now builds on Ubuntu 9.10 2010-01-31 23:16:10 +01:00
rude aa01c984b9 Updated all dates to 2010. 2010-01-31 16:54:47 +01:00
rude 5b30c7fcfe Major developments to love.audio/love.sound. Music and Sound are gone. There are only Sources now, which is much cleaner.
The audio module was not really stable in 0.6.0, it takes very little messing around to cause OpenAL to do horrible things. It should now be much more stable,
and you *should* be able to play/stop/pause/resume/rewind/loop like a madman without disasters. Seek and tell, however, are still not tested and verified for
all decoders, but that's less important. Also, all objects now have object:type() and object:typeOf(), which returns the type name of the object,
and checks whether an object is of a certain type, respectively.
2010-01-31 11:52:54 +01:00
rude 87e3c4131c Finally abstracted constants properly. Changed how the event module works; wasn't really abstract before. Removed libs we're not going to use: native, signal. 2009-10-10 11:11:04 +02:00
rude 42a3be2171 Added __tostring for all types. 2009-09-06 12:56:53 +02:00
rude 3c2bd1bd9c Fixed epic bug in runtime.cpp causing non-Lua-owned objects to be released by Lua GC. 2009-09-05 16:14:52 +02:00
rude 623e701549 Modules now reside in Lua and are treated (almost) like normal objects.
Also added a way of getting a pointer to abstract module instances internally.
2009-09-02 21:18:13 +02:00
rude d4a97d49f3 Added all callbacks to World. 2009-08-15 14:29:47 +02:00
rude dd420d68a3 Ok, project generation didn't really work out. Reverted. 2009-08-10 21:33:07 +02:00
rude ba1a75e547 Added many comments, and changed function names for wrapper functions. 2009-08-09 21:08:55 +02:00
rude 8e681b4204 It's now possible to build each module individually (as a DLL). 2009-08-04 19:57:14 +02:00
rude 524ef5e118 Added looping in love.audio (though needs implementation in love.sound). 2009-08-01 22:11:48 +02:00
rude 0c241a14fb Added resources, and changed slightly how wrappers expose functions. 2009-07-30 00:37:43 +02:00
rude dcb3dfd83d Initial Mercurial commit. 2009-07-26 15:46:49 +02:00