Can't write screenshot to HD

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
mode7
Prole
Posts: 35
Joined: Tue Aug 21, 2012 5:45 pm
Contact:

Can't write screenshot to HD

Post by mode7 »

Hey everybody,
I was coding a very small app, that is supposed to randomly generate bingo tables from a given set of numbers. Basically what I want is to render the table to the screen and save the screenshot.

The problem: No screenshot is saved in the directory, setting an identity does not work either. What am I doing wrong?

here's the code:

Code: Select all

function love.load()
numbers = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,25,29,31,36,38,42,45,47,53,55,56,74,78,75,85,86,84,96,93,100}
counter = 1
mul = 30
end

function love.draw()
love.graphics.setBackgroundColor(255,255,255)
love.graphics.setColor(0,0,0)

for y=0, 3 do
	for x=0, 3 do
		
		love.graphics.print(numbers[math.random(#numbers)],5+x*mul,10+y*mul)
		love.graphics.line(x*mul,y*mul,x*mul+500,y*mul)
		love.graphics.line(x*mul,y*mul,x*mul,y*mul+500)
	end
end
love.graphics.line(120,0,120,120)
love.graphics.line(0,120,120,120)
s = love.graphics.newScreenshot() 

s:encode("Bingo"..counter..".png")
counter = counter+1

end
Also I'll provide the love file. Be careful - if it works it will spam yout hd
Attachments
Bingo.love
(1.11 KiB) Downloaded 83 times
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Can't write screenshot to HD

Post by Nixola »

Yay, 638 images! (It works here)
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
mode7
Prole
Posts: 35
Joined: Tue Aug 21, 2012 5:45 pm
Contact:

Re: Can't write screenshot to HD

Post by mode7 »

Thanks for testing, strange it doesn't work here and neither does it on my laptop. First I thought it's because I'm using loveJIT but its the same with the vanilla version.

Which os are you on?
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Can't write screenshot to HD

Post by Nixola »

Windows 7 x64, what OS are you on?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Qcode
Party member
Posts: 170
Joined: Tue Jan 10, 2012 1:35 am

Re: Can't write screenshot to HD

Post by Qcode »

Works for me, Mac OS X 10.8.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Can't write screenshot to HD

Post by slime »

Are you sure you're looking in the right place for the generated screenshots? They'll be in the LÖVE save directory, not the directory where your main.lua is.
Post Reply

Who is online

Users browsing this forum: Google [Bot], srg and 24 guests