Hey!
How can I configure the project correctly to correctly display small (16x16) sprites and fonts?
p.s. is there any project architecture recommended, such as ECS?
How to setup project to pixel graphic?
Re: How to setup project to pixel graphic?
Hi and welcome to the forums!
Code: Select all
love.graphics.setLineStyle ('rough')
love.graphics.setDefaultFilter ('nearest', 'nearest')
Code: Select all
font = love.graphics.newImageFont("graphics/font.png", " abcdefghijklmnopqrstuvwxyz" ..
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0" ..
"123456789.,!?-+/():;%&`'*#=[]\"")
Code: Select all
canvas = love.graphics.newCanvas (width, height)
local gWidth = love.graphics.getWidth ()
local gHeight = love.graphics.getHeight ()
scale = math.floor(math.min (gWidth/width, gHeight/height))
print ('scale', scale)
translateX = math.floor((gWidth - width*scale)/2)
translateY = math.floor((gHeight - height*scale)/2)
Code: Select all
function draw ()
love.graphics.setColor (1,1,1)
love.graphics.draw (canvas, translateX, translateY, 0, scale, scale)
end
Who is online
Users browsing this forum: No registered users and 5 guests