Kelsidavis-WoWee/include/addons/addon_manager.hpp
Kelsi 1f8660f329 feat: add OnUpdate frame script for per-frame addon callbacks
Frames can now set an OnUpdate script that fires every frame with
the elapsed time as an argument. This enables addon timers, polling,
and animations.

  local f = CreateFrame("Frame")
  f:SetScript("OnUpdate", function(self, elapsed)
      -- called every frame with deltaTime
  end)

OnUpdate only fires for visible frames (frame:Hide() pauses it).
Tracked in __WoweeOnUpdateFrames table, dispatched via
LuaEngine::dispatchOnUpdate() called from the Application main loop.
2026-03-20 12:07:22 -07:00

35 lines
894 B
C++

#pragma once
#include "addons/lua_engine.hpp"
#include "addons/toc_parser.hpp"
#include <memory>
#include <string>
#include <vector>
namespace wowee::addons {
class AddonManager {
public:
AddonManager();
~AddonManager();
bool initialize(game::GameHandler* gameHandler);
void scanAddons(const std::string& addonsPath);
void loadAllAddons();
bool runScript(const std::string& code);
void fireEvent(const std::string& event, const std::vector<std::string>& args = {});
void update(float deltaTime);
void shutdown();
const std::vector<TocFile>& getAddons() const { return addons_; }
LuaEngine* getLuaEngine() { return &luaEngine_; }
bool isInitialized() const { return luaEngine_.isInitialized(); }
private:
LuaEngine luaEngine_;
std::vector<TocFile> addons_;
bool loadAddon(const TocFile& addon);
};
} // namespace wowee::addons