## [Solved] Resolution NES (256x240)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
var77
Prole
Posts: 30
Joined: Wed May 02, 2018 1:57 pm

### [Solved] Resolution NES (256x240)

Hi everyone,

I'm back here with a little issue about resolution. Actually i try to get the same resolution as the NES for some test.
Unfortunatly it didn't get the expected result in full screen mode. I try several things and wonder if any one got a tips for it ?

I try changing widht and height in conf.lua but no change in fullscreen (still 1920x1080).

I try this function:

Code: Select all

-- love.update
function scale_size()
width,height = love.graphics.getDimensions
window_width,window_height = love.graphics.getDimensions()
window_scale_y = window_height/256
window_scale_x = window_scale_y
window_translate_x = (window_width - (window_scale_x*240))/2
scr.h = window_scale_y
scr.w = window_scale_x
end

--love.draw()
love.graphics.translate(window_translate_x,0)
love.graphics.scale(window_scale_x,window_scale_y)
But the result is smooth not like with a sprite filter ("setFilter("nearest", "nearest", 0)")
and the "cross" mouse move far away from the screen.

All files if it help:
c.zip
So if anyone got an idea
Last edited by var77 on Sat Jan 12, 2019 3:02 pm, edited 1 time in total.

ivan
Party member
Posts: 1410
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: Resolution NES (256x240)

Instead of scaling you could render everything to a 256x240 canvas. That would give you the nice pixelated aesthetic you are looking for.

var77
Prole
Posts: 30
Joined: Wed May 02, 2018 1:57 pm

### Re: Resolution NES (256x240)

Thanks for the fast answer ivan unfortunatly i'm not very familiar with the canvas. I try a lil with love wiki but didn't give me good result with fullscren. So if you have some tips on it i'll appreciate

ivan
Party member
Posts: 1410
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: Resolution NES (256x240)

Code: Select all

canvas = love.graphics.newCanvas(256, 240)

function love.draw()
love.graphics.setCanvas(canvas)
-- draw everything to the canvas
...
love.graphics.setCanvas()
-- draw the canvas itself
love.graphics.draw(canvas, 0, 0)
end

var77
Prole
Posts: 30
Joined: Wed May 02, 2018 1:57 pm

### Re: Resolution NES (256x240)

thanks again i try your code it work in some sort but with lil improve (i guess i understand
why some part of the screen are hide but not why it didn't handle the full screen).
I let you see the result that make some strange things with the cross mouse.

files:
c.zip

ivan
Party member
Posts: 1410
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: Resolution NES (256x240)

Almost there. You need to clear the canvas each frame:

Code: Select all

  love.graphics.setCanvas(canvas)
love.graphics.clear()
In full screen mode, you have to use some sort of scaling to fill the screen:

Code: Select all

  -- draw the canvas itself
local w, h = love.graphics.getDimensions()
local cw, ch = canvas:getDimensions()
love.graphics.draw(canvas, 0, 0, 0, w/cw, h/ch)

var77
Prole
Posts: 30
Joined: Wed May 02, 2018 1:57 pm

### Re: Resolution NES (256x240)

This is close to what i was looking for. I just wondering why it's still smooth the pixel but
i guess it's my graphic card nvidia that force the job ?
c.zip

pgimeno
Party member
Posts: 1531
Joined: Sun Oct 18, 2015 2:58 pm

### Re: Resolution NES (256x240)

Try canvas:setFilter("linear", "nearest") at initialization.
Thrust II Reloaded - GifLoad for Löve - GSpöt GUI - My NotABug.org repositories - portland (mobile orientation)
The MS-Github repositories I had have been closed after the acquisition announcement and will be removed in the near future.

var77
Prole
Posts: 30
Joined: Wed May 02, 2018 1:57 pm

### Re: Resolution NES (256x240)

That's it pal you save my day thanks both of you.

### Who is online

Users browsing this forum: No registered users and 13 guests