fully working UI
This commit is contained in:
parent
4a15eedb05
commit
044aebe3c8
@ -18,31 +18,35 @@ function _init()
|
|||||||
dcy = 0
|
dcy = 0
|
||||||
|
|
||||||
init_box_pals()
|
init_box_pals()
|
||||||
init_row_pals()
|
init_rows_pals()
|
||||||
|
end
|
||||||
|
|
||||||
|
function boxspr(x, y)
|
||||||
|
return 1+x+16*(y\2)+(y%2*0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
function init_box_pals()
|
function init_box_pals()
|
||||||
box_pals = {}
|
box_pals = {}
|
||||||
for x=0,box_cols do
|
for x=0,box_cols-1 do
|
||||||
local pal_col = {}
|
local pal_col = {}
|
||||||
for y=0,box_rows do
|
for y=0,box_rows-1 do
|
||||||
pal_col[y] = load_box_palette(1+x+16*(y\2)+(0.5*y%2))
|
pal_col[y] = load_box_palette(boxspr(x,y))
|
||||||
end
|
end
|
||||||
box_pals[x] = pal_col
|
box_pals[x] = pal_col
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function init_row_pals()
|
function init_rows_pals()
|
||||||
row_pals = {}
|
rows_pals = {}
|
||||||
for x=0,row_cols do
|
for x=0,rows_cols-1 do
|
||||||
local pal_col = {}
|
local pal_col = {}
|
||||||
for y=0,row_rows do
|
for y=0,rows_rows-1 do
|
||||||
pal_col[y] = load_row_palette(
|
pal_col[y] = load_row_palette(
|
||||||
8+16*x,
|
8+16*x,
|
||||||
16+2*y
|
16+2*y
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
row_pals[x] = pal_col
|
rows_pals[x] = pal_col
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -69,14 +73,15 @@ end
|
|||||||
function _draw()
|
function _draw()
|
||||||
cls()
|
cls()
|
||||||
draw_hud()
|
draw_hud()
|
||||||
local pals = (mode == "boxes") and box_pals or row_pals
|
local pals = (mode == "boxes") and box_pals or rows_pals
|
||||||
pals[scx][scy]:do_both(0)
|
pals[scx][scy]:do_both(0)
|
||||||
pals[dcx][dcy]:do_both(1)
|
pals[dcx][dcy]:do_both(1)
|
||||||
draw_bars()
|
draw_bars()
|
||||||
end
|
end
|
||||||
|
|
||||||
function draw_hud()
|
function draw_hud()
|
||||||
palt()
|
pal(0)
|
||||||
|
pal(1)
|
||||||
if (mode == "boxes") return draw_box_hud()
|
if (mode == "boxes") return draw_box_hud()
|
||||||
draw_rows_hud()
|
draw_rows_hud()
|
||||||
end
|
end
|
||||||
@ -86,6 +91,12 @@ function print_shadow(s,x,y,c)
|
|||||||
print(s,x,y,c or 7)
|
print(s,x,y,c or 7)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function lpad(str,w)
|
||||||
|
str=tostr(str)
|
||||||
|
while (#str < w) str = " "..str
|
||||||
|
return str
|
||||||
|
end
|
||||||
|
|
||||||
box_rows = 4
|
box_rows = 4
|
||||||
box_cols = 4
|
box_cols = 4
|
||||||
|
|
||||||
@ -97,10 +108,12 @@ function draw_box_hud()
|
|||||||
spr(109 + (active == "draw" and toff or 0),
|
spr(109 + (active == "draw" and toff or 0),
|
||||||
3+8*dcx,4*dcy,1,0.5)
|
3+8*dcx,4*dcy,1,0.5)
|
||||||
|
|
||||||
print_shadow("spr",42,5,12)
|
print_shadow("spr",42,1,12)
|
||||||
|
print_shadow(lpad(boxspr(scx,scy),3),42,9,6)
|
||||||
sspr(8+8*scx,4*scy,8,4,55,4,16,8)
|
sspr(8+8*scx,4*scy,8,4,55,4,16,8)
|
||||||
|
|
||||||
print_shadow("draw",73,5,14)
|
print_shadow("draw",73,1,14)
|
||||||
|
print_shadow(lpad(boxspr(dcx,dcy),3),77,9,6)
|
||||||
sspr(8+8*dcx,4*dcy,8,4,91,4,16,8)
|
sspr(8+8*dcx,4*dcy,8,4,91,4,16,8)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -193,7 +206,7 @@ end
|
|||||||
function palette:compile_palt()
|
function palette:compile_palt()
|
||||||
self.cpl_tr = nil
|
self.cpl_tr = nil
|
||||||
local bits, tr = 0, self.tr
|
local bits, tr = 0, self.tr
|
||||||
for i = 15,0,-1 do
|
for i = 0,15 do
|
||||||
if (tr[i] == nil) return
|
if (tr[i] == nil) return
|
||||||
bits <<= 1
|
bits <<= 1
|
||||||
if (tr[i]) bits += 1
|
if (tr[i]) bits += 1
|
||||||
@ -235,14 +248,14 @@ function load_row_palette(sx, sy)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
__gfx__
|
__gfx__
|
||||||
00000000012300000123555501230000012355550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000012300000123111101230000012311110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000456700004567555545670000456755550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000456700004567111145670440456711110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
0070070089ab000089ab555589ab000089ab55550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0070070089ab000089ab111189ab024089ab11980000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00077000cdef0000cdef5555cdef0000cdef55550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00077000cdef0000cdef1111cdef0000cdef11990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00077000012324440123355501232444012335550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00077000012324440123355501232444012335550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00700700456744444567555545674444456755550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00700700456744444567555545674004456755550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000089ab444489ab555589ab444489ab55550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0000000089ab444489ab555589ab420489ab55ca0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000cdef4444cdef5555cdef4444cdef55550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000cdef4444cdef5555cdef4444cdef55ba0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000012301230123012301230123012301230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000012301230123012301230123012301230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000456745674567456745674567456745670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000456745674567456745674567456745670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000089ab89ab89ab89ab89ab89ab89ab89ab0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0000000089ab89ab89ab89ab89ab89ab89ab89ab0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
Loading…
Reference in New Issue
Block a user