diff options
-rw-r--r-- | img/better_disp.lua | 12 |
1 files changed, 7 insertions, 5 deletions
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 |