Page 1 of 1

Perrrceeenttages

Posted: Thu Mar 29, 2012 5:35 pm
by baconhawka7x
I'm not sure if this is where I should be posting this(Maybe there's a page for ideas for the next love update?).
But I was working on my splended game ( viewtopic.php?f=5&t=8604 ) and the whole time I was thinking of one thing that would be mazing if they added it in the next update. I know XHTML(yes, i'm just the most amazing person ever), but I thought that it was really cool, that with divs, you could place them at percentages on the screen, instead of pixels. So if that was in love, I think it would be awesome!:D
so if there is lets say...a 800px wide screen then..

THIS:

Code: Select all

love.graphics.draw(img, 400, 10)
would become THIS

Code: Select all

love.graphics.draw(img, 50%, 10
Idk, maybe it's a bad idea. I haven't thought of many problems that could come with this, except that I don't want it to be like html, where you have to type what kind of numb it is right after it(10px, 100%, etc,.)

Re: Perrrceeenttages

Posted: Thu Mar 29, 2012 5:41 pm
by bartbes
But then it would have to scale too, wouldn't it? And how would you know where something would actually be?
Basically, the stance love takes here is: You've got the tools (getHeight, getWidth), if you want it, you can implement it.

If you want to, for instance, you could define a draw function like this:

Code: Select all

function myDraw(drawable, x, y, ...)
    local w, h = love.graphics.getWidth(), love.graphics.getHeight()
    -- ew, optimize the line above!
    return love.graphics.draw(drawable, x*w, y*h, ...)
end

--Usage:
myDraw(some_image, 0.5, 0.1)