Search found 726 matches

by grump
Wed Mar 31, 2021 1:14 pm
Forum: Support and Development
Topic: Enforce just one instance?
Replies: 21
Views: 6279

Re: Enforce just one instance?

We need to open an issue request to include love.filesystem.lock in the next version of love2d. If you want this to happen, you have to submit a pull request yourself, and PhysFS does not seem to support file locking, so it's not going to integrate super well with the filesystem API. And even then....
by grump
Wed Mar 31, 2021 11:45 am
Forum: Support and Development
Topic: Enforce just one instance?
Replies: 21
Views: 6279

Re: Enforce just one instance?

Yeah good point. Use this only if it's not actually critical for your game. Otherwise use FFI to get exclusive file locking.
by grump
Tue Mar 30, 2021 8:18 pm
Forum: Support and Development
Topic: Enforce just one instance?
Replies: 21
Views: 6279

Re: Enforce just one instance?

Instead of making the port configurable, I propose this hybrid solution (pseudo code): function other_instance_running() if exists(lockfile) then port = read_port_from(lockfile) socket = bind_local_socket(port) if not succeeded(socket) then return true end delete(lockfile) end return false end funct...
by grump
Mon Mar 22, 2021 12:33 pm
Forum: Support and Development
Topic: Interactive Map in Löve
Replies: 7
Views: 3324

Re: Interactive Map in Löve

Do you by any chance have some pointers (or similar projects) I can use as a resource for learning? I quickly made this crude example as a proof of concept. It's ~60 lines of code. There are three different map images: a map with all countries highlighted, the same map but not highlighted, and a ma...
by grump
Sat Mar 20, 2021 9:24 am
Forum: Support and Development
Topic: Interactive Map in Löve
Replies: 7
Views: 3324

Re: Interactive Map in Löve

I wouldn't use a tile map. The blocky map doesn't seem too big and it's static, so you could just put it in an image. Think of the image as your tile map and cut out the middleman. 1 pixel = 1 tile. To detect which country is at the mouse cursor, use a second image of the map in which you assigned a...
by grump
Fri Mar 19, 2021 5:35 pm
Forum: Support and Development
Topic: Canvas and alpha
Replies: 11
Views: 3863

Re: Canvas and alpha

Inside my mind the canvas should have been an exact copy of the texture after drawing inside it When you draw something in mode alpha + alphamultiply, this formula is applied: dst.rgb = src.rgb * src.a + dst.rgb * (1 - src.a) For any alpha < 1, this results in darkened colors in the target canvas. ...
by grump
Fri Mar 19, 2021 3:49 pm
Forum: Support and Development
Topic: Canvas and alpha
Replies: 11
Views: 3863

Re: Canvas and alpha

Uhm, what the hell. I must've been thinking about another engine or use case. Sorry about that. I could've sworn the rgb multiplication is done in the shader when using Canvas. Anyway, for this exact copy-texture-to-canvas case you can use blendmode 'none' (or is it 'replace'?) to copy the color cha...
by grump
Fri Mar 19, 2021 1:35 pm
Forum: Support and Development
Topic: Canvas and alpha
Replies: 11
Views: 3863

Re: Canvas and alpha

Or, if you can, use a shader that doesn't premultiply alpha when drawing to the Canvas. Which should be the default anyway imo, because these stupid special cases are a pain to deal with. It sucks. // use this instead of no shader to disable premultiplication vec4 effect(vec4 col, Image tex, vec2 uv...
by grump
Sat Feb 20, 2021 8:00 pm
Forum: Support and Development
Topic: Memory leak - Something I'm missing ?
Replies: 8
Views: 1829

Re: Memory leak - Something I'm missing ?

I'm doing it right In my opinion, allocating ~120 MB of texture memory to draw a simple low-res, low-color, pixellated tile map that should only take a couple hundred KB at most is not right and seems like an awfully inefficient way to do things. It simplifies the map rendering, but it also defeats...
by grump
Mon Feb 15, 2021 9:25 pm
Forum: Support and Development
Topic: [solved]LuaJIT + FFI small sample runs ok but crash within Love2D
Replies: 5
Views: 1450

Re: LuaJIT + FFI small sample runs ok but crash within Love2D

For the headers, if not there, the dynamic library does not compile. I'm no expert and just followed what my understanding of the Lua / C API and LuaJIT are at the moment ( pretty much nothing ^^). Lua's C API is used to make Lua modules in C, while ffi is used to import C modules in Lua. There's n...