Page 1 of 1

love keeps crashing..

Posted: Wed Jan 26, 2011 6:09 pm
by TheBreadCat
love crashes when i drag my LoveGame -> LÖVE.exe.
and it keeps doing it.
here is the source code:

Code: Select all

function love.load()
	imgx = 10
	imgy = 20
	image = love.graphics.newImage("cake.jpg")
	local f = love.graphics.newFont(12)
	love.graphics.setFont(f)
	love.graphics.setColor(0,0,0,255)
	love.graphics.setBackgroundColor(255,255,255)
end

function love.update(dt)
   if love.keyboard.isDown("up") then
      num = num + 100 * dt -- this would increment num by 100 per second
   end
end

function love.draw()
   love.graphics.draw(image, imgx, imgy)
   love.graphics.print("Click and drag the cake around or use the arrow keys", 10, 10)
end

function love.mousepressed(x, y, button)
   if button == 'l' then
      imgx = x -- move image to where mouse clicked
      imgy = y
   end
end

function love.focus(f)
  if not f then
    print("LOST FOCUS")
  else
    print("GAINED FOCUS")
  end
end

function love.quit()
  print("Thanks for playing! Come back soon!")
end

Re: love keeps crashing..

Posted: Wed Jan 26, 2011 6:14 pm
by TechnoCat
What kind of crash?

Re: love keeps crashing..

Posted: Wed Jan 26, 2011 6:18 pm
by TheBreadCat
TechnoCat wrote:What kind of crash?
first white window.
then it say that the program does not respond.
and it shut down.
ps: lol TechnoCat and BreadCat :p

Re: love keeps crashing..

Posted: Wed Jan 26, 2011 6:51 pm
by TheBreadCat
i tested.
it works with:

Code: Select all

function love.draw()
    love.graphics.print("Hello World", 400, 300)
end
but when i add all the other functions it shuts down.

Re: love keeps crashing..

Posted: Wed Jan 26, 2011 6:59 pm
by Robin
I see you use print() (I'm not talking about love.graphics.print() here). I think that if you run your game on Windows with console disabled and you try to print something, it could crash. Try running adding a file conf.lua with as contents:

Code: Select all

function love.conf(t)
    t.console = true
end

Re: love keeps crashing..

Posted: Wed Jan 26, 2011 7:06 pm
by bartbes
Robin wrote:I think that if you run your game on Windows with console disabled and you try to print something, it could crash
Actually, that doesn't matter, what does matter is that if it can't write to love's install dir it will crash, this should be fixed in 0.7.1.

Re: love keeps crashing..

Posted: Wed Jan 26, 2011 8:43 pm
by Robin
bartbes wrote:
Robin wrote:I think that if you run your game on Windows with console disabled and you try to print something, it could crash
Actually, that doesn't matter, what does matter is that if it can't write to love's install dir it will crash, this should be fixed in 0.7.1.
I know, I just hoped it wouldn't crash if you ran it with a console so we could avoid the whole "make LÖVE's install dir writeable" issue.

Re: love keeps crashing..

Posted: Sun Feb 13, 2011 3:54 am
by dschnare
Booyah, thanks guys for clearing this up. I was getting rather annoyed.

Something I've noticed as well regarding the lua print() function. Calling print() outside of any love life-cycle methods (i.e. load, draw, update, etc) will crash love on Windows even when the Love install directory is writable. The moment I move the print() calls inside say love.load() then it traces perfectly to the console window as expected. If I put it back to say at the top of main.lua then it crashes every time.

The message I was testing was simply:

Code: Select all

print("hello")