Page 1 of 1

The problem with TLfres

Posted: Fri Mar 29, 2013 7:09 pm
by Faren
The problem is it doesn't work, and that flumoxxes many newbies to codeing immediately.

I know it sounds like a bold statement, but it is true. I have written an updated version, but will not be releasing it any time soon (sorry).

In the meantime, I will give you this.

Code: Select all

function love.mouse.getX()
	local x, y = love.mouse.getPosition()
	return x*(multiRes.stdX/CONF_WIDTH)
end

function love.mouse.getY()
	local x, y = love.mouse.getPosition()
	return y*(multiRes.stdY/CONF_HEIGHT)
end
TFL doesnt't take into account mouse position, which is very important when you resize your entire screen. Addition of the above code will change that. Just remember to define the constants CONF_WIDTH and CONF_HEIGHT to the screen resolution your game is running in I.e., CONF_WIDTH = 1280, CONF_HEIGHT = 720, and multiRes.stdY / x to the resolution the game was origianally designed for.

I will add to this post.

Don't obey.

Re: The problem with TFLres

Posted: Fri Mar 29, 2013 7:42 pm
by markgo
I made my own. It supports a lot different scaling style and has mouse position support. Yup I'm advertising. viewtopic.php?f=5&t=12819&p=75120&hilit ... ing#p75120

Re: The problem with TFLres

Posted: Fri Mar 29, 2013 7:48 pm
by Faren
markgo wrote:I made my own. It supports a lot different scaling style and has mouse position support. Yup I'm advertising. viewtopic.php?f=5&t=12819&p=75120&hilit ... ing#p75120
Great, but it isn't exactly helpful. Sadly. I plan to expand my original post with the entire class. When I have more time.

Re: The problem with TFLres

Posted: Fri Mar 29, 2013 7:49 pm
by markgo
Just giving the readers some choices. Take it or leave it. ;)

Re: The problem with TFLres

Posted: Fri Mar 29, 2013 8:15 pm
by Faren
markgo wrote:Just giving the readers some choices. Take it or leave it. ;)
Choice is a good thing, make no mistake.

I wanted to add some results to the google search. I'm working on a full framework for newbies to codeing. Just because I have the time to do that. I'm sure your link is legit, but I am trying to make my information accesible :)

Peace out bro, made with Love.

Re: The problem with TFLres

Posted: Sat Mar 30, 2013 6:15 pm
by SiENcE
I'm also using TFLres and modified it to fit my suits.

For mouse position i use this function. But you have to adjust _globalScale_.x, _globalScale_.y <- my scaling values and maybe TLfres.wt and TLfres.ht for centering.

Code: Select all

local __getPosition = love.mouse.getPosition
function love.mouse.getPosition( ... )
	local x,y = __getPosition( ... )
	-- TLfres.wt/_globalScale_.x and TLfres.ht/_globalScale_.y was added due to the global fullscreen scale & recentering of the screen
	x = x/_globalScale_.x - TLfres.wt/_globalScale_.x
	y = y/_globalScale_.y - TLfres.ht/_globalScale_.y
	return x,y
end

Re: The problem with TFLres

Posted: Sat Mar 30, 2013 6:57 pm
by Faren
Isn't that exactly what I said? In less lines of code?

Re: The problem with TFLres

Posted: Sat Mar 30, 2013 7:00 pm
by daviddoran
Link to this TFLres thing?

EDIT: Ah, TLF.

Re: The problem with TFLres

Posted: Sat Mar 30, 2013 7:08 pm
by Faren
daviddoran wrote:Link to this TFLres thing?

EDIT: Ah, TLF.
Well said.