Page 1 of 1

Starting with love...

Posted: Sat Oct 30, 2010 6:11 pm
by marin
Hi, I need someone to help me ... I'm starting in Love and when I try a simple example made by me, only I get a black window .... I do not understand why?. The main.lua I have :

function load( )
font = love.graphics.newFont( love.default_font, 12 )
love.graphics.setFont( font )
message = " Test "

player=love.graphics.newImage("player.gif")
end

function draw()
love.graphics.draw(message, 100, 100)
love.graphics.draw(player, 100, 100)
end
Gracias....

Re: Starting with love...

Posted: Sat Oct 30, 2010 8:16 pm
by Robin
That's some rather old syntax. Were did you get that from? This must be 0.5.0 or even older...

Currently, you'll want to use:

Code: Select all

function love.load( )
    font = love.graphics.newFont( 12 )
    love.graphics.setFont( font )
    message = " Test "

    player=love.graphics.newImage("player.gif")
end

function love.draw()
    love.graphics.print(message, 100, 100) --i'm sorry, this shouldn't be draw
    love.graphics.draw(player, 100, 100)
end

Re: Starting with love...

Posted: Sat Oct 30, 2010 8:27 pm
by bartbes
And even you make a mistake:

Code: Select all

function love.load( )
    font = love.graphics.newFont( 12 )
    love.graphics.setFont( font )
    message = " Test "

    player=love.graphics.newImage("player.gif")
end

function love.draw()
    love.graphics.print(message, 100, 100)
    love.graphics.draw(player, 100, 100)
end

Re: Starting with love...

Posted: Sat Oct 30, 2010 8:47 pm
by Robin
I'm sorry, looked right over it. :oops: