From 6998d614a9782d8a3a502a96e106092979d2214d Mon Sep 17 00:00:00 2001 From: Nyeogmi Date: Sat, 10 Feb 2024 20:56:48 -0800 Subject: [PATCH] Better board/cursor graphics --- board.lua | 5 ++--- cursor.lua | 7 +++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/board.lua b/board.lua index d393942..e52b7bf 100644 --- a/board.lua +++ b/board.lua @@ -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 diff --git a/cursor.lua b/cursor.lua index 19e456f..38a6525 100644 --- a/cursor.lua +++ b/cursor.lua @@ -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 \ No newline at end of file