Image Lua-快速变化的图像
我不是一个程序员,甚至不是业余爱好者,我只是想要一个可以无限快地改变PSP屏幕整体颜色的程序。我做了一些事情:Image Lua-快速变化的图像,image,background,lua,Image,Background,Lua,我不是一个程序员,甚至不是业余爱好者,我只是想要一个可以无限快地改变PSP屏幕整体颜色的程序。我做了一些事情: rdupa = Image.load("red.png") gdupa = Image.load("green.png") bdupa = Image.load("blue.png") screen:clear() while true do screen:blit(0, 0, rdupa, false) screen:clear() screen:blit(0, 0, gdupa,
rdupa = Image.load("red.png")
gdupa = Image.load("green.png")
bdupa = Image.load("blue.png")
screen:clear()
while true do
screen:blit(0, 0, rdupa, false)
screen:clear()
screen:blit(0, 0, gdupa, false)
screen:clear()
screen:blit(0, 0, bdupa, false)
screen:clear()
end
使用谷歌,但这不起作用。我做错了什么?我将*.png图像与脚本放在同一文件夹中?准备就绪的脚本将被视为Veeeeeery非常好。我不确定您的环境,但我猜它很可能无法更新其主窗口或其他内容,因为它基本上无法执行截断的Lua代码,除非该代码在单独的线程中执行。Lua是一种小型简洁的编程语言,只提供很少的核心代码功能见
默认情况下,Lua不提供任何用于处理屏幕和图像的函数,因此在不知道您使用的库/框架的情况下,我们几乎无法提供帮助对于这个答案,我假设你正在考虑添加一个LuaPoto标签。从我在报告中看到的情况来看,你应该使用
screen.flip()
而不是
screen:clear()
每当你想更新屏幕时。不幸的是,我的PSP上没有CFW,所以我自己不能测试。
老实说,我甚至不考虑使用图像。 这样做可以:
这是使用PGELua,但很容易适应LuaLayerwhile pge.running() do
color = pge.gfx.createcolor(pge.math.rand(255),pge.math.rand(255),pge.math.rand(255))
pge.gfx.startdrawing()
pge.gfx.drawrect(0,0,480,272,color)
pge.gfx.enddrawing()
pge.gfx.swapbuffers()
end
如果你想要明确的颜色,也许像这样
red = pge.gfx.createcolor(255,0,0)
gre = pge.gfx.createcolor(0,255,0)
blu = pge.gfx.createcolor(0,0,255)
loop = 1
while pge.running() do
pge.gfx.startdrawing()
if loop==1 then
pge.gfx.drawrect(0,0,480,272,red)
elseif loop==2 then
pge.gfx.drawrect(0,0,480,272,gre)
elseif loop==3 then
pge.gfx.drawrect(0,0,480,272,blu)
end
loop=loop+1
if loop>4 then
loop=1
end
pge.gfx.enddrawing()
pge.gfx.swapbuffers()
end
也许你应该告诉我们你正在使用什么让你在PSP上运行Lua代码。