Page 74 of 91

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Oct 14, 2016 5:04 pm
by smunnelsnakzruule
Hmm, sorry I would prefer not to use the canvas, I hear it has issues and I want to work with the (primary?) buffer.
I guess I'll have to render it the old fashion way and append all my drawables to a list to be rendered in a virtual rect which is scaled using.. math.

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Oct 14, 2016 6:13 pm
by zorg
What kind of issues did you hear?

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Oct 14, 2016 7:39 pm
by evgiz
smunnelsnakzruule wrote:Hmm, sorry I would prefer not to use the canvas, I hear it has issues and I want to work with the (primary?) buffer.
I guess I'll have to render it the old fashion way and append all my drawables to a list to be rendered in a virtual rect which is scaled using.. math.
For my game I use canvases extensively and haven't had any issues at all, nor have I heard of anyone else having any. If there are issues they must be fairly small and only in edge cases. Doing everything a canvas has to offer using math sounds horrible and like a lot of extra work! :o

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Oct 14, 2016 8:39 pm
by Jasoco
Canvas has no issues. Especially on 0.10.0 where it is guaranteed to work since it doesn't run on machines that don't have support anyway.

Use them.

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Oct 14, 2016 10:41 pm
by PiFace
Hey guys, I was testing love.filesystem.remove, and something kinda weird was happening to me: it never actually deleted a file the fisrt time the love.filesystem.remove command was called in the game. Only when I called it a second time (or anytime later) it actually worked. To prevent this from happening, I wrote the command twice, as the game goes on even if no file was found or deleted. But do you have any ideas why that was happening? o.O

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Oct 14, 2016 10:54 pm
by slime
Can you write a minimal example that people can test?

Re: "Questions that don't deserve their own thread" thread

Posted: Sat Oct 15, 2016 12:33 am
by Positive07
Also was the file inside the save directory? LÖVE can't delete files that are not in the save directory

Re: "Questions that don't deserve their own thread" thread

Posted: Sat Oct 15, 2016 12:45 am
by PiFace
Positive07 wrote:Also was the file inside the save directory? LÖVE can't delete files that are not in the save directory
Yes, it was in the save directory.
slime wrote:Can you write a minimal example that people can test?
Yes

This is the function that deletes the deck file (it is a card game). This file extension is specific for the decks, but they are just .txt
'deckList' is a table with the names of each deck.
'deck' is the index of the currently selected deck.
'deckDir' is just a string used by other functions in the same file, referring to where the decks should be saved. I kept it in a variable so I could change it later if necessary. (for now, it's just a folder called 'decks')

Code: Select all

function deckDelete(deck,deckList)
    if deckList[deck] then
        love.filesystem.remove(deckDir .. '/' .. deckList[deck] .. '.dhcd')
        love.filesystem.remove(deckDir .. '/' .. deckList[deck] .. '.dhcd')
        table.remove(deckList,deck)
    end
    return deckList
end
Edit: the deckList table is made when the game loads, according to the files inside that deckDir folder.
So, for example, if the 'deck' variable was 3 and the deckList table contains 15 strings that correspond to the files inside the deckDir folder, deckList[deck] will be, in this case, the third deck, ('test deck (3)' for example). The line should become:

Code: Select all

love.filesystem.remove('decks/test deck (3).dhcd')
It seems there's nothing wrong with it, and indeed there isn't, but somehow, only during the first time this command is run, nothing happens.

Re: "Questions that don't deserve their own thread" thread

Posted: Sat Oct 15, 2016 2:22 am
by Positive07
That example is not enough, those functions work if used like that, please provide a .love file that actually shows what the error is

Re: "Questions that don't deserve their own thread" thread

Posted: Sat Oct 15, 2016 2:54 am
by PiFace
:huh: ... well, nevermind, after making a window to confirm the deletion (those "Are you sure you want to do this?" popups) it just works as intended. Sorry to bother .-.
That example is not enough, those functions work if used like that, please provide a .love file that actually shows what the error is
Yeah, now that I come to think of it, the problem could not be inside that function, it was somewhere else, but now that it's gone, I think it doesn't matter anymore.