I have initialized properly (i believe) by having love.filesystem.setIdentity("folderName") in the love.load() callback
but when I try:
img=love.graphics.newScreenshot()
love.filesystem.write("folderName/img_rawData.txt", img)
it doesn't work!
It's a simple thing I'm doing, but where is it wrong?
Please help me with using love.filesystem?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Please help me with using love.filesystem?
1) You already save it to "folderName", so there is no need to use that:
2) I'm not sure if that works. If not, try:
Code: Select all
img=love.graphics.newScreenshot()
love.filesystem.write("img_rawData.txt", img)
Code: Select all
img=love.graphics.newScreenshot()
love.filesystem.write("img_rawData.txt", img:getString())
Help us help you: attach a .love.
Re: Please help me with using love.filesystem?
alright I will, thanks a lot!
Re: Please help me with using love.filesystem?
It's still not working!
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Please help me with using love.filesystem?
Could you post your .love, so we can see what the problem is?
Help us help you: attach a .love.
Re: Please help me with using love.filesystem?
function love.load()
love.filesystem.setIdentity("imgData")
love.graphics.setCaption("Draw")
love.graphics.setBackgroundColor(255,255,255)
love.graphics.setColor(0,0,0)
pixels={}
love.keyboard.setKeyRepeat(1,1)
end
function love.update(dt)
mouseX=love.mouse.getX()
mouseY=love.mouse.getY()
if love.mouse.isDown("l") then
table.insert(pixels,{mouseX,mouseY})
end
end
function love.draw()
for index,value in ipairs(pixels) do
love.graphics.rectangle("fill",value[1],value[2],10,10)
end
end
function love.mousepressed()
end
function love.mousereleased()
end
function love.keypressed(key)
if key == "z" then
table.remove(pixels)
elseif key == "s" then
rawData=love.graphics.newScreenshot()
love.filesystem.write("img_rawData.txt",rawData:getString())
end
end
love.filesystem.setIdentity("imgData")
love.graphics.setCaption("Draw")
love.graphics.setBackgroundColor(255,255,255)
love.graphics.setColor(0,0,0)
pixels={}
love.keyboard.setKeyRepeat(1,1)
end
function love.update(dt)
mouseX=love.mouse.getX()
mouseY=love.mouse.getY()
if love.mouse.isDown("l") then
table.insert(pixels,{mouseX,mouseY})
end
end
function love.draw()
for index,value in ipairs(pixels) do
love.graphics.rectangle("fill",value[1],value[2],10,10)
end
end
function love.mousepressed()
end
function love.mousereleased()
end
function love.keypressed(key)
if key == "z" then
table.remove(pixels)
elseif key == "s" then
rawData=love.graphics.newScreenshot()
love.filesystem.write("img_rawData.txt",rawData:getString())
end
end
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Please help me with using love.filesystem?
Didn't you have to make it EncodedImageData first?
Re: Please help me with using love.filesystem?
It works perfectly, remember love.filesystem stores your data in %appdata%/LOVE in windows. When you check there, there will be an 'imgData' folder with your 'img_rawData.txt' file.
Re: Please help me with using love.filesystem?
I should have mentioned this earlier, I'm not using windows, I'm using a mac.
Re: Please help me with using love.filesystem?
Well, on the Mac, it should store files in ~/Library/Application Support/LOVE. So, try looking there?
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], darkfrei, Google [Bot] and 3 guests