Resolution Solution [library]

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

togFox wrote: Thu Feb 01, 2024 9:18 am Is this the correct way to initial RS when I develop in 1920 x 1080 while allowing the user to resize to whatever they want?

Code: Select all

res.conf({game_width = 1920, game_height = 1080, scale_mode = 1})
res.setMode(1920, 1080, {resizable=true})
The demo is 800 x 600 so just checking I got this bit right. Thanks.
I mean, there no "correct" way to initialize window, in fact, you can call it whenever you want, after all, res.setMode is just wrapper for https://love2d.org/wiki/love.window.setMode, which would immediately call res.resize to update all internals.
I think you might got math somewhere wrong
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Resolution Solution [library]

Post by togFox »

Okay. Thanks. When I develop I use my monitor size so I'll use this code that should take my 1920x1080 and scale it to the users monitor size:

Code: Select all

	res.conf({game_width = 1920, game_height = 1080, scale_mode = 1})
	res.setMode(0, 0, {resizable=false})
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Resolution Solution [library]

Post by togFox »

So, documenting here for others, my project is using:

Code: Select all

love.graphics.scale
and

Code: Select all

love.graphics.origin()
These things change the way things are drawn and if you're not careful, will interfere with RS.

Obviously.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

togFox wrote: Sun Feb 04, 2024 12:41 am So, documenting here for others, my project is using:

Code: Select all

love.graphics.scale
and

Code: Select all

love.graphics.origin()
These things change the way things are drawn and if you're not careful, will interfere with RS.

Obviously.
So are you was drawing ui by resetting scaling?
If so, you better off using love.graphics.pop/push combo to draw something inside rs.pop/push combo, or simple draw ui outside of this combo
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Resolution Solution [library]

Post by togFox »

Some scenes were using RS and some scenes were using RS and scale. Making sure the rs.pop, rs.push. love.graphics.scale and origin is called in the right sequence and being disciplined in the scope fixes it. Thanks!
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

v3002

Post by GVovkiv »

v3002, 20 May 2024
Mostly fixing typos in library code (like error messages) and some updates to
documentation.
https://github.com/Vovkiv/resolution_solution
Documentation:
•Turns out I forget to document rs.conf() function. Welp. That sucks.
•Updated styling and some information (maybe later I need to rewrite it...)
Changed:
•Better error messages.
•Now rs.resize() accepts optional width and height arguments, like most scaling libraries do.
You can use it to monkeypatch something (for example, for pixel perfect scaling). If you
won’t provide one of this variables, then library will simple get it itself from
love.graphics.getWidth() and love.graphics.getHeight(); If you updating from previous
version, no changes to code necessary.
Changed:
• Fixed outdated error text in rs.debug_info() function.

Soon(tm) I have plans to try and add some icons and other kind of assets to library, mostly as banners and for people who might wish to add it to "credits" menu. If someone knows how to design icons, banners, etc and willing to help, then go to repo and open pull request, thanks.
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Resolution Solution [library]

Post by togFox »

Welcome back! Thanks for the update.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

Yeah, hello there
I found some underpowered laptop which igpu suprisingly capable of OpenGL ES 2.0, so might aswell spend time with love (hey-hey) while I'm on it.
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

v3003, 30 May 2024
Added new scaling mode (No Scaling Mode) and added variables to replace magic numbers.
https://github.com/Vovkiv/resolution_solution
Documentation:
• Added explanation about newly added No Scaling Mode and about magic numbers.
Added:
• Added new No Scaling Mode. When it is active, no scaling will be performed as you never
used Resolution Solution. It might be useful for cases of debugging, quickly turning off
scaling or maybe in case if this library used with some program, where most of time you
don’t need scaling, but might want it to show preview of image.
• Added variables for magic numbers of scale modes:

Code: Select all

rs.ASPECT_MODE = 1
rs.STRETCH_MODE = 2
rs.PIXEL_PERFECT_MODE = 3
rs.NO_SCALING_MODE = 4
Fixed:
rs.is_it_inside function supposed to early return true when you in stretch scaling mode (and
now in newly added no scaling mode) for optimisation purposes, but turns out that during
latest v3000 rewrite, where I switched to shake_case from camelCase, I forget to update
checks in code, as result, that early return never worked after v3000.
Good news is, that I didn’t breaked anything, everything was calculated as is should, just
slightly longer. So if you upgrading to v3003, no code changes required here.
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

With each release I make more and more typos, and forget more and more things to fill. This time I forget to add documentation to "history" directory, aswell as forget to set correct date for this release.

Idea of adding new "no scale" mode was on my mind for some time, not sure why.
I'm not 100% sure about use case here for it, but maybe someone wish to build some game engine like Godot where you could choosy any scaling mode you need, including no scaling (come to think about it, maybe because of Godot I started thinking about adding this feature to my love library...).
I "kinda" "checked" everything this time, so all functions should work as intended...

Anyway, have a great day and good luck with coding!
Post Reply

Who is online

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