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 »

FUTURECATCC wrote: Tue May 17, 2022 8:20 pm Thank you for helping me i have fixed the broken fullscreen thing it beacause i changed a number accidently so
Well, good for you.
Good luck with scaling your games, comrade!
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

Version 1004, 19 may 2022
* rs.widthScale = 0 --> rs.scaleWidth = 0
* rs.heightScale = 0 --> rs.scaleHeight = 0
I'm stupid.
If you use rs.getScale(), you don't need to worry about anything,
this function returned correct values, but
documentation: "rs.widthScale" and "rs.heightScale" while
should be "rs.scaleWidth" and "rs.scaleHeight", so meaning that
trying to get "rs.widthScale" or "rs.heightScale" will result in 0, 0.
Yeah...

This release will fix that shit.

https://github.com/Vovkiv/resolution_so ... /tag/v1004

(UGH, YET ANOTHER UPDATE IN SAME DAY
Since i don't want to spam with update posts, i just edit this message to inform about version v1005.)

Version 1005, 19 may 2022
(Sorry for bothering again with update on the same day...)
Anyway:
* Added table rs.gameZone, which contains x, y, w, h coordinates of scaled area.
You might need it when you want to draw UI, which shoudn't be scaled by lib
regardless of currect scaling mode (stretching or with black bars),
because to draw UI you need to know where starts/ends scaled area on window.
And it might help for camera libraries, which uses love.graphics.setScissors.

For example, if you want to use kikito's camera lib (https://github.com/kikito/gamera)
with this my lib, you need to do:

Code: Select all

rs = require("scaling_solution")
gamera = require("gamera")

cam = gamera.new(0, 0, 2000, 2000)

love.update = function(dt)
  -- Update my lib.
  rs.update()
  -- Unpack new function.
  local gameZone = RS.getGameZone()
  -- Set right coordinates for scissors.
  -- (also, for best results, do rounding to uncoming values
  -- because it might create empty space between black bars (that my lib render)
  -- and everything, that gamera lib draw.)
  cam:setWindow(math.ceil(gameZone.x - 0.5), math.ceil(gameZone.y - 0.5), math.ceil(gameZone.w), math.ceil(gameZone.h))
end

local draw = function()
  -- Then after gamera finished tranlsating and scaling, call my lib draw:
  rs.start()
  -- * Here you draw everything that you need to be scaled.
end

love.draw = function()
  cam:draw(draw) -- you need to call camera draw in first place.
  rs.stop() -- and only after camera done drawing, you stops my lib.
end
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

Working on big update...
Will add 3rd scaling method (pixel perfect, so it will be possible to deal with pixelated games now)
Full internals rewrite, so compatibility might not be my priority, but i will try my best, i promise.
Maybe slight performance boost, QoL changes, better documentation and better demo showcase. (And possible lesser filesize.)

So, if someone care about this library, then yay!
And if someone who use it, have any suggestion, i will gladly listen.
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 »

I will certainly test it out. :)
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: Tue Dec 27, 2022 7:57 am I will certainly test it out. :)
Yay!

Anyway, github page prepared, release uploaded. Only love page left unfinished.
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

New video showcase (i feel like new one are not really better then last one... but at least 1080p, so hurray?):

https://github.com/Vovkiv/resolution_solution

Version v2000 27 december 2022
Big rewrite! Check source file for all detailed changes. (Some functionality in this version is not compatible with old versions.)
Source file, at almost top, now include some tips and "tricks", check them out.
New:
* Pixel Perfect scaling! rs.setScaleMode(3) to check it out!
* rs.init(options) - before, to change some options in library, you could update value directly from rs.* table or use provided built-in functions. Now, considering new "insidies" of library, changing options directly as rs.scaleMode = 1 will do nothing, because library will be updated only on rs.resize() or via newly (and old one) provided functions, including rs.init().
You should call rs.init() at least once, even if you don't need to update anything in options, otherwise until first rs.resize(), you will see black screen.
You can pass argument as table with options, or pass nothing to just update. List of options avaliable in source library file.
* rs.setScaleMode() - allow you to change scale mode via number. Pass 1, 2, 3 to change.
* rs.debug - boolean, which controls if rs.debugFunc() will be rendered or not.
* rs.debugFunc() - function that will show some data that useful for debug. Call it somewhere in love.draw() as rs.debugFunc().
* rs.switchDebug() - switch rs.debug, from true to false and vice-versa.
Removed:
* rs.windowChanged() - because now there no need in this callback.
* rs.gameChanged() - also not really useful anymore.
* rs.gameAspect - it was not really useful anyway.
* rs.windowAspect - also not useful.
* rs.update() - explained below.
Changed functionality:
* Before, there was only 2 bars: Left/right or top/bottom and they was avaliable only at scaleMode 1. With intoduced 3rd scale method, Pixel perfect, that has bars at top/bottom/left/right at same time, their functionality changed.
You can still access them as: rs.x1, rs.y1, rs.w1, rs.h1 (from 1 to 4, rs.x1, rs.x2, rs.x3...), but order changed:
1 for top bar
2 for left bar
3 for right bar
4 for bottom bar
* Apperantly, rs.gameZone table was never updated, because i forgot to do so in rs.update... Welp, that sucks. Now it updates properly.
* Now all functions, that expects arguments, have error messages to point out if you passed something wrong. Yay!
* rs.resize - now library update loop was designed around love.resize() function, instead of love.update(), like other scaling libs do. So less wasted frame time, yay! Don't forget to pass w and h from love.resize(w, h) to library as rs.resize(w, h). For compatability sake, it should be possible to put rs.resize at love.update and just pass rs.resize(love.graphics.getWidth(), love.graphics.getHeight()). It was not tested properly, but i believe there shoudn't be any problem with it, except maybe performance.
* rs.switchScaleMode() - before until 3rd scaling method, there was only 2 methods and this function acted more like "boolean". Now, you can pass 1 or -1 to choose how you want to switch methods: 1 -> 2 -> 3 -> 1... or 3 -> 2 -> 1 -> 1...
If you pass nothing, function will act as you passed 1.
Renamed, but functionality the same:
rs.drawBars -> rs.bars
rs.drawBlackBars -> rs.drawBars
rs.switchDrawBars -> rs.switchBars
* Rewrited demo.
* From now on, i will include minified version of library, with removed comments and minified code, that will make filesize lesser. https://mothereff.in/lua-minifier. Check github page.
Last edited by GVovkiv on Wed Dec 28, 2022 3:00 pm, edited 2 times in total.
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Re: Resolution Solution [library]

Post by Gunroar:Cannon() »

Wow, nice. This is becoming the best scaling lib. I really need that pixel scaling now so :awesome:
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

Gunroar:Cannon() wrote: Wed Dec 28, 2022 2:09 pm Wow, nice. This is becoming the best scaling lib. I really need that pixel scaling now so :awesome:
Only if you into integer scaling and ready to sacrifice for it space on top/left/right/bottom sides at same time, tho.
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Re: Resolution Solution [library]

Post by Gunroar:Cannon() »

Hmmm ...maybe.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Resolution Solution [library]

Post by GVovkiv »

Gunroar:Cannon() wrote: Wed Dec 28, 2022 3:12 pm Hmmm ...maybe.
Then use that damn scaling, haha. And don't forget to add somewhere in options screen option to switch scaling, if they not oki-doki with that.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests