TLfres - resolution freedom

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: TLfres - resolution freedom

Post by Davidobot »

Can this be used with a camera lib? I tried it and it screwed up my entire game. :|
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
Teraku
Prole
Posts: 27
Joined: Mon Jun 24, 2013 10:01 am
Location: The Netherlands

Re: TLfres - resolution freedom

Post by Teraku »

Sorry for bumping this, but I'm having a bit of a problem. I originally programmed my game to work at a resolution of 1280x720, but I would like to be able to have the game play in 1024x768 instead. However, I just get a black screen when using this.

I don't really understand how you're supposed to use TLfres.setScreen() with arguments. Could anyone give me an example?
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: TLfres - resolution freedom

Post by Taehl »

This library is very old and not compatible with modern versions of Love2D. I'm going to port it once I can figure out the correct aspect ratio math instead of my old kludge.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
knorke
Party member
Posts: 237
Joined: Wed Jul 14, 2010 7:06 pm
Contact:

Re: TLfres - resolution freedom

Post by knorke »

(old thread but it seems to be the newest?)
So I dug up an old löve project on an old harddisk. It was in 800x600 resolution and I had never bothered to deal with the boring maths of screen resolutions and ratios. I found https://love2d.org/wiki/TLfres , did as written in the instruction and it worked.
Thanks!

Small note:
TLfres does not set the BlendMode. My game was drawing over the letterboxes because the last used blendmode in love.draw() had been "add".
(If you draw a circle with centerpoint at x=0 then half the circle will be offscreen. Or in case of using TLfres: on top the letterbox)
Fix:

Code: Select all

love.graphics.setBlendMode("alpha")
TLfres.endRendering({0.1,0,0.1})
User avatar
togFox
Party member
Posts: 764
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: TLfres - resolution freedom

Post by togFox »

I get a black screen but would love to see this working.

Edit: IDK why but it started working when I defined a letterbox colour (instead of relying on default). Makes no sense.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
knorke
Party member
Posts: 237
Joined: Wed Jul 14, 2010 7:06 pm
Contact:

Re: TLfres - resolution freedom

Post by knorke »

I noticed some strange behaviour:
When using fullscreen, sometimes after a few minutes my game randomly gets rendered in the original desktop resolution instead of the TLfres resolution of 800x600. When that happens, everything gets rendered in the upper left corner of the screen and at smaller scale. Strangely, a love.particleSystem that I use as background animation still gets drawn correctly in the middle of the screen.
Sadly my game's code is a total mess, maybe I can provide a cleaner example at some time. Until then does anyone have an idea what might cause this? This is on windows 10.
User avatar
knorke
Party member
Posts: 237
Joined: Wed Jul 14, 2010 7:06 pm
Contact:

Re: TLfres - resolution freedom

Post by knorke »

as not be a DenverCoder9, I'll reply to myself :roll:
my game had two places where stuff was drawn like this:

Code: Select all

love.graphics.translate(v.b:getX(), v.b:getY())
love.graphics.polygon("line", v.s:getPoints())
love.graphics.origin()
that caused the translate/scale to get messed up. Replaced like this:

Code: Select all

love.graphics.translate(v.b:getX(), v.b:getY())
love.graphics.polygon("line", v.b:getWorldPoints(v.s:getPoints()))
So it was a mistake in my code. Maybe a thing to learn here is that when using this, one has to be careful with graphics states/modes. (also see previous post on BlendMode)
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests