summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2024-08-23 12:54:44 -0500
committercheapie <no-email-for-you@example.com>2024-08-23 12:54:44 -0500
commit8472cc3178b600e7ed7b9f51e449e6d5f3d743e7 (patch)
treedf21f2c65aa0e287bc10eb3d0b2800a2d8c5c586
parent18b293cec8b183f51a479d589ad1b0b429ab4998 (diff)
downloaddigiscreen-8472cc3178b600e7ed7b9f51e449e6d5f3d743e7.tar
digiscreen-8472cc3178b600e7ed7b9f51e449e6d5f3d743e7.tar.gz
digiscreen-8472cc3178b600e7ed7b9f51e449e6d5f3d743e7.tar.bz2
digiscreen-8472cc3178b600e7ed7b9f51e449e6d5f3d743e7.tar.xz
digiscreen-8472cc3178b600e7ed7b9f51e449e6d5f3d743e7.zip
Performance improvements, for real this time
-rw-r--r--init.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 43589d0..45f8663 100644
--- a/init.lua
+++ b/init.lua
@@ -22,7 +22,12 @@ local function generateTexture(pos,serdata)
for y=1,16,1 do
if type(data[y]) ~= "table" then data[y] = {} end
for x=1,16,1 do
- bincolors = bincolors..minetest.colorspec_to_bytes(data[y][x] or "000000")
+ local colorspec = 0
+ if data[y][x] then
+ colorspec = tonumber(data[y][x],16) or 0
+ end
+ colorspec = 0xFF000000 + colorspec
+ bincolors = bincolors..minetest.colorspec_to_bytes(colorspec)
end
end
local img = minetest.encode_png(16,16,bincolors,0)