fix centering and clipping

no idea why I need some of these offsets but whatever
This commit is contained in:
2024-02-11 01:09:56 -08:00
parent 7803f22838
commit a78b12d750
2 changed files with 43 additions and 21 deletions

View File

@ -196,7 +196,7 @@ end
view = {
x=0,
y=0,
w=128,
w=255,
h=128,
}
mknew(view, function(x)
@ -691,7 +691,8 @@ zonk_mode = {
files={},
lnh = 9,
--space width
spc_w = 2,
spc_w = 0,
spc_full=6,
--text mode
txmd=0x81,
--text spring-in distance
@ -730,13 +731,19 @@ function zonk_mode:g(_, fn, ...)
return _ENV[fn](...)
end
function zonk_mode:at(_, x, y)
--i don't know why i need the
--spc_full offset but i do
self.txt_frame=scootbox.new{
x=x,
from=y,
to=y-self.exmg,
x=x-self.spc_full,
from=y-5,
to=y-5-self.exmg,
frames=self.exf,
}
end
function zonk_mode:center(_, rows, cols)
local w,h = cols*self.spc_full, rows*self.lnh-1
self:at(_, 64-ceil(w/2), 64-ceil(h/2))
end
function zonk_mode:bon()
self.brth.on=true
self.brth.off_soon=false
@ -788,7 +795,7 @@ function zonk_mode:next_item()
self.line = nil
self.expect_cfg_line = true
self.cx = 0
self.cy = 0
self.cy = 5
return 0, nil
end
self.line = split(line, " ")
@ -803,10 +810,11 @@ function zonk_mode:next_item()
local token = tostr(del(self.line, 1))
while #token == 0 and #self.line > 0 do
-- emit extra spaces
self.cx += 1 + self.spc_w
self.cx += self.spc_full
token = tostr(deli(self.line, 1))
end
local pp,cmult=nrm_txt_pal,1
if (token[1]==">") token,self.cx=sub(token,2),self.cx+self.spc_full\2
if (token[1]=="$") token,cmult=sub(token,2),2
if (token[1]=="^") token,cmult=sub(token,2),0.5
if (token[1]=="!") token,pp=sub(token,2),sfd_txt_pal
@ -896,6 +904,7 @@ function zonk_mode:draw()
self.txt_frame:draw()
-- TODO: draw throbber
if not self.playing_text and not self.confirmed and self.twt <= 0 then
font_default()
print("➡️",121,121,12)
print("➡️",120,120,self:throbber_color())
end
@ -903,7 +912,7 @@ function zonk_mode:draw()
end
function zonk_mode:throbber_color()
if (not self.bwt) return ((t()<<1)&0x1 < 1) and 7 or 6
if (not self.bwt or self.bwt==0) return ((t()<<1)&0x1 < 1) and 7 or 6
return self.brth:matches(self.bwt) and 7 or 6
end
@ -964,7 +973,7 @@ function ao_splash:draw()
self.c:draw()
if self.fwait < ao_splash.fwait then
print("18+", 55, 60, 7)
print("aDULTS ONLY", 35, 90, 15)
print("aDULTS ONLY", 30, 90, 15)
end
if (self.d) self.d:draw()
end
@ -1548,11 +1557,11 @@ function start_game()
{
f=zonk_mode.new,
params={{
file=[[at:2:55
hI! iN A LATER VERSION
THERE WILL BE ACTUAL
INSTRUCTIONS HERE AND
THE BG WON'T BE ON.]],
file=[[center:4:20
wELCOME! iN A LATER
VERSION, THERE WILL
BE INSTRUCTIONS HERE
AND NO BG yet.]],
txd=0,
txf=1,
cmul=0.25,
@ -1567,23 +1576,23 @@ THE BG WON'T BE ON.]],
{
f = zonk_mode.new,
params={{
file=[[at:40:40
file=[[center:5:14
ZONK TEXT TEST
#ZONK TEXT #TEST
$ZONK $TEXT $TEST
!ZONK !TEXT !TEST
^ZONK ^TEXT ^TEST
-----
at:30:60 bon bpal:1 set:confirmed:true set:bwt:1 set:txf:2 set:txd:0 set:exd:0 set:exf:10
center:1:13 bon bpal:1 set:confirmed:true set:bwt:1 set:txf:2 set:txd:0 set:exd:0 set:exf:10
bREATHE IN...
-----
at:28:60 set:confirmed:true set:bwt:2 bpal:2
center:1:14 set:confirmed:true set:bwt:2 bpal:2
bREATHE OUT...
-----
set:bwt:0 set:txd:16 set:txf:20 set:exf:60 at:1:55
gREAT! iT'S LIKE YOU'VE
BEEN DOING THIS YOUR
ENTIRE LIFE.
set:bwt:0 set:txd:16 set:txf:20 set:exf:60 center:3:19
>gREAT! iT'S LIKE
YOU'VE BEEN DOING
THIS ALL YOUR LIFE.
]],
}},
},