From 85fc8219c19d1c06d7ecf1694221063dd807c65c Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Sun, 2 Apr 2023 01:23:11 +0200 Subject: [PATCH] Move notifs to the left --- src/api.lua | 2 +- src/common.lua | 22 +++++++++++----------- src/hud.lua | 8 ++++---- textures/i3_bg_notif.png | Bin 870 -> 1422 bytes 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/api.lua b/src/api.lua index 2122cfa..8b0c161 100644 --- a/src/api.lua +++ b/src/api.lua @@ -321,7 +321,7 @@ function i3.hud_notif(name, msg, img) local player = get_player_by_name(name) if not player then return end - local max_y = -120 + local max_y = -125 local def = { show = true, diff --git a/src/common.lua b/src/common.lua index 8fcfb91..9dc9189 100644 --- a/src/common.lua +++ b/src/common.lua @@ -640,29 +640,29 @@ local function init_hud_notif(player) return { bg = player:hud_add { hud_elem_type = "image", - position = {x = 1, y = 1}, - offset = {x = -330, y = 0}, - alignment = {x = 1, y = 1}, - scale = {x = 0.6, y = 0.6}, + position = {x = 0, y = 1}, + offset = {x = 10, y = 0}, + alignment = {x = 1, y = 1}, + scale = {x = 0.6, y = 0.6}, text = "i3_bg_notif.png", z_index = 0xDEAD, }, img = player:hud_add { hud_elem_type = "image", - position = {x = 1, y = 1}, - offset = {x = -320, y = 20}, - alignment = {x = 1, y = 1}, - scale = {x = 1, y = 1}, + position = {x = 0, y = 1}, + offset = {x = 20, y = 20}, + alignment = {x = 1, y = 1}, + scale = {x = 1, y = 1}, text = "", z_index = 0xDEAD, }, text = player:hud_add { hud_elem_type = "text", - position = {x = 1, y = 1}, - offset = {x = -245, y = 40}, - alignment = {x = 1, y = 1}, + position = {x = 0, y = 1}, + offset = {x = 100, y = 40}, + alignment = {x = 1, y = 1}, number = 0xffffff, text = "", z_index = 0xDEAD, diff --git a/src/hud.lua b/src/hud.lua index 5019351..f6f81e6 100644 --- a/src/hud.lua +++ b/src/hud.lua @@ -1,4 +1,4 @@ -IMPORT("abs", "max", "ceil", "remove", "str_to_pos") +IMPORT("max", "ceil", "remove", "str_to_pos") IMPORT("get_connected_players", "add_hud_waypoint") local function init_hud(player) @@ -57,7 +57,7 @@ local function show_hud(player, data, notif, idx, dt) player:hud_change(def, "offset", { x = hud_info.offset.x, - y = hud_info.offset.y - (speed * max(1, (#data.hud.notifs - idx + 1) / 1.4)) + y = hud_info.offset.y - (speed * max(1, (#data.hud.notifs - idx + 1) / 1.45)) }) end elseif notif.show == false and notif.hud_timer >= i3.settings.hud_timer_max then @@ -67,11 +67,11 @@ local function show_hud(player, data, notif, idx, dt) local hud_info = player:hud_get(def) player:hud_change(def, "offset", { - x = hud_info.offset.x + speed, + x = hud_info.offset.x - speed, y = hud_info.offset.y }) - if hud_info.offset.x > abs(notif.max.x) then + if hud_info.offset.x < notif.max.x then player:hud_remove(def) remove(data.hud.notifs, idx) end diff --git a/textures/i3_bg_notif.png b/textures/i3_bg_notif.png index c136571427770e33cd703dc119065dee09f0fe97..161bee00b23054bb0359239bc144fe51e304a5e2 100644 GIT binary patch delta 864 zcmaFH*2g_Txt_5l)7d$|)7e>}peR2rGbfdSL1SX=L~D=30U~Yx_pR_aday}}Pjb~{ z*FZt{wN8RsEl~?Y*(cB5x4_eR(xXQjJH%vabi!m~=9HEeh_W1H?^xYEc~SS2ioBo< z!N-lK|NeOYv;Li}_y=<>AJgW?4XYyEtY!*q+8L_&r%R#cg?l|mvXJpt%RrxloAv?}#C+^v{=}c*q zvqzGkw}7I98*gezf}-DUxB9M5ley|Pf13N^Ri^u_Gm@|r3uxs!`LX%`!S^?3wVvcO z*PO)Qq`&R2Ax}$rW7^$q`}=cuS2D58Yt&x*cD-4{O#e%-b9KvDzT`2BU(fZu$E;W0 z(5N13q~gwX;gdMmf!~s~!F(@vv+lZnXXn;)g})e5GQw6$KX@P@p&9gT*YVx;yRDvo z%lFT&v$qT=n(()?SD1l;fi20~-G$*l2rk&Wd@@jkv%n*=n1O*CD9bI($S`Y;1W=H@ z#M9T6{W%MxxR_SRhYUD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