fade the title screen in

also the ditherer automatically decides which way to go
This commit is contained in:
Kistaro Windrider 2024-02-08 21:52:04 -08:00
parent bd7066b65e
commit c02c15e79f
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -391,7 +391,9 @@ ditherer = {
c=0, c=0,
pattern=fadetable, pattern=fadetable,
} }
mknew(ditherer) mknew(ditherer, function(x)
if (x.di and x.di < 0 and not x.i) x.i = (x.pattern and #x.pattern or #fadetable) + 0.99
end)
function ditherer:update() function ditherer:update()
self.i += self.di self.i += self.di
@ -424,7 +426,11 @@ function newtitle()
end end
title_screen = {} title_screen = {}
mknew(title_screen) mknew(title_screen, function(t)
t.d = ditherer.new{
di = -1
}
end)
function title_screen:activate() function title_screen:activate()
font_dogica() font_dogica()
@ -436,9 +442,11 @@ function title_screen:draw()
cls(12) cls(12)
print("title screen", 30, 57, 0) print("title screen", 30, 57, 0)
print("press right arrow", 15, 66, 0) print("press right arrow", 15, 66, 0)
self.d:draw()
end end
function title_screen:update() function title_screen:update()
self.d:update()
if (btnp(1)) start_game() if (btnp(1)) start_game()
end end
-->8 -->8