Last active
July 30, 2024 22:38
-
-
Save mvrozanti/ed836ec1add06ad282c552b5988b0c11 to your computer and use it in GitHub Desktop.
Network display effect for keyleds (https://github.com/keyleds/keyleds/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
keys = keyleds.db | |
colorCapsLock = tocolor(keyleds.config.colorCapsLock) | |
colorScrollLock = tocolor(keyleds.config.colorScrollLock) | |
if type(keys) ~= "table" then | |
local tempKeys = {} | |
for i = 1, #keys do | |
table.insert(tempKeys, keys[i]) | |
end | |
keys = tempKeys | |
end | |
function getKeyFromName(keyName) | |
for _, key in ipairs(keys) do | |
if key.name == keyName then | |
return key | |
end | |
end | |
end | |
buffer = RenderTarget:new() | |
function update(buffer) | |
if colorCapsLock then | |
buffer[getKeyFromName("CAPSLOCKLED")] = colorCapsLock | |
end | |
if colorScrollLock then | |
buffer[getKeyFromName("SCROLLLOCKLED")] = colorScrollLock | |
end | |
end | |
update(buffer) | |
function render(ms, target) | |
update(buffer) | |
target:blend(buffer) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment