Perrrceeenttages

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
baconhawka7x
Party member
Posts: 494
Joined: Mon Nov 21, 2011 7:05 am
Location: Oregon, USA
Contact:

Perrrceeenttages

Post 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,.)
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Perrrceeenttages

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

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 4 guests