Search found 188 matches

by monolifed
Tue Mar 30, 2021 7:38 pm
Forum: Libraries and Tools
Topic: A Simple Resource Library
Replies: 1
Views: 12687

A Simple Resource Library

https://github.com/monolifed/lua-modules -> simple_cache.lua example: local asrl = require("asrl") local cache = asrl.newCache() cache:addLoader("registerImage", love.graphics.newImage) -- sometimes first entry is not a unique key so we need a key function local function font_key...
by monolifed
Sun Mar 21, 2021 1:05 pm
Forum: Support and Development
Topic: Enforce just one instance?
Replies: 21
Views: 12760

Re: Enforce just one instance?

You can also run a local server with a fixed port. Then the other instance can't use the same port. (The code is just proof of concept) local socket = require"socket" local s, err = socket.bind("0.0.0.0", "8329") local role = err == "address already in use" an...
by monolifed
Thu Mar 18, 2021 3:00 pm
Forum: Games and Creations
Topic: Point In Polygon algorithm
Replies: 11
Views: 9390

Re: Point In Polygon algorithm

Thanks, changed it accordingly
Anyway sorry devdev
by monolifed
Thu Mar 18, 2021 1:39 pm
Forum: Games and Creations
Topic: Point In Polygon algorithm
Replies: 11
Views: 9390

Re: Point In Polygon algorithm

There is no possibility of NaN, (y1 > y) ~= (y2 > y) is false for y1 = y2

Your other points are right
by monolifed
Thu Mar 18, 2021 11:40 am
Forum: Libraries and Tools
Topic: Fast 2D point-in-polygon test
Replies: 13
Views: 11789

Re: Fast 2D point-in-polygon test

Since you use +1 and -1, wouldn't "return wn ~= 0" be sufficient.
by monolifed
Thu Mar 18, 2021 11:36 am
Forum: Games and Creations
Topic: Point In Polygon algorithm
Replies: 11
Views: 9390

Re: Point In Polygon algorithm

pgimeno's code after further simplification -- By Pedro Gimeno, donated to the public domain function isPointInPolygon(x, y, poly) local x1, y1, x2, y2 local len = #poly x2, y2 = poly[len - 1], poly[len] local wn = 0 for idx = 1, len, 2 do x1, y1 = x2, y2 x2, y2 = poly[idx], poly[idx + 1] if (y1 > y...
by monolifed
Fri Feb 12, 2021 8:39 pm
Forum: Support and Development
Topic: stutter while scrolling
Replies: 5
Views: 4122

Re: stutter while scrolling

Thanks.
I assume that if it can run smoothly on some system with proper settings, code is not the problem.
I tested it on linux too, so I guess it makes no difference
by monolifed
Fri Feb 12, 2021 6:56 pm
Forum: Support and Development
Topic: stutter while scrolling
Replies: 5
Views: 4122

Re: stutter while scrolling

So it is smooth with speed=240 and vsync on? But it is still the same for me with or without the print()
The print() was there to warn when dt is more than 1/60, And I noticed that it prints even without scrolling

OK this one has speed=240, vsync=1 and no print
by monolifed
Fri Feb 12, 2021 4:02 pm
Forum: Support and Development
Topic: stutter while scrolling
Replies: 5
Views: 4122

stutter while scrolling

If I keep going right non stop I see small stutters. Attached file rather simple. My assumption is it is the video card/driver.
I am just curious that whether anyone else sees the stutter. Use left/right arrow keys to go left/right respectively