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
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:
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.