Skip to content

Commit

Permalink
Coordinates: You can now configure how fast the display updates (defa…
Browse files Browse the repository at this point in the history
…ult 1). The lower the value the more memory/CPU will be used but the faster the display will refresh. This is important as asking the game for coordinate data is a lot more expensive in BfA.
  • Loading branch information
funkydude committed May 22, 2018
1 parent adf18b4 commit 23828bb
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 7 deletions.
38 changes: 31 additions & 7 deletions Coordinates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ local options = {
mod.db.locked = v
end,
},
updateRate = {
type = "range",
name = L.updateRate,
desc = L.updateRateDesc,
order = 2.1,
width = "full",
min = 0.1,
max = 1,
step = 0.1,
get = function()
return mod.db.updateRate
end,
set = function(info, v)
mod.db.updateRate = v
end
},
fontColor = {
type = "color",
name = L["Font Color"],
Expand Down Expand Up @@ -157,9 +173,14 @@ function mod:OnInitialize(profile)
locked = false,
fontColor = {},
enabled = false,
updateRate = 1,
}
end
self.db = profile.coordinates
-- XXX temp 7.3.5
if not profile.coordinates.updateRate then
profile.coordinates.updateRate = 1
end
end

function mod:OnEnable()
Expand Down Expand Up @@ -207,19 +228,22 @@ function mod:CreateFrame()
local CTimerAfter = C_Timer.After
if not GetBestMapForUnit then -- XXX 8.0
local function updateCoords()
CTimerAfter(0.1, updateCoords)
CTimerAfter(mod.db.updateRate, updateCoords)
local x, y = GetPlayerMapPosition"player"
coordsText:SetFormattedText("%.1f, %.1f", x and x*100 or 0, y and y*100 or 0)
end
updateCoords()
else
local function updateCoords()
CTimerAfter(0.5, updateCoords)
local tbl = GetPlayerMapPosition(GetBestMapForUnit("player"), "player")
if tbl then
coordsText:SetFormattedText("%.1f, %.1f", tbl.x*100, tbl.y*100)
else
coordsText:SetText("00.0, 00.0")
CTimerAfter(mod.db.updateRate, updateCoords)
local uiMapID = GetBestMapForUnit"player"
if uiMapID then
local tbl = GetPlayerMapPosition(uiMapID, "player")
if tbl then
coordsText:SetFormattedText("%.1f, %.1f", tbl.x*100, tbl.y*100)
else
coordsText:SetText("00.0, 00.0")
end
end
end
updateCoords()
Expand Down
3 changes: 3 additions & 0 deletions localization/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an
L["Zone Text"] = "Zonentext"
L["Zoom In Button"] = "Heranzoom-Knopf"
L["Zoom Out Button"] = "Herauszoom-Knopf"

--L.updateRate = "Update Rate (seconds)"
--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."
2 changes: 2 additions & 0 deletions localization/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ L["Lock Coordinates"] = "Lock Coordinates"
L["Font Size"] = "Font Size"
L["Font Color"] = "Font Color"
L["Reset Position"] = "Reset Position"
L.updateRate = "Update Rate (seconds)"
L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."

-- ./Fader.lua
L["Enable Minimap Fader"] = "Enable Minimap Fader"
Expand Down
3 changes: 3 additions & 0 deletions localization/esES.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ L["Width"] = "Ancho"
-- L["Zone Text"] = "Zone Text"
L["Zoom In Button"] = "Botón de Acercar Zoom"
L["Zoom Out Button"] = "Botón de Alejar Zoom"

--L.updateRate = "Update Rate (seconds)"
--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."
3 changes: 3 additions & 0 deletions localization/frFR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an
L["Zone Text"] = "Zone de Texte"
L["Zoom In Button"] = "Boutton Zoom Interieur"
L["Zoom Out Button"] = "Boutton Zoom Exterieur"

--L.updateRate = "Update Rate (seconds)"
--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."
3 changes: 3 additions & 0 deletions localization/itIT.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an
L["Zone Text"] = "Testo Zona"
L["Zoom In Button"] = "Zoom d'Ingrandimento"
L["Zoom Out Button"] = "Pulsante Zoom d'Ingrandimento"

--L.updateRate = "Update Rate (seconds)"
--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."
3 changes: 3 additions & 0 deletions localization/koKR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an
L["Zone Text"] = "지역 글자" -- Needs review
L["Zoom In Button"] = "축소 버튼" -- Needs review
L["Zoom Out Button"] = "확대 버튼" -- Needs review

--L.updateRate = "Update Rate (seconds)"
--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."
3 changes: 3 additions & 0 deletions localization/ptBR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ L["Width"] = "Largura"
L["Zone Text"] = "Texto da Zona" -- Needs review
L["Zoom In Button"] = "Botão aumentar o Zoom"
L["Zoom Out Button"] = "Botão diminuir o Zoom"

--L.updateRate = "Update Rate (seconds)"
--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."
3 changes: 3 additions & 0 deletions localization/ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an
L["Zone Text"] = "Текст игровой зоны" -- Needs review
L["Zoom In Button"] = "кнопку приближения" -- Needs review
L["Zoom Out Button"] = "кнопку отдаления" -- Needs review

--L.updateRate = "Update Rate (seconds)"
--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."
3 changes: 3 additions & 0 deletions localization/zhCN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an
L["Zone Text"] = "地区文本"
L["Zoom In Button"] = "放大按钮"
L["Zoom Out Button"] = "缩小按钮"

--L.updateRate = "Update Rate (seconds)"
--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."
3 changes: 3 additions & 0 deletions localization/zhTW.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an
L["Zone Text"] = "地區文字"
L["Zoom In Button"] = "放大按鈕"
L["Zoom Out Button"] = "縮小按鈕"

--L.updateRate = "Update Rate (seconds)"
--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."

0 comments on commit 23828bb

Please sign in to comment.