From 5c7ddf881df446c075867aa916530435493c0862 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 19 May 2022 19:05:11 +0200 Subject: [PATCH] Generate arrow textures --- generate_textures.lua | 27 +++++++++++++++++++++++++++ init.lua | 10 ++++++++-- textures/maps_arrow.tga | Bin 179 -> 93 bytes textures/maps_arrow_diagonal.tga | Bin 180 -> 93 bytes 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 generate_textures.lua diff --git a/generate_textures.lua b/generate_textures.lua new file mode 100644 index 0000000..0c5953f --- /dev/null +++ b/generate_textures.lua @@ -0,0 +1,27 @@ +dofile("../tga_encoder/init.lua") + +local _ = { 1 } +local K = { 0 } +local W = { 255 } + +local pixels = { + { _, K, K, K, K, K, _ }, + { _, K, W, W, W, K, _ }, + { K, K, W, W, W, K, K }, + { K, W, W, W, W, W, K }, + { _, K, W, W, W, K, _ }, + { _, _, K, W, K, _, _ }, + { _, _, _, K, _, _, _ }, +} +tga_encoder.image(pixels):save("textures/maps_arrow.tga") + +local pixels = { + { _, _, _, _, K, _, _ }, + { K, K, _, K, W, K, _ }, + { K, W, K, W, W, W, K }, + { K, W, W, W, W, K, _ }, + { K, W, W, W, K, _, _ }, + { K, W, W, W, W, K, _ }, + { K, K, K, K, K, K, _ }, +} +tga_encoder.image(pixels):save("textures/maps_arrow_diagonal.tga") diff --git a/init.lua b/init.lua index e17c46d..205019c 100644 --- a/init.lua +++ b/init.lua @@ -440,14 +440,20 @@ minetest.register_globalstep( yaw == 180 or yaw == 270 ) then - marker = "maps_arrow.tga" .. "^[transformR" .. yaw + marker = "maps_arrow.tga" .. + "^[makealpha:1,1,1" .. + "^[transformR" .. + yaw elseif ( yaw == 45 or yaw == 135 or yaw == 225 or yaw == 315 ) then - marker = "maps_arrow_diagonal.tga" .. "^[transformR" .. (yaw - 45) + marker = "maps_arrow_diagonal.tga" .. + "^[makealpha:1,1,1" .. + "^[transformR" .. + (yaw - 45) end if marker then player:hud_change( diff --git a/textures/maps_arrow.tga b/textures/maps_arrow.tga index 91fccf460cc43a800d24ef5de25fd8c565592a86..b39dd708e52aa805e3d591102bac4a8c1f47eade 100644 GIT binary patch literal 93 zcmZQzU}k^;b_R9^4hBXrmywa-|Ns9W4u}GiU@lk?B+0-C0w5BmJtQd9HOw>E)89`w L!p+miRgVDxR526= literal 179 zcmZQz;9`IQb_R9^1r9K;1xWq}vlyYW|C{~;0f+|{Zv-*GLSPn1(f<~Z3NQ78!&x9+NKmM2m}ju3zn^Y|o2QSf9s>Y}WiO-v diff --git a/textures/maps_arrow_diagonal.tga b/textures/maps_arrow_diagonal.tga index 6798c9f21442b18323a1359eb3c9591a5cc04e44..91cfce255aeb5bc90d12c722793f7959bc924780 100644 GIT binary patch literal 93 zcmZQzU}k^;b_R9^4hBXb01^xgj12$5`2YX^3=BX5%ma}?2?!6Y5vURZLV`kF!#smM O{rz+!+&q0;^%ww6cNGEv literal 180 zcmZQz;9`IQb_R9^1&$^Vml22sf%tzThzBD6vw&DY@E-&~G>F55EYJj%fk^#t25~_K sfmDJFWB89y0X7#bhN6t26{HL#4hJDYp{`+`!Jhtpx)E-kKCXHU0F1sb#Q*>R