Commit Graph

57 Commits

Author SHA1 Message Date
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 ec9dec6b80 Replaced luax_newtype with luax_pushtype (and added luax_rawnewtype for the old functionality of luax_newtype.)
luax_pushtype keeps the object in a weak table and checks the table before creating a new userdata, so it re-uses the object's existing wrapper userdata if it can, whenever the object is pushed to Lua.

This fixes some subtle issues with love objects, where using them as keys in tables would not always work as expected (https://love2d.org/forums/viewtopic.php?f=4&t=39398&p=112388#p112415). It also decreases the amount of new Lua objects created, saving the garbage collector some work.
2013-08-29 00:40:06 -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
Alex Szpakowski 0c053e09d4 Improved error messages when using the wrong love type in a function 2013-08-03 18:52:00 -03:00
Alex Szpakowski 335cc378fc Added some internal verification for registering love type names 2013-07-18 00:45:49 -03:00
Alex Szpakowski 5a3055dd3b Replaced internal calls to luaL_register (deprecated in Lua 5.2) with an alternative 2013-07-16 23:23:58 -03:00
Bart van Strien f5603b0291 Make love compile against lua5.2 2013-07-10 16:02:52 +02:00
Alex Szpakowski 4dc2072fc6 Fixed error messages in functions where love.filesystem.newFile(Data) is called internally 2013-05-23 17:59:15 -03:00
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