Search found 281 matches
- Wed Apr 03, 2024 8:36 am
- Forum: Support and Development
- Topic: Different ways to adjust audio
- Replies: 4
- Views: 891
Re: Different ways to adjust audio
I'm in the same boat, in that I haven't tried the Löve audio system yet. What I'd do is make a folder with a main.lua inside it and treat it like a sandbox, testing all kinds of stuff. You mentioned that Banjo Kazooie style of speech, I think there are only two ways: playing the same source over and...
- Wed Apr 03, 2024 7:57 am
- Forum: Support and Development
- Topic: Avoid table overhead by using Data when creating a mesh
- Replies: 6
- Views: 951
Re: Avoid table overhead by using Data when creating a mesh
Using a flat array of attributes set by pointer index timed a bit faster than using an array of structs. But using structs leads to less cumbersome code, as instead of "myAttributes[vertexOffset + attributeOffset] = value", you'd do "myVertex.attribute = value". So unfortunately ...
- Mon Mar 25, 2024 12:00 pm
- Forum: Libraries and Tools
- Topic: Fast 2D point-in-polygon test
- Replies: 13
- Views: 17508
Re: Fast 2D point-in-polygon test
I'm not too surprised. In LuaJIT, external function calls via standard Lua (as opposed to via FFI) either prevent compilation, or require trace stitching (meaning, switch to interpreter mode, run the function, switch back to compiled mode and resume), both of which are slow. I already got caught by...
- Sun Mar 24, 2024 1:33 pm
- Forum: Libraries and Tools
- Topic: Fast 2D point-in-polygon test
- Replies: 13
- Views: 17508
Re: Fast 2D point-in-polygon test
Ehhh, here's something weird. From my tests, that Lua-based method in the OP is slightly faster than the Box2D one. Point for LuaJIT I guess, it's probably optimizing that function amazingly. I honestly thought the C++ one would be faster. point-in-polygon_benchmark.png The code I'm using is this (t...
- Sun Mar 24, 2024 3:42 am
- Forum: Support and Development
- Topic: Weird Mobile Screensize Behavior
- Replies: 2
- Views: 4716
Re: Weird Mobile Screensize Behavior
Also check love.graphics.getWidth() and love.graphics.getPixelWidth(), in the Window section of the graphics page:
https://love2d.org/wiki/love.graphics#Window
https://love2d.org/wiki/love.graphics#Window
- Sun Mar 24, 2024 3:20 am
- Forum: Libraries and Tools
- Topic: Fast 2D point-in-polygon test
- Replies: 13
- Views: 17508
Re: Fast 2D point-in-polygon test
Yes, this: https://love2d.org/wiki/Shape:testPoint That's cool dusoft, nice tip. That will rely on the fast C++ Box2D implementation. The testing code seems to be this: https://github.com/love2d/love/blob/main/src/libraries/box2d/collision/b2_polygon_shape.cpp#L250 They're using a facingness test b...
- Mon Mar 18, 2024 6:06 am
- Forum: General
- Topic: Code Doodles!
- Replies: 197
- Views: 311129
Re: Code Doodles!
roundedRectanglePreview.gif Example of drawing a round-corner rectangle using a pixel shader. While there's the rx,ry parameters of love.graphics.rectangle() that make a rounded rectangle using geometry, in this way it's done by fading the alpha of pixels outside of the rounded corners. io.stdout:s...
- Sun Mar 17, 2024 12:32 pm
- Forum: General
- Topic: Gradients (gradient as fill)
- Replies: 10
- Views: 4258
Re: Gradients (gradient as fill)
Nice, I see what you're after. Thank you for the images.
- Fri Mar 15, 2024 10:57 am
- Forum: General
- Topic: Gradients (gradient as fill)
- Replies: 10
- Views: 4258
- Sun Mar 10, 2024 8:25 pm
- Forum: Support and Development
- Topic: Finding which object in the table is closest
- Replies: 5
- Views: 2357
Re: Finding which object in the table is closest
local closest_dist = 999999 --some arbitrarily large number This reminded me, for this "absurdly large initial value" kind of thing, there's that constant that's loaded by default: math.huge But my favorite is in Python: float("inf") creates a positive infinity value, nothing is...