I'm using Löve2D for writing a small game. Löve2D is an open source game engine for Lua. The problem I'm encountering is that some antialias filter is automatically applied to your sprites when you draw it at integer positions.
love.graphics.draw( texture, quad, x, y, r, sx, sy)
My plan was :
- Cut a small image into 9 to fit Quad.
- Zoom in on it to fit the UI.
- Make Variable UI.
My image was :
full image
Zoom in :
5px green rectangle in 15px rounded rectangle
And My test code was :
function love.load()
sprite = love.graphics.newImage('image.png')
centerbox = love.graphics.newQuad(5, 5, 5, 5, sprite:getDimensions()
end
function love.draw()
love.graphics.draw(sprite, centerbox, 0, 0, 0, 30, 30)
I want display only that blue : x=5px, y=5px, w=5px, h=5px
Result :
That's not fun
5 is integer, 30 is integer, 0 is integer.
My UI is : That's not cool
How can I get only the pixels I want?
i've already read Turning off antialiasing in Löve2D.