Resolution Solution [library]

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

Re: Resolution Solution [library]

Post by GVovkiv »

Version 1001, 6 february 2022
* Now, scaling.stop() will remember color that was set before it and return it back after
* Added comments for "Simple demo"
* Added more comments for functions and variables in library, to clarify more what the do and don't
* Fixed typo in "Simple demo"
togFox wrote: Sun Feb 06, 2022 1:21 am I found something that is not really a bug but something that is definitely inconvenient.
And now it fixed
If you don't want to jump into library update
Now, at beginning of scaling.stop() library will save current color, that you set before stop() function, in locals, and at end, return colors as they was before stop()
(which means, if you never used love.graphics.setColor(), it will be white, yay)
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 fast! Thanks!
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Turn-based PBEM horse stable (racing) management sim: https://togfox.itch.io/horse-stable-manager
https://discord.gg/HeHgwE5nsZ
User avatar
pgimeno
Party member
Posts: 3657
Joined: Sun Oct 18, 2015 2:58 pm

Re: Resolution Solution [library]

Post by pgimeno »

Definitely no library should change the graphics state, at least not without a big warning in the docs (and that might make it unpopular). Gspot's demo project includes a sort of unit testing that the library never steals the colour or anything else.

There's love.graphics.push("all") to save everything, which may help in case many things change.
User avatar
GVovkiv
Party member
Posts: 685
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

pgimeno wrote: Sun Feb 06, 2022 4:41 pm Definitely no library should change the graphics state, at least not without a big warning in the docs (and that might make it unpopular). Gspot's demo project includes a sort of unit testing that the library never steals the colour or anything else.

There's love.graphics.push("all") to save everything, which may help in case many things change.
Well, i will try don't make same mistake again in future, so thanks
User avatar
GVovkiv
Party member
Posts: 685
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

Version 1002, 8 february 2022
* Fixed (probably) edge cases in isMouseInside() function, so now it should corectly deal with non integer offsets provided by scaling.xOff/yOff
* Now isMouseInside() return always true if scale mode is == 2, since there is no black bars in that scaling method
* Updated isMouseInside() comments
* Rewrited "Simple demo", now it uses modified demo from github's page (at moment, it takes whoping 193 lines of code, bloat!)
* Fixed typos, rewrited/rephrased comments
* Added note in scaling.toGame/scaling.toScreen about rounding/missmathing, make sure check it
* Added note about scaling.isMouseInside, make sure check it

https://github.com/Vovkiv/resolution_so ... /tag/v1002
User avatar
GVovkiv
Party member
Posts: 685
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

Working on auto-completion API for Zerobrane Studio
User avatar
GVovkiv
Party member
Posts: 685
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

Finished Zerobrane auto-completion (and tooltip) api!
If you happens to use my library (https://github.com/Vovkiv/resolution_solution) and Zerobrane Studio (https://studio.zerobrane.com/) as IDE for that, then you can use auto-completion of this library!
https://github.com/Vovkiv/resolution_so ... _api_v1000
Autocompletion:

Tooltip:

Also, update for library itself released:
Version 1003, 12 february 2022
Added library license text in rs._LICENSE_TEXT
Added auto-completion API for Zerobrane Studio!
Visit rs._URL and file RS_ZBS_API.lua for more info
Updated comments
https://github.com/Vovkiv/resolution_so ... g/rs_v1003
FUTURECATCC
Prole
Posts: 2
Joined: Mon May 16, 2022 9:08 pm
Location: Canada

Re: Resolution Solution [library]

Post by FUTURECATCC »

Hey i love that lib it help me in my game making , but
There is a problem

1. Pixel Perfect
Actually i changed the linear mode to nearest mode , but
my game cause pixel distorsion in fullscreen
Can you add a Pixel perfect mode or somewhone could help me with this

2.Other Resolutions
My game runs in 640x360
Actually everything look fine in 1366x768 and over
but under 1366x768 my game dont scale correctly and its result something broken in Fullscreen
Please fix thoses issues . :rofl: :)
User avatar
GVovkiv
Party member
Posts: 685
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

FUTURECATCC wrote: Mon May 16, 2022 11:38 pm Hey i love that lib it help me in my game making , but
There is a problem

1. Pixel Perfect
Actually i changed the linear mode to nearest mode , but
my game cause pixel distorsion in fullscreen
Can you add a Pixel perfect mode or somewhone could help me with this

2.Other Resolutions
My game runs in 640x360
Actually everything look fine in 1366x768 and over
but under 1366x768 my game dont scale correctly and its result something broken in Fullscreen
Please fix thoses issues . :rofl: :)
Can you provide game source (or small example that demonstrate problem), so i can see what exactly wrong, because i'm not very sure what "game dont scale correctly and its result something broken in Fullscreen" means
Also, it might be useful, if you provide info:
What os you use? (Maybe you use linux with some poor wm, which resulted in problems?)
What window manager (if there any)?
Can you add a Pixel perfect mode
No.
You can't have have pixel perfect scaling with that library, and here is why:
Lets say, you use my lib and set scaling for 1366x768 and start building game for that resolution.
You run that game in 1280x720 window (or in fullscreen monitor with native 1280x720, don't matter)
Now, scaling lib (if we talk about stretching mode) will calculate that data:
1280 / 1366 = 0.93704246 for width scaling and 720 ÷ 768 = 0.9375 for height scaling, which is non integer, meaning, it will produce stretched image for width and height, with slight blurring/distortion
If you ran that game in 1366x768: 1366 (window size) / 1366 (game size) = 1 and 768 (window size) / 768 (game size) = 1
Which means it will be scaled perfectly fine, without any issues
The almost same deal with scaling with black bars, but width and height have same scaling factor and use black bars to fill unused space

You have (at least in my knowledge) at least 3 options:
1. You take that library and delete it and implement in your game option, allowing them to set zoom UI and game stuff with different values
There some games, that use this techigue:
Wayward, Pixel Dungeon.
The problem is that game now become tight to screen/window resolution.
You can try to set limit to max zoom level, depending on screen size or you don't do that and allow to player to see "out-of-bound" staff if they use too small scaling factor.

2.You create assets, scripts, etc for different resolutions, that you want to use.
For example, for 1920x1080 (so if user have 1920x1080 monitor, they will be able to enjoy game with 1:1 scaling), 1366x768, etc
And add ingame option to switch between resolutions.

3.Deal with fact, that if your player doesn't have screen with same resolution (or with resolution, which is bigger then game in 2, 3, integer times. for example, your game is 640x360, on screen with 1280x720, it will become: 1280/640 = 2 and 720 / 360 = 2, meaning it will be scaled in factor 2, without distortions) then they will not be able to play with 1:1 scaling.

If you making game with procedural level generation and want perfect scaling, then use 1 method, because you can't really see out-of-bound staff if everything is generated randomly anyway.
If game need to hide something, that player shoudn't see and you still need pixel perfect scaling, then use 2 method.

In any other case, just use scaling as it and don't worry about that.
(Maybe there exist way to scale perfectly with shaders or even on level of scaling algorithms, but:
A: i don't know anything about it.
B: shader method might cause significant perfomance degradation)
FUTURECATCC
Prole
Posts: 2
Joined: Mon May 16, 2022 9:08 pm
Location: Canada

Re: Resolution Solution [library]

Post by FUTURECATCC »

Thank you for helping me i have fixed the broken fullscreen thing it beacause i changed a number accidently so
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests