34 lines
524 B
Lua
34 lines
524 B
Lua
return function(con)
|
|
|
|
function con.resz(w, h, cw, ch)
|
|
con.cw, con.ch =
|
|
cw or con.cw,
|
|
ch or con.ch
|
|
con.w, con.h =
|
|
math.floor(w / cw),
|
|
math.floor(h / ch)
|
|
con.reszT()
|
|
end
|
|
|
|
function con.reszT()
|
|
local y = con.forText()
|
|
con.th = y * con.ch
|
|
end
|
|
|
|
function con.down()
|
|
con.oy = 0
|
|
con.move(-math.huge)
|
|
end
|
|
|
|
function con.move(oy)
|
|
con.oy = con.oy + oy
|
|
con.oy = math.max(
|
|
-(con.th - con.ch * con.h / 1.2),
|
|
math.min(con.oy, 0)
|
|
)
|
|
if con.th < (con.ch - 1) * con.h
|
|
then con.oy = 0 end
|
|
end
|
|
|
|
end
|