The problem with TLfres

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Faren
Prole
Posts: 17
Joined: Sun Mar 03, 2013 6:33 pm

The problem with TLfres

Post 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.
Last edited by Faren on Sun Mar 31, 2013 8:10 am, edited 2 times in total.
User avatar
markgo
Party member
Posts: 190
Joined: Sat Jan 05, 2013 12:21 am
Location: USA

Re: The problem with TFLres

Post 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
User avatar
Faren
Prole
Posts: 17
Joined: Sun Mar 03, 2013 6:33 pm

Re: The problem with TFLres

Post 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.
User avatar
markgo
Party member
Posts: 190
Joined: Sat Jan 05, 2013 12:21 am
Location: USA

Re: The problem with TFLres

Post by markgo »

Just giving the readers some choices. Take it or leave it. ;)
User avatar
Faren
Prole
Posts: 17
Joined: Sun Mar 03, 2013 6:33 pm

Re: The problem with TFLres

Post 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.
User avatar
SiENcE
Party member
Posts: 805
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: The problem with TFLres

Post 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
User avatar
Faren
Prole
Posts: 17
Joined: Sun Mar 03, 2013 6:33 pm

Re: The problem with TFLres

Post by Faren »

Isn't that exactly what I said? In less lines of code?
User avatar
daviddoran
Prole
Posts: 30
Joined: Sun Mar 24, 2013 5:35 am

Re: The problem with TFLres

Post by daviddoran »

Link to this TFLres thing?

EDIT: Ah, TLF.
User avatar
Faren
Prole
Posts: 17
Joined: Sun Mar 03, 2013 6:33 pm

Re: The problem with TFLres

Post by Faren »

daviddoran wrote:Link to this TFLres thing?

EDIT: Ah, TLF.
Well said.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests