badapple换成ogv视频

This commit is contained in:
MrZ626
2021-03-03 00:04:33 +08:00
parent 8cd40cc99a
commit c0868feb6b
3 changed files with 12 additions and 35 deletions

Binary file not shown.

View File

@@ -1,55 +1,32 @@
--Bad Apple!! (128x96, 10fps, 2192f)
--Bad Apple!!
local gc=love.graphics
local rectangle=gc.rectangle
local int=math.floor
local back={}
local bAnd,bRshift=bit.band,bit.rshift
local t
local video
local X,Y,K
function back.init()
if not video then
video=love.data.decompress("string","zlib",love.filesystem.read("parts/backgrounds/badapple.dat"))
video=gc.newVideo("parts/backgrounds/badapple.ogv",{false})
video:setFilter("linear","linear")
video:play()
end
t=0
back.resize()
end
function back.resize()
local W,H=SCR.w,SCR.h
if H/W>=96/128 then
K=W/128
X,Y=0,(H-W*96/128)*.5
if H/W>=36/48 then
K=W/48
X,Y=0,(H-W*36/48)*.5
else
K=H/96
X,Y=(W-H*128/96)*.5,0
end
end
function back.update()
t=t+1
if t==13146 then
t=0
K=H/36
X,Y=(W-H*48/36)*.5,0
end
end
function back.draw()
gc.clear(.2,.2,.2)
gc.push("transform")
gc.origin()
gc.translate(X,Y)
gc.scale(K)
gc.setColor(.4,.4,.4)
local t1=1536*int(t/6)+1
for i=0,1535 do
local B=video:byte(t1+i)
for j=7,0,-1 do
local p=8*i+j
if bAnd(B,1)==0 then
rectangle("fill",p%128,int(p/128),1,1)
end
B=bRshift(B,1)
end
end
gc.pop()
local r,g,b=COLOR.rainbow_light(TIME())
gc.setColor(r,g,b,.2)
gc.draw(video,X,Y,nil,K)
end
function back.discard()
video=nil

Binary file not shown.