From e8305e38e93700f507b055435b75d8a7f8a6c072 Mon Sep 17 00:00:00 2001 From: Wouters Dorian Date: Tue, 25 Aug 2015 20:40:08 +0200 Subject: [PATCH] Add functions to set HUD offset and position --- hud.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hud.lua b/hud.lua index 742f637..2b8c64b 100644 --- a/hud.lua +++ b/hud.lua @@ -16,6 +16,24 @@ local hud_config = { position = {x = 1, y = 0.2}, offset = { x = -200, y = 0}, number = quests.colors.new } +--- Set the HUD position (not offset). +-- Supplied positions may be `nil` and will be skipped. +-- @note Calling this function while quests are already displayed will result +-- in undefined behaviour. Call it beforehand. +function quests.set_hud_position(x, y) + hud_config.position.x = x or hud_config.position.x + hud_config.position.y = y or hud_config.position.y +end + +--- Set the HUD offset (not position). +-- Supplied positions may be `nil` and will be skipped. +-- @note Calling this function while quests are already displayed will result +-- in undefined behaviour. Call it beforehand. +function quests.set_hud_position(x, y) + hud_config.offset.x = x or hud_config.offset.x + hud_config.offset.y = y or hud_config.offset.y +end + --- Show quests HUD to player. -- The HUD can only show up to `show_max` quests -- @param playername Player whose quests HUD must be shown