diff options
author | ubq323 <ubq323@ubq323.website> | 2022-08-05 23:40:31 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2022-08-05 23:40:31 +0100 |
commit | e33799e0da61b3b882ef4427807d9cd9579c553e (patch) | |
tree | 2c040c3712a9c55fc6cd868691898fcb6472c9ce | |
parent | 2e77396090af401509be4a7e46c64365a63b0629 (diff) |
vlorb
-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 |