I have a Ui that I'm gonna draw on the screen and my question is that my image (it's called heliumUI.png) is inside my project folder (called helium) and I did something similar a little bit more than half a year ago where I drew a image that I had made on to the screen but I had those images on my desktop.
I'm wondering if I have to move my ui (heliumUI.png) to the desktop or can I draw it from my project folder (helium) or does Löve know that I have it in my project folder?
Might sound like a stupid question but the project is part of refreshing my memory of lua/löve so I'm sorry for any inconveniences.
[EDIT]
Right now I have put the image under love.load and it looks like this:
You are correct, that you are to draw things inside love.graphics, and for actually creating the stuff you want to draw (like making a new image with love.graphics.newImage) can be done as you did, in love.load, or somewhere where it's not called every frame. (calling this in love.draw would needlessly create dozens of new images each second)
As for where those images (or any other assets) are stored, love can only reliably look in two places for files, the project's folder (or inside a love), and the user's save folder associated with the game.
Note that this is only true for love.filesystem functions; if you want to use lua's io library, then you can access files from elsewhere, but if i recall correctly, the problem with that was cross-platform issues, i believe.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
zorg wrote:You are correct, that you are to draw things inside love.graphics, and for actually creating the stuff you want to draw (like making a new image with love.graphics.newImage) can be done as you did, in love.load, or somewhere where it's not called every frame. (calling this in love.draw would needlessly create dozens of new images each second)
As for where those images (or any other assets) are stored, love can only reliably look in two places for files, the project's folder (or inside a love), and the user's save folder associated with the game.
I currently keeping my project folder inside the documents folder (mac), is it still possible to access my heliumUI.png image from there?
zorg wrote:Note that this is only true for love.filesystem functions; if you want to use lua's io library, then you can access files from elsewhere, but if i recall correctly, the problem with that was cross-platform issues, i believe.
It does not matter where your project folder is, as long as the assets are inside that folder; love.filesystem handles files relatively, with the "top" folder being... both the project's and the save directory.
As for me recommending the use of love.filesystem functions instead of io functions, a bigger reason for it is that you might not have permissions to access/read/write other folders; love guarantees that you can read from your project folder (and from the .love file itself), and that you can read from and write to the save folder of your game.
And a game's more honest if it just doesn't have the ability to access and modify just ANY file on your computer, only in select places. (That said, my beliefs on this matter are somewhat different, but that's irrelevant here.)
in any case, the wiki is tremendously helpful still: [wiki]love.filesystem[/wiki]
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.