Commit Graph

82 Commits

Author SHA1 Message Date
Alex Szpakowski 6e92bd8302 Improved the argument type checking for World:setCallbacks, World:setContactFilter, World:queryBoundingBox, and World:rayCast. 2015-04-27 18:48:13 -03:00
Alex Szpakowski cf0968fc6d Avoid some VC++ compiler warnings 2015-04-02 00:28:09 -03:00
Alex Szpakowski 2f419c1c83 Replaced most cases of type bits and type name strings in love's Lua wrapper code with type id's.
--HG--
branch : minor
2015-03-01 18:32:41 -04:00
Alex Szpakowski 33d20620b5 The Proxy struct now stores an actual love::Object pointer (rather than void*), which makes code using Proxies a bit cleaner.
--HG--
branch : minor
2015-02-21 20:52:29 -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 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 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 8d0654a6a7 Added runtime drag-and-drop file and folder support via new love.filedropped and love.directorydropped event callback functions. filedropped has a single File object argument, and directorydropped has a single string argument containing the full path of the directory, which can be used with love.filesystem.mount.
--HG--
branch : minor
2014-10-18 20:30:36 -03:00
Alex Szpakowski 6f6bf6a2bb Merged default into minor
--HG--
branch : minor
2014-08-30 22:08:10 -03:00
Alex Szpakowski 40c6821048 Removed some dead code and fixed luax_pushtype when the object argument is null. 2014-08-28 00:48:32 -03:00
Alex Szpakowski 0c1b73e2ca Reference counting for love objects is now atomic.
--HG--
branch : minor
2014-08-13 02:43:50 -03:00
Alex Szpakowski 1798115858 Error if the coordinates given to Canvas:getPIxel are not within [0, dimensions). 2014-08-10 03:09:16 -03:00
Alex Szpakowski d5ccdc040a Cleaned up some Proxy-related code. 2014-08-09 16:18:22 -03:00
Alex Szpakowski da7cd267ea Changed luax_pushtype to retain the pushed object itself, but only if the object isn't in the Lua state already.
Previously, calling e.g. love.graphics.getFont() 10,000 times would retain the object 10,000 times (and release it 10,000 times when the Font object was garbage-collected in the Lua state.) Now it will only retain it once and release it once.
2014-08-09 16:04:59 -03:00
Alex Szpakowski 79b453653a Added love.joystick.loadGamepadMappings (resolves issue #842), and Joystick:saveGamepadMapping.
The latter returns a mapping string, and the former loads a newline-separated list of mapping strings.
2014-06-04 15:50:06 -03:00
Alex Szpakowski f05551a01f Fixed a potential null pointer dereference and a case of undefined behaviour 2014-04-11 03:48:12 -03:00
Alex Szpakowski 0e13975c11 Improved some error message text 2014-01-17 22:28:06 -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 5e3a0fbc6e Updated box2d from 2.2.1 to 2.3.0
--HG--
branch : box2d-2.3
2013-11-09 04:30:36 -04:00
rude 27de844472 Include <algorithm> when std::min/max is used.
It won't build in Visual Studio 2013 unless we do this.
2013-10-23 00:09:12 +02: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 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