Better board/cursor graphics

This commit is contained in:
Pyrex 2024-02-10 20:56:48 -08:00
parent e184552458
commit 6998d614a9
2 changed files with 7 additions and 5 deletions

View File

@ -169,14 +169,13 @@ function board:draw()
self.animator:draw()
if self.animator:idle() then
self.watcher:draw(self)
local hover_slot=self.cursor:hover_slot()
forall_slots(function(x,y,s_ix,s,l,n)
if hover_slot==s_ix then
self.cursor:draw_at(l,n+1)
self.cursor:draw_at(l,n)
end
end)
self.watcher:draw(self)
end
end

View File

@ -36,7 +36,7 @@ function cursor:toggle_grab()
local acc,src,tar=self:acceptance_state()
local slot=self:hover_slot()
if acc==acceptance_state.not_grabbed then
if (not self.board.watcher:intercept("grab",slot)) printh("intercepted") return
if (not self.board.watcher:intercept("grab",slot)) return
if (self.board.slots[slot]:peek()) self.grabbed=slot
elseif acc==acceptance_state.would_accept then
if (not self.board.watcher:intercept("drop",slot)) return
@ -88,12 +88,15 @@ function cursor:draw_at(l,i)
end
if card then
i+=1
local x,y=l:place_card(i)
local card_fg=self.ruleset.deck:draw_card(x+dx,y+dy,card,{rotate=l.rotated})
local fg=card_fg
if (acc==acceptance_state.would_accept) fg=9
draw_layout_hint(l,i,fg,false,dx,dy)
else
draw_layout_hint(l,i,9,true,dx,dy)
local filled=false
if (i<1) i=1 filled=true
draw_layout_hint(l,i,9,filled,dx,dy)
end
end