Black rectangle drawn instead of image
Posted: Sun Mar 04, 2012 10:49 am
Hello.
I'm completely new to LOVE engine, and I decided to start with reading tutorials. I'm following the instructions, but when I try to draw an image, the black rectangle is drawn instead. It has the same size as the image. I tried different image editors and different formats but every time I got the same result.
Here's the code:
And here's what the result looks like:
Everything else works fine: the text output and mouse events.
I'm using windows 7 x64, can it be the issue?
I'm completely new to LOVE engine, and I decided to start with reading tutorials. I'm following the instructions, but when I try to draw an image, the black rectangle is drawn instead. It has the same size as the image. I tried different image editors and different formats but every time I got the same result.
Here's the code:
Code: Select all
function love.load()
image1 = 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)
num = 0
imgx = 10
imgy = 30
end
function love.update(dt)
if love.keyboard.isDown("up") then
num = num + 100*dt
end
end
function love.draw()
love.graphics.print("cake", 10, 10)
love.graphics.draw(image1, imgx, imgy)
end
function love.mousepressed(x, y, button)
if button == 'l' then
imgx = x
imgy = y
end
end
I'm using windows 7 x64, can it be the issue?