image - Lua / Love 2d:用像素缩放图像
问题描述
你好 !
使用 Lua 和 Love 2d,我想用像素调整图像的大小:
img = love.graphics.newImage("assets/bg.png")
-- resize the image (500 x 400)
function love.draw()
love.graphics.draw(bg, 0, 0)
end
解决方案
我的理解是,您想要以像素艺术风格缩放图像并且您不想要这种模糊效果,您可以在使用 love.graphics.newImage(path) 加载图像之前将默认过滤器设置为最近:
love.graphics.setDefaultFilter("nearest", "nearest")
love.graphics.newImage(path)
love.graphics.setDefaultFilter("linear", "linear") --[[ If you want to let the filter like before ]]
我建议您访问 love2d 论坛。如果这不起作用,请访问此论坛
推荐阅读
- javascript - changing span to text with javascript using textcontent
- javascript - Trouble with updating ngrx state
- arrays - Passing pointer to 2D array position as function argument and changing where it points to
- jaxb - JAXB: why are defined namespace prefixes not used in generated xml document?
- unity3d - The VSCode debug not working when want to see a breakpoint
- firebase - Delete Firebase deep link
- dart - Flutter Dart Process.run Unhandled Exception: ProcessException: 系统找不到指定的文件
- django - Django 多个 slug url
- python - 如何在 python 中找到文件的一行并删除该行?
- android - 使用 adb 将图片推送到 android 11 模拟器的照片中未显示图片?