Search found 239 matches
- Mon Mar 25, 2024 12:00 pm
- Forum: Libraries and Tools
- Topic: Fast 2D point-in-polygon test
- Replies: 13
- Views: 11502
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: 11502
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: 1054
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: 11502
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: 196
- Views: 260251
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: 1680
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: 1680
- Sun Mar 10, 2024 8:25 pm
- Forum: Support and Development
- Topic: Finding which object in the table is closest
- Replies: 5
- Views: 1240
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...
- Sun Mar 10, 2024 3:42 am
- Forum: Support and Development
- Topic: Method doesn't see self variable when called by other method (hump.class)
- Replies: 8
- Views: 858
Re: Method doesn't see self variable when called by other method (hump.class)
See https://love2d.org/forums/viewtopic.php?p=231457#p231457 and the next post. Thanks for that reference, very interesting. AFAIK it seems that the JIT compiles "hot paths" / frequently executed code when it hits some specific loop cycle count, the default settings for which can be seen ...
- Sat Mar 09, 2024 8:17 pm
- Forum: Support and Development
- Topic: Method doesn't see self variable when called by other method (hump.class)
- Replies: 8
- Views: 858
Re: Method doesn't see self variable when called by other method (hump.class)
Is there another one you’d recommend/are using? I think that the mechanism being used to simulate this sort of templating / class inheritance (the __index metamethod from a metatable) is simple enough that you can reimplement it yourself, without the need for an entire library (unless you need the ...