Help with keeping resolution

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
DanMightBeTheMan
Prole
Posts: 2
Joined: Thu Dec 12, 2024 12:01 am

Help with keeping resolution

Post 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!
Attachments
resolution_solution.lua
(23.48 KiB) Downloaded 328 times
main.lua
(1.28 KiB) Downloaded 351 times
game.love
(7.94 KiB) Downloaded 196 times
User avatar
GVovkiv
Party member
Posts: 686
Joined: Fri Jan 15, 2021 7:29 am

Re: Help with keeping resolution

Post 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 227 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 725 times
Using canvas:
canvas.png
canvas.png (6.38 KiB) Viewed 725 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")
DanMightBeTheMan
Prole
Posts: 2
Joined: Thu Dec 12, 2024 12:01 am

Re: Help with keeping resolution

Post by DanMightBeTheMan »

That's exactly it! Thank you so much!
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot] and 12 guests