love keeps crashing..

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
TheBreadCat
Prole
Posts: 22
Joined: Wed Jan 26, 2011 6:05 pm

love keeps crashing..

Post 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
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: love keeps crashing..

Post by TechnoCat »

What kind of crash?
TheBreadCat
Prole
Posts: 22
Joined: Wed Jan 26, 2011 6:05 pm

Re: love keeps crashing..

Post 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
TheBreadCat
Prole
Posts: 22
Joined: Wed Jan 26, 2011 6:05 pm

Re: love keeps crashing..

Post 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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: love keeps crashing..

Post 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
Help us help you: attach a .love.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: love keeps crashing..

Post 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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: love keeps crashing..

Post 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.
Help us help you: attach a .love.
dschnare
Prole
Posts: 1
Joined: Sun Feb 13, 2011 12:42 am

Re: love keeps crashing..

Post 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")
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests