In my current project, I wanted a low-res feel, so I opted to just draw to an Image, then display that to the screen for a pixel-perfect representation of older games. All of the sprites I draw have no anti-aliasing, but whenever I want to draw a shape (like
image.drawLine(5,5,25,20,"#fff")) the anti-aliasing is still there. The
image.setPixelated(true) only seems to work for sprites/images, but not for shapes. Is there any way I can disable the anti-aliasing entirely?
To my knowledge, line drawing always works with anti-aliasing (lines without this technique look very bad - if they are not vertical or horizontal).
You can draw a line yourself - create a function to draw a line where you place pixels with image.setRGB ()
Or make false pixels - you draw a pattern (line) on an Image type object, and then you draw this object on the screen.
If you are not afraid of rotating, zooming, copying and complicating the code - you can use something like this.
init = function()
image = new Image( 50, 50 )
image.setPixelated( 0 )
image.setLineWidth( 1 )
posX = 0
screen.setScale( 2, 2 )
angle = 0
pixelX = 2
pixelY = 10
fi = fakePixelImage( pixelX, pixelY, 10, 10, 2, "#FF00FF")
fakePixelImage = function( pixelX, pixelY, sizeX, sizeY, space, color )
local image = new Image( pixelX * ( sizeX + space) , pixelY*( sizeY+space) )
print( pixelX * ( sizeX + space) +' ' + pixelY*( sizeY+space) )
image.setColor( color )
for loopY = 0 to pixelY - 1
for loopX = 0 to pixelX - 1
image.fillRect( loopX * ( sizeX + space) , loopY*( sizeY+space) , sizeX, sizeY )
update = function()
posX += 0.01
angle += 0.1
draw = function()
screen.setDrawRotation( angle )
screen.drawImage( image, 50, 0, 100, 100 )
screen.drawImage( fi , -50, 0, fi.width, fi.height )