Page 1 of 1

Help with keeping resolution

Posted: Thu Dec 12, 2024 12:21 am
by DanMightBeTheMan
Hello,

So, I'm relatively experienced with Lua already, and I'm looking to make a small game to familiarize myself with this engine. I want to make a low-resolution racing game, so I found a library that would keep the resolution of the game when you resize it, so hopefully the game would run on any resolution. The library I'm using is resolution solution (https://github.com/Vovkiv/resolution_solution). I tested this library with some text and images, and it works fine, but then I tried using some love.graphics drawing functions, and then I noticed a problem. These functions don't actually draw to the target resolution, so they end up looking much more smooth than they should. I'll attach my current program that shows this issue. Basically, no matter how you resize the window, it will be rendered the same way every time. I either need a different library that keeps the resolution that also works with love.graphics, or a library that draws at the target resolution every time, so if you have any suggestions, that would be very helpful!

Re: Help with keeping resolution

Posted: Thu Dec 12, 2024 7:58 pm
by GVovkiv
Hello there, the creator of "Resolution Solution" is here, lol.
If I understand you correctly, you want to draw rectangles, polygons, etc scaled, not "smooth". To achieve something like this, instead of using scissors method of drawing (that used as default example), but rather canvas method https://github.com/Vovkiv/resolution_so ... ith_canvas.
You do all your drawing operations to canvas and then you scale canvas itself.

Here, patched code:
game_v2.love
(7.92 KiB) Downloaded 230 times
If that what you mean - great!
If not, then ask more questions and I will try to respond.

Using scissors:
scissors.png
scissors.png (6.83 KiB) Viewed 728 times
Using canvas:
canvas.png
canvas.png (6.38 KiB) Viewed 728 times
Also, if you are going for pixel art (based on scaling method, low-resolution and font in source) then don't forget to use nearest filtering which is best suited for pixel art

Code: Select all

love.graphics.setDefaultFilter("nearest", "nearest")

Re: Help with keeping resolution

Posted: Fri Dec 13, 2024 3:01 am
by DanMightBeTheMan
That's exactly it! Thank you so much!