Skip to content

Commit

Permalink
Only render modules as needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Jan 14, 2024
1 parent 368fa00 commit a45a112
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 28 deletions.
5 changes: 1 addition & 4 deletions class_configs/bst_class_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ local RGMercUtils = require("utils.rgmercs_utils")

return {
['Modes'] = {
'Tank',
'DPS',
'Healer',
'Hybrid',
},
['ItemSets'] = {
['Epic'] = {
Expand Down Expand Up @@ -741,7 +738,7 @@ return {
},
},
['DefaultConfig'] = {
['Mode'] = '1',
['Mode'] = { DisplayName = "Mode", Category = "Combat", Tooltip = "Select the Combat Mode for this Toon", Type = "Custom", RequiresLoadoutChange = true, Default = 1, Min = 1, Max = 1, },
},
},
}
2 changes: 1 addition & 1 deletion extras/version.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return { commitId = 'a7cfb1d 2024-01-13' }
return { commitId = '368fa00 2024-01-13' }
37 changes: 14 additions & 23 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,13 @@ local function renderModulesTabs()
if not RGMercConfig:SettingsLoaded() then return end

for _, name in ipairs(RGMercModules:GetModuleOrderedNames()) do
if ImGui.BeginTabItem(name) then
RGMercModules:ExecModule(name, "Render")
ImGui.EndTabItem()
end
end
end

local function renderDragDropForItem(label)
ImGui.Text(label)
ImGui.PushID(label .. "__btn")
if ImGui.Button("HERE", ICON_WIDTH, ICON_HEIGHT) then
if mq.TLO.Cursor() then
return true, mq.TLO.Cursor.Name()
if RGMercModules:ExecModule(name, "ShouldRender") then
if ImGui.BeginTabItem(name) then
RGMercModules:ExecModule(name, "Render")
ImGui.EndTabItem()
end
end
return false, ""
end
ImGui.PopID()
return false, ""
end

local function Alive()
Expand Down Expand Up @@ -220,16 +209,18 @@ local function RGMercsGUI()
end

for n, s in pairs(RGMercConfig.SubModuleSettings) do
ImGui.PushID(n .. "_config_hdr")
if s and s.settings and s.defaults and s.categories then
if ImGui.CollapsingHeader(string.format("%s: Config Options", n)) then
s.settings, pressed, _ = RGMercUtils.RenderSettings(s.settings, s.defaults, s.categories)
if pressed then
RGMercModules:ExecModule(n, "SaveSettings", true)
if RGMercModules:ExecModule(n, "ShouldRender") then
ImGui.PushID(n .. "_config_hdr")
if s and s.settings and s.defaults and s.categories then
if ImGui.CollapsingHeader(string.format("%s: Config Options", n)) then
s.settings, pressed, _ = RGMercUtils.RenderSettings(s.settings, s.defaults, s.categories)
if pressed then
RGMercModules:ExecModule(n, "SaveSettings", true)
end
end
end
ImGui.PopID()
end
ImGui.PopID()
end

if ImGui.CollapsingHeader("Outside Assist List") then
Expand Down
4 changes: 4 additions & 0 deletions modules/basic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ function Module:Init()
return { self = self, settings = self.settings, defaults = self.DefaultConfig, categories = self.DefaultCategories, }
end

function Module:ShouldRender()
return true
end

function Module:Render()
ImGui.Text("Basic Combat Modules")
local pressed
Expand Down
4 changes: 4 additions & 0 deletions modules/class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ function Module:SetCombatMode(mode)
end
end

function Module:ShouldRender()
return true
end

function Module:Render()
ImGui.Text("Core Class Modules")

Expand Down
4 changes: 4 additions & 0 deletions modules/contributors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ function Module:RenderName(name)
end
end

function Module:ShouldRender()
return true
end

function Module:Render()
ImGui.Text("Contributors - Thank You!")

Expand Down
4 changes: 4 additions & 0 deletions modules/mez.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ function Module:Init()
return { self = self, settings = self.settings, defaults = self.DefaultConfig, categories = self.DefaultCategories, }
end

function Module:ShouldRender()
return RGMercUtils.IsMezzing()
end

function Module:Render()
ImGui.Text("Mez Module")

Expand Down
4 changes: 4 additions & 0 deletions modules/movement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ function Module:Campfire(camptype)
end
end

function Module:ShouldRender()
return true
end

function Module:Render()
ImGui.Text("Chase Module")

Expand Down
4 changes: 4 additions & 0 deletions modules/performance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ function Module:Init()
return { self = self, settings = self.settings, defaults = self.DefaultConfig, categories = self.DefaultCategories, }
end

function Module:ShouldRender()
return true
end

function Module:Render()
ImGui.Text("Performance Monitor Modules")
local pressed
Expand Down
4 changes: 4 additions & 0 deletions modules/pull.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ function Module:RenderMobList(displayName, settingName)
end
end

function Module:ShouldRender()
return true
end

function Module:Render()
ImGui.Text("Pull")

Expand Down
4 changes: 4 additions & 0 deletions modules/travel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ function Module:GenerateFilteredPortsList()
table.sort(self.TempSettings.FilteredList.SortedTabNames)
end

function Module:ShouldRender()
return #self.TempSettings.PorterList > 0
end

function Module:Render()
local width = ImGui.GetWindowWidth()
local buttonsPerRow = math.max(1, math.floor(width / self.ButtonWidth))
Expand Down

0 comments on commit a45a112

Please sign in to comment.