Search found 261 matches

by RNavega
Wed Apr 03, 2024 8:36 am
Forum: Support and Development
Topic: Different ways to adjust audio
Replies: 4
Views: 635

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...
by RNavega
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: 690

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 ...
by RNavega
Mon Mar 25, 2024 12:00 pm
Forum: Libraries and Tools
Topic: Fast 2D point-in-polygon test
Replies: 13
Views: 16514

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...
by RNavega
Sun Mar 24, 2024 1:33 pm
Forum: Libraries and Tools
Topic: Fast 2D point-in-polygon test
Replies: 13
Views: 16514

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...
by RNavega
Sun Mar 24, 2024 3:42 am
Forum: Support and Development
Topic: Weird Mobile Screensize Behavior
Replies: 2
Views: 4451

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
by RNavega
Sun Mar 24, 2024 3:20 am
Forum: Libraries and Tools
Topic: Fast 2D point-in-polygon test
Replies: 13
Views: 16514

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...
by RNavega
Mon Mar 18, 2024 6:06 am
Forum: General
Topic: Code Doodles!
Replies: 197
Views: 276649

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...
by RNavega
Sun Mar 17, 2024 12:32 pm
Forum: General
Topic: Gradients (gradient as fill)
Replies: 10
Views: 3901

Re: Gradients (gradient as fill)

Nice, I see what you're after. Thank you for the images.
by RNavega
Fri Mar 15, 2024 10:57 am
Forum: General
Topic: Gradients (gradient as fill)
Replies: 10
Views: 3901

Re: Gradients (gradient as fill)

dusoft wrote: Tue Mar 12, 2024 4:33 pm Thanks for your suggestions, I will be staying with scaled up overlapping polygons for now.
Hi. How does that overlap thing work, can you describe it?
by RNavega
Sun Mar 10, 2024 8:25 pm
Forum: Support and Development
Topic: Finding which object in the table is closest
Replies: 5
Views: 2290

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...