From e33799e0da61b3b882ef4427807d9cd9579c553e Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 5 Aug 2022 23:40:31 +0100 Subject: vlorb --- img/better_disp.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'img') diff --git a/img/better_disp.lua b/img/better_disp.lua index 63eb505..99fa5dd 100644 --- a/img/better_disp.lua +++ b/img/better_disp.lua @@ -12,11 +12,13 @@ local function vlorb(onc,offc, g1,g2,g3,g4,g5,g6) local textc,bgc = onc,offc if g6 then textc,bgc=bgc,textc end local vlorbchar = 0x80 - if g1 then vlorbchar=vlorbchar+1 end - if g2 then vlorbchar=vlorbchar+2 end - if g3 then vlorbchar=vlorbchar+4 end - if g4 then vlorbchar=vlorbchar+8 end - if g5 then vlorbchar=vlorbchar+16 end + -- ~= on booleans is xor + -- if g6 set then flip all the other bits + if g1 ~= g6 then vlorbchar=vlorbchar+1 end + if g2 ~= g6 then vlorbchar=vlorbchar+2 end + if g3 ~= g6 then vlorbchar=vlorbchar+4 end + if g4 ~= g6 then vlorbchar=vlorbchar+8 end + if g5 ~= g6 then vlorbchar=vlorbchar+16 end return textc,bgc,string.char(vlorbchar) end -- cgit v1.2.3